Critical Buffer Overflow Vulnerability in Python3 Affects Multiple Alpine Versions

python3 Updated 02 Oct 2025

Summary

19/01/2021
N/A
Yes i
Critical
9.8

ALPINE-CVE-2021-3177: Python 3.x through 3.9.1 has a buffer overflow in PyCArg_repr in _ctypes/callproc.c, which may lead to remote code execution in certain Python applications that accept floating-point numbers as untrusted input, as demons... Affects python3 versions < 3.7.7-r2. Fixed in 3.7.7-r2. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Python3 is a widely-used programming language known for its simplicity and versatility, enabling developers to create a variety of applications ranging from web development to data analysis. The package in question, python3, is the implementation of Python 3.x for Alpine Linux, a security-oriented, lightweight Linux distribution. This vulnerability poses a significant risk as it allows remote code execution through unsafe handling of floating-point numbers.

Vulnerability Detail

Python 3.x through 3.9.1 contains a buffer overflow vulnerability in the PyCArg_repr function located in _ctypes/callproc.c. This flaw can be exploited by passing untrusted floating-point numbers, such as a 1e300 argument to c_double.from_param, leading to potential remote code execution. The vulnerability arises from the unsafe use of the sprintf function, which can result in memory corruption and arbitrary code execution in affected applications.

How To Fix

Minimum fixed version

3.7.7-r2

This is the first release that contains the fix.

sudo apk add --upgrade python3

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

Workaround

As a temporary workaround, avoid using untrusted floating-point inputs in applications that utilize the vulnerable python3 package. Implement input validation to sanitize user inputs before processing them.

Conclusion

The buffer overflow vulnerability in Python3 poses a significant risk to applications running on Alpine Linux. It is crucial for users to update their packages to the patched versions to mitigate potential exploitation. Implementing input validation can serve as a temporary measure until updates are applied.

See every vulnerability recorded for python3 →

Share this vulnerability

FAQ

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

Python 3.x versions up to and including 3.9.1 are affected by this vulnerability.

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

If an immediate update is not possible, ensure to validate and sanitize all user inputs to mitigate the risk of exploitation.

More information can be found in the CVE database or by visiting the Alpine Linux security advisories.

Related vulnerabilities

Recent vulnerabilities recorded for python3.

How To Fix

Minimum fixed version

3.7.7-r2

This is the first release that contains the fix.

sudo apk add --upgrade python3

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