
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2025-12781 is a data integrity vulnerability in Python's base64 standard library module, where the b64decode(), standard_b64decode(), and urlsafe_b64decode() functions unconditionally accept the characters + and / regardless of the altchars parameter value used to specify an alternative base64 alphabet. This behavior follows older base64 RFCs but conflicts with newer RFC recommendations that require rejecting or erroring on out-of-alphabet characters. The vulnerability was reported on October 12, 2024 (GitHub issue #125346), publicly disclosed on January 21, 2026, and affects all Python versions before 3.13.10, versions 3.14.0 through 3.14.1 (exclusive), and 3.15.0-alpha1. It carries a CVSS v3.1 score of 5.3 (Medium) and a CVSS v4.0 score of 6.3 (Medium) (Red Hat CVE, CPython Issue).
The root cause is classified as CWE-704 (Incorrect Type Conversion or Cast): the base64 decoding functions perform an implicit character substitution step that maps altchars onto +/ before decoding, meaning the standard +/ characters remain valid even when a completely different alphabet is specified via altchars. An attacker who can supply user-controlled base64 input to an application using a custom alphabet (e.g., URL-safe -_ instead of +/) can craft input containing the standard +/ characters that will be silently accepted and decoded, producing output the application did not intend to process. The vulnerability is only exploitable in applications that explicitly use the altchars parameter or urlsafe_b64decode() with a non-standard alphabet; applications using the default base64 alphabet are unaffected. The fix, implemented in PR #141128 by Serhiy Storchaka, emits deprecation/future warnings rather than raising errors to avoid breaking existing programs (CPython PR, CPython Issue).
Successful exploitation can cause data integrity violations where decoded binary data differs from what the application expected based on its specified base64 alphabet, potentially allowing malformed or unintended data to pass through input validation. Applications relying on the custom alphabet as a security boundary (e.g., to distinguish URL-safe tokens from standard base64 tokens) may incorrectly accept and process attacker-supplied data. There is no confidentiality or availability impact; the scope is limited to integrity of decoded data within the affected application (Red Hat CVE, CPython Issue).
base64.b64decode() with a custom altchars parameter (e.g., altchars='-_' for URL-safe encoding) or calls urlsafe_b64decode(), and accepts user-controlled base64 input.+ or / characters that would normally be rejected by the custom alphabet. For example, if the application expects URL-safe base64 (-_ alphabet), submit a string like /+/+ instead of the expected -_-_.base64.b64decode('/+/+', altchars='-_') will silently decode the input as if +/ were valid, producing b'\xff\xef\xfe'.Upgrade Python to version 3.13.10 or later, 3.14.1 or later, or 3.15.0-alpha1 or later, which introduce deprecation warnings when + or / characters appear in base64 data decoded with a non-standard alphabet. As an immediate workaround for applications that cannot upgrade, validate user-controlled base64 inputs against the expected alphabet before passing them to decode functions (e.g., reject inputs containing + or / when using a URL-safe alphabet). IBM has also released patches for affected watsonx Orchestrate with watsonx Assistant Cartridge products (Python Mailing List, IBM Advisory).
The Python Security team coordinated the fix through the standard CPython security process, with core developer Serhiy Storchaka authoring the patch and Seth Larson (PSF Security Developer-in-Residence) reviewing it. Reviewer commentary in the PR discussion highlighted concerns about subtle breakages from behavior changes, ultimately leading to a deprecation warning approach rather than an immediate error to preserve backward compatibility. IBM issued a security bulletin for downstream products (watsonx Orchestrate) affected by this CVE (CPython PR, IBM Advisory).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."