Back to skill

Security audit

ClawAPI Manager

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real OpenClaw API management tool, but it needs review because it handles provider keys and OpenClaw configuration with unsafe secret-handling and under-disclosed external routing behavior.

Review before installing on any system with real provider keys. Do not pass keys on command lines, avoid rotate_key.sh list/active/rotate with real credentials until outputs are redacted, lock secret files to owner-only permissions, and keep routing local-only for sensitive tasks unless you intentionally allow task text to be sent to OpenRouter.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

other

Warning
Location
lib/ai_complexity_predictor.py:42
Finding

Automatic Disclosure of Complete Task Descriptions to OpenRouter

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
rotate_key.sh:35
Finding

Insecure API Credential Storage and Disclosure

Content
View full analysis
"${OUTPUT_FILE}" ``` The generated file contains every provider API key in plaintext, but the script does not set `umask 077` or apply mode `0600` to the output file. ```bash # rotate_key.sh:35-40 save_pool() { local content="$1" local tmp="${KEY_POOL_FILE}.$$" echo "${content}" > "${tmp}" mv "${tmp}" "${KEY_POOL_FILE}" } ``` The key pool and its temporary file are written without explicitly restricting permissions. ```bash # rotate_key.sh:88-99 if [ -n "${current}" ]; then local backup backup=$(echo "${pool}" | jq ".providers.${provider}.backup = \"${current}\"") pool="${backup}" fi pool=$(echo "${pool}" | jq ".providers.${provider}.active = \"${next}\"") save_pool "${pool}" echo "Rotated ${provider}: ${current} -> ${next}" ``` Rotation prints both the old and new full credentials to standard output. ```bash # rotate_key.sh:106-129 add_key() { local provider="$1" local key="$2" local pool pool=$(load_pool) pool=$(echo "${pool}" | jq ".providers.${provider}.keys += [\"${key}\"]") local active active=$(echo "${pool}" | jq -r ".providers.${provider}.active // empty") if [ -z "${active}" ]; then pool=$(ech ...[truncated 5257 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (118)

Tainted flow: 'API_KEY' from os.getenv (line 18, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · lib/task_delegation.py (reported line 152)May include surrounding context.

python
elif cmd == "test":
        # 测试 OpenRouter 连接
        r = requests.get(f"{API_BASE}/models", 
                         headers={"Authorization": f"Bearer {API_KEY}"})
        if r.status_code == 200:
            print(f"✅ OpenRouter API OK, {len(r.json().get('data', []))} models available")

Tainted flow: 'API_KEY' from os.getenv (line 18, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · lib/task_delegation.py (reported line 161)May include surrounding context.

python
elif cmd == "test":
        # 测试 OpenRouter 连接
        r = requests.get(f"{API_BASE}/models", 
                         headers={"Authorization": f"Bearer {API_KEY}"})
        if r.status_code == 200:
            print(f"✅ OpenRouter API OK, {len(r.json().get('data', []))} models available")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · auto_rotate.sh (reported line 14)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · check_cost.sh (reported line 30)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · check_quota.sh (reported line 15)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 16)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 38)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 40)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 41)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 49)May include surrounding context.

sh
LOG_DIR="${SCRIPT_DIR}/logs"

# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"

Credential Access

High
Category
Privilege Escalation
Confidence
86% confidence
Finding

Sourcing a .env file executes it as shell code, not just as data. If an attacker or untrusted process can modify that file, they can achieve arbitrary command execution when this script runs, which is especially dangerous because the file likely contains privileged credentials and may be used by automation.

Content

Scanner excerpt · auto_rotate.sh (reported line 15)May include surrounding context.

sh
# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · auto_rotate.sh (reported line 17)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · auto_rotate.sh (reported line 49)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · check_cost.sh (reported line 33)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · check_quota.sh (reported line 18)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · encrypt_keys.sh (reported line 42)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · encrypt_keys.sh (reported line 58)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 42)May include surrounding context.

sh
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1
fi

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

Sourcing the .env file executes it as shell code, not just as data. If an attacker can modify config/.env, they can achieve arbitrary command execution in the context of this script, which is more dangerous than ordinary credential loading.

Content

Scanner excerpt · check_cost.sh (reported line 31)May include surrounding context.

sh
# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found"
    exit 1

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

Sourcing a .env file executes it as shell code, not just as data. If an attacker can modify that file, they can achieve arbitrary command execution in the context of the script and manipulate sensitive variables such as tokens, provider settings, or alert destinations.

Content

Scanner excerpt · check_quota.sh (reported line 16)May include surrounding context.

sh
# Load environment variables
if [ -f "${CONFIG_DIR}/.env" ]; then
    source "${CONFIG_DIR}/.env"
else
    echo "Error: ${CONFIG_DIR}/.env not found. Copy .env.example and configure it."
    exit 1

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code explicitly prints p['api_key'] in clear text during the list command, directly disclosing sensitive credentials. Because this script manages central server providers, exposed keys may grant access to upstream AI services, enable unauthorized usage, data access, billing abuse, or lateral compromise depending on provider permissions.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The function returns natural-language output containing full API keys, which is a severe secret-handling flaw for an assistant skill. In this context, the skill is explicitly designed for conversational platforms, so exposed keys may be surfaced to end users, stored in chat transcripts, or reused to impersonate the service account.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The provider listing function includes p['api_key'] directly in assistant-facing output, which exposes full secrets to any user or channel able to invoke this helper. In a chat-integrated skill, this is especially dangerous because secrets can be revealed into conversation history, logs, screenshots, or downstream integrations, enabling unauthorized use of the external API accounts.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This line prints stored provider API keys without masking or warning, creating a direct credential disclosure vulnerability. Because the helper is intended for AI assistants in messaging environments, accidental or attacker-induced invocation could leak usable secrets broadly and persistently.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The encrypt() and decrypt() helpers silently fall back to returning plaintext when the key file is missing. This creates a fail-open security condition where callers may believe secrets are being protected even though sensitive values are exposed or stored unencrypted.

Content

No source excerpt is available for this finding.