CVE-2025-12781: base64.b64decode() always accepts "+/" characters, despite setting altchars
Vulnerability summary
CVE-2025-12781 is a medium (CVSS 6.3) Incorrect Type Conversion or Cast vulnerability in python software foundation cpython. EPSS estimates a 0.86% chance of exploitation in the next 30 days, higher than 58.5% of scored vulnerabilities. 1 public exploit is recorded.
Not severe (CVSS 6.3, network access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 9 · Related 9Timeline
- 21-01-2026PublishedVulnerability first disclosed.
- 22-01-2026Last modifiedVulnerability information updated.
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.
CVSS metrics
8 scores · 6 sources · 2 versions- OSV · UbuntuEcosystem advisory · calculated6.3MediumCVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
- OSV · WolfiEcosystem advisory · calculated6.3MediumCVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
- OSV · ChainguardEcosystem advisory · calculated6.3MediumCVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
- NVDNIST6.3MediumCVSS: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
- OSV · DebianEcosystem advisory · calculated5.3MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
- NVDNIST5.3MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
EPSS trend
Probability
0.86%
Chance of exploitation in the next 30 days
Percentile
59%
Versus all other CVEs
30-day change
Increase +0.29 pp
From 0.57% on 04-10-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
1 foundCpython
Maturity: poc
Weaknesses
CWE · root causeAffected systems
Known conditions: network-reachable, no authentication, no user interaction (CVSS vector). Other conditions: not stated in public data.
Ubuntu13 products
- pypy3All versions (No fix recorded)
- python2.7All versions (No fix recorded)
- python3.10All versions (No fix recorded)
- python3.11All versions (No fix recorded)
- python3.12All versions (No fix recorded)
Chainguard6 products
- python-3.10All versions (No fix recorded)
- python-3.11All versions (No fix recorded)
- python-3.12All versions (No fix recorded) | < 3.12.16-r2
- python-3.13< 3.13.14-r0
- python-3.14< 3.14.6-r1
Wolfi5 products
- python-3.10All versions (No fix recorded)
- python-3.11All versions (No fix recorded)
- python-3.12All versions (No fix recorded) | < 3.12.16-r2
- python-3.13< 3.13.14-r0
- python-3.14< 3.14.6-r1
Debian4 products
- pypy3All versions (No fix recorded)
- python3.11All versions (No fix recorded)
- python3.13All versions (No fix recorded)
- python3.14All versions (No fix recorded) | < 3.14.2-1
Python1 product
- python< 3.13.10 | ≥ 3.14.0, < 3.14.1 | 3.15.0:alpha1
Python software foundation1 product
- cpython< 3.13.10 | ≥ 3.14.0, < 3.14.1 | ≥ 3.15.0a1, < 3.15.0a2
6 vendors · 30 products
References
14 links- mail.python.org/archives/list/security-announce@python.org/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/Vendor AdvisoryREPORTAdvisoryMailing List
Show all 14 references
- github.com/python/cpythonPACKAGE