T01 · Skill Instruction Hijacking
- Location
infra/agents/ask-cargo.prompt.ts:18- Finding
Mutable Repository Instructions Can Override the Agent's Security Policy
- Content
View full analysis
Vulnerability Details
File Location:
infra/agents/ask-cargo.prompt.ts, lines 18–19
Vulnerability Type: Instruction-precedence vulnerability
Risk Level: HighComplete Code Snippet
typescript Read AGENTS.md (or CLAUDE.md) first for the repository's conventions. Repository conventions win over anything in this prompt.Technical Analysis
The agent is explicitly instructed to treat mutable
AGENTS.mdorCLAUDE.mdrepository content as higher priority than the remainder of its deployed system prompt. This creates a prompt-injection boundary violation: a repository contributor can modify one of these files after deployment and provide instructions that supersede the Skill's security controls.The lower-priority controls include the requirement to obtain approval before actions that spend, send, or wake another agent; restrictions on Slack tools; prohibitions against exposing secrets; and limitations on destructive or deployment operations. Although the configured viewer service role prevents some workspace-level administrative changes, it does not technically enforce all of these controls. The harness still has access to a repository write path, Slack-supplied tools, repository and workspace data, a short-lived Cargo session, and approved CLI operations.
This is a reachable vulnerability rather than evidence of malicious authorship. The surrounding project attempts to establish confirmation gates and least privilege, but the unconditional precedence statement undermines those protections.
Attack Path
- An attacker with permission to commit to the bound repository adds malicious instructions to
AGENTS.mdorCLAUDE.md. - A Slack user mentions the deployed agent, causing a new harness run against the repository checkout.
- The agent reads the attacker-modified instruction file as required.
- The quoted precedence rule tells the agent that those instructions override the rest of the Skill prompt.
- The injected inst ...[truncated 965 chars]
- An attacker with permission to commit to the bound repository adds malicious instructions to
- Remediation
View remediation
Remediation Suggestions
- Remove the unconditional statement that repository conventions override the entire system prompt.
- Restrict repository conventions to non-security concerns, such as formatting, test commands, directory layout, and contribution workflow.
- Add an explicit immutable precedence rule stating that repository files and retrieved content cannot override authorization, confidentiality, confirmation, channel, tool-use, or destructive-action restrictions.
- Treat
AGENTS.md,CLAUDE.md, and all other checkout content as untrusted data when interpreting operational instructions. - Enforce critical controls outside the language-model prompt:
- Limit Slack tools to the summoning thread at the platform or capability layer.
- Represent confirmation as verified application state bound to the exact proposal, record count, action, and maximum cost.
- Exclude credentials and environment secrets from model-accessible contexts.
- Maintain the viewer service role and further minimize CLI operations and connector permissions.
- Restrict repository writes to dedicated branches and enforce protected branches and mandatory pull-request review on GitHub.
- Add a contract test that rejects prompts assigning higher precedence to mutable repository content.
