Back to skill

Security audit

CPA Manager

Security checks for vulnerabilities and agentic risk

Overview

This CPA operations skill matches its stated purpose, but it needs Review because some documented preview/safety expectations do not match high-impact account changes and sensitive token/auth-file handling.

Install only after reviewing the CPA environment carefully. Use HTTPS or loopback-only access for management endpoints, use a narrowly scoped management token, avoid proxy inheritance, keep generated SQLite/log/export files in a private directory, and do not treat --no-delete-401 as a full dry run. Be especially cautious with maintain, maintain-refill, upload, --yes, auto_register, and any register_command because they can change remote accounts or run local commands.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cpa_warden.py:949
Finding

Management Credentials and Authentication Files Can Be Transmitted over Plaintext HTTP

Content
View full analysis
dict[str, str]: headers = { "Authorization": f"Bearer {token}", "Accept": "application/json, text/plain, */*", } if include_json: headers["Content-Type"] = "application/json" return headers ``` ```python def fetch_auth_files(base_url: str, token: str, timeout: int) -> list[dict[str, Any]]: LOGGER.info("开始拉取 auth-files 列表") LOGGER.debug("GET %s/v0/management/auth-files", base_url.rstrip("/")) resp = requests.get( f"{base_url.rstrip('/')}/v0/management/auth-files", headers=mgmt_headers(token), timeout=timeout, ) resp.raise_for_status() data = safe_json(resp) files = data.get("files") LOGGER.info("auth-files 拉取完成: %s", len(files) if isinstance(files, list) else 0) return files if isinstance(files, list) else [] ``` ```python if upload_method == "multipart": form = aiohttp.FormData() form.add_field( "file", candidate["content_bytes"], filename=file_name, content_type="application/json", ) req_headers = mgmt_headers(token) request_kwargs: dict[str, Any] = {"data": form} request_url = multipart_upload_url else: req_headers = mgmt_headers(token, include_json=True) request_kwargs = {"data": candidate["content_text"]} request_url = json_upload_url async with session.post( request_url, headers=req_headers, timeout=timeout, **request_kwargs, ) as resp: ``` ### Technical Analysis The example configuration and operational documentation use an `http://` CPA management endpoi ...[truncated 1946 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cpa_warden.py:886
Finding

Complete Identity-Token Objects and Account Metadata Are Persisted without Restrictive File Protection

