T09 · Insecure Skill Coding Practices
- Location
SKILL.md:29- Finding
Predictable and Insufficiently Protected Sensitive Backup Files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 29–34, 42–50, and 54–67
Vulnerability Type: Unsafe backup-file creation and retention
Risk Level: MediumThe skill prescribes copying important or sensitive files to a predictable backup location and retaining those copies until explicit user confirmation. The relevant command examples are:
sh cp config.json backups/config.json.2026-03-14.baksh rm backups/xxx.bakThe documented rules also establish that backups remain indefinitely if the user does not authorize deletion. Files identified as candidates include configuration files, core Agent files, and other user-designated sensitive files.
Technical Analysis
The workflow does not require:
- Restrictive permissions on the
backups/directory or created files. - Verification that the destination directory and file are not symbolic links.
- Exclusive or atomic destination-file creation.
- Collision-resistant backup names.
- Path validation or protection against option-like filenames.
- A maximum retention period for abandoned backups.
- Cleanup of stale backup files.
The predictable pattern
backups/<filename>.<date>.bakallows an attacker with write access to the backup directory to anticipate the destination. Depending on the behavior and privileges of thecpimplementation, a pre-created destination symbolic link could redirect the copy and overwrite another file accessible to the Agent. Ambient directory permissions could also make copied configuration or Agent-state data readable by other local users or processes.This is a conditional local vulnerability: exploitation requires the attacker to have write or observation access to the selected backup directory. The workflow itself does not grant such access.
Attack Path
- The attacker obtains write access to the default or user-selected backup directory.
- The attacker predicts the destination ...[truncated 1253 chars]
- Restrictive permissions on the
- Remediation
View remediation
Remediation Suggestions
- Create a dedicated backup directory with mode
0700and verify that it is owned by the expected user. - Reject backup directories and destination files that are symbolic links or resolve outside the approved backup root.
- Create backup files atomically and exclusively with mode
0600; fail safely if a destination already exists. - Use collision-resistant names containing a full timestamp and a securely generated random component rather than only a date.
- Validate and canonicalize source and destination paths before performing filesystem operations.
- Use option termination for command-line paths, such as
cp -- "$source" "$destination"andrm -- "$destination". - Verify that the source is a regular file unless other file types are explicitly supported.
- Define a retention period and notify the user about stale backups instead of retaining them indefinitely.
- Before deletion, verify that the selected path is the exact recorded backup, remains inside the authorized backup directory, and has not been replaced by a symbolic link.
- Prefer a filesystem API with explicit no-follow and exclusive-creation controls over constructing shell commands from variable paths.
- Create a dedicated backup directory with mode
