T09 · Insecure Skill Coding Practices
- Location
SKILL.md:163- Finding
Unvalidated Project Paths Can Escape the Workspace Boundary
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 163-195
Vulnerability Type: Unvalidated path traversal through project-history entries
Risk Level: MediumThe skill reads project metadata from
PROJECT-HISTORY.md, selects a matching entry, and directly uses its project path for folder and file operations. The workflow does not require path canonicalization or verification that the resolved destination remains inside the current workspace.Relevant code segment:
text Read PROJECT-HISTORY.md ↓ Match rules (priority order): 1. key exact match → Direct use 2. name/desc contains keyword → Direct use 3. Chinese keyword mapping hit → Direct use 4. No match → Auto-create new project 5. Multiple matches → Use first one, notify usertext 【Existing Project】 1. Create ./[project]/ folder (if not exists) 2. Update PROJECT-HISTORY.md: last_used = today 3. Reply: "Task organized to [project] (last_used: today)" 【New Project】 1. Create ./[project-name]/ folder - If folder exists, auto-add suffix _1, _2, etc. 2. Append new entry to PROJECT-HISTORY.md 3. Reply: "Created new project [project-name], files will be organized here"The history format permits a path field without defining validation requirements:
markdown ## project-key - name: Project Name / 项目名称 - path: ./project-folder/ - desc: Project description / 项目描述 - created: YYYY-MM-DD - last_used: YYYY-MM-DDTechnical Analysis
PROJECT-HISTORY.mdfunctions as control data because itspathvalues determine where subsequent operations occur. The skill treats those values as trusted even though the file is writable and persistent.No instruction requires the agent to:
- Reject absolute paths.
- Reject
..traversal components. - Resolve the candidate path against a canonical workspace root.
- Verify that the resolved path is a strict descendant of that root.
- Detect symbolic-link escapes.
- Validate malformed o ...[truncated 2011 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat every history entry as untrusted input and parse it using a strict schema.
- Require project paths to be normalized relative paths containing only approved directory-name characters.
- Reject absolute paths, empty paths, control characters, URI-like values, and any
.or..traversal component. - Resolve the candidate path against the canonical workspace root before every operation.
- Verify that the canonical destination is a strict descendant of the canonical workspace root, using path-component-aware comparison rather than a raw string-prefix check.
- Inspect every existing path component for symbolic links and reject any path whose real destination escapes the workspace.
- Apply the same checks to generated project names before creating folders.
- Refuse invalid history entries and notify the user rather than silently creating or using their paths.
- Use an atomic, permission-restricted history update process to reduce tampering and race-condition risks.
- Add tests covering
../outside, nested traversal, absolute paths, encoded separators, malformed entries, prefix-confusion paths, and symbolic-link escapes.
