T09 · Insecure Skill Coding Practices
- Location
SKILL.md:15- Finding
Unrestricted Output Path Allows Arbitrary File Overwrite
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 15 and 41
Vulnerability Type: Unrestricted user-controlled file path
Risk Level: MediumVulnerable Code Snippet
The following is an English translation of the relevant instructions:
text - outputPath (optional): defaults to reports/{date}-daily-report.md ... 3) Write to outputPath (ensure the parent directory exists)Technical Analysis
The skill accepts
outputPathas an input and instructs the agent to create its parent directory and write the generated report to that path. It does not require the resolved path to remain under the intendedreports/directory, reject absolute paths, remove traversal components, or prevent overwriting an existing file.Consequently, a caller can provide a path containing
../components or an absolute path. If the underlying agent follows these instructions literally, the report may be written to any location permitted by the agent process. Creating missing parent directories further expands the set of reachable destinations.This is an arbitrary file-write and overwrite weakness rather than a privilege-escalation mechanism. The write remains limited by the filesystem permissions of the process executing the skill.
Attack Path
- An attacker invokes the skill with otherwise valid report data.
- The attacker supplies an
outputPathsuch as../../target-fileor an absolute filesystem path. - The skill normalizes the date and generates the Markdown report.
- Following the documented behavior, the agent creates the supplied path's parent directories if necessary.
- The agent writes the report to the attacker-selected destination.
- If the destination already contains a writable configuration, source, state, or data file, its contents may be replaced by the generated report.
Successful exploitation requires the selected destination to be writable by the agent process.
Impact
...[truncated 475 chars]
- Remediation
View remediation
Remediation Suggestions
- Use a fixed, dedicated output root such as
reports/. - Reject absolute paths and input containing parent-directory traversal components.
- Resolve the requested path to its canonical absolute form and verify that it remains beneath the canonical output root.
- Treat the user input as a filename or safe relative path rather than an unrestricted filesystem path.
- Reject symbolic-link destinations that resolve outside the approved output directory.
- Do not overwrite existing files by default; require explicit authorization or use exclusive file creation.
- Permit directory creation only beneath the approved output root.
- Run the skill with least-privilege filesystem permissions and test validation against absolute paths, traversal sequences, symbolic links, and encoded traversal variants.
- Use a fixed, dedicated output root such as
