T09 · Insecure Skill Coding Practices
- Location
secret-manager.sh:168- Finding
Arbitrary Shell Command Execution Through a Configurable Secrets File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill does manage OpenClaw secrets, but it also executes a configurable secrets file and performs service/process recovery actions that need careful review before installation.
Review this before installing. Prefer interactive or stdin secret entry, avoid passing secrets as command arguments, do not use SECRETS_ENV_FILE unless you fully control and audit that file, and expect the script to modify OpenClaw config and restart or force-stop gateway processes. The skill is not classified as malicious because the main behavior is disclosed and there is no evidence of exfiltration, remote payloads, or hidden persistence, but its current implementation has real safety and scoping issues.
secret-manager.sh:168Arbitrary Shell Command Execution Through a Configurable Secrets File
secret-manager.sh:109Credentials Exposed Through Command-Line Arguments
secret-manager.sh:76Secret Prefixes and Exact Lengths Disclosed by the List Command
The declared description frames the skill as secure key management, but the documented behavior extends into sourcing external env files, listing secrets with partial disclosure, altering systemd user environment, restarting services, interacting with a container, and manipulating runtime lock files. This mismatch is dangerous because users and automated systems may grant trust based on the narrow description while the skill actually performs privileged operational actions that can expose secrets or disrupt services.
Referencing a .env secrets file for credential handling weakens the security model advertised by the skill because secrets may reside in plaintext on disk or be loaded unsafely. In the context of a secret-management skill, this is more dangerous because users are primed to assume strong secret hygiene while the design introduces an alternate, less secure secret source.
| :--- | :--- | :--- |
| `OPENCLAW_CONTAINER` | Name of the Distrobox container | `clawdbot` |
| `OPENCLAW_HOME` | Path to OpenClaw config directory | `~/.openclaw` |
| `SECRETS_ENV_FILE` | Path to an optional .env file to source | `~/.config/openclaw/secrets.env` |
## Usage
Referencing a .env secrets file for credential handling weakens the security model advertised by the skill because secrets may reside in plaintext on disk or be loaded unsafely. In the context of a secret-management skill, this is more dangerous because users are primed to assume strong secret hygiene while the design introduces an alternate, less secure secret source.
| :--- | :--- | :--- |
| `OPENCLAW_CONTAINER` | Name of the Distrobox container | `clawdbot` |
| `OPENCLAW_HOME` | Path to OpenClaw config directory | `~/.openclaw` |
| `SECRETS_ENV_FILE` | Path to an optional .env file to source | `~/.config/openclaw/secrets.env` |
## Usage
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#!/bin/bash
# secret-manager
# Securely manage API keys in GNOME Keyring and inject them into OpenClaw configuration.
#
# Usage:
# secret-manager <KEY_NAME> [value]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#!/bin/bash
# secret-manager
# Securely manage API keys in GNOME Keyring and inject them into OpenClaw configuration.
#
# Usage:
# secret-manager <KEY_NAME> [value]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#!/bin/bash
# secret-manager
# Securely manage API keys in GNOME Keyring and inject them into OpenClaw configuration.
#
# Usage:
# secret-manager <KEY_NAME> [value]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
#!/bin/bash
# secret-manager
# Securely manage API keys in GNOME Keyring and inject them into OpenClaw configuration.
#
# Usage:
# secret-manager <KEY_NAME> [value]
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
CONTAINER_NAME="${OPENCLAW_CONTAINER:-clawdbot}"
OPENCLAW_DIR="${OPENCLAW_HOME:-$HOME/.openclaw}"
AUTH_PROFILES="$OPENCLAW_DIR/agents/main/agent/auth-profiles.json"
SECRETS_FILE="${SECRETS_ENV_FILE:-$HOME/.config/openclaw/secrets.env}"
# Key Definition: Env Var Name -> Keyring Service Name
declare -A SERVICES LABELS
The script executes source "$SECRETS_FILE" on a path controlled by the environment variable SECRETS_ENV_FILE or a default file in the user's home directory. Sourcing is code execution in Bash, so any shell commands in that file run with the user's privileges, which exceeds the stated secret-management purpose and creates an arbitrary code execution path.
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
pkill -9 -f "openclaw$" 2>/dev/null
sleep 1
# Dynamic user ID path
rm -f "/tmp/openclaw-$(id -u)/gateway.*.lock" 2>/dev/null
' 2>/dev/null || true
fi
sleep 2
The skill advertises installation metadata but does not declare an explicit tool or permission scope, while the described behavior includes writing configuration and modifying runtime state. Without clear scope boundaries, an agent may be allowed to perform broader file-modifying actions than a user expects, increasing the risk of unintended secret exposure or config tampering.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
## Installation
Ensure you have the dependencies:
- **Debian/Ubuntu:** `sudo apt install libsecret-tools`
- **Fedora:** `sudo dnf install libsecret`
- **Arch:** `sudo pacman -S libsecret`
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
## Installation
Ensure you have the dependencies:
- **Debian/Ubuntu:** `sudo apt install libsecret-tools`
- **Fedora:** `sudo dnf install libsecret`
- **Arch:** `sudo pacman -S libsecret`
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
## Installation
Ensure you have the dependencies:
- **Debian/Ubuntu:** `sudo apt install libsecret-tools`
- **Fedora:** `sudo dnf install libsecret`
- **Arch:** `sudo pacman -S libsecret`
The usage example encourages passing secrets directly on the command line without warning that such values may be recorded in shell history, process listings, logs, or audit trails. This can leak API keys to other local users, support tooling, or future forensic review even if the final storage mechanism is secure.
The script copies secrets from GNOME Keyring into auth-profiles.json in plaintext without warning the user that the secret leaves the keyring boundary. That increases exposure through filesystem reads, backups, editor history, permissive file permissions, and other local processes that can access the config file.
Sourcing an external env file is not just loading configuration; it executes arbitrary shell contained in that file. Without an explicit warning or validation, a user may reasonably assume the file is treated as data, making this a dangerous and surprising execution path.
The script performs service control (systemctl stop/start) and process cleanup in addition to secret storage. While not inherently malicious, this broadens the blast radius of the tool: invoking a secret update can disrupt user services, restart daemons with unintended state, and create side effects unrelated to credential management.
The distrobox block force-kills processes with pkill -9 -f and deletes lock files inside a container as part of normal secret management. These are destructive recovery actions not justified by the advertised purpose, and they can terminate unrelated matching processes or corrupt state by bypassing graceful shutdown.
The script uses pkill -9 and removes lock files silently as part of restart handling. These actions can cause data loss, incomplete writes, or service instability, and the absence of an explicit warning makes the behavior more dangerous because users may not expect destructive recovery steps from a secret manager.
No suspicious patterns detected.