Content
View full analysis
None: conn.executescript( """ CREATE TABLE IF NOT EXISTS auth_accounts ( name TEXT PRIMARY KEY, disabled INTEGER NOT NULL, id_token_json TEXT, email TEXT, ``` ```python def build_auth_record( item: dict[str, Any], existing_row: dict[str, Any] | None, now_iso: str, ) -> dict[str, Any]: id_token_obj = get_id_token_object(item) id_token_json = json.dumps(id_token_obj, ensure_ascii=False) if id_token_obj else None existing_row = existing_row or {} return { "name": get_item_name(item), "disabled": int(bool(item.get("disabled"))), "id_token_json": id_token_json, "email": str(item.get("email") or "").strip() or None, "provider": str(item.get("provider") or "").strip() or None, "source": str(item.get("source") or "").strip() or None, "unavailable": int(bool(item.get("unavailable"))), "auth_index": str(item.get("auth_index") or "").strip() or None, "account": get_item_account(item) or None, "type": get_item_type(item) or None, "runtime_only": int(bool(item.get("runtime_only"))), "status": str(item.get("status") or "").strip() or None, "status_message": compact_text(item.get("status_message"), 1200), "chatgpt_account_id": extract_chatgpt_account_id_from_item(item) or None, "id_token_plan_type": extract_id_token_plan_type(item) or None, ``` ```python def export_records(path: str, rows: list[dict[str, Any]]) -> None: with open(path, "w", encoding="utf-8") as fh: json.dump(rows, fh, ensure_ascii=False, indent=2) ``` ### Technical Analysis The scan obtains an `id_toke ...[truncated 1898 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/cpa_warden.py:2589
Finding

Documented Maintenance Preview Still Disables Remote Quota Accounts

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cpa_warden.py:2293
Finding

Proxy Environment Inheritance Can Redirect Sensitive Management Requests

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (16)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · clawhub-preflight.md (reported line 112)May include surrounding context.

md
- **Never** upload skills containing real credentials or sensitive configuration
- **Always** test uploaded skills in isolated environments first
- **Regularly** update skills to incorporate security fixes and improvements
- **Monitor** skill usage and provide support documentation

## 📞 Support Contact

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The code builds a shell command from configurable register_command and executes it via asyncio.create_subprocess_shell, which allows arbitrary external program execution outside the stated CPA management scope. Because this runs with the current user's privileges and inherits environment state, a malicious or compromised config can trigger unintended code execution, persistence actions, or data exfiltration.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
94% confidence
Finding

The code copies the full parent environment into the spawned registration process using os.environ.copy(). When combined with arbitrary external command execution, this can leak secrets such as API keys, tokens, proxy credentials, CI secrets, or cloud credentials to the child process and any tooling it invokes.

Content

Scanner excerpt · scripts/cpa_warden.py (reported line 2747)May include surrounding context.

python
f"--count {shlex.quote(str(count))} "
        f"--output-dir {shlex.quote(str(upload_dir))}"
    )
    env = os.environ.copy()
    env["CPA_REGISTER_COUNT"] = str(count)
    env["CPA_REGISTER_OUTPUT_DIR"] = str(upload_dir)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The maintain-refill path can execute an external shell command automatically when account counts are low, and this occurs without an additional confirmation or prominent safety warning. In a security-sensitive operations tool, unattended shell execution materially raises the chance of malicious config abuse or operator surprise leading to arbitrary code execution.

Content

No source excerpt is available for this finding.

Instruction Override

High
Category
Prompt Injection
Confidence
70% confidence
Finding

This pattern attempts to override system instructions or ignore safety constraints. Without LLM analysis, manual review is recommended.

Content

Scanner excerpt · troubleshooting.md (reported line 98)May include surrounding context.

Step 2: Run Verbose Scan

bash
# Enable debug mode in config.json
# Set "debug": true
python3 cpa_warden.py --mode scan --config config.json

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill documents and encourages operations that inherently require broad capabilities including shell execution, file access, network access, and likely environment/config handling, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, this increases the chance of over-privileged execution, accidental destructive actions against CPA management APIs, and unintended access to local auth files or tokens.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The natural-language content of the skill is written entirely in Chinese, including the top-level description and operational guidance, with no indication that users may choose another language. This can violate language/locale policy when a skill imposes a specific language without user opt-in or documented regional justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The guidance claims the listed scan operations 'only read data, never modify', but at least one documented command explicitly writes output files. This can mislead operators into treating the command as side-effect free, which may cause unsafe execution in sensitive environments, overwrite concerns, or incorrect assumptions during incident response and change control.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

This JSON config enables automated account-disabling behavior via "quota_action": "disable" and also enables deletion-like handling for 401 responses with "delete_401": true, but the file does not describe the precise conditions or boundaries under which those actions occur. In a manifest/config file, that lack of specificity can create ambiguous activation of impactful behaviors.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Upload mode reads local JSON files and posts their full contents to the remote management API automatically once the mode is invoked, without any interactive warning about data transmission. Since these files are authentication artifacts, accidental selection of the wrong directory or misuse of the tool could disclose sensitive credentials or account material to a remote service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script exports 401/quota account inventory to local JSON files containing account identifiers, provider/source metadata, auth indexes, account IDs, and probe status information. Writing this data to predictable local paths without warning or permission hardening can expose sensitive operational inventory to other local users, backups, or accidental sharing.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest describes an operations tool for CPA inventory, cleanup, upload, and refill, but the code additionally supports spawning external registration workflows. This hidden capability increases risk because operators may authorize or install the skill expecting API-only behavior, while it can actually execute local programs with user privileges.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The troubleshooting guide instructs users to send a bearer token in example curl commands to management endpoints and uses plain HTTP URLs without warning about transport security or credential handling. This can normalize unsafe practices, leading operators to expose sensitive management tokens via shell history, logs, screenshots, or interception on unencrypted networks.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The document discusses deletion and maintenance flows that can remove accounts, but the warning is fragmented and not presented as a prominent global caution before destructive procedures. In an ops tool that manages auth files and account pools, this increases the risk of accidental mass deletion or irreversible service disruption through routine operator error.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
61% confidence
Finding

The configuration hard-codes a specific user agent value that presents a fixed platform/locale-style identity rather than allowing user choice or documenting why that identity is required. This may conflict with organizational expectations against forcing a particular language or locale-related presentation without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

User-facing strings throughout the file, including prompts, errors, and status messages, are written only in Chinese, and there is no option to select another language or locale. This is a natural-language policy issue because the tool imposes a fixed language on all users without opt-in or documented locale scope.

Content

No source excerpt is available for this finding.