Skip to content

AAK-SANDBOX-DENYLIST-001: Deny-list of names used as a Python sandbox boundary, with the lookup builtins still reachable

Severity
CRITICAL
Category
Trust Boundaries (trust-boundary)
Scanner
agent_audit_kit/scanners/denylist_sandbox.py
Auto-fixable
No.
SARIF name
DenylistSandboxLookupReachable

What it detects

Caller-supplied Python is inspected against a deny-list of attribute and builtin names held as strings, then executed in-process — while getattr, __getattribute__, vars or globals remain reachable. A deny-list over names is not a boundary when the name can be reached through a lookup: a caller walks literal.__class__.__base__.__subclasses__() to a reference the list never mentioned, and arrives at subprocess without typing any denied token. ToolUniverse's python_code_executor is the exemplar (CVE-2026-81096, CVSS 10.0, unauthenticated); RestrictedPython's getattr bypass in mcp-context-forge (CVE-2026-53710) is the same defect in a different product, which is what makes it a class. A deny-list that also denies the lookup primitives is merely fragile; one that leaves them reachable is bypassable by construction, and that is what this rule reports.

How to fix

Do not gate execution on a list of forbidden names. Run untrusted code in a separate process with an OS-level boundary — a container, a seccomp profile, or at minimum a subprocess with dropped privileges and no network — and treat the in-process namespace as reachable in full. If in-process execution is unavoidable, invert to an allow-list of permitted builtins and deny the attribute-lookup primitives with it; and never let a per-call argument widen the permitted set before the inspection runs, which is the second half of CVE-2026-81096.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-SANDBOX-DENYLIST-001

Limitations

Python only, and requires all four signals together — a deny-list of names, checked against a value, an in-process exec of that value, and a still-reachable lookup primitive. An executor that isolates in a subprocess never matches, by design: the submitted source is not run here.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-SANDBOX-DENYLIST-001.md: the page then shows that text, with the registry reference appended under it.