# PSF-2021-5: ftplib should not use the host from the PASV response

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2021-02-21T00:00:00.000Z
- Modified: 2025-10-09T01:03:13.933Z

## Description

The IPv4 address value returned from the server in response to the PASV
command should not be trusted. This prevents a malicious FTP server from
using the response to probe IPv4 address and port combinations on the
client network.

Instead of using the returned address, we use the IP address we're already
connected to. This is the strategy other ftp clients adopted, and matches
the only strategy available for the modern IPv6 EPSV command where the
server response must return a port number and nothing else.

(As written by Python Software Foundation.)

## Affected

- https://github.com/python/cpython: before 0ab152c6b5d95caa2dc1a30fa96e10258b5f188e; before 4134f154ae2f621f25c5d698cc0f1748035a1b88; before 664d1d16274b47eea6ec92572e1ebf3939a6fa0c; before 79373951b3eab585d42e0f0ab83718cbe1d0ee33; before 7dcb4baa4f0fde3aef5122a8e9f6a41853ec9335

## References

- <https://hackerone.com/reports/1040166> (advisory)
- <https://bugs.python.org/issue43285> (report)

## Sources

- Python Software Foundation: [PSF-2021-5](https://osv.dev/vulnerability/PSF-2021-5), CC-BY-4.0, modified 2025-10-09

---

Page: https://cve.day/PSF-2021-5 · Whole record: https://cve.day/PSF-2021-5.json · Rebuilt by cve.day 2026-11-25T22:56:19.254Z
