T09 · Insecure Skill Coding Practices
- Location
scripts/batch_rename.py:8- Finding
Destination Path Traversal Through Unsanitized Rename Patterns
- Content
View full analysis
/../outside/001.txt ``` An absolute prefix can cause `os.path.join()` to discard the supplied base directory entirely. Consequently, the destination is not guaranteed to remain beneath `args.dir`. The vulnerability does not grant additional operating-system privileges. However, it allows the process to move affected entries to any destination writable by the user running the script. ### Attack Path 1. An attacker controls or influences the command-line arguments used to invoke the renamer. 2. The attacker supplies a traversal-bearing or absolute prefix, such as `--prefix ../outside/`. 3. The script enumerates entries in the selected source directory. 4. It constructs destination paths without canonicalization or containment validation. 5. When run without `--dry-run`, `os.rename()` moves entries outside the selected directory. 6. The ...[truncated 543 chars]- Remediation
View remediation
