Critical Vulnerability in Python3 Packages on Alpine: CVE-2025-4516

python3 Updated 02 Oct 2025

Summary

15/05/2025
N/A
Yes i
Unrated
Not published

ALPINE-CVE-2025-4516: There is an issue in CPython when using bytes.decode("unicode_escape", error="ignore|replace"). Affects python3 versions < 3.11.12-r1. Fixed in 3.11.12-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

Python3 is a widely-used programming language known for its simplicity and versatility. It is utilized in various applications, from web development to data analysis. The Alpine Linux distribution, known for its lightweight and security-oriented design, includes Python3 as a core package. However, a vulnerability has been identified in the way Python3 handles certain byte decoding operations, potentially exposing applications to security risks.

Vulnerability Detail

The vulnerability arises from an issue in CPython when using the bytes.decode method with the 'unicode_escape' encoding and specific error handlers ('ignore' or 'replace'). This flaw can lead to unexpected behavior or security issues if not properly managed. The vulnerability is tracked under CVE-2025-4516 and affects multiple versions of Python3 across different Alpine Linux releases.

How To Fix

Minimum fixed version

3.11.12-r1

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 the 'error' handler in the bytes.decode method. Instead, wrap the call in a try-except block to catch any DecodeError. Example code:

try: decoded_bytes = bytes.decode(your_bytes) except UnicodeDecodeError: # Handle the error appropriately decoded_bytes = '' # or any fallback action

Conclusion

CVE-2025-4516 presents a significant risk to applications using Python3 on Alpine Linux. It is crucial to update to the patched versions or implement the provided workaround to mitigate potential security threats.

See every vulnerability recorded for python3 →

Share this vulnerability

FAQ

CVE-2025-4516 is a vulnerability in Python3 that affects how bytes are decoded using the 'unicode_escape' encoding with specific error handlers.

The vulnerability affects Python3 in Alpine Linux versions v3.18, v3.19, v3.20, v3.21, and v3.22.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software by simply providing a manifest file like package-lock.json.

If an immediate update is not possible, implement the recommended workaround by avoiding the use of error handlers in the bytes.decode method.

Detailed information about CVE-2025-4516 can be found in the official CVE database and the Alpine Linux security advisories.

Related vulnerabilities

Recent vulnerabilities recorded for python3.

How To Fix

Minimum fixed version

3.11.12-r1

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