CVE-2025-12781
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.
Description as published by the source, in English.
Key facts
- Published
- 2026-01-21
- Last modified
- 2026-06-17
- Assigned by
- cna@python.org
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N- Scored by
- nvd@nist.gov (NVD Primary)
- Probability of exploitation
-
0.5 %
higher than 41 %
of all known vulnerabilities
EPSS, next 30 days, model v2026.06.15 - Fix available
- Yes, see references
Affected products
| Vendor | Product | Versions | Status |
|---|---|---|---|
| Python | Python | < 3.13.10 | Affected |
| Python | Python | 3.15.0 | Affected |
| Python | Python | ≥ 3.14.0, < 3.14.1 | Affected |
Weakness type
-
CWE-704: Incorrect Type Conversion or Cast
The product does not correctly convert an object, resource, or structure from one type to a different type.
References
- https://github.com/python/cpython/commit/13360efd385d1a7d0659beba03787ea3d063ef9b
- https://github.com/python/cpython/commit/1be80bec7960f5ccd059e75f3dfbd45fca302947
- https://github.com/python/cpython/commit/9060b4abbe475591b6230b23c2afefeff26fcca5
- https://github.com/python/cpython/commit/e95e783dff443b68e8179fdb57737025bf02ba76
- https://github.com/python/cpython/commit/fd17ee026fa9b67f6288cbafe374a3e479fe03a5
- https://github.com/python/cpython/issues/125346
- https://github.com/python/cpython/pull/141128
- https://mail.python.org/archives/list/security-announce@python.org/thread/KRI7GC6S27YV5NJ…
Related at Berigo
Articles
-
A fake CAPTCHA gets the user to open a tunnel into the network
Same product
2026-09-01
Microsoft has tracked the TerminalFix campaign, in which compromised websites show a fake Cloudflare CAPTCHA and ask visitors to paste a command into…
-
The crypto library behind Python now ships quantum-resistant algorithms
Same product
2026-08-18
Trail of Bits has added ML-KEM and ML-DSA to pyca/cryptography, funded by the Sovereign Tech Agency. The library is the eleventh most downloaded pack…
-
Records are being pulled from Salesforce and ServiceNow portals that need no login
Same product
2026-08-14
Reco is tracking an ongoing campaign it calls City-Forum, in which a single tool written in Go pulls records from customer portals in Salesforce Expe…
-
CrashStealer poses as Apple crash reporting and empties the Keychain on Mac
Same product
2026-08-05
Kaspersky has described CrashStealer, a macOS information stealer delivered through a fake videoconferencing installer. The installer is both signed …
Does this affect you?
A vulnerability matters only if you run the product, in an affected version, somewhere an attacker can reach.