T01 · Skill Instruction Hijacking
Error
- Location
- SKILL.md:348
- Finding
- Untrusted GitHub Content Is Injected into Privileged Sub-Agent Prompts<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:348-388`, `SKILL.md:676-712`, and `SKILL.md:728-830` **Vulnerability Type**: Prompt injection through untrusted GitHub issue and review content **Risk Level**: High ### Vulnerable Code ```text For each issue, construct the following prompt and pass it to sessions_spawn. Variables to inject into the template: - {SOURCE_REPO} — upstream repo where the issue lives - {PUSH_REPO} — repo to push branches to (same as SOURCE_REPO unless fork mode) - {FORK_MODE} — true/false - {PUSH_REMOTE} — `fork` if FORK_MODE, otherwise `origin` - {number}, {title}, {url}, {labels}, {body} — from the issue - {BASE_BRANCH} — from Phase 4 - {notify_channel} — Telegram channel ID for notifications (empty if not set). When constructing the task, replace all template variables including {notify_channel} with actual values. <issue> Repository: {SOURCE_REPO} Issue: #{number} Title: {title} URL: {url} Labels: {labels} Body: {body} </issue> <instructions> Follow these steps in order. If any step fails, report the failure and stop. ``` Review comments are similarly passed directly to a command-capable agent: ```text <review_comments> {json_array_of_actionable_comments} Each comment has: - id: comment ID (for replying) - user: who left it - body: the comment text - path: file path (for inline comments) - line: line number (for inline comments) - diff_hunk: surrounding diff context (for inline comments) - source: where the comment came from (review, inline, pr_body, greptile, etc.) </review_comments> <instructions> Follow these steps in order: 1. CHECKOUT — Switch to the PR branch: git fetch {PUSH_REMOTE} {branch_name} git checkout {branch_name} git pull {PUSH_REMOTE} {branch_name} 2. UNDERSTAND — Read ALL review comments carefully. Group them by file. Understand what each reviewer is asking for. 3. IMPLEMENT — For each comment, make the requested change: - Read the file and locate the relevant code - Make the change the ...[truncated 3136 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat every GitHub field as untrusted data and state this explicitly in the system-controlled portion of each sub-agent prompt. 2. Do not interpolate raw issue or review content into an instruction template. Serialize it as JSON with correct escaping and process it through a dedicated data channel where available. 3. Add an immutable rule that commands, URLs, code blocks, and instructions found in issues or comments must never be executed or followed. 4. Extract a bounded problem statement using a non-tool-enabled parser before invoking a command-capable agent. 5. Run sub-agents in isolated worktrees or containers that do not contain unrelated credentials or files. 6. Provide agents with short-lived, repository-scoped credentials instead of the orchestrator's general token. 7. Apply command and path allowlists. Block access to configuration, credential, state, SSH, cloud, and unrelated repository paths. 8. Require human approval after displaying the proposed diff and before any commit, push, API write, or external notification. 9. Validate that changed files are relevant to the selected issue or review. Reject unexpected binaries, workflows, dependency changes, credential files, and unrelated modifications. 10. Disable unattended processing of content from untrusted authors, particularly in `--yes`, `--cron`, and automated review modes. ]]>
