T09 · Insecure Skill Coding Practices
- Location
scripts/backup.sh:3- Finding
Plaintext Backup of API Credentials to an Insufficiently Protected Desktop Directory
- Content
View full analysis
Vulnerability Details
File Location:
scripts/backup.sh:3-9
Related Documentation:SKILL.md:20-29
Vulnerability Type: Plaintext storage of sensitive credentials and unsafe backup destination handling
Risk Level: HighVulnerable code in
scripts/backup.sh:bash BACKUP_DIR="$HOME/Desktop/OpenClawBackup-$DATE" mkdir -p "$BACKUP_DIR" cp ~/.openclaw/openclaw.json "$BACKUP_DIR/" cp -r ~/.openclaw/agents "$BACKUP_DIR/" cp -r ~/.openclaw/credentials "$BACKUP_DIR/" cp -r ~/.openclaw/cron "$BACKUP_DIR/"Equivalent documented procedure in
SKILL.md:bash DATE=$(date +%Y%m%d-%H%M%S) BACKUP_DIR="$HOME/Desktop/OpenClawBackup-$DATE" mkdir -p "$BACKUP_DIR" cp ~/.openclaw/openclaw.json "$BACKUP_DIR/" cp -r ~/.openclaw/agents "$BACKUP_DIR/" cp -r ~/.openclaw/credentials "$BACKUP_DIR/" cp -r ~/.openclaw/cron "$BACKUP_DIR/" echo "Backup created: $BACKUP_DIR"Technical Analysis
The script recursively copies the complete
~/.openclaw/credentialsdirectory, which the documentation identifies as containing API keys, into an unencrypted directory on the user's Desktop. It also copies configuration, agent definitions, and scheduled-task data that may disclose operational details.The destination is created with
mkdir -pwithout explicitly enforcing restrictive permissions such as mode0700. Consequently, effective access depends on the user's currentumask, existing directory permissions, and destination state. The script does not encrypt the credentials, verify that the destination is newly created and not a symbolic link, or warn about Desktop synchronization and indexing services.Credential access is related to a comprehensive backup and is openly documented; therefore, it is not hidden malicious behavior. However, recursively copying every credential is not the minimum privilege or data scope necessary for backing up ordinary OpenClaw configuration. Secret back ...[truncated 1606 chars]
- Remediation
View remediation
Remediation Suggestions
- Exclude
~/.openclaw/credentialsfrom backups by default and require an explicit option, such as--include-credentials, before copying secrets. - Display a clear warning and request confirmation before creating any backup containing API keys.
- Create the destination atomically with restrictive permissions and fail if it already exists:
bash umask 077 if ! mkdir -m 700 -- "$BACKUP_DIR"; then echo "Refusing to use an existing or unavailable backup path" >&2 exit 1 fi - Validate that the destination and its parent are trusted directories and reject symbolic links or unexpected existing filesystem objects.
- Encrypt secret-containing backups with a well-maintained encryption tool and a user-supplied key or recipient identity. Do not retain an unencrypted intermediate archive.
- Prefer a user-selected, non-synchronized backup destination rather than the Desktop. Warn that Desktop directories may be indexed or uploaded by cloud synchronization software.
- Preserve or tighten source permissions when copying sensitive files, and verify after creation that no backup file is accessible to group or other users.
- Separate non-secret configuration backups from credential backups so users can apply different retention, encryption, and access-control policies.
- Document secure deletion, retention, restoration, and credential-rotation procedures for secret-containing backups.
- Exclude
