Critical Vulnerability in Python Package: CVE-2021-4189 - FTP Client Library Trust Issue

python2.7 Updated 02 Oct 2025

Summary

31/12/2021
N/A
Yes i
Medium
5.3

UBUNTU-CVE-2021-4189: A flaw was found in Python, specifically in the FTP (File Transfer Protocol) client library in PASV (passive) mode. Affects python2.7 versions < 2.7.6-8ubuntu0.6+esm12. Fixed in 2.7.6-8ubuntu0.6+esm12. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Python is a widely-used high-level programming language known for its readability and versatility. It supports multiple programming paradigms and is extensively utilized in web development, data analysis, artificial intelligence, and more. The vulnerability in question affects the FTP client library within Python, specifically in passive mode, where it improperly trusts the host from the PASV response, leading to potential security risks.

Vulnerability Detail

A flaw was found in Python's FTP client library that affects its passive mode. The vulnerability arises from the library's default behavior of trusting the host from the PASV response. This can allow an attacker to set up a malicious FTP server that tricks clients into connecting to a specified IP address and port. The ramifications include unauthorized port scanning and potential exposure of sensitive data, as the FTP client may connect to unintended servers.

How To Fix

Minimum fixed version

2.7.6-8ubuntu0.6+esm12

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python2.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can avoid using the FTP client library in passive mode until the package is updated. Alternatively, consider using secure file transfer protocols such as SFTP or FTPS that do not exhibit this vulnerability.

Conclusion

The CVE-2021-4189 vulnerability in Python's FTP client library poses a significant risk due to its flawed trust mechanism in passive mode. Users are urged to update their Python packages to the latest patched versions to mitigate this risk. In the meantime, utilizing secure file transfer protocols can serve as a temporary workaround.

See every vulnerability recorded for python2.7 →

Share this vulnerability

FAQ

CVE-2021-4189 is a vulnerability in Python's FTP client library that allows an attacker to exploit the trust mechanism in passive mode, potentially leading to unauthorized connections.

The CVSS score for this vulnerability is 5.3, indicating a medium severity level that could lead to security risks if not addressed.

The vulnerability affects multiple versions of Python, including 2.7, 3.4, 3.5, 3.6, 3.7, and 3.8, particularly in their FTP client libraries.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If immediate updates are not possible, consider using secure alternatives to FTP or disabling the FTP client library's passive mode as a temporary measure.

Related vulnerabilities

Recent vulnerabilities recorded for python2.7.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.7.6-8ubuntu0.6+esm12

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python2.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback