T09 · Insecure Skill Coding Practices
- Location
SKILL.md:24- Finding
Unvalidated .wdp-prd Pointer Enables Filesystem Access Outside the Current Project
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 24–31
Vulnerability Type: Untrusted path traversal / arbitrary filesystem target selection
Risk Level: MediumVulnerable Code
markdown ## Storage Model - Global root: `~/.wdp/prd/` (override with the `PRD_ROOT` environment variable). - Per-project subdirectory: `<PRD_ROOT>/<project-slug>/`, containing: - `backlog/R-###.md` requirement cards - `execution-plan.md` scheduling view - `plans/` implementation-plan archive - Bridge: a `.wdp-prd` file in the project root whose content is the absolute path of that project's global root (i.e. `<PRD_ROOT>/<slug>/`). Read it before every command operation.Technical Analysis
The skill treats the contents of the project-local
.wdp-prdfile as an authoritative absolute filesystem path. It does not require canonicalization or verify that the resolved path remains under the configuredPRD_ROOT. It also specifies no protection against symbolic links, unexpected file types, path substitution, or pointers to another project's requirement directory.Because
.wdp-prdcan be supplied by an untrusted repository, an attacker can choose the directory from which the agent reads requirement cards and to which it writesexecution-plan.md, card updates, implementation plans, and acceptance records. Subsequent command workflows explicitly rely on this pointer, including reading all cards, rewriting the execution plan after state changes, and archiving plans.This creates a confused-deputy condition: repository-controlled path data directs an agent operating with the user's filesystem privileges. The most direct exploit is cross-project access or corruption by pointing to another valid WDP project directory. Additional arbitrary-file effects may be possible if the selected directory contains attacker-prepared symbolic links with expected names such as
execution-plan.mdor card fil ...[truncated 1781 chars]- Remediation
View remediation
Remediation Suggestions
- Treat
.wdp-prdas untrusted input. Resolve bothPRD_ROOTand the pointer target to canonical absolute paths before any read or write. - Require the canonical pointer target to be a strict descendant of the canonical configured
PRD_ROOT; reject paths that escape it. - Validate that the target matches the expected
<PRD_ROOT>/<project-slug>structure and that the slug satisfies a strict pattern such as^[a-z0-9]+(?:-[a-z0-9]+)*$. - Bind the pointer to the current project using trusted metadata rather than accepting an arbitrary absolute path. Prefer storing only the validated slug in
.wdp-prdand deriving the full path fromPRD_ROOT. - Refuse to operate when
.wdp-prd, the target directory,backlog,plans, card files, orexecution-plan.mdare symbolic links or unexpected file types. - Before a pre-existing pointer is first trusted, display its resolved destination and require explicit user confirmation if it was not created in the current session.
- Perform writes using safe file APIs: create temporary files in the validated target directory, reject symlink destinations, apply restrictive permissions, and atomically rename the files.
- Add negative tests for pointers outside
PRD_ROOT,..traversal after normalization, pointers to another project, symlinked pointer files, symlinked target directories, and symlinked output files. - Abort all command processing on validation failure rather than falling back to the unvalidated path.
- Treat
