Vulnerability · Published Jan 21, 2026 · Assigned by PSF

CVE-2025-12781base64.b64decode() always accepts "+/" characters, despite setting altchars

Medium 6.3

In plain English

A medium-severity security flaw in CPython from Python Software Foundation. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.9% (higher than 59% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 4.0)6.3Medium
Exploit odds (30 days)0.9%top 41.3% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official 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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12pypy3no fix listedDEBIAN-CVE-2025-12781
Debian:13pypy3no fix listedDEBIAN-CVE-2025-12781
Debian:14pypy3no fix listedDEBIAN-CVE-2025-12781
Debian:12python3.11no fix listedDEBIAN-CVE-2025-12781
Debian:13python3.13no fix listedDEBIAN-CVE-2025-12781
Debian:14python3.143.14.2-1DEBIAN-CVE-2025-12781
Ubuntu:22.04:LTSpypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu:24.04:LTSpypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu:25.10pypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu:26.04:LTSpypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu:26.10pypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu:22.04:LTSpython2.7no fix listedUBUNTU-CVE-2025-12781
Ubuntu:22.04:LTSpython3.10no fix listedUBUNTU-CVE-2025-12781
Ubuntu:22.04:LTSpython3.11no fix listedUBUNTU-CVE-2025-12781
Ubuntu:24.04:LTSpython3.12no fix listedUBUNTU-CVE-2025-12781
Ubuntu:25.10python3.13no fix listedUBUNTU-CVE-2025-12781
Ubuntu:25.10python3.14no fix listedUBUNTU-CVE-2025-12781
Ubuntu:26.04:LTSpython3.14no fix listedUBUNTU-CVE-2025-12781
Ubuntu:26.10python3.14no fix listedUBUNTU-CVE-2025-12781

Affected products (as reported)

VendorProductVersions
Python Software Foundation CPython 0 – before 3.13.103.14.0 – before 3.14.13.15.0a1 – before 3.15.0a2

Weakness: CWE-704 · Vector: CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

References