CVE-2025-12781
Last modified
CVE-2025-12781 is a medium-severity vulnerability rated 5.3/10 on the CVSS scale. 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. EPSS estimates a 0.51% chance of exploitation in the next 30 days.
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.
Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
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/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
Weakness Enumeration
Affected Software
| Vendor | Product | Versions | Update |
|---|---|---|---|
| Python | Python | < 3.13.10 | — |
| Python | Python | >= 3.14.0, < 3.14.1 | — |
| Python | Python | 3.15.0 | Alpha1 |
References
- https://github.com/python/cpython/issues/125346Exploit, Issue Tracking
- https://github.com/python/cpython/pull/141128Issue Tracking, Patch
- https://mail.python.org/archives/list/security-announce@python.org/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/Mailing List, Vendor Advisory
Timeline
- Published
- Last Modified
- Status
- Analyzed
Frequently Asked Questions
What is CVE-2025-12781?
How severe is CVE-2025-12781?
How do I fix CVE-2025-12781?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2025
- CVE-2025-12776The Report Builder component of the application stores user …5.4
- CVE-2025-12777The YITH WooCommerce Wishlist plugin for WordPress is vulner…5.3
- CVE-2025-12778The Ultimate Member Widgets for Elementor – WordPress User D…5.3
- CVE-2025-12779Improper handling of the authentication token in the Amazon …8.8
- CVE-2025-1278An issue has been discovered in GitLab CE/EE affecting all v…7.5
- CVE-2025-12780Rejected reason: This CVE ID has been rejected or withdrawn …
- CVE-2025-12782The Beaver Builder – WordPress Page Builder plugin for WordP…4.3
- CVE-2025-12783The Premmerce Brands for WooCommerce plugin for WordPress is…4.3
- CVE-2025-12784Certain HP LaserJet Pro printers may be vulnerable to inform…4.9
- CVE-2025-12785Certain HP LaserJet Pro printers may be vulnerable to inform…7.5
- CVE-2025-12787The Hydra Booking — Appointment Scheduling & Booking Calenda…5.3
- CVE-2025-12788The Hydra Booking — Appointment Scheduling & Booking Calenda…5.3
Are you affected by CVE-2025-12781?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
