T09 · Insecure Skill Coding Practices
- Location
SKILL.md:72- Finding
Plaintext Backups of Sensitive Configuration Files
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 72–80
Vulnerability Type: Plaintext storage of sensitive configuration backups
Risk Level: MediumVulnerable Code
markdown **自动备份的场景:** - 编辑配置文件(openclaw.json、.env、nginx.conf 等) - 覆盖写入工作区文件 - 修改 cron jobs - 更新数据库记录 **备份机制:** - 备份路径:`~/.openclaw/workspace-main/.hook-guard/backups/YYYY-MM-DD/` - 文件名:`{原始文件名}.{HHmmss}.bak` - 保留最近 7 天的备份,自动清理旧备份Technical Analysis
The Skill explicitly instructs the Agent to back up sensitive configuration files, including
.env, into a predictable workspace directory. Such files commonly contain API keys, access tokens, database credentials, and passwords.The backup procedure does not require encryption, redaction, restrictive file permissions, secure directory permissions, or exclusion of secret-bearing files. It can therefore create additional plaintext copies of credentials and retain them for seven days. The predictable directory and filename scheme also makes those copies easy to locate.
Exploitation requires an attacker, local process, another Agent, workspace scanner, synchronization service, or backup tool to have read access to the workspace backup directory. The Skill does not itself grant such access.
Attack Path
- A user or Agent modifies a secret-bearing file such as
.env. - Hook Guard classifies the modification as a Yellow operation.
- Before editing, it copies the original file to
~/.openclaw/workspace-main/.hook-guard/backups/YYYY-MM-DD/. - The backup retains the original secrets in plaintext under a predictable filename.
- A principal or process with workspace read access enumerates the backup directory.
- The principal reads the backup and obtains any credentials stored in the source file.
- The exposed credentials may then be used against the services for which they are valid.
Impact Assessment
Successful exploitation can disclose API keys, passwords, tokens, database credentials, and other secr ...[truncated 456 chars]
- A user or Agent modifies a secret-bearing file such as
- Remediation
View remediation
Remediation Suggestions
- Exclude
.env, private keys, credential stores, token files, and other secret-bearing files from automatic backups by default. - Require explicit user confirmation before creating a backup of any file detected as containing secrets.
- Store backups outside shared or routinely indexed workspace directories.
- Create backup directories and files with owner-only permissions, such as directory mode
0700and file mode0600. - Preserve restrictive source permissions and never make a backup more broadly readable than its source.
- Encrypt sensitive backups at rest using keys stored separately from the backup directory.
- Apply secret-aware redaction when a complete byte-for-byte backup is unnecessary.
- Avoid predictable filenames where feasible and prevent symlink-based redirection when creating backup files.
- Securely remove expired sensitive backups and document that filesystem snapshots or synchronization services may retain copies.
- Add tests verifying that secret-bearing files are excluded or protected and that backup permissions remain restrictive.
- Exclude
