BIT-python-min-2025-4516: Use-after-free in "unicode_escape" decoder with error handler

Published May 15, 2025
·
Updated

There is an issue in CPython when using bytes.decode("unicodeescape", error="ignore|replace"). If you are not using the "unicodeescape" encoding or an error handler your usage is not affected. To work-around this issue you may stop using the error= handler and instead wrap the bytes.decode() call in a try-except catching the DecodeError.

Affected Software

1 affected component
Python Software Foundation CPython

Event History

May 15, 2025
CVE Published
via OSV·01:29 PM
Data Sourced
via OSV·01:29 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which applications are exposed to this issue?

Applications are affected only if they call bytes.decode() with the "unicode_escape" encoding and use the error="ignore" or error="replace" handler. Uses that do not combine this encoding with an error handler are not affected.

2

What can be done if an update cannot be applied immediately?

Avoid using the error= handler for the unicode_escape decode operation. Instead, call bytes.decode() without that handler and wrap the call in try-except to catch DecodeError.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203