CVE-2025-4516 Details
Description
There is an issue in CPython when using `bytes.decode("unicode_escape", error="ignore|replace")`. If you are not using the "unicode_escape" encoding or an error handler your usage is not affected. To work-around this issue you may stop using the error= handler and instead wrap the bytes.decode() call in a try-except catching the DecodeError.
A use-after-free vulnerability has been identified in CPython's handling of the 'bytes.decode' method with the 'unicode_escape' encoding and certain error handlers. This issue can lead to a crash, as the vulnerability allows for memory corruption by creating a temporary bytes object that, once deleted, invalidates pointers to the decoded data. The problem arises when the 'unicode_escape' decoder is used with error handlers that modify the decoding process, such as 'ignore' or 'replace'.
Users can avoid this vulnerability by not using the 'unicode_escape' encoding with the 'error' parameter. Instead, the 'bytes.decode' method can be called without the 'error' parameter, and any decoding errors can be handled manually using a try-except block.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
Volerion
Assessed May 15, 2025CISA-ADP
Assessed May 15, 2025References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-416 | Use After Free | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| Python CPython | All versions |
CPE
Remediation
| |
Change History
8 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jul 31, 2026 | CVE Modified | [email protected] |
| Jul 30, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 3, 2025 | CVE Modified | [email protected] |
| May 19, 2025 | CVE Modified | CVE |
| May 16, 2025 | CVE Modified | CVE |
| May 15, 2025 | New CVE Received | [email protected] |
Volerion