T09 · Insecure Skill Coding Practices
- Location
SKILL.md:344- Finding
Project Root Escape Through Unsanitized Character and Arc Paths
- Content
View full analysis
/characters/.md` - STEP 4 大纲 → 按 L1–L5 层级分解为多个 `/arcs/arc--.md` ``` The persistence protocol also instructs the Agent to use these dynamic paths without requiring safe-basename validation: ```text ### STEP 6 · 更新人物卡 1. 对 `characters_present` 每个角色: - 打开 `characters/.md` 2. 对 `new_characters`: - 新建 `characters/.md` ``` The read protocol trusts character paths obtained from a project index: ```text 1. 从 Phase 3 拿到 `characters` 列表 2. 读 `characters/_index.md` 定位文件路径 3. 每个角色读 frontmatter + "当前修为" + "最近状态" ``` ### Technical Analysis The validation uses `path.startswith(project_root + "/")`, which checks the textual representation of a path rather than its normalized or canonical destination. A path such as: ```text /characters/../../outside/target.md ``` starts with the expected project-root prefix and has `characters` as its first component, but filesystem normalization resolves it outside `project_root`. No documented validation rejects: - `..` or `.` path components - Forward or backw ...[truncated 2314 chars]- Remediation
View remediation
