T09 · Insecure Skill Coding Practices
- Location
scripts/consolidate.py:82- Finding
Plaintext Credential Backups Preserve Potentially Insecure Source Permissions
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This credential-management skill is purpose-aligned and shows no exfiltration, but it broadly gathers, centralizes, backs up, and can delete sensitive secrets in ways that need careful Review before installation.
Install only if you intend to let this skill read and reorganize credentials across your account. Before running consolidation or cleanup, review the exact files it found, avoid --yes for sensitive migrations, protect or encrypt backups yourself, do not store wallet seed phrases or irreplaceable private keys unless you fully accept the risk, and do not delete originals until you have verified the new store and backups work.
scripts/consolidate.py:82Plaintext Credential Backups Preserve Potentially Insecure Source Permissions
scripts/consolidate.py:201Credential Store Is Written Non-Atomically Before Secure Permissions Are Applied
scripts/cleanup.py:31Cleanup Can Permanently Delete Credential Files Without Verifying Successful Migration
scripts/validate.py:28Git-Ignore Protection Is Incorrectly Validated Through Substring Matching
scripts/scan.py:13Default Credential Discovery Reads Broad Cross-Application Secret Locations
Mandating a single plaintext .env as the only repository for all OpenClaw credentials centralizes every secret into one file. While centralization can simplify management, it also creates a high-value single point of compromise: access to that file grants access to all integrated services.
There is exactly ONE location for all OpenClaw credentials:
~/.openclaw/.env
No exceptions. Not workspace, not skills, not scripts. Root only.
The document explicitly instructs scanning ~/.config/*/credentials.json and similar files to collect secrets. Although credential handling is the stated purpose of the skill, broad discovery and aggregation of credential stores materially increases access to sensitive data and expands the blast radius if the process, backups, or destination file are compromised.
- `~/.openclaw/workspace/skills/*/.env` ❌ → Root
- `~/.openclaw/workspace/skills/*/repo/.env` ❌ → Root
- `~/.openclaw/workspace/scripts/.env` ❌ → Root
- `~/.config/*/credentials.json` ❌ → Root
- Any scattered API key files ❌ → Root
## Enforcement
The enforcement section describes detecting all .env and credential files and merging them into a central location. Automated bulk collection of secrets is inherently sensitive and dangerous because it can unintentionally ingest unrelated credentials, duplicate stale secrets into backups, or expose all credentials through one migration pathway.
The credential-manager skill enforces this rule:
1. **Scan:** Detects ALL .env files and credential files
2. **Consolidate:** Merges everything into `~/.openclaw/.env`
3. **Cleanup:** Removes scattered files (after backup)
4. **Validate:** Ensures no scattered files remain
The bash example tells developers to source ~/.openclaw/.env, which executes the contents of the file as shell code rather than safely parsing key-value pairs. If the .env file is modified maliciously or contains unexpected shell syntax, this can lead to arbitrary command execution in the developer's shell or script context.
#!/bin/bash
# Load from root .env
source ~/.openclaw/.env
# Use credentials
The documentation repeatedly frames the skill as a complete consolidation and security workflow, but the reported implementation does not scan scattered sources, back up files, create the .env file, or perform actual migration. In a credential-management context, this is especially risky because inaccurate security tooling can cause operators to centralize trust in a process that does not protect or preserve their credentials.
The documentation repeatedly frames the skill as a complete consolidation and security workflow, but the reported implementation does not scan scattered sources, back up files, create the .env file, or perform actual migration. In a credential-management context, this is especially risky because inaccurate security tooling can cause operators to centralize trust in a process that does not protect or preserve their credentials.
The documentation repeatedly frames the skill as a complete consolidation and security workflow, but the reported implementation does not scan scattered sources, back up files, create the .env file, or perform actual migration. In a credential-management context, this is especially risky because inaccurate security tooling can cause operators to centralize trust in a process that does not protect or preserve their credentials.
The skill is explicitly designed to discover and process credential files such as credentials.json, which is highly sensitive behavior. Even if intended for legitimate migration, any agent granted this skill gains access to secrets across common directories, creating substantial confidentiality risk if the skill is misused, over-scoped, or compromised.
The skill automatically detects credentials by scanning for:
**File Patterns:**
- `credentials.json` files in config directories
- `.env` files
- Memory files with `-creds` or `credentials` in the name
The skill explicitly targets highly sensitive material such as access tokens, passwords, private keys, and seed phrases. A tool that searches for and consolidates these artifacts carries elevated inherent risk, and any implementation flaw, overbroad permission, or deceptive behavior could expose extremely high-value secrets.
- Memory files with `-creds` or `credentials` in the name
**Sensitive Key Patterns:**
- API keys, access tokens, bearer tokens
- Secrets, passwords, passphrases
- OAuth consumer keys
- Private keys, signing keys, wallet keys
The documented scan targets broad filesystem patterns for credential files, including config directories and memory files. That broad discovery surface can expose unrelated secrets and increases the blast radius if the skill behaves incorrectly or if an attacker coerces the agent into running it in the wrong context.
The skill scans these locations:
~/.config/*/credentials.json
~/.openclaw/workspace/memory/*-creds.json
~/.openclaw/workspace/memory/*credentials*.json
~/.env (if exists, merges)
The skill proposes merging an existing ~/.env into a centralized credential file, which can unintentionally ingest unrelated secrets from other applications. In a credential-management tool, this broad import behavior materially increases exposure and the chance of cross-application secret leakage.
~/.config//credentials.json ~/.openclaw/workspace/memory/-creds.json ~/.openclaw/workspace/memory/credentials.json ~/.env (if exists, merges)
## Security Features
The example instructs other skills to import helper code from this skill to enforce and retrieve credentials. This creates a trust dependency where many other skills may gain a path to secret access through shared credential helper code, amplifying impact if that code is flawed or tampered with.
# Add credential-manager scripts to path
sys.path.insert(0, str(Path.home() / '.openclaw/skills/credential-manager/scripts'))
# Enforce secure .env (exits if not compliant)
from enforce import require_secure_env, get_credential
require_secure_env()
The bash example directs skills to execute a Python enforcement script from a user-writable skill directory before handling credentials. Running executable code from that location creates a supply-chain and tampering risk, especially because successful execution becomes the gatekeeper for secret access.
#!/usr/bin/env bash
set -euo pipefail
# Validate .env exists and is secure
if ! python3 ~/.openclaw/skills/credential-manager/scripts/enforce.py; then
exit 1
fi
The bash example sources ~/.openclaw/.env directly, which executes shell-parsed content rather than safely parsing key-value pairs. If an attacker or malformed file places command substitutions or shell syntax in .env, sourcing can lead to arbitrary command execution in the caller's shell.
fi
source ~/.openclaw/.env
**This creates a fail-fast system:** If credentials aren't properly secured, skills refuse to run. Users are forced to fix it.
This shell example again instructs sourcing ~/.openclaw/.env, which treats credential data as executable shell input. In a secrets-management context, that is especially dangerous because a tampered .env can execute commands whenever downstream skills load credentials.
# Load .env
set -a
source ~/.openclaw/.env
set +a
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Development
~/.openclaw/.env.development
# Production
~/.openclaw/.env.production
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
~/.openclaw/.env.development
~/.openclaw/.env.production
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
File patterns: x/credentials.json, twitter/credentials.json
Keys:
No suspicious patterns detected.