T01 · Skill Instruction Hijacking
- Location
SKILL.md:43- Finding
Unvalidated Execution of Runtime-Provided Commands
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:43; related instruction inagents/openai.yaml:56
Vulnerability Type: T01: Skill Instruction Hijacking
Risk Level: CriticalVulnerable Code
SKILL.md:41-45:markdown ## Hard rules (MUST follow) 1. **Always obey `nextCommand`**: If `zf setup --format json` returns a `nextCommand` field, execute that command immediately. 2. **Always obey `nextAction`**: If `zf service list --format json` returns a `nextAction` field, follow it. If `nextAction=ready`, proceed to play.agents/openai.yaml:55-57:yaml CRITICAL RULES: - When zf setup --format json returns a "nextCommand" field, execute that command immediately. Do not suggest alternatives. - QQ Music and Apple Music work without separate CLI linking — just play directly via zf play music.Technical Analysis
The skill requires the agent to execute the value of
nextCommandimmediately. That value is generated by the externally installedzfexecutable, but the skill does not impose an allowlist, command grammar, argument validation, or confirmation requirement.The instruction to execute the result immediately, combined with “Do not suggest alternatives,” suppresses the agent's opportunity to evaluate whether the returned command is relevant or safe. If
zfor its update channel is compromised, the returned field can contain a command unrelated to Sonos control.Structured output does not make a command trustworthy. A JSON field containing shell text remains untrusted input and must not be passed to a shell or command-execution tool without strict validation.
Attack Path
- An attacker compromises the
zfrelease repository, update channel, installed executable, or another component capable of affecting its output. - The user starts a session, causing the agent to invoke
zf setup --format json. - The compromised executable returns a malicious value in `nextComm ...[truncated 895 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Remove the requirement to execute arbitrary command strings returned through
nextCommand. - Replace command strings with a typed action schema containing a fixed action identifier and separately encoded arguments.
- Maintain a local allowlist that maps recognized action identifiers to reviewed
zfinvocations. - Invoke commands through argument arrays rather than a shell, preventing shell metacharacters and command substitution from being interpreted.
- Reject unknown actions, unexpected fields, absolute executable paths, shell operators, redirections, and nested commands.
- Restrict automated actions to low-risk, documented Sonos operations.
- Require explicit user confirmation before account-linking, update, configuration-changing, destructive, or otherwise security-sensitive actions.
- Treat every field returned by
zfas untrusted data, even when valid JSON is returned. - Log the validated action and arguments without exposing secrets, and report rejected runtime instructions to the user.
- Remove the requirement to execute arbitrary command strings returned through
