CVE-2025-22153 try/except* clauses could allow bypass RestrictedPython via type confusion bug in the CPython interpreter

High 7.9 Published Updated

A type confusion bug in CPython allows attackers to bypass RestrictedPython sandbox restrictions, potentially executing unauthorized code.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-22153?

CVE-2025-22153 is a high-severity vulnerability in zopefoundation RestrictedPython, published on 23 Jan 2025. An attacker needs administrator access to exploit it, with no action from the victim.

Official description

RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. Via a type confusion bug in versions of the CPython interpreter starting in 3.11 and prior to 3.13.2 when using `try/except*`, RestrictedPython starting in version 6.0 and prior to version 8.0 could be bypassed. The issue is patched in version 8.0 of RestrictedPython by removing support for `try/except*` clauses. No known workarounds are available.

Weakness: CWE-843

Which versions are affected by CVE-2025-22153?

3 open source packages ship an affected version, including restrictedpython and RestrictedPython.

PackageAffectedFixed in
restrictedpython PyPIFrom 6.08.0
restrictedpython PyPIFrom 6.08.0
RestrictedPython PyPIFrom 6.08.0

How do I fix CVE-2025-22153?

Upgrade restrictedpython to 8.0 or later.

Is CVE-2025-22153 being exploited?

There is no known exploitation of CVE-2025-22153 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2025-22153, GHSA-gmj9-h825-chq2, PYSEC-2026-1874, UBUNTU-CVE-2025-22153.

Is CVE-2025-22153 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free