Critical Vulnerability in Python 2: Local File Scheme Bypass

python2 Updated 02 Oct 2025

Summary

23/03/2019
N/A
Yes i
Critical
9.1

ALPINE-CVE-2019-9948: urllib in Python 2.x through 2.7.16 supports the local_file: scheme, which makes it easier for remote attackers to bypass protection mechanisms that blacklist file: URIs, as demonstrated by triggering a urllib.urlopen('l... Affects python2 versions < 2.7.16-r1. Fixed in 2.7.16-r1. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Python 2 is a widely-used programming language known for its simplicity and readability. The 'urllib' module in Python 2.x, specifically through version 2.7.16, facilitates URL handling and web requests. However, it contains a significant vulnerability that allows remote attackers to exploit the local_file: scheme, potentially bypassing security mechanisms designed to restrict access to local files.

Vulnerability Detail

The vulnerability arises from the 'urllib' module in Python 2.x through version 2.7.16, which supports the local_file: scheme. This support enables attackers to bypass protections that blacklist file: URIs. For instance, an attacker could execute a command like 'urllib.urlopen('local_file:///etc/passwd')', allowing unauthorized access to sensitive files on the server. This vulnerability poses a high risk as it can lead to data exposure and compromise the integrity of the system.

How To Fix

Minimum fixed version

2.7.16-r1

This is the first release that contains the fix.

sudo apk add --upgrade python2

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

Workaround

As a temporary workaround, consider implementing input validation to restrict the use of the local_file: scheme in your application. Additionally, ensure that your application does not allow user input to directly influence URL requests made through urllib.

Conclusion

The vulnerability in Python 2's urllib module poses a significant risk by allowing remote attackers to bypass security measures and access local files. It is crucial to update to the patched versions to protect against potential exploitation. Utilizing tools like Vulert can help monitor and alert for such vulnerabilities in real-time.

See every vulnerability recorded for python2 →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 9.1, indicating a critical level of severity.

All versions of Python 2.x up to and including 2.7.16 are affected by this vulnerability.

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

Exploitation of this vulnerability can lead to unauthorized access to sensitive files, data exposure, and potential system compromise.

Implementing strict input validation and avoiding the use of the local_file: scheme in your application can help mitigate the risk until an update can be applied.

Related vulnerabilities

Recent vulnerabilities recorded for python2.

How To Fix

Minimum fixed version

2.7.16-r1

This is the first release that contains the fix.

sudo apk add --upgrade python2

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