T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/search-docs.sh:213- Finding
Arbitrary Local File Read Through Path Traversal
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi local root target root=$(realpath "$LOCAL_DOCS") || exit 1 target=$(realpath -e "$root/$doc") || { echo "Document does not exist" >&2 exit 1 } case "$target" in "$root"/*.md) ;; *) echo "Document path is outside the documentation directory" >&2 exit 1 ;; esac if [ ! -f "$target" ]; then echo "Document is not a regular file" >&2 exit 1 fi cat -- "$target" } ``` Additional hardening measures: 1. Reject absolute paths and any input containing traversal components before resolution. 2. Restrict readable targets to regular `.md` files. 3. Use `realpath -e` so containment is checked after symlink resolution. 4. Add tests for `../`, absolute paths, symlinks escaping the root, missing arguments, and valid nested documents. 5. Run the Skill under an account with minimal access to credentials and unrelated workspace data. ]]>
