Skip to content

Port unsafe-command-allowlist risk flag from mcp-audit - #15

Merged
rajaramr7 merged 1 commit into
mainfrom
feat/unsafe-command-allowlist-port
Aug 26, 2026
Merged

Port unsafe-command-allowlist risk flag from mcp-audit#15
rajaramr7 merged 1 commit into
mainfrom
feat/unsafe-command-allowlist-port

Conversation

@rajaramr7

Copy link
Copy Markdown
Collaborator

Ports the unsafe-command-allowlist detection (merged into mcp-audit in apisec-inc/mcp-audit#11) into ai-surface so it ships to users on the active tool.

What it detects

MCP command allowlists (e.g. ALLOW_COMMANDS) whose value names a binary with its own argument-level execution primitive. Checking argv[0] alone does not restrict execution when the allowlisted binary can be told to run arbitrary commands: git -c alias.x=!cmd, find -exec, python -c, tar --checkpoint-action=exec, and shells/env/xargs/ssh.

Changes

  • New data module data/mcp/allowlist_bypass_binaries.py — 16 argument-injection-prone binaries with per-binary reasons, plus token-based allowlist-key matching that correctly excludes denylists (DISALLOW_COMMANDS), unrelated toggles (ALLOW_COMMAND_LOGGING), and full-argv allowlists (ALLOW_COMMANDS="git status").
  • Wired into McpAuditDetector._identify_risks.
  • risk_definitions entry (critical severity) + OWASP LLM06 Excessive Agency mapping.
  • Classified CONFIRMED in verdicts.py — the presence of a bypassable binary under an allowlist key is a declared, re-checkable fact of the config as written (same class as shell-access/broad-permissions).
  • 11 new tests including denylist, toggle, and full-argv negative cases.

Verification

  • Full suite: 396 pass (was 385), ruff + mypy clean.
  • End-to-end: a config with ALLOW_COMMANDS=git,ls,cat flags unsafe-command-allowlist (critical, LLM06, verdict CONFIRMED); a clean ALLOW_COMMANDS=ls,cat,echo does not flag.

Credit: original detection by @hackwither in apisec-inc/mcp-audit#11.

Detects MCP command allowlists (e.g. ALLOW_COMMANDS) that name a binary with
its own argument-level execution primitive, where checking argv[0] alone does
not restrict execution (git -c alias, find -exec, python -c). Ported from the
merged mcp-audit detection.

- New data module allowlist_bypass_binaries.py (16 binaries, token-based key
  matching that excludes denylists and full-argv allowlists)
- Wired into McpAuditDetector._identify_risks
- risk_definitions entry (critical) + OWASP LLM06 mapping
- Classified CONFIRMED in verdicts (a declared, re-checkable config fact)
- 11 tests incl. denylist/toggle/full-argv negative cases

396 tests pass, ruff + mypy clean.
@github-actions

Copy link
Copy Markdown

After this PR merges: 38 total AI surfaces, 42 total risk indicators · 2 high, 1 medium.

🤖 AI Surface Changes

No AI surface changes in this PR.

Powered by ai-surface. Useful? Star the repo so more engineers find it. Validate which of these surfaces are exploitable: apisec.ai/products.

@rajaramr7
rajaramr7 merged commit 21817ce into main Aug 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant