T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:238
- Finding
- Sensitive credentials and operational data are copied into an unprotected plaintext backup## Vulnerability Details **File Location**: `SKILL.md`, lines 238–255 **Vulnerability Type**: Plaintext storage of sensitive data with inherited filesystem permissions **Risk Level**: Medium ### Vulnerable Code ```bash BACKUP_DIR=~/openclaw-backup-$(date +%Y%m%d-%H%M%S) mkdir -p "$BACKUP_DIR" # Core files cp ~/.openclaw/openclaw.json "$BACKUP_DIR/" [ -f ~/.openclaw/env ] && cp ~/.openclaw/env "$BACKUP_DIR/" || echo "No env file (tokens may be in systemd drop-in or plist)" cp -r ~/.openclaw/agents "$BACKUP_DIR/" cp -r ~/.openclaw/devices "$BACKUP_DIR/" cp -r ~/.openclaw/workspace "$BACKUP_DIR/" # Service config if [ "$(uname -s)" = "Linux" ]; then cp ~/.config/systemd/user/openclaw-gateway.service "$BACKUP_DIR/" 2>/dev/null cp -r ~/.config/systemd/user/openclaw-gateway.service.d "$BACKUP_DIR/" 2>/dev/null elif [ "$(uname -s)" = "Darwin" ]; then cp ~/Library/LaunchAgents/com.openclaw.gateway.plist "$BACKUP_DIR/" 2>/dev/null fi ``` ### Technical Analysis The backup procedure copies the OpenClaw environment file, agent state, paired-device information, workspace contents, and service configuration into a new plaintext directory. The Skill itself identifies the environment file as containing tokens, while agent and service files may also contain authentication material or operational secrets. The directory is created using `mkdir -p` without first setting a restrictive `umask` or explicitly assigning permissions. Consequently, its effective permissions depend on the invoking user's environment. A permissive umask may make the directory or copied files accessible to other local users or processes. The procedure also provides no encryption, retention limit, or secure disposal mechanism, increasing the number and lifetime of sensitive-data copies. ### Attack Path 1. An operator or rescue agent follows the documented backup procedure. 2. The procedure creates a predictably named ` ...[truncated 1138 chars]
- Remediation
- ## Remediation Suggestions - Set a restrictive process mask before creating or copying backup data: ```bash umask 077 ``` - Create the destination with explicit owner-only permissions: ```bash install -d -m 700 "$BACKUP_DIR" ``` - Apply mode `600` to sensitive copied files and verify ownership after the copy. - Exclude `~/.openclaw/env`, authentication profiles, and service environment files by default. Back them up only after explicit user approval. - Encrypt backups containing secrets using a vetted tool and a key stored separately from the backup. - Avoid predictable long-lived plaintext copies where feasible. - Define a retention policy and provide a secure deletion or encrypted-key-destruction procedure. - Verify backup permissions after creation, for example: ```bash find "$BACKUP_DIR" -type d -exec chmod 700 {} + find "$BACKUP_DIR" -type f -exec chmod 600 {} + ```
