T09 · Insecure Skill Coding Practices
- Location
SKILL.md:125- Finding
Predictable Temporary Directory Enables Symlink Attacks and Sensitive Artifact Exposure
- Content
View full analysis
/ as TEMP_DIR 3. Resolve and normalize REFERENCE_IMAGE 4. Persist user request: echo "$TARGET_CONTENT" > "$TEMP_DIR/target-content.txt" ``` The workflow subsequently writes additional artifacts to the same directory: ```bash echo "$SHORT_CAPTION" > "$TEMP_DIR/reference-short-caption.txt" echo "$LONG_CAPTION" > "$TEMP_DIR/reference-long-caption.txt" echo "$LAYOUT_BLUEPRINT_JSON" > "$TEMP_DIR/layout-blueprint.json" ``` ```bash echo "$NEW_LONG_CAPTION" > "$TEMP_DIR/new-long-caption.txt" ``` ```bash --save-path "$TEMP_DIR/attempt_.png" ``` ### Technical Analysis The task identifier is based only on a timestamp with one-second precision. Such a value is predictable and can also collide when multiple tasks start during the same second. The workflow does not require: - Atomic creation of a unique temporary directory. - Restrictive directory and file permissions. - Verification that the directory is owned by the current process or user. - Rejection of pre-existing files or symbolic links. - No-follow semantics when opening output files. - Cleanup of intermediate artifacts after task completion. Shell output redirection follows symbolic links. In a shared local environment, another user or compromised process may predict and pre-create the workspace or individual output paths. When the worker writes an artifact, the write may consequently target a different file accessible to the worker account. The stored artifacts may include the user's target content, all text extracted from the reference image, the layout blueprint, the rewritten generation prompt, and generated images. If default filesystem permissi ...[truncated 1613 chars]- Remediation
View remediation
