codesafe is vulnerable to Remote code execution
90
CVE Score
Critical
Remote code execution
codesafe's safe_eval() parses a user-supplied expression string with ast and runs an AST check (_check_ast) that only blocks ast.Call nodes whose func is a plain ast.Name not present in an application-supplied allowed_function_calls list, while the evaluation globals (built from the full builtins.__dict__) retained dangerous builtins like exec, eval, compile, and __import__. Because the check does not restrict indirect call targets (e.g., via subscripting __builtins__) and the builtins dictionary itself was not filtered to a safe allowlist, an application that forwards an attacker-influenced expression into safe_eval() could reach those dangerous builtins and achieve arbitrary code execution. The fix limits the builtins dictionary to a safe allowlist and rejects call targets other than an allowlisted name or an explicitly permitted method.
Upgrade the codesafe package to version 0.0.5 or later.
You are affected if you are using a version that falls within the vulnerable range and you pass untrusted expression strings into the library's safe_eval function for evaluation.
0.0.1 - 0.0.4
Fixed in 0.0.5codesafe is vulnerable to Remote code execution in versions 0.0.1 - 0.0.4.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.