CVE-2025-12781: Python Vulnerability

CVE-2025-12781

NVDCVSS scored by cna@python.org

Vulnerability Summary

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.
Severity Level
MEDIUM(6.3)
Published Date
Jan 21, 2026
Last Modified
Feb 2, 2026
Exploitation Status
Public exploit available
Root Weakness (CWE)
The product does not correctly convert an object, resource, or structure from one type to a different type.
CVSS v4.0 Base Metrics — Score 6.3 (MEDIUM)
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Attack VectorNetwork
Attack ComplexityHigh
Attack RequirementsPresent
Privileges RequiredNone
User InteractionNone
Confidentiality (Vulnerable System)None
Integrity (Vulnerable System)Low
Availability (Vulnerable System)None
Confidentiality (Subsequent System)None
Integrity (Subsequent System)None
Availability (Subsequent System)None
Show CVSS v3.x metrics (score 5.3)
CVSS v3.1 Base Metrics — Score 5.3 (MEDIUM)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredNone
User InteractionNone
ScopeUnchanged
ConfidentialityNone
IntegrityLow
AvailabilityNone

Affected & Patched Versions

Affected Versions
  • Python < 3.13.10
  • Python >= 3.14.0 and < 3.14.1
  • Python
Patched Versions
  • Python 3.13.10
  • Python 3.14.1

What to do

Prioritize this fix. Exploit code is public, so attacks can follow quickly.

  1. Check whether you run Python and which version.
  2. Update to a patched version listed above, then confirm the new version.
  3. Review logs and exposed services for signs of earlier compromise.

Timeline

  • Jan 21, 2026Published
  • Feb 2, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new Python CVEsYou are reading CVE-2025-12781. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Dec 5, 2026 07:11 UTC