cve.bz

CVE-2025-12781 python python: Incorrect Type Conversion or Cast

6.3 mediumExploit referenceEPSS 0.9%Fix available

Medium (6.3) in python python. EPSS 0.9% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 4.0

6.3 medium
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

CVSS 3.1

5.3 medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
EPSS
0.9% (unchanged from 0.9% a week ago; 0.6% 30 days ago) estimated probability of exploitation activity in the next 30 days; 59th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2026-01-22. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-704 Incorrect Type Conversion or Cast
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2025-12781 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2025-12781?via=ask-ai-copy and https://cve.bz/cve/CVE-2025-12781?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2025-12781 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
Python Software Foundation CPythonbefore 3.13.10
Python Software Foundation CPythonfrom 3.14.0 before 3.14.1
Python Software Foundation CPythonfrom 3.15.0a1 before 3.15.0a2

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12pypy3, python3.11no fix listedDEBIAN-CVE-2025-12781
Debian13pypy3, python3.13no fix listedDEBIAN-CVE-2025-12781
Debian14pypy3no fix listedDEBIAN-CVE-2025-12781
Debian14python3.143.14.2-1DEBIAN-CVE-2025-12781
Ubuntu20.04:LTSpypy3no fix listedUBUNTU-CVE-2025-12781
Ubuntu22.04:LTSpypy3, python2.7, python3.10 and 1 moreno fix listedUBUNTU-CVE-2025-12781
Ubuntu24.04:LTSpypy3, python3.12no fix listedUBUNTU-CVE-2025-12781
Ubuntu25.10pypy3, python3.13, python3.14no fix listedUBUNTU-CVE-2025-12781
Ubuntu26.04:LTS, 26.10pypy3, python3.14no fix listedUBUNTU-CVE-2025-12781
UbuntuPro:14.04:LTSpython2.7, python3.4, python3.5no fix listedUBUNTU-CVE-2025-12781
UbuntuPro:16.04:LTSpython2.7, python3.5no fix listedUBUNTU-CVE-2025-12781
UbuntuPro:18.04:LTSpython2.7, python3.6, python3.7 and 1 moreno fix listedUBUNTU-CVE-2025-12781
UbuntuPro:20.04:LTSpython2.7, python3.8, python3.9no fix listedUBUNTU-CVE-2025-12781
SUSELinux Enterprise High Performance Computing 15 SP4-ESPOS, Linux Enterprise High Performance Computing 15 SP4-LTSS, Linux Enterprise High Performance Computing 15 SP5-ESPOS and 5 morepython311, python311-core, python311-documentation3.11.14-150400.9.75.1SUSE-SU-2026:0693-1
SUSELinux Enterprise Module for Basesystem 15 SP7python311-core3.11.14-150600.3.44.1SUSE-SU-2026:0767-1
SUSELinux Enterprise Module for Public Cloud 15 SP4python311, python311-core3.11.14-150400.9.75.1SUSE-SU-2026:0693-1
SUSELinux Enterprise Module for Python 3 15 SP7, Linux Enterprise Server 15 SP6-LTSS, Linux Enterprise Server for SAP Applications 15 SP6python311, python311-core3.11.14-150600.3.44.1SUSE-SU-2026:0767-1
SUSELinux Micro 6.0python311, python311-core3.11.14-3.1SUSE-SU-2026:20710-1
SUSELinux Micro 6.1python311, python311-core3.11.14-slfo.1.1_3.1SUSE-SU-2026:20665-1
openSUSELeap 15.6python311, python311-core, python311-documentation3.11.14-150600.3.44.1SUSE-SU-2026:0767-1
openSUSETumbleweedpython3113.11.14-4.1openSUSE-SU-2026:10221-1
openSUSETumbleweedpython3123.12.12-5.1openSUSE-SU-2026:10222-1
openSUSETumbleweedpython3143.14.3-1.1openSUSE-SU-2026:10206-1
openSUSETumbleweedpython3153.15.0~a3-4.1openSUSE-SU-2026:10152-1
Azure Linux2python3no fix listedAZL-75225
Azure Linux3docbook5-style-xslno fix listedAZL-84287
Azure Linux3python-pyno fix listedAZL-109683
Azure Linux3python3no fix listedAZL-75231
Alpaquita23python33.11.13-r3BELL-CVE-2025-12781
Alpaquita25python33.12.12-r2BELL-CVE-2025-12781
Alpaquitastreampython33.12.12-r3BELL-CVE-2025-12781
BellSoft Hardened Containers23python33.11.13-r3BELL-CVE-2025-12781
BellSoft Hardened Containers25python33.12.12-r2BELL-CVE-2025-12781
BellSoft Hardened Containersstreampython33.12.12-r3BELL-CVE-2025-12781

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0; Microsoft's Azure Linux vulnerability data, MIT; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE · Alpaquita · BellSoft Hardened Containers.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

This issue can only be exploited by Python applications that use the base64 functions to validate if a string is safe for a URL or filename without additional input validation. Additionally, this flaw affects only the base64 functions when an alternative alphabet is specified via the altchars parameter, limiting its exposure. This issue can cause logical errors and integrity issues but it does not allow direct access to system data or critical files, as the exploitation depends on how the application processes the decoded data. Due to these reasons, this vulnerability has been rated with a moderate severity.

Red Hat's mitigation

To mitigate this issue, implement manual input validation before calling the base64 functions with an alternative alphabet, ensuring to reject any string containing the standard base64 characters, such as '+' and '/', that are not part of the expected alphabet.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 10firefoxFix deferred
Red Hat Enterprise Linux 10python3.12Fix deferred
Red Hat Enterprise Linux 10python3.14Fix deferred
Red Hat Enterprise Linux 6pythonFix deferred
Red Hat Enterprise Linux 7firefoxFix deferred
Red Hat Enterprise Linux 7pythonFix deferred
Red Hat Enterprise Linux 7python3Fix deferred
Red Hat Enterprise Linux 8firefoxFix deferred
Red Hat Enterprise Linux 8python3Fix deferred
Red Hat Enterprise Linux 8python3.11Fix deferred
Red Hat Enterprise Linux 8python3.12Fix deferred
Red Hat Enterprise Linux 8python36:3.6/python36Fix deferred
Red Hat Enterprise Linux 8python39-devel:3.9/python39Fix deferred
Red Hat Enterprise Linux 9firefoxFix deferred
Red Hat Enterprise Linux 9python3.11Fix deferred
Red Hat Enterprise Linux 9python3.12Fix deferred
Red Hat Enterprise Linux 9python3.14Fix deferred
Red Hat Enterprise Linux 9python3.9Fix deferred
Red Hat Enterprise Linux AI (RHEL AI) 3rhelai3/bootc-aws-cuda-rhel9Fix deferred
Red Hat Enterprise Linux AI (RHEL AI) 3rhelai3/bootc-azure-cuda-rhel9Fix deferred
10 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2025-12781.

References

Check your stackJSON