Skip to main content
VulnerabilityPublished

CVE-2025-12781: Python Software Foundation CPython · CWE-704

Affects Python Software Foundation CPythonSource CVE Database V5

0

Not known to be exploited · CVSS 6.3 Medium · fixed in 3.15.0a2 : update Python Software Foundation CPython when convenient.

Data as of 26 Oct 2026, 08:30 UTC

CVSS 4.0 base score
6.3Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.8% chance of exploitation in 30 days – higher than 58% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
Patch
Available – fixed in 3.15.0a2, 3.14.1, 3.13.10
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 21 Jan 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.

What to do

Upgrade Python Software Foundation CPython to 3.15.0a2, 3.14.1 or 3.13.10.

Affected software

ProductAffectedFixed in
Python Software FoundationCPythonAffected
  • <3.13.10
  • >=3.14.0 <3.14.1
  • >=3.15.0a1 <3.15.0a2
Fixed in
  • 3.15.0a2
  • 3.14.1
  • 3.13.10
PyPIcpythonpkg:pypi/cpythonOther threatsAffected
  • =0
  • =3.14.0
  • =3.15.0
Fixed in–
GitHubCPythonpkg:github/CPythonOther threatsAffected
  • <3.13.10
  • >=3.14.0 <3.14.1
  • >=3.15.0a1 <3.15.0a2
Fixed in
  • 3.13.10
  • 3.14.1
  • 3.15.0a2

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

European organizations should implement the following specific mitigations: 1) Audit all Python applications and libraries to identify usage of the base64 module's b64decode(), standard_b64decode(), and urlsafe_b64decode() functions, especially where the altchars parameter is used to specify alternate alphabets. 2) Implement strict input validation to ensure that any base64-encoded data strictly conforms to the expected alphabet, rejecting or sanitizing inputs containing '+' or '/' when these are not part of the intended encoding scheme. 3) Where possible, refactor applications to avoid reliance on alternate base64 alphabets or to handle decoding explicitly and safely. 5) Incorporate static and dynamic code analysis tools to detect improper base64 decoding usage patterns. 6) Educate developers and security teams about the implications of this vulnerability and the importance of encoding validation. 7) For critical systems, consider implementing additional data integrity checks post-decoding to detect corrupted or malformed data early. These steps go beyond generic advice by focusing on code auditing, input validation, and proactive patch management tailored to the specifics of this vulnerability.

Description

When passing data to the b64decode(), standard_b64decode(), and urlsafe_b64decode() functions in the "base64" module the characters "+/" will always be accepted, regardless of the value of "altchars" parameter, typically used to establish an "alternative base64 alphabet" such as the URL safe alphabet. This behavior matches what is recommended in earlier base64 RFCs, but newer RFCs now recommend either dropping characters outside the specified base64 alphabet or raising an error. The old behavior has the possibility of causing data integrity issues. This behavior can only be insecure if your application uses an alternate base64 alphabet (without "+/"). If your application does not use the "altchars" parameter or the urlsafe_b64decode() function, then your application does not use an alternative base64 alphabet. The attached patches DOES NOT make the base64-decode behavior raise an error, as this would be a change in behavior and break existing programs. Instead, the patch deprecates the behavior which will be replaced with the newly recommended behavior in a future version of Python. Users are recommended to mitigate by verifying user-controlled inputs match the base64 alphabet they are expecting or verify that their application would not be affected if the b64decode() functions accepted "+" or "/" outside of altchars.

References

Community reviews

Loading reviews…