Vulnerability
CVE-2025-12781
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.
32 advisories report this vulnerability, across 10 ecosystems.
Advisories
-
AZL-109683
CVE-2025-12781 affecting package python-py 1.11.0-1
-
AZL-75225
CVE-2025-12781 affecting package python3 3.9.19-19
-
AZL-75231
CVE-2025-12781 affecting package python3 3.12.9-9
-
AZL-84287
CVE-2025-12781 affecting package docbook5-style-xsl 1.79.2-11
- CGA-34m3-pqv7-q76p
- CGA-3f4q-3vqj-xhx7
- CGA-3mjq-5c23-prmp
- CGA-4mf7-96v4-52mj
- CGA-72qp-7wjg-2v7q
- CGA-8w6w-j788-x97q
- CGA-fmgm-45cx-6m2f
- CGA-m2h9-8f76-h5pw
- CGA-p288-9mv5-m48f
- CGA-qm9w-v5cx-mm74
- CGA-x4f5-663c-vj94
- CGA-xp35-jg4m-v7xg
-
CNA-CVE-2025-12781
base64.b64decode() always accepts "+/" characters, despite setting altchars
-
DEBIAN-CVE-2025-12781
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,…
-
OESA-2026-1356
python3 security update
-
OESA-2026-1357
python3 security update
-
OESA-2026-1358
python3 security update
-
OESA-2026-1461
python3 security update
-
RHVEX-CVE-2025-12781
cpython: base64.b64decode() always accepts "+/" characters, despite setting altchars
-
SUSE-SU-2026:0693-1
Security update for python311
-
SUSE-SU-2026:0767-1
Security update for python311
-
SUSE-SU-2026:20665-1
Security update for python311
-
SUSE-SU-2026:20710-1
Security update for python311
-
UBUNTU-CVE-2025-12781
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,…
-
openSUSE-SU-2026:10152-1
python315-3.15.0~a3-4.1 on GA media
-
openSUSE-SU-2026:10206-1
python314-3.14.3-1.1 on GA media
-
openSUSE-SU-2026:10221-1
python311-3.11.14-4.1 on GA media
-
openSUSE-SU-2026:10222-1
python312-3.12.12-5.1 on GA media
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/[email protected]/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/