T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
Overly Broad and Unverified Recursive File Deletion
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:45-55
Vulnerability Type: Unsafe destructive file cleanup
Risk Level: MediumComplete Code Snippet:
bash SSH to the datax development machine and execute: # Check disk status before cleanup df -h # Delete .log files older than 7 days find /mnt/www -name '*.log' -mtime +7 -delete # Delete tmp_* files older than 3 days find /mnt/www -name 'tmp_*' -mtime +3 -deleteTechnical Analysis
The skill instructs a delegated agent to connect to a remote development machine and recursively delete files throughout
/mnt/www. Selection is based only on filename patterns and modification age. The commands do not:- Restrict candidates to regular files with
-type f. - Limit cleanup to an explicit allowlist of dedicated log and temporary directories.
- Verify file ownership, application association, active use, or backup status.
- Exclude protected business or configuration paths.
- Preview candidates or require approval before deletion.
- Preserve a deletion manifest sufficient for recovery or investigation.
Consequently, the documented safety claim that business and configuration data will not be removed is not technically enforced. A legitimate application artifact whose name matches
*.logortmp_*can be deleted solely because it resides below/mnt/wwwand exceeds the age threshold.Attack Path
- A legitimate application, deployment process, or malicious local actor creates or renames a valuable file under
/mnt/wwwso that its name matches*.logortmp_*. - The file's modification time exceeds the configured threshold, naturally or through timestamp manipulation.
- A user invokes one of the documented cleanup trigger phrases.
- The main agent delegates the cleanup to a sub-agent with SSH access to
datax. - The sub-agent executes the recursive
find ... -deletecommand. - The matching file is permanently r ...[truncated 534 chars]
- Restrict candidates to regular files with
- Remediation
View remediation
Remediation Suggestions
- Replace
/mnt/wwwwith an explicit allowlist of dedicated cleanup directories. - Add
-type fand enforce expected ownership and filesystem boundaries. - Exclude protected application, configuration, backup, and audit-log paths.
- Generate and review a candidate manifest before deletion.
- Require explicit user confirmation when candidates exceed defined count or size thresholds.
- Prefer application-native log rotation and retention mechanisms.
- Record exact deleted paths, sizes, timestamps, and command outcomes in an access-controlled audit log.
- Use backups, quarantine, or a reversible staging period before permanent deletion.
- Run cleanup using a narrowly scoped account that cannot modify unrelated applications.
- Add locking so concurrent cleanup jobs cannot run against the same paths.
- Replace
