T09 · Insecure Skill Coding Practices
- Location
SKILL.md:35- Finding
Unnecessary Plaintext Credential Duplication in Agent Workspace
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 35–41
Vulnerability Type: Insecure storage and excessive collection of credentials
Risk Level: Mediumbash BACKUP_DIR="$HOME/.openclaw/workspace/backups/openclaw-upgrade-$(date -u +%Y%m%d-%H%M%S)" mkdir -p "$BACKUP_DIR" # Config + credentials + agents cp ~/.openclaw/openclaw.json "$BACKUP_DIR/" cp -r ~/.openclaw/credentials "$BACKUP_DIR/" 2>/dev/null cp -r ~/.openclaw/agents "$BACKUP_DIR/agents" 2>/dev/nullTechnical Analysis
The procedure recursively copies the entire OpenClaw credential directory into a timestamped directory under
~/.openclaw/workspace. This duplicates sensitive material in plaintext inside a location intended for Agent workspace activity.The backup directory is created with
mkdir -p, so its permissions depend on the user's currentumask; owner-only access is not explicitly enforced. The procedure also provides no encryption, credential-file allowlist, retention period, secure deletion, or warning that the backup contains secrets. Redirecting errors to/dev/nullcan conceal missing, partial, or permission-inconsistent backups.The documented rollback restores only
openclaw.jsonand the systemd service file. It does not restore the copied credential directory or agent state. Based on the documented workflow, collecting the entire credential store is therefore unnecessary for the implemented rollback and exceeds the minimum data access needed for the Skill's declared functionality.Attack Path
- A user follows the upgrade procedure.
- The commands recursively copy the full credential directory into
~/.openclaw/workspace/backups/.... - The plaintext backup remains after the upgrade because no cleanup or expiration procedure is defined.
- An Agent, plugin, workspace synchronization process, local backup service, or local account with workspace read access discovers the backup.
- The component or principal reads tokens or other authentica ...[truncated 899 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the credential backup unless credential restoration is demonstrably necessary for rollback.
- Back up only explicitly identified files required for the upgrade and rollback rather than recursively copying the complete credentials and agents directories.
- Store sensitive backups outside
~/.openclaw/workspaceso Agents and workspace-oriented integrations do not routinely encounter them. - Enforce owner-only permissions before creating files:
bash umask 077 install -d -m 700 "$BACKUP_DIR"- If credentials must be backed up, encrypt them with a user-controlled key and restrict each resulting file to mode
600. - Add a documented restoration step for every sensitive item retained; otherwise, do not collect it.
- Define a short retention period and an automatic secure cleanup process after successful verification or rollback.
- Replace blanket
2>/dev/nullsuppression with explicit error handling that reports failed or partial backups without printing secret contents. - Warn users that configuration, diagnostic output, and gateway logs may contain sensitive values and must be reviewed and redacted before being attached to a public bug report.
