T09 · Insecure Skill Coding Practices
- Location
scripts/guard_scanner.py:378- Finding
Directory Scans Exclude Executable Skill Files
- Content
View full analysis
Vulnerability Details
File Location:
scripts/guard_scanner.py:378-381
Vulnerability Type: Incomplete security scanning coverage
Risk Level: Mediumpython if args.file: skill_path = Path(args.file) if skill_path.is_dir(): skill_path = skill_path / "SKILL.md" try: with open(skill_path) as f: code = f.read()Technical Analysis
When the supplied path is a directory, the scanner replaces it with the path to
SKILL.md. It therefore scans only the documentation file and does not inspect other files in the skill package, including executable content underscripts/.This behavior conflicts with the scanner's stated purpose of checking a skill for malicious code before installation. Because omitted files are not reported as skipped, an approval result may appear to cover the complete package even though only its manifest was analyzed.
Attack Path
- An attacker creates a skill package containing an innocuous
SKILL.md. - The attacker places malicious or otherwise dangerous code in another packaged file, such as
scripts/payload.py. - A reviewer invokes the scanner with the skill directory through
--file. - The scanner automatically changes the input path to
<directory>/SKILL.md. - Only the benign Markdown file is passed to the detection engines.
- The scanner may return an approval while the malicious executable file remains unexamined.
- If the package is subsequently installed or invoked, the omitted code can execute according to the permissions of the invoking user or agent.
Impact Assessment
This flaw enables a security-control bypass and false-negative scan results. It does not itself execute attacker code or grant additional privileges. However, it can facilitate installation of an unreviewed malicious skill whose scripts may subsequently operate with all filesystem, process, network, and tool permissions available to t ...[truncated 278 chars]
- An attacker creates a skill package containing an innocuous
- Remediation
View remediation
Remediation Suggestions
- Recursively enumerate and scan all regular files beneath a supplied skill directory rather than rewriting the input path to
SKILL.md. - Prioritize executable and configuration formats, including Python, shell, JavaScript, TypeScript, PowerShell, YAML, JSON, and package manifests.
- Resolve each path and verify that it remains beneath the original package root.
- Do not follow symbolic links by default; otherwise, explicitly validate resolved symlink targets to prevent traversal outside the package.
- Apply per-file and aggregate size limits to prevent memory exhaustion.
- Handle binary, unreadable, and unsupported files explicitly and include them in a
skipped_filesorscan_errorssection. - Treat incomplete coverage as a warning or blocking condition rather than returning an unconditional approval.
- Include the list and count of scanned files in both human-readable and JSON reports.
- Add a regression test containing a benign
SKILL.mdand a malicious pattern underscripts/, verifying that a directory scan detects the script.
- Recursively enumerate and scan all regular files beneath a supplied skill directory rather than rewriting the input path to
