T09 · Insecure Skill Coding Practices
- Location
SKILL.md:200- Finding
Predictable Backup May Expose Secrets and Retain Revoked Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 200–202
Vulnerability Type: Insecure handling of secret-bearing backup files
Risk Level: MediumComplete Code Snippet:
markdown - **Always back up first.** Before writing any changes, copy the original: ```bash cp ~/.clawdbot/clawdbot.json ~/.clawdbot/clawdbot.json.bak ```Technical Analysis
The Skill directs the agent to copy
~/.clawdbot/clawdbot.jsonto a fixed.bakpath before applying configuration changes. The source configuration may contain gateway tokens, passwords, API keys, private keys, or other plaintext credentials.The backup procedure does not explicitly enforce restrictive permissions on the resulting backup, validate that the destination is not a symbolic link, use exclusive file creation, or remove the backup after successful verification. Although the Skill separately recommends
chmod 600for the active configuration, that remediation does not coverclawdbot.json.bak.If the source file is overly permissive, the backup may preserve insecure access characteristics depending on platform and environment. Token rotation also leaves the previous token in the backup. Furthermore, the predictable destination can be unsafe if an attacker with local access can pre-create or manipulate that path.
Attack Path
- The active configuration contains credentials and has insecure permissions.
- The Skill identifies one or more WARN or FAIL conditions.
- The user authorizes automatic remediation.
- Before remediation, the Skill copies the configuration to the predictable
clawdbot.json.bakpath. - The active configuration is secured or its gateway token is replaced.
- The backup remains present with the original credentials and without an explicit permission-hardening step.
- A local attacker who can read the backup recovers the credentials. If the backup destination can be manipulated beforehand, the ...[truncated 757 chars]
- Remediation
View remediation
Remediation Suggestions
- Create backups with restrictive permissions from the outset, using mode
600or stricter. - Use exclusive creation and refuse to follow symbolic links.
- Avoid a predictable reusable destination; use a securely created temporary file in a directory accessible only to the current user.
- Verify ownership and permissions immediately after backup creation.
- Apply permission hardening to both the active configuration and every retained backup.
- Remove the backup after successful post-change validation unless the user explicitly elects to retain it.
- When rotating credentials, ensure backups containing superseded secrets are securely deleted or encrypted.
- Check for an existing destination before copying and abort if its type, ownership, or permissions are unsafe.
- Ensure failures during backup creation or permission hardening stop the remediation process before any configuration changes occur.
- Create backups with restrictive permissions from the outset, using mode
