T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:61
- Finding
- Blind Execution of Remotely Influenced Upgrade Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 61 **Vulnerability Type**: Remote command injection through trusted runtime messages **Risk Level**: High ### Vulnerable Code Snippet Translated instruction preserving the source meaning: ```text If the command returns {"ok":false,"stage":"version",...}, the message contains the upgrade command; execute it exactly as provided. ``` ### Technical Analysis The Skill directs the agent to execute an upgrade command supplied through the CLI's runtime `message` field without validating the command against a fixed allowlist. This converts output controlled by the installed CLI or its remote backend into a shell command-execution channel. Although version upgrades are relevant to maintaining the CLI, accepting arbitrary command text from a runtime response is not necessary. The Skill can instead define a fixed, reviewed upgrade operation locally. Trusting a message as executable code violates the separation between untrusted data and shell instructions. The dangerous behavior requires the agent to interpret and follow the message rather than being an automatic shell-level injection. Nevertheless, the instruction explicitly directs that behavior, making a compromised package or service response capable of influencing local command execution. ### Attack Path 1. An attacker compromises the `@iqinghu/qhkit` package, its distribution account, update infrastructure, or the backend that supplies version-gate messages. 2. The compromised component returns a response with `stage` set to `version`. 3. The response's `message` field contains an attacker-selected shell command rather than a legitimate upgrade command. 4. Following the Skill instruction, the agent executes the command exactly as provided. 5. The command runs with the same OS identity and environment access as the agent. ### Impact Assessment Successful exploitation permits arbitrary command execution within the agent process's existing ...[truncated 554 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Never execute shell commands copied from CLI output, service responses, error messages, or other runtime-controlled text. - Treat the `message` field exclusively as displayable diagnostic data. - Replace the instruction with a locally defined and strictly allowlisted upgrade command. - Pin upgrades to a reviewed package version instead of accepting an arbitrary or latest version. - Require explicit user approval before installing or upgrading executable dependencies. - Validate package provenance and integrity before execution. - Perform dependency installation in an isolated, unprivileged environment with restricted filesystem and credential access. - If a version-gate response is received, display the diagnostic message after escaping it and separately offer the fixed, locally approved upgrade action. ]]>
