T09 · Insecure Skill Coding Practices
- Location
SKILL.md:51- Finding
Unsafe Execution of a Missing Relative Script
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:51-54,SKILL.md:123-161,SKILL.md:170,SKILL.md:197, andSKILL.md:239-252
Vulnerability Type: Untrusted relative-path script execution and excessive tool permission
Risk Level: MediumThe Skill declares command-execution access and repeatedly instructs the Agent to execute
short_story.pyusing a relative path. However, the audited project contains onlySKILL.md; the referenced Python script is not included.Relevant tool configuration from
SKILL.md:51-54:yaml tools: - read - exec - writeRepresentative execution instructions from
SKILL.md:239-252:bash python3 short_story.py --helpbash python3 short_story.py write --structure structure.json --output story.mdTechnical Analysis
Python resolves
short_story.pyrelative to the process's current working directory when invoked in this form. Because the package does not provide the script or require execution from a verified Skill-owned directory, the actual file executed depends on the Agent's runtime environment.If an attacker can place a file named
short_story.pyin the working directory, the documented command can execute that file. The problem is amplified by the Skill's declaration of the unrestrictedexectool, even though its stated story-generation functionality can be implemented through the Agent's built-in language model and constrained file-writing operations.In a clean working directory, the commands fail because the script does not exist. This also creates a material discrepancy between the documented capabilities and the contents of the package.
Attack Path
- An attacker obtains write access to, or influences the contents of, the directory from which the Agent runs the Skill.
- The attacker creates a malicious file named
short_story.pyin that directory. - A user requests one of the documented story-generation ope ...[truncated 1298 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
execpermission if story generation can be performed using the built-in language model and constrained file-write operations. - Remove all instructions that invoke the nonexistent
short_story.pyfile, or include a reviewed implementation in the Skill package. - If a script is required, resolve it from a fixed, trusted Skill installation directory rather than the current working directory.
- Validate the resolved script path and ensure that it remains inside the expected Skill directory before execution.
- Verify the packaged script's integrity using a trusted manifest or cryptographic digest before running it.
- Invoke Python with a fully resolved absolute path to the verified script and pass arguments as a structured argument array rather than constructing shell command strings.
- Restrict execution through sandboxing, minimal filesystem permissions, disabled network access where unnecessary, and an allowlist of permitted commands.
- Add installation and startup checks that fail safely when required packaged files are absent, without searching the current directory or system path for substitutes.
- Remove the
