-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() #149648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+51
−2
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3be7f40
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp()
gpshead 553e9d7
Merge branch 'main' into gh-87451-ftplib-ftpcp
gpshead 19999b8
Update the thank you attribution.
gpshead 917aad9
gh-87451: Use unittest.mock instead of hand-written fakes in ftpcp test
gpshead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp()
ftpcp() called parse227() directly and passed the source server's self-reported PASV IPv4 address to the target server's PORT command, bypassing the CVE-2021-4189 fix that was applied only to FTP.makepasv(). A malicious source FTP server could use this to redirect the target server's data connection to an arbitrary host:port (SSRF). ftpcp() now uses the source server's actual peer address, honoring the existing trust_server_pasv_ipv4_address opt-out, the same as makepasv(). Thanks to Qi Ding (AKA ikow) for the report.
- Loading branch information
commit 3be7f4059e0e13940a78d8507e6cedb7613386e4
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Misc/NEWS.d/next/Security/2026-05-10-18-05-32.gh-issue-87451.XkKB6M.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| The :mod:`ftplib` module's undocumented ``ftpcp`` function no longer trusts | ||
| the IPv4 address value returned from the source server in response to the | ||
| ``PASV`` command by default, completing the fix for CVE-2021-4189. As with | ||
| :class:`ftplib.FTP`, the former behavior can be re-enabled by setting the | ||
| ``trust_server_pasv_ipv4_address`` attribute on the source :class:`ftplib.FTP` | ||
| instance to ``True``. Thanks to Qi Ding (AKA ikow) for the report. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.