Back to skill

Security audit

Anthropic Usage

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it handles a high-privilege Anthropic Admin key with unsafe chat-paste guidance and a test setup that can accidentally use real credentials.

Before installing, understand that this skill needs an Anthropic Admin API key and will send it to Anthropic API endpoints when checking or fetching usage. Use the OpenClaw API-key field or a controlled local secret configuration; do not paste the Admin key into chat. Avoid running the bundled tests while a real ANTHROPIC_ADMIN_API_KEY is exported unless the missing curl stub issue is fixed.

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
tests/run_tests.sh:87
Finding
Test Suite Can Make Unintended Authenticated Production API Requests<![CDATA[ ## Vulnerability Details **File Location**: `tests/run_tests.sh:87-95` **Related Locations**: `tests/run_tests.sh:16`, `README.md:278-284` **Vulnerability Type**: Failure to enforce test isolation and unsafe credential inheritance **Risk Level**: Medium ### Vulnerable Code ```bash STUBS_DIR="${SCRIPT_DIR}/stubs" ``` ```bash # Run the script with the curl stub injected into PATH. # Sets ANTHROPIC_ADMIN_API_KEY to a fake but valid-format key by default. # Extra env vars can be passed as KEY=VALUE arguments before the script flags. run_script() { local fixture="${STUB_CURL_FIXTURE:-response_ok}" STUB_CURL_FIXTURE="$fixture" \ PATH="${STUBS_DIR}:${PATH}" \ ANTHROPIC_ADMIN_API_KEY="${ANTHROPIC_ADMIN_API_KEY:-sk-ant-admin-test-fake-key-0000}" \ bash "$SCRIPT" "$@" 2>&1 } ``` The repository tree supplied for review contains no `tests/stubs/` directory and no `tests/stubs/curl` executable. This contradicts the test-suite assumption and the statement in `README.md:278-284` that testing requires no credentials or network access. ### Technical Analysis The test harness attempts to intercept HTTP requests by prepending `tests/stubs` to `PATH`. Because the expected `curl` stub is absent, command resolution continues through the rest of the inherited `PATH` and can select the system-installed `curl`. Credential handling compounds the problem: ```bash ANTHROPIC_ADMIN_API_KEY="${ANTHROPIC_ADMIN_API_KEY:-sk-ant-admin-test-fake-key-0000}" ``` The fallback test key is used only when the environment variable is unset or empty. If the user already has a real Anthropic Admin API key exported, the test harness preserves that production credential. The invoked `scripts/usage.sh` can consequently use the system `curl` to send the real key to `https://api.anthropic.com` and perform actual usage-report or model-validation requests. The destination is Anthropic’s official API, not an attacker-controlled service, so this is not evidence of credential ...[truncated 1679 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Package the intended executable curl stub at `tests/stubs/curl` and verify that it is executable. 2. Fail closed before running any tests: ```bash CURL_STUB="${STUBS_DIR}/curl" if [[ ! -x "$CURL_STUB" ]]; then echo "ERROR: required curl test stub is missing or not executable: $CURL_STUB" >&2 exit 1 fi ``` 3. Replace inherited credentials unconditionally with a synthetic test value: ```bash ANTHROPIC_ADMIN_API_KEY="sk-ant-admin-test-fake-key-0000" ``` Do not use the caller’s `ANTHROPIC_ADMIN_API_KEY` as a default for unit tests. 4. Use a minimal controlled `PATH`, or invoke the stub by an explicit absolute path. If PATH-based interception remains necessary, verify resolution: ```bash resolved_curl=$(PATH="$STUBS_DIR" command -v curl || true) [[ "$resolved_curl" == "$STUBS_DIR/curl" ]] || { echo "ERROR: tests are not using the required curl stub" >&2 exit 1 } ``` 5. Add an explicit network-denial mechanism in CI, such as a network-disabled container or sandbox, so accidental calls cannot reach production even if stubbing regresses. 6. Add a regression test that fails if the real `curl` binary executes or if any outbound connection is attempted. 7. Keep the README’s offline-testing claim only after the repository includes and validates the required stub. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (14)

Natural-Language Policy Violations

High
Confidence
99% confidence
Finding
Encouraging a user to place an admin API key into chat normalizes unsafe secret handling and can expose the credential to conversation history, agent memory, telemetry, or other integrations. Because the key is an organization admin credential, compromise could enable broad account-level access and billing or data exposure impacts.

Ssd 3

High
Confidence
99% confidence
Finding
This instruction promotes storage of a sensitive admin credential via the agent after receiving it in chat, creating unnecessary exposure during both transmission and storage. In the context of a skill that only needs API access for reporting, routing a high-privilege secret through conversational input is disproportionate and dangerous.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
# Reset the page counter used by the paginated stub.
reset_page_counter() {
  rm -f "${TMPDIR:-/tmp}/.stub_curl_page_counter"
}

# --- Tests -------------------------------------------------------------------
Confidence
95% confidence
Finding
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).

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Install `jq` if missing:

- **Ubuntu/Debian**: `sudo apt install jq`
- **macOS**: `brew install jq`
- **Fedora/RHEL**: `sudo dnf install jq`
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Install `jq` if missing:

- **Ubuntu/Debian**: `sudo apt install jq`
- **macOS**: `brew install jq`
- **Fedora/RHEL**: `sudo dnf install jq`
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Whitespace Padding

Medium
Category
Prompt Injection
Content
What each outcome means:

| Output                 | Meaning                                                                | Action                                                                                  |
| ---------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| `OK — key is valid...` | Key is accepted by the API                                             | You are good to go                                                                      |
| `401 Unauthorized`     | Key is invalid, expired, or has a typo                                 | Re-generate the key in the Anthropic Console and update `~/.openclaw/openclaw.json`     |
Confidence
70% confidence
Finding
Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill invokes both shell and network-capable actions but does not declare any explicit tool scope such as permissions or allowed-tools. That weakens least-privilege enforcement and can let the runtime grant broader capabilities than the user expects, especially since the skill also handles a high-value Admin API key.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The documented purpose is usage reporting via the Anthropic Admin API, but the instructions expand behavior to live-fetch external pricing data from anthropic.com. This increases the skill's operational scope beyond the declared function, creating hidden network behavior and a larger attack surface than users reviewing the description would anticipate.

Context-Inappropriate Capability

Medium
Confidence
90% confidence
Finding
The skill mandates an external web_fetch step that is not necessary to retrieve usage data from the Admin API. Requiring an additional fetch introduces avoidable outbound network activity, dependency on external content, and potential for prompt or content-driven misuse, particularly in a skill already entrusted with an Admin credential.

External Transmission

Medium
Category
Data Exfiltration
Content
# -----------------------------------------------------------------------------

# Anthropic API endpoint for usage reports.
API_BASE="https://api.anthropic.com/v1/organizations/usage_report/messages"

# The API version header required by Anthropic.
API_VERSION="2023-06-01"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
# -----------------------------------------------------------------------------

# Anthropic API endpoint for usage reports.
API_BASE="https://api.anthropic.com/v1/organizations/usage_report/messages"

# The API version header required by Anthropic.
API_VERSION="2023-06-01"
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Context-Inappropriate Capability

Medium
Confidence
99% confidence
Finding
The script explicitly tells users to paste an Anthropic Admin API key into chat so the agent can save it automatically. Asking users to disclose privileged credentials through a chat channel materially increases the risk of accidental retention, logging, prompt leakage, or misuse by the agent/runtime, especially because this is an admin-scoped key.

Missing User Warnings

Low
Confidence
82% confidence
Finding
At L121 the README notes that cost estimation automatically fetches the current Anthropic pricing page, which is a network action beyond the primary usage-report API call. While the behavior is disclosed, it is not framed as a user warning about external network access, which is the type of behavior the markdown guidance says should be warned about when affecting privacy or system behavior.

Description-Behavior Mismatch

Low
Confidence
91% confidence
Finding
The manifest describes a skill focused on retrieving Anthropic Admin API token usage reports. The --check path instead calls https://api.anthropic.com/v1/models, which is a separate capability for validating credentials against a different endpoint and not part of fetching usage data itself.

Static analysis

No suspicious patterns detected.