T07 · Tool Hijacking and Spoofing
- Location
SKILL.md:27- Finding
Untrusted Skill Discovery Enables Execution of Attacker-Controlled Scripts
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 27–29 and 147–172
Vulnerability Type: Untrusted local tool discovery and execution
Risk Level: MediumVulnerable Code
text The skill directory (SKILL_DIR) is at `~/.claude/skills/claude-to-im`. If that path doesn't exist, fall back to Glob with pattern `**/skills/**/claude-to-im/SKILL.md` and derive the root from the result.The derived directory is subsequently trusted when executing scripts:
text ### `start` **Pre-check:** Verify `~/.claude-to-im/config.env` exists (see "Config check" above). Without it, the daemon will crash immediately and leave a stale PID file. Run: `bash "SKILL_DIR/scripts/daemon.sh" start` Show the output to the user. If it fails, tell the user: - Run `doctor` to diagnose: `/claude-to-im doctor` - Check recent logs: `/claude-to-im logs` ### `stop` Run: `bash "SKILL_DIR/scripts/daemon.sh" stop` ### `status` Run: `bash "SKILL_DIR/scripts/daemon.sh" status` ### `logs` Extract optional line count N from arguments (default 50). Run: `bash "SKILL_DIR/scripts/daemon.sh" logs N`text ### `doctor` Run: `bash "SKILL_DIR/scripts/doctor.sh"`Technical Analysis
When the expected fixed directory does not exist, the skill instructs the agent to search broadly for any path matching
**/skills/**/claude-to-im/SKILL.mdand deriveSKILL_DIRfrom the result. The discovered directory is accepted without validating its canonical path, ownership, permissions, package identity, signature, or cryptographic digest.Later subcommands execute
daemon.shanddoctor.shfrom that derived directory through Bash. Therefore, a matching filename and directory layout are treated as sufficient proof that the scripts are trusted.The audited project contains only
SKILL.mdandSAFETY.md; the referenced scripts are absent. Their implementation and integrity therefore cannot be verified as ...[truncated 1677 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the broad recursive Glob fallback. Resolve executable resources only relative to the already loaded and audited
SKILL.md. - Canonicalize the package directory with an equivalent of
realpathbefore use and verify that every executable path remains inside the trusted package root. - Reject ambiguous discovery results rather than choosing one of multiple matching packages.
- Verify package ownership and permissions. Refuse scripts located in directories writable by untrusted users.
- Package
scripts/daemon.sh,scripts/doctor.sh, and all referenced files with the skill so their contents can be audited together. - Pin expected script hashes or validate a signed package manifest before execution.
- Invoke scripts using exact, quoted, canonical paths and reject symbolic links that resolve outside the verified package root.
- If the trusted installation cannot be located or verified, stop safely and instruct the user to reinstall the package rather than searching arbitrary filesystem locations.
- Remove the broad recursive Glob fallback. Resolve executable resources only relative to the already loaded and audited
