T01 · Skill Instruction Hijacking
Error
- Location
- scripts/heartbeat-coordinator.js:113
- Finding
- Untrusted Task Content Can Hijack Privileged Agent Prompts<![CDATA[ ## Vulnerability Details **File Location**: `scripts/heartbeat-coordinator.js:113-162`, with additional injection sinks at `scripts/heartbeat-coordinator.js:229-235`, `scripts/heartbeat-coordinator.js:310`, and `scripts/start-reviewer.js:47` **Vulnerability Type**: Prompt injection across agent trust boundaries **Risk Level**: High ### Vulnerable Code ```js function buildReviewPrompt(task) { const iteration = (task.current_iteration || 0) + 1; const subtasks = task.context?.subtasks || []; const lastResult = task.result || {}; const completedStep = lastResult.subtask_completed || 0; const nextStep = completedStep + 1; let prompt = `You are a Reviewer for the auto-evolution system. ## Task - **ID:** ${task.task_id} - **Goal:** ${task.goal} - **Iteration:** ${iteration} / ${task.max_iterations} - **Progress:** ${completedStep} / ${subtasks.length} subtasks ## Subtasks ${subtasks.map((s, i) => `${i + 1}. ${s}`).join('\n')} ## Previous Result ${lastResult.summary || '(First iteration)'} `; if (completedStep >= subtasks.length) { prompt += ` ## All subtasks completed — finalize Set verdict to "complete" and summarize the outcome. `; } else { prompt += ` ## Your Job 1. Review previous result (if any) 2. Decide: approve / revise / reject 3. Write specific instructions for subtask ${nextStep} 4. Define acceptance criteria ## Output (strict JSON) \`\`\`json { "verdict": "approve", "feedback": "Review comments", "next_instructions": { "summary": "Iteration ${iteration}: Step ${nextStep}", "current_step": ${nextStep}, "total_steps": ${subtasks.length}, "step": { "step": ${nextStep}, "action": "${subtasks[nextStep - 1] || ''}", "detail": "Implementation details..." }, "acceptance_criteria": ["Criterion 1", "Criterion 2"] } } \`\`\` Output only JSON. `; } return prompt; } ``` Additional execution-stage sinks include: ```js return `You are an Executor for the auto-evolution s ...[truncated 2797 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Treat every task field and every model response as untrusted data. 2. Pass task data through structured agent or tool arguments instead of embedding it in free-form instructions where supported. 3. Place untrusted content inside explicit delimiters and add a higher-priority instruction stating that content inside those delimiters is data and must never be interpreted as agent directives. 4. Validate task fields against a strict schema, including types, lengths, supported characters, and expected object structure. 5. Enforce file and command allowlists for Executor agents rather than relying on prompt text. 6. Run spawned agents with least privilege in an isolated workspace, without unnecessary credentials or access to unrelated files. 7. Require human authorization for sensitive operations, including external network access, credential access, and modifications outside the task-specific directory. 8. Validate reviewer-generated `next_instructions` against the original task scope before sending them to an Executor. 9. Ensure the Auditor independently verifies actual artifacts and test results rather than trusting task-controlled summaries. ]]>
