T07 · Tool Hijacking and Spoofing
- Location
SKILL.md:41- Finding
Repository-Controlled Markdown Parser Can Execute Arbitrary Code
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:41,SKILL.md:155,references/environment-probing.md:74,references/environment-probing.md:607-613,references/sync-procedures.md:6, andreferences/verification-dimensions.md:7
Vulnerability Type: Untrusted local tool selection and execution
Risk Level: HighVulnerable Code and Instructions
The security-relevant instruction at
SKILL.md:41, translated into English, is:markdown `$MD_SECTIONS` is dynamically resolved by Phase 0 Step 3. The project-local `scripts/md-sections.sh` is preferred, followed by `$SKILL_DIR/scripts/md-sections.sh`; grep is used only if neither is available.The executable detection logic at
references/environment-probing.md:607-613is:bash if [ -x "scripts/md-sections.sh" ]; then echo "Project version: scripts/md-sections.sh" elif [ -x "$HOME/.config/opencode/skills/contract-doc-sync/scripts/md-sections.sh" ]; then echo "Built-in Skill version" else echo "No available version; falling back to grep" fiThe security-relevant convention at
references/sync-procedures.md:6, translated into English, is:markdown Every reference to `scripts/md-sections.sh` in this file must be replaced with the detected `$MD_SECTIONS` path, with the project version preferred over the built-in Skill version.Technical Analysis
The target repository is untrusted input to the Skill. Nevertheless, the Skill explicitly gives an executable supplied by that repository precedence over the parser shipped in the audited Skill package.
The only demonstrated eligibility check is whether
scripts/md-sections.shexists and has its executable bit set. This does not verify:- Whether the script is the expected Markdown parser.
- Whether it has been reviewed or approved by the user.
- Whether it is a symlink to a file outside the repository.
- Whether its content or cryptographic hash matche ...[truncated 2358 chars]
- Remediation
View remediation
Remediation Suggestions
- Always use the immutable parser shipped under
$SKILL_DIRby default. - Do not execute repository-provided scripts merely because they have an expected filename and executable bit.
- If project-specific parsers are necessary:
- Display the canonical resolved path.
- Inspect the complete script before execution.
- Require explicit user approval.
- Reject symlinks and paths outside the repository.
- Verify ownership, permissions, and an approved cryptographic hash.
- Resolve paths canonically and ensure the selected executable remains within an approved trusted directory.
- Prefer implementing Markdown parsing in trusted Skill code rather than invoking a shell script.
- Run any explicitly approved repository parser in a sandbox with:
- Read-only repository access.
- No credential mounts.
- No network access.
- No access to the home directory.
- A restricted executable allowlist.
- Log the selected parser path and hash in the final report.
- Update every reference that currently states project-local parser precedence, including
SKILL.md,environment-probing.md,sync-procedures.md, andverification-dimensions.md.
- Always use the immutable parser shipped under
