T09 · Insecure Skill Coding Practices
- Location
scripts/backup_rotator.py:120- Finding
Tar Option Injection Through an Attacker-Controlled Source Directory Name
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This backup skill appears purpose-built rather than malicious, but its automatic deletion and weak verification could cause users to lose or trust bad backups.
Review before installing. Use only on dedicated backup directories, run dry-run first, avoid shared destinations, do not rely on its verify command as proof that backups are intact, and be especially careful with cron because it can permanently delete backup files unattended.
scripts/backup_rotator.py:120Tar Option Injection Through an Attacker-Controlled Source Directory Name
scripts/backup_rotator.py:70Incorrect Retention Classification and Overly Broad File Matching Can Delete Unintended Backups
scripts/backup_rotator.py:272Checksum Verification Does Not Compare Against a Trusted Integrity Baseline
The documented behavior overstates safety and correctness: 'verify' only prints hashes instead of validating against a trusted manifest, and some backup forms may not be discovered or rotated as claimed. This can create a false sense of protection, causing operators to believe backups are intact and governed by retention policy when they may be silently excluded or unverifiable.
The skill advertises and instructs use of a script that writes backup files and deletes old ones, yet the skill metadata does not declare any tool scope or permission boundaries. In an agent setting, missing explicit permissions increases the chance of over-broad file access or shell use without adequate review, especially because backup and rotation operations are inherently destructive and touch arbitrary paths.
The skill describes automated rotation and deletion of old backups without an explicit warning about irreversible data loss from misconfigured retention values, prefixes, or target directories. In backup tooling, destructive actions are especially sensitive because mistakes can remove the very recovery data users depend on.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# Compress directory to tar.gz
backup_path = backup_dir / f"{src_name}_{ts}.tar.gz"
print(f" Compressing {source} → {backup_path} ...")
result = subprocess.run(
["tar", "-czf", str(backup_path), "-C", str(source.parent), source.name],
capture_output=True, text=True
)
The skill advertises backup integrity verification with SHA256, but the implementation only computes and prints hashes of current files; it does not compare them to a previously trusted checksum, verify signatures, or validate archive contents. This can mislead users into believing backups are verified and trustworthy when corruption or tampering would go undetected unless manually noticed.
The tool deletes files automatically during rotation without an explicit confirmation barrier or stronger safety guardrails. In the context of a backup-management skill, destructive behavior is expected, but a misconfigured backup name, directory, or retention policy could cause unintended deletion of backup data and reduce recovery capability.
No suspicious patterns detected.