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

- Severity: Medium 6.3 (CVSS:4.0, scored by PSF) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.86%, higher than 59% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-01-21T19:34:47.979Z
- Modified: 2026-06-17T08:32:56.797Z
- Also known as: PSF-2026-7, BIT-LIBPYTHON-2025-12781, BIT-PYTHON-2025-12781, BIT-PYTHON-MIN-2025-12781
- Weaknesses: CWE-704
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: PSF

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

(As written by CVE List.)

## Affected

- Python Software Foundation CPython: before 3.13.10; from 3.14.0 before 3.14.1; from 3.15.0a1 before 3.15.0a2
- https://github.com/python/cpython: before 13360efd385d1a7d0659beba03787ea3d063ef9b; before 1be80bec7960f5ccd059e75f3dfbd45fca302947; before 9060b4abbe475591b6230b23c2afefeff26fcca5; before e95e783dff443b68e8179fdb57737025bf02ba76; before fd17ee026fa9b67f6288cbafe374a3e479fe03a5
- python python: before 3.13.10; from 3.14.0 before 3.14.1; 3.15.0
- libpython (Bitnami): before 3.15.0
- python (Bitnami): before 3.15.0
- python-min (Bitnami): before 3.15.0

## Every score

- PSF: 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`
- NVD: 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`
- Bitnami Vulnerability Database: rating Medium

## References

- <https://github.com/python/cpython/issues/125346> (exploit, issue-tracking, report, web)
- <https://github.com/python/cpython/pull/141128> (issue-tracking, patch, web)
- <https://mail.python.org/archives/list/security-announce@python.org/thread/KRI7GC6S27YV5NJ4FPDALS2WI5ENAFJ6/> (advisory, mailing-list, vendor-advisory, web)
- <https://github.com/python/cpython/commit/13360efd385d1a7d0659beba03787ea3d063ef9b> (fix, patch, web)
- <https://github.com/python/cpython/commit/1be80bec7960f5ccd059e75f3dfbd45fca302947> (fix, patch, web)
- <https://github.com/python/cpython/commit/9060b4abbe475591b6230b23c2afefeff26fcca5> (fix, patch, web)
- <https://github.com/python/cpython/commit/e95e783dff443b68e8179fdb57737025bf02ba76> (fix, patch, web)
- <https://github.com/python/cpython/commit/fd17ee026fa9b67f6288cbafe374a3e479fe03a5> (fix, patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2025-12781> (web)

## Sources

- CVE List: [CVE-2025-12781](https://www.cve.org/CVERecord?id=CVE-2025-12781), CVE Terms of Use, modified 2026-01-22
- Python Software Foundation: [PSF-2026-7](https://osv.dev/vulnerability/PSF-2026-7), CC-BY-4.0, modified 2026-01-26
- NVD: [CVE-2025-12781](https://nvd.nist.gov/vuln/detail/CVE-2025-12781), Public domain, modified 2026-06-17
- Bitnami Vulnerability Database: [BIT-LIBPYTHON-2025-12781](https://osv.dev/vulnerability/BIT-LIBPYTHON-2025-12781), Apache-2.0, modified 2026-01-26
- Bitnami Vulnerability Database: [BIT-PYTHON-2025-12781](https://osv.dev/vulnerability/BIT-PYTHON-2025-12781), Apache-2.0, modified 2026-01-26
- Bitnami Vulnerability Database: [BIT-PYTHON-MIN-2025-12781](https://osv.dev/vulnerability/BIT-PYTHON-MIN-2025-12781), Apache-2.0, modified 2026-01-26

---

Page: https://cve.day/CVE-2025-12781 · Whole record: https://cve.day/CVE-2025-12781.json · Rebuilt by cve.day 2026-11-25T22:59:10.746Z
