Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2025-4516: CWE-416 Use After Free in Python Software Foundation CPython

0
Medium
VulnerabilityCVE-2025-4516cvecve-2025-4516cwe-416
Published: Thu May 15 2025 (05/15/2025, 13:29:20 UTC)
Source: CVE
Vendor/Project: Python Software Foundation
Product: CPython

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.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 04/22/2026, 05:42:35 UTC

Technical Analysis

This vulnerability in CPython arises when decoding bytes using bytes.decode("unicode_escape", error="ignore" or "replace"), leading to a use-after-free condition (CWE-416). The flaw is specific to this combination of encoding and error handlers. Users not employing "unicode_escape" encoding or error handlers are not affected. The vulnerability was published on 2025-05-15 and affects CPython versions from 0 up to 3.14.0a1. No known exploits are reported in the wild. There is no vendor advisory or patch link provided, and the vulnerability is not related to a cloud service.

Potential Impact

The vulnerability can cause use-after-free memory corruption in CPython when decoding bytes with the specified parameters, potentially leading to crashes or undefined behavior. The CVSS 4.0 vector indicates local attack vector, high attack complexity, partial attack type, no privileges required, no user interaction, and high impact on availability. There are no reports of active exploitation.

Mitigation Recommendations

Currently, no official patch or fix is documented. Users should avoid using bytes.decode() with the "unicode_escape" encoding combined with error handlers "ignore" or "replace". Instead, remove the error handler parameter and wrap the decode call in a try-except block to catch DecodeError exceptions. Monitor the Python Software Foundation advisories for any forthcoming official fixes.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.1
Assigner Short Name
PSF
Date Reserved
2025-05-09T14:59:53.878Z
Cisa Enriched
true
Cvss Version
4.0
State
PUBLISHED

Threat ID: 682cd0f81484d88663aeb86b

Added to database: 5/20/2025, 6:59:04 PM

Last enriched: 4/22/2026, 5:42:35 AM

Last updated: 5/9/2026, 10:18:08 PM

Views: 476

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses