base64.b64decode() always accepts "+/" characters, despite setting altchars
CVE-2025-12781Published 21 Jan 2026, 19:34 UTC
Real-world risk
0.5/ 10Low
Routine
If the vulnerable configuration applies to you: 1.1
PreliminaryFrom the CVSS vector only · confidence low
CVSS
6.3
scored by the vendor (CNA), CVSS 4.0
In plain words
No plain-language summary yet. The original description is below.
Original description (from PSF)
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.
Am I affected?
| Product | Affected versions (from the sources) | Fixed in |
|---|---|---|
| CPythonUbiquitous | < 3.13.10; >= 3.14.0, < 3.14.1; >= 3.15.0a1, < 3.15.0a2 | 3.13.10, 3.14.1, 3.15.0a2 |
What to do
Update to a fixed version: 3.13.10, 3.14.1, 3.15.0a2.
Why this score
| Factor | Value | Evidence | × |
|---|---|---|---|
| Impact | MinorReflected XSS, CSRF with low effect, open redirect, minor leak | From the CVSS vector | 0.30 |
| Attacker position | InternetAnyone on the Internet can reach a typical deployment | From the CVSS vector | 1.00 |
| Privileges needed | NoneNo account | From the CVSS vector | 1.00 |
| Victim interaction | NoneNothing | From the CVSS vector | 1.00 |
| Configuration | UncommonNeeds a non-default feature that a minority enables | From the CVSS vector | 0.45 |
| Reliability | HardNarrow race, needs an extra info leak, needs a man-in-the-middle position, or must be chained with another bug | From the CVSS vector | 0.45 |
Threat level T1: Nothing known (× 0.85)
The default for a new disclosure
EPSS 0.9% chance of exploitation in 30 days (percentile 60), as of 2026-12-03.
The arithmetic
- Prerequisites multiplied together0.203
- Threat T1: Nothing known0.850
- 10 × impact 0.3 × prerequisites 0.2025 × threat 0.850.516
- Rounded to one decimal between 0.1 and 100.5
Exploitation and evidence timeline
- 21 Jan 2026 Published
- 3 Dec 2026 Risk 0.5 (cvss fallback)
Weakness
CWE-704
References
- https://github.com/python/cpython/pull/141128patch
- https://github.com/python/cpython/issues/125346issue-tracking
- https://mail.python.org/archives/list/[email protected]/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/vendor-advisory
- https://github.com/python/cpython/commit/13360efd385d1a7d0659beba03787ea3d063ef9bpatch
- https://github.com/python/cpython/commit/1be80bec7960f5ccd059e75f3dfbd45fca302947patch
- https://github.com/python/cpython/commit/9060b4abbe475591b6230b23c2afefeff26fcca5patch
- https://github.com/python/cpython/commit/e95e783dff443b68e8179fdb57737025bf02ba76patch
- https://github.com/python/cpython/commit/fd17ee026fa9b67f6288cbafe374a3e479fe03a5patch
- CVE-2025-12781 on CVE.org