CVE-2026-8328: FTP PASV SSRF, ftpcp() does not use actual peer address, trusts server-supplied PASV host address
The ftpcp() function in Lib/ftplib.py was not updated when
CVE-2021-4189 was fixed. While makepasv() was patched to replace
server-supplied PASV host addresses with the actual peer address
(getpeername()[0]), ftpcp() still calls parse227() directly and passes
the raw attacker-controllable IP address and port to target.sendport(). This patch is related to CVE-2021-4189.
Security readout for executives and security teams
Plain-English summary
A malicious or compromised FTP server can supply a passive-mode address that Python's ftpcp() trusts. This may cause another FTP endpoint involved in a server-to-server copy to connect to an unintended system, creating a server-side request forgery risk and potential integrity impact.
Executive priority
Prioritize patching systems that automate server-to-server FTP copies across trust boundaries or can reach sensitive internal services. Treat other installations as routine remediation after confirming ftpcp() usage. The medium score and prerequisite conditions reduce broad urgency, but high integrity impact warrants prompt review where exposure exists.
Technical view
CPython Lib/ftplib.py fixed PASV address handling in makepasv() for CVE-2021-4189, but ftpcp() continued calling parse227() directly. It forwards the server-controlled address and port to target.sendport() instead of using the actual peer address. The issue is CWE-918 with CVSS 4.0 score 5.9.
Likely exposure
Exposure requires Python code using ftplib.ftpcp(), passive FTP behavior, and interaction with a malicious or compromised FTP server. Applications that never call ftpcp(), prohibit untrusted FTP endpoints, or tightly restrict outbound connections are less exposed. The supplied affected-version data does not clearly establish exact vulnerable-to-fixed release boundaries.
Exploitation context
The CVE is not listed in CISA KEV, and the supplied sources do not report active exploitation. Exploitation requires application involvement and control over, or compromise of, an FTP server participating in the transfer. Successful abuse could redirect a connection toward an attacker-selected network address.
Researcher notes
This is an incomplete-fix variant related to CVE-2021-4189. The security boundary failure is specifically ftpcp() bypassing corrected makepasv() behavior and trusting parse227() output. Multiple CPython patch commits are supplied, but the bundle does not map each commit to a precise fixed release or document observed exploitation.
Mitigation direction
Update CPython to a vendor-confirmed patched release applicable to your supported branch.
Review the Python security advisory and linked commits for branch-specific remediation status.
Avoid ftplib.ftpcp() with untrusted or externally controlled FTP servers until patched.
Restrict FTP-server egress to approved destinations as a compensating control.
Validation and detection
Inventory deployed CPython versions and applications importing or calling ftplib.ftpcp().
Confirm installed branch patches match the vendor advisory or linked CPython commits.
Review FTP workflows for connections to untrusted, external, or compromised servers.
Monitor FTP server connection logs for unexpected destination addresses during server-to-server transfers.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-918: Information exposure and cloud metadata lookup
Information exposure and SSRF weaknesses can make discovery, cloud metadata, and credential material review relevant. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references SSRF or metadata access, so cloud discovery and credential material review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-918 · source CWE mapping
Server-Side Request Forgery (SSRF)
Server-Side Request Forgery (SSRF) represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.