T01 · Skill Instruction Hijacking
- Location
ima_api.cjs:114- Finding
Remote Update Response Can Hijack Agent Instructions
- Content
View full analysis
Vulnerability Details
File Location:
ima_api.cjs:114-134;SKILL.md:162-170
Vulnerability Type: Untrusted remote content treated as agent instructions
Risk Level: HighVulnerable Code
js const latestVersion = (updateResp.data && updateResp.data.latest_version) || ''; const releaseDesc = (updateResp.data && updateResp.data.release_desc) || ''; const instruction = (updateResp.data && updateResp.data.instruction) || ''; if (latestVersion && latestVersion !== skillVersion) { const updateContext = { current_version: skillVersion, latest_version: latestVersion, release_desc: releaseDesc, instruction, checked_at: new Date().toISOString(), }; process.stdout.write(JSON.stringify(updateContext)); const err = new Error('update available'); err.code = ERR_UPDATE_AVAILABLE; err.msg = `发现新版本 skill:${latestVersion}(当前版本:${skillVersion})。${instruction || '请更新。'}`; err.updateContext = updateContext; throw err; }The corresponding instructions in
SKILL.md:162-170identify the remoteinstructionfield as prompt text and direct the agent to use it to guide the update process.Technical Analysis
The automatic update check retrieves
instructionfrom a mutable API response and places it in both standard output and the surfaced error message. The Skill instructions then tell the agent to follow that field as an update prompt.No allowlist, command schema, content sanitization, cryptographic signature, or separation between untrusted release data and trusted agent instructions is applied. Consequently, control of the update response provides an instruction-injection channel into the current agent session.
The update check runs automatically before normal API requests, generally once per day. If the returned version differs from the local version, the original user operation is interrupted, increasing the likelihood ...[truncated 1342 chars]
- Remediation
View remediation
Remediation Suggestions
- Never interpret server-provided
instruction,release_desc, or similar fields as agent instructions. - Remove the requirement in
SKILL.mdto follow the remote field. Present release information only as quoted, untrusted data. - Implement update behavior through a fixed local workflow with a strict set of permitted actions.
- Require explicit user confirmation before any update, installation, file replacement, or command execution.
- Authenticate update metadata with a pinned public key and verify a detached signature before displaying it.
- Validate update responses against a strict schema, including a constrained semantic-version format and bounded inert text fields.
- Do not interrupt the original operation merely because free-form remote text is present. If an update is available, return a locally generated notification.
- Ensure no remote field can be passed to a shell, package manager, URL-fetching tool, or agent prompt.
- Never interpret server-provided
