Back to skill

Security audit

AI Usage

Security checks for vulnerabilities and agentic risk

Overview

This skill appears purpose-built for AI usage reporting, but it directly reads Claude Code OAuth credentials and session logs and can be invoked for broad or recurring usage checks without a clear consent boundary.

Review this before installing if you are not comfortable with a skill reading Claude Code OAuth credentials and OpenClaw session logs. Use it only when you intentionally want account usage reporting, and avoid recurring heartbeat or cron use unless you understand that each run may read local credentials and send an authenticated request to Anthropic.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (8)

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The skill explicitly instructs reading an OAuth token from ~/.claude/.credentials.json, which is direct access to sensitive credentials. Even if intended only for legitimate usage reporting, reading credential material from disk is dangerous because a compromised or over-broad skill could exfiltrate or misuse the token for unauthorized API access.

Content

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

md
## How It Works

- **Anthropic quota:** `GET https://api.anthropic.com/api/oauth/usage` using Claude Code's OAuth token from `~/.claude/.credentials.json` (requires `user:profile` scope)
- **Token auto-refresh:** If the token is expired, the script automatically refreshes it by invoking `claude --print -p "ok"` (Claude Code refreshes its own OAuth token on any invocation), then re-reads the updated credentials file. If Claude Code isn't installed, Anthropic quota is skipped gracefully.
- **Session stats:** Parses `~/.openclaw/agents/main/sessions/*.jsonl` for per-provider/model token and cost data

Credential Access

High
Category
Privilege Escalation
Confidence
93% confidence
Finding

Documenting CLAUDE_CREDENTIALS_PATH as an overridable environment variable normalizes and facilitates access to credential storage. While this line is documentation rather than code, it reinforces a design that depends on direct credential-file access and can make misuse easier in environments where path injection or unintended file targeting is possible.

Content

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

md
| Variable | Default | Description |
|----------|---------|-------------|
| `OPENCLAW_SESSIONS_DIR` | `~/.openclaw/agents/main/sessions` | OpenClaw session log directory |
| `CLAUDE_CREDENTIALS_PATH` | `~/.claude/.credentials.json` | Claude Code credentials file |

## Tips

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · scripts/usage_check.py (reported line 34)May include surrounding context.

python
# Claude Code credentials (needs user:profile scope for usage endpoint)
CLAUDE_CREDS_PATH = Path(
    os.environ.get("CLAUDE_CREDENTIALS_PATH",
                    Path.home() / ".claude" / ".credentials.json")
)

ANTHROPIC_USAGE_URL = "https://api.anthropic.com/api/oauth/usage"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill describes operations that read local credential files, parse session logs, invoke a shell command, and make a network request, but it declares no explicit tool or permission scope. That creates an over-privileged/implicit-trust situation where an agent may execute sensitive actions without clear sandboxing or user consent boundaries.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest says to use the skill when the user asks about 'costs or spending on AI' and includes broad examples like 'how much have I used.' These phrases can overlap with ordinary conversation and the file does not provide exclusions or tighter scope boundaries, increasing the chance of unintended invocation.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
87% confidence
Finding

The skill sends a request to an external API using a local OAuth token, which is a real external transmission of authenticated data. In context this is functionally necessary for quota lookup, but it remains security-relevant because it can disclose account metadata and expands trust to a remote service using locally sourced credentials.

Content

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

md
## How It Works

- **Anthropic quota:** `GET https://api.anthropic.com/api/oauth/usage` using Claude Code's OAuth token from `~/.claude/.credentials.json` (requires `user:profile` scope)
- **Token auto-refresh:** If the token is expired, the script automatically refreshes it by invoking `claude --print -p "ok"` (Claude Code refreshes its own OAuth token on any invocation), then re-reads the updated credentials file. If Claude Code isn't installed, Anthropic quota is skipped gracefully.
- **Session stats:** Parses `~/.openclaw/agents/main/sessions/*.jsonl` for per-provider/model token and cost data

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/usage_check.py (reported line 37)May include surrounding context.

python
Path.home() / ".claude" / ".credentials.json")
)

ANTHROPIC_USAGE_URL = "https://api.anthropic.com/api/oauth/usage"

# Display names for known models (extend as needed)
MODEL_NAMES = {

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/usage_check.py (reported line 61)May include surrounding context.

python
"""
    import subprocess
    try:
        subprocess.run(
            ["claude", "--print", "-p", "ok"],
            capture_output=True, timeout=30,
        )

Static analysis

No suspicious patterns detected.