T09 · Insecure Skill Coding Practices
- Location
SKILL.md:46- Finding
Unsanitized User-Controlled Degree Name Used in Filesystem Paths
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:46anddegrees.md:15,112-113
Vulnerability Type: Path traversal caused by unsafe path construction
Risk Level: MediumVulnerable Code Snippets
SKILL.md:46:markdown **New degree/career:** User says what they want to learn → Generate complete curriculum equivalent to university degree → Map prerequisites → Estimate total time → Create study calendar → Store in degrees/[name]/.degrees.md:15:markdown 6. **Store** — Create degrees/[name]/ with curriculum.md, progress.md, calendar.mddegrees.md:112-113:markdown 1. Generate completion certificate summary 2. Move to degrees/archive/[name]/Technical Analysis
The Skill derives a degree name from user input and instructs the Agent to use that value as a directory component. It does not require validation, safe slug generation, canonical-path resolution, or verification that the resulting path remains inside
~/university/degrees/.If an Agent follows these instructions with filesystem tools, path separators or traversal components in the supplied name may alter the destination. For example, a value containing
../could resolve outside the intended degree directory. The same weakness affects both initial creation and archival operations.The exploitability and exact effects depend on the hosting Agent's filesystem tools, path handling, existing files, and operating-system permissions.
Attack Path
- The user asks to create a degree whose supplied name contains path traversal components, such as
../../target. - The Skill substitutes that value into
degrees/[name]/. - The Agent creates curriculum, progress, or calendar files at the resulting unresolved or normalized path.
- The operating system resolves the traversal components outside
~/university/degrees/. - During archival, the same crafted name may cause a move operation to target an unintended source or destination.
- Files outside th ...[truncated 609 chars]
- The user asks to create a degree whose supplied name contains path traversal components, such as
- Remediation
View remediation
Remediation Suggestions
- Convert every user-provided degree name into a restricted slug before using it in a path.
- Allow only a conservative character set, such as ASCII letters, digits, hyphens, and underscores.
- Reject absolute paths,
.and..components, path separators, null bytes, drive prefixes, and platform-specific alternate separators. - Resolve the candidate path to its canonical absolute form before any create, write, or move operation.
- Verify that the canonical path is a descendant of the canonical
~/university/degrees/directory. - Use filesystem APIs that operate relative to a trusted directory handle where available.
- Refuse operations involving symbolic links that could redirect access outside the workspace.
- Avoid overwriting existing files by default and require explicit confirmation for destructive archival conflicts.
- Maintain a display name separately from the sanitized filesystem identifier.
- Apply the same validation to creation, lookup, update, export, and archival operations.
A suitable instruction would be:
markdown Before using a degree name in any filesystem path, generate a safe slug containing only letters, digits, hyphens, and underscores. Resolve the final path canonically and proceed only if it remains beneath `~/university/degrees/`. Reject absolute paths, traversal components, separators, and symbolic-link escapes.
