LiveActive security incident?Get immediate response
CVE Record

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

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.

MediumCVSS 5.9Not KEV-listedUpdated
Glexia's TakeAutomated analysismoderate

Security readout for executives and security teams

Plain-English summary

A memory safety flaw can crash affected CPython processes when specific malformed bytes are decoded using the "unicode_escape" codec with "ignore" or "replace" error handling. Applications not using that exact combination are not affected. The supplied evidence indicates availability impact, not data theft or modification.

Executive priority

Use targeted, moderate-priority remediation. Quickly identify internet-facing or business-critical services using the affected pattern, then upgrade or apply the documented workaround. Systems without that pattern do not require emergency action for this CVE. Escalate if exposure to untrusted input is confirmed.

Technical view

CVE-2025-4516 is a CWE-416 use-after-free in CPython's "unicode_escape" decoder. The CVSS 4.0 score is 5.9, with local access, high complexity, prerequisite conditions, and high vulnerable-system availability impact. The source bundle lists multiple CPython branches but does not clearly identify fixed release numbers.

Likely exposure

Exposure is narrow: code must decode bytes with "unicode_escape" while specifying errors="ignore" or errors="replace". Risk increases when untrusted or attacker-influenced bytes can reach that path. Inventory results should be confirmed against Python's advisory because the supplied affected-version data is incomplete.

Exploitation context

The supplied CVSS vector describes local attack access, high complexity, and prerequisite conditions. CISA KEV status is false, and no supplied source establishes active exploitation. Treat claims of remote exploitation or code execution as unsubstantiated by this bundle.

Researcher notes

The evidence supports a narrowly triggered use-after-free and denial-of-service risk. The affected list contains ambiguous version entries, including "0" and branch starting points, so it should not be interpreted as precise fixed-release guidance. Review the linked advisory and branch commits before making version-based conclusions.

Mitigation direction

  • Upgrade to a vendor-supported CPython release containing the referenced corrections after confirming applicable release guidance.
  • As a workaround, remove the error handler and catch the decoding exception around the decode operation.
  • Prioritize applications where untrusted bytes reach the affected decoding pattern.
  • Retest decoding behavior after changing error handling or upgrading CPython.

Validation and detection

  • Search application and dependency code for "unicode_escape" decoding combined with "ignore" or "replace" error handling.
  • Record deployed CPython versions and compare them with the Python security advisory and supported fixed releases.
  • Trace whether untrusted bytes can reach each identified decoding call.
  • Run controlled regression tests covering malformed input, expected exceptions, and process stability.
Prepared
Confidence
high
Sources
5

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-416: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2025-4516 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Medium
CVSS
5.9 (4.0)
Known Exploited
No
Published

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

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
3Timeline events
2ADP providers
11Source links

SSVC decision data

CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: partial

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

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

Vulnerability scoring details

Base CVSS 4.0 score

5.9Medium
CVSS 4.0 vector shape for CVE-2025-4516Attack VectorAttack ComplexityAttack RequirementsPrivileges RequiredUser InteractionVS ConfidentialityVS IntegrityVS AvailabilitySS ConfidentialitySS IntegritySS Availability

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

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Attack Requirements
NonePresent
Privileges Required
NoneLowHigh
User Interaction
NonePassiveActive
VS Confidentiality
HighLowNone
VS Integrity
HighLowNone
VS Availability
HighLowNone
SS Confidentiality
HighLowNone
SS Integrity
HighLowNone
SS Availability
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. CVE publishedCVE Program

    The CVE record was published.

  3. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

ADP provider summaries

CISA-ADPCISA ADP Vulnrichment
other:ssvc
CVECVE Program Container
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
Python Software FoundationCPython0, 3.10.0, 3.11.0, 3.12.0, 3.13.0, 3.14.0a1unaffected
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.

CWE-416 · source CWE mapping

Use After Free

Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.