T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- SKILL.md:18
- Finding
- Unscoped Access to and Reuse of External Source Directories## Vulnerability Details **File Location**: `SKILL.md`, lines 18–54 **Vulnerability Type**: Unrestricted external directory access and unvalidated source reuse **Risk Level**: Medium ### Vulnerable Code ```markdown → Use source code from `/Users/root009/projects/demos/g1/game2` **Improve the game** — user says things like: - "improve the chess game" - "better UI/UX for the chess" - "enhance the game experience" - "make the game feel better" → Use source code from `/Users/root009/projects/demos/g2/game2` ## Workflow ### Step 1: Identify the intent | User intent | Source to use | |---|---| | Generate / create / build a new game | `/Users/root009/projects/demos/g1/game2` | | Improve / enhance / better experience | `/Users/root009/projects/demos/g2/game2` | ### Step 2: Read the source directory Read all files in the appropriate directory before doing anything else: ``` # For new game generation Read all files under /Users/root009/projects/demos/g1/game2 # For game improvement Read all files under /Users/root009/projects/demos/g2/game2 ``` Use `Glob` to list files, then `Read` to read each one. ### Step 3: Apply the source - Use the source code **directly** — do not rewrite from scratch. - Copy structure, logic, and patterns from the directory. - Only adapt what is strictly necessary for the user's context (target directory, filenames, etc.). ``` ### Technical Analysis The skill directs the agent to enumerate and read every file in one of two absolute, machine-specific directories outside the audited skill package. It then requires the contents to be reused directly. There is no file allowlist, source-integrity check, provenance verification, symlink restriction, sensitive-file exclusion, or review step before the external content is incorporated into a user project. The referenced directories are not part of the audited artifact, which contains only `SKILL.md`. Their contents and ...[truncated 2518 chars]
- Remediation
- ## Remediation Suggestions 1. Package reviewed Chinese-chess templates within the skill artifact instead of relying on absolute directories outside the package. 2. Replace “read all files” with an explicit allowlist of required relative paths and permitted source extensions. 3. Resolve and canonicalize each path before access, verify that it remains beneath the approved template root, and reject symlinks or path escapes. 4. Exclude secrets, environment files, credentials, version-control metadata, build output, dependency trees, temporary files, and other unrelated content. 5. Verify template provenance and integrity through reviewed version control and pinned hashes or signed releases. 6. Inspect and summarize selected files before copying them. Require explicit approval before incorporating executable scripts, dependency manifests, build hooks, or configuration capable of running commands. 7. Copy only the files necessary for the requested functionality rather than mirroring the entire directory. 8. Use portable project-relative paths and fail safely if the trusted template is unavailable instead of searching or substituting arbitrary local content. 9. Correct the contradictory source mappings in the “Common Mistakes” table so the selected source cannot vary because of inconsistent instructions.
