Threat Feed

CVE-2026-133467: CodeSafe: safe_eval Sandbox Escape via Indirect Subscript Call

Exploitation: None known · CVSS 9.8 Critical · Unauthenticated · Published 2026-11-25

Description

CodeSafe is an open-source Python library for code encryption, decryption, and safe evaluation using Python's AST module. From versions 0.0.1 through 0.0.4, the safe_eval() function can be bypassed with indirect subscript calls such as builtins'exec', because AST validation blocks only direct calls to dangerous built-ins. An attacker who controls an expression passed to safe_eval() can execute arbitrary Python code with the permissions of the host application. This issue is fixed in version 0.0.5.

Enclave's analysis

CodeSafe's safe_eval() is supposed to block dangerous code, but it only checks for direct calls like exec(...). Reaching the same builtin through a subscript, like __builtins__['exec'](...), slips right past the AST check and runs with the host app's permissions. The vendor's own fix commit includes a test proving file and socket access are reachable pre-patch. Upgrade to 0.0.5 — it's a drop-in version bump, not a code change.

Fix

Upgrade CodeSafe (PyPI package 'codesafe') to 0.0.5. No fixed version is listed for CodeSafe; follow the vendor advisory.

Affected versions

ProductVulnerableFixed in
CodeSafe>= 0.0.1, < 0.0.5Not listed
CodeSafe (PyPI package 'codesafe')>=0.0.1, <0.0.50.0.5

Seen in 2 sources