Skip to content

AAK-HOOK-001: Hook executes network-capable command

Severity
CRITICAL
Category
Hook Injection (hook-injection)
Scanner
agent_audit_kit/scanners/hook_injection.py
Auto-fixable
No.
SARIF name
HookNetworkCapableCommand

What it detects

A hook command contains network-capable tools (curl, wget, nc, etc.), or an http hook posts each event to a URL that is cleartext to another machine, a bare IP address or carries a credential. Hooks run automatically and can exfiltrate code, API keys, or session data.

How to fix

Remove network calls from hooks. Use file-based logging if audit trail is needed. An http hook that must report somewhere should post to an https URL on a host name you control, with any credential in a header taken from allowedEnvVars rather than in the URL.

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

agent-audit-kit scan . --rules AAK-HOOK-001

Limitations

Matches curl, wget, nc, ncat, ssh, scp, rsync and ftp by name, and the one-liners python -c ... import requests (not python3 -c) and node -e ... fetch(, in the command line of each hook (its command, followed by args when set). An http hook, which posts the event to its url, is reported when the URL, read both the way Node reads it and the way urlsplit and curl do, is plain http to a host other than this machine, names a bare IP address other than loopback, or carries a credential that evidence redaction masks (a password or token in the userinfo, a credential-named query parameter such as token, or a known token format such as a Slack or Discord webhook path); one to an https URL on a DNS name in every reading is otherwise not reported, wherever it points. What a script file does is not followed, so bash .claude/hooks/report.sh passes even when the script runs curl. Hooks are read from .claude/settings.json, .claude/settings.local.json, a plugin's hooks/hooks.json (where the plugin's directory holds .claude-plugin/ or sits under a marketplace's .claude-plugin/marketplace.json) and the frontmatter of a SKILL.md. A plugin or skill file over 512,000 bytes is not read. One nested too deeply to parse (YAML past 100 levels, or past 64 levels of [ ] or { }, or JSON past 500 levels), or a frontmatter block that YAML aliases expand past twice its length plus 1,000 and past 200,000 nodes, is not read either, and the refusal is reported against the file as AAK-INTERNAL-SCANNER-FAIL. Hooks a plugin declares in .claude-plugin/plugin.json and hooks in a subagent's frontmatter are not read.

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-HOOK-001.md: the page then shows that text, with the registry reference appended under it.