CVE-2025-4516 MEDIUM

CVE-2025-4516: Use-after-free in "unicode_escape" decoder with error handler

Vendor Python Software Foundation
Product CPython
Weakness CWE-416
Published May 15, 2025
Last update April 21, 2026

CVSS base score

5.9/10
Attack vector Local
Attack complexity High
Privileges required None
User interaction None
Confidentiality
Integrity

CVSS vector

CVSS:4.0/AV:L/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

What the vulnerability does

01Description

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.

Key dates

02Disclosure timeline

May 15, 2025 CVE published
April 21, 2026 Record updated