T09 · Insecure Skill Coding Practices
- Location
SKILL.md:71- Finding
Existing destination files can be silently overwritten
- Content
View full analysis
/dev/null;; pdf|doc|docx|txt|md|rtf|odt|xps) mv "$f" documents/ 2>/dev/null;; xls|xlsx|csv|tsv|ods) mv "$f" spreadsheets/ 2>/dev/null;; zip|tar|gz|bz2|7z|rar) mv "$f" archives/ 2>/dev/null;; py|js|ts|html|css|json|yaml|yml|sh|rb) mv "$f" code/ 2>/dev/null;; mp3|mp4|wav|flac|mkv|mov|avi) mv "$f" media/ 2>/dev/null;; *) mv "$f" other/ 2>/dev/null;; esac done ``` ### Technical Analysis The execution phase invokes `mv` without a no-clobber option or an explicit destination-collision check. If a category directory already contains a file with the same basename as a source file, standard non-interactive `mv` behavior can replace the destination file. The documented dry run only reports the target category and does not determine whether the final destination path already exists. In addition, `2>/dev/null` suppresses diagnostic messages, making move failures and other abnormal behavior less visible to the user. ### Attack Path 1. Create or identify an existing file such as `images/photo.jpg`. 2. Place a different top-level file named `photo.jpg` in the workspace. 3. Run the documented organization procedure. 4. The image branch executes `mv "./photo.jpg" images/`. 5. The existing `images/photo.jpg` can be replaced by the top-level file without a collision warning. ### Impact Assessment This issue can cause irreversible loss or replacement of files already stored in category directories. An attacker able to place a same-named source file in the worksp ...[truncated 332 chars]- Remediation
View remediation
