CVE-2025-12781
base64.b64decode() always accepts "+/" characters, despite setting altchars
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.
INFO
Published Date :
Jan. 21, 2026, 8:16 p.m.
Last Modified :
Feb. 2, 2026, 5:25 p.m.
Remotely Exploit :
Yes !
Source :
[email protected]
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.1 | MEDIUM | [email protected] | ||||
| CVSS 4.0 | MEDIUM | 28c92f92-d60d-412d-b760-e73465c3df22 | ||||
| CVSS 4.0 | MEDIUM | [email protected] |
Solution
- Verify user-controlled inputs match expected base64 alphabet.
- Test application impact if "+/" are accepted.
- Update Python when future behavior change is released.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2025-12781.
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2025-12781 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2025-12781
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2025-12781 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2025-12781 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Feb. 02, 2026
Action Type Old Value New Value Added CVSS V3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N Added CPE Configuration OR *cpe:2.3:a:python:python:3.15.0:alpha1:*:*:*:*:*:* *cpe:2.3:a:python:python:*:*:*:*:*:*:*:* versions from (including) 3.14.0 up to (excluding) 3.14.1 *cpe:2.3:a:python:python:*:*:*:*:*:*:*:* versions up to (excluding) 3.13.10 Added Reference Type Python Software Foundation: https://github.com/python/cpython/commit/13360efd385d1a7d0659beba03787ea3d063ef9b Types: Patch Added Reference Type Python Software Foundation: https://github.com/python/cpython/commit/1be80bec7960f5ccd059e75f3dfbd45fca302947 Types: Patch Added Reference Type Python Software Foundation: https://github.com/python/cpython/commit/9060b4abbe475591b6230b23c2afefeff26fcca5 Types: Patch Added Reference Type Python Software Foundation: https://github.com/python/cpython/commit/e95e783dff443b68e8179fdb57737025bf02ba76 Types: Patch Added Reference Type Python Software Foundation: https://github.com/python/cpython/commit/fd17ee026fa9b67f6288cbafe374a3e479fe03a5 Types: Patch Added Reference Type Python Software Foundation: https://github.com/python/cpython/issues/125346 Types: Exploit, Issue Tracking Added Reference Type Python Software Foundation: https://github.com/python/cpython/pull/141128 Types: Issue Tracking, Patch Added Reference Type Python Software Foundation: https://mail.python.org/archives/list/[email protected]/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/ Types: Mailing List, Vendor Advisory -
CVE Modified by [email protected]
Jan. 22, 2026
Action Type Old Value New Value Added Reference https://github.com/python/cpython/commit/13360efd385d1a7d0659beba03787ea3d063ef9b Added Reference https://github.com/python/cpython/commit/1be80bec7960f5ccd059e75f3dfbd45fca302947 Added Reference https://github.com/python/cpython/commit/9060b4abbe475591b6230b23c2afefeff26fcca5 Added Reference https://github.com/python/cpython/commit/e95e783dff443b68e8179fdb57737025bf02ba76 Added Reference https://github.com/python/cpython/commit/fd17ee026fa9b67f6288cbafe374a3e479fe03a5 -
CVE Modified by 134c704f-9b21-4f2e-91b3-4a467353bcc0
Jan. 22, 2026
Action Type Old Value New Value Added CWE CWE-704 -
New CVE Received by [email protected]
Jan. 21, 2026
Action Type Old Value New Value Added 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. Added CVSS V4.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 Added Reference https://github.com/python/cpython/issues/125346 Added Reference https://github.com/python/cpython/pull/141128 Added Reference https://mail.python.org/archives/list/[email protected]/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/