Back to skill

Security audit

OpenRouter Cron Migration

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent cron-migration purpose, but it should be reviewed because its setup steps can expose OpenRouter API keys in command output or logs.

Install only if you are comfortable reviewing the commands before running them. Replace the credential checks with presence-only tests, do not paste API keys into chat, avoid passing keys as command-line arguments, and approve each cron edit only after confirming the old model, new model, and rollback path.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:43
Finding

Local OpenRouter credentials may be exposed through command output

Content
View full analysis
/dev/null || echo "No OPENROUTER_API_KEY in .env" cat ~/.openclaw/agents/main/agent/auth-profiles.json 2>/dev/null | rg -i openrouter || echo "No OpenRouter auth profile" ``` ### Technical Analysis The first command searches the local OpenClaw environment file and prints every complete line containing `OPENROUTER`. If the file contains an entry such as `OPENROUTER_API_KEY=`, the secret value is exposed directly in command output. The second command reads the entire OpenClaw authentication profile before filtering lines containing `openrouter`. Depending on the JSON layout, a matching line may include an API token or adjacent authentication data. Both operations exceed the minimum privilege required to determine whether OpenRouter authentication is configured: only a Boolean presence check is necessary. The Skill subsequently instructs the Agent to summarize the findings. Consequently, exposed credentials may enter the Agent's context, conversation transcripts, terminal logs, execution telemetry, or other retained records. The audited content does not instruct the Agent to send these values to an unrelated endpoint, so this is a local disclosure risk rather than confirmed credential exfiltration. ### Attack Path 1. A user invokes the Skill on a system with an OpenRouter key stored in `~/.openclaw/.env` or `~/.openclaw/agents/main/agent/auth-profiles.json`. 2. The Agent executes the prescribed provider and credential checks. 3. `grep` or `rg` returns a complete secret-bearing line rather than reporting only whether a credential exists. 4. The secret is incorporated into command output and potentially the Agent's context or summary. 5. An attacker or unauthorized party with access to conversation records, terminal logs, executio ...[truncated 701 chars]
Remediation
View remediation
/dev/null; then echo "OpenRouter API key is configured" else echo "OpenRouter API key is not configured" fi ``` For `auth-profiles.json`, parse the file and emit only a Boolean result or a non-sensitive provider name. Do not print the original matching JSON line. For example, use a structured JSON query tailored to the documented schema and ensure its output cannot include token fields. Additional hardening measures: 1. Explicitly instruct the Agent never to display, summarize, log, or retain API-key values. 2. Redact credential-like output before it reaches Agent context or telemetry. 3. Use secure interactive secret entry or protected standard input when onboarding, if supported, rather than exposing a token through expanded command-line arguments. 4. Restrict credential-file permissions to the owning user. 5. Rotate any key that has already appeared in a transcript, terminal log, or execution record. 6. Avoid suppressing every diagnostic with `2>/dev/null`; distinguish a missing file from permission, parsing, and configuration errors without revealing sensitive content. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (9)

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

This duplicate finding points to the same credential-access behavior: reading .env and auth-profile material during setup validation. In a skill intended for routine cron migration, access to secret-bearing files is broader than necessary and materially increases the chance of credential leakage.

Content

Scanner excerpt · SKILL.md (reported line 43)May include surrounding context.

Step 1.1: Check provider + credentials

bash
openclaw providers list 2>/dev/null | rg -i openrouter || echo "OpenRouter provider missing"
grep -i OPENROUTER ~/.openclaw/.env 2>/dev/null || echo "No OPENROUTER_API_KEY in .env"
cat ~/.openclaw/agents/main/agent/auth-profiles.json 2>/dev/null | rg -i openrouter || echo "No OpenRouter auth profile"

Summarize what you found. If no key is set, ask the user for their OpenRouter API key.

Credential Access

High
Category
Privilege Escalation
Confidence
98% confidence
Finding

This duplicate finding points to the same credential-access behavior: reading .env and auth-profile material during setup validation. In a skill intended for routine cron migration, access to secret-bearing files is broader than necessary and materially increases the chance of credential leakage.

Content

Scanner excerpt · SKILL.md (reported line 43)May include surrounding context.

Step 1.1: Check provider + credentials

bash
openclaw providers list 2>/dev/null | rg -i openrouter || echo "OpenRouter provider missing"
grep -i OPENROUTER ~/.openclaw/.env 2>/dev/null || echo "No OPENROUTER_API_KEY in .env"
cat ~/.openclaw/agents/main/agent/auth-profiles.json 2>/dev/null | rg -i openrouter || echo "No OpenRouter auth profile"

Summarize what you found. If no key is set, ask the user for their OpenRouter API key.

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 57)May include surrounding context.

Step 1.3: Verification

bash
openclaw providers list | rg -i openrouter
curl -s https://openrouter.ai/api/v1/models \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  | python3 -m json.tool | head -20 || echo "OpenRouter API call failed"

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 117)May include surrounding context.

Phase 3: Pick popular, inexpensive OpenRouter models

Step 3.1: Fetch live rankings (curl only)

bash
curl -s 'https://openrouter.ai/api/v1/models?orderby=rank' \
  | python3 - <<'PY'

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 140)May include surrounding context.

  • Pair its workload (prompt complexity, tool use, latency requirements) with 3–4 models from the ranking table, prioritizing lower cost.
  • Example script snippet to highlight the top four cheapest popular models:
bash
curl -s 'https://openrouter.ai/api/v1/models?orderby=rank' \
  | python3 - <<'PY'
import json, sys
rows = json.load(sys.stdin).get('data', [])

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 206)May include surrounding context.

  1. Credits/balance
    bash
    curl -s https://openrouter.ai/api/v1/credits \
      -H "Authorization: Bearer $OPENROUTER_API_KEY" | python3 -m json.tool
    
  2. Daily activity

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · SKILL.md (reported line 212)May include surrounding context.

  1. Daily activity
    bash
    DATE=$(date +%Y-%m-%d)
    curl -s "https://openrouter.ai/api/v1/activity?date=$DATE" \
      -H "Authorization: Bearer $OPENROUTER_API_KEY" \
      | python3 - <<'PY'
    

import json, sys

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill instructs the agent to inspect credential-bearing files and report what it finds, including grepping ~/.openclaw/.env and reading auth-profiles.json. In an agent setting, this creates a real risk of secret disclosure to logs, chat output, or downstream tools, especially because there is no instruction to redact values and only report presence/absence.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The onboarding command passes $OPENROUTER_API_KEY directly on the command line via --token, which can expose the secret through shell history, process listings, audit logs, or agent execution traces. Even if the environment variable is already set, this pattern unnecessarily broadens secret exposure.

Content

No source excerpt is available for this finding.