Back to skill

Security audit

Cloudflare

Security checks for vulnerabilities and agentic risk

Overview

This Cloudflare management skill is transparent and purpose-aligned, but it can change live Cloudflare configuration so users should use a least-privilege token and confirm destructive actions.

Install only if you intend to let the agent manage Cloudflare. Create a narrowly scoped Cloudflare API token for the specific account/zones and permissions needed, avoid broad account-wide edit tokens, and require explicit confirmation before delete, import, SSL/settings, tunnel, or full cache-purge commands.

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
scripts/cf.sh:13
Finding
Cloudflare API Token Exposed Through Process Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/cf.sh`, lines 13–17 **Vulnerability Type**: Bearer token disclosure through command-line arguments **Risk Level**: Medium ### Vulnerable Code ```bash TOKEN="${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}" _curl() { curl -sS -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" "$@" } ``` ### Technical Analysis The `_curl` function expands `CLOUDFLARE_API_TOKEN` into the `curl` command-line argument containing the `Authorization` header. Consequently, the bearer token may appear in the process argument vector while `curl` is running. On systems where process arguments are visible to other local users, privileged monitoring software, process auditing systems, or diagnostic tooling, an observer may recover the token from process listings or process metadata. The exposure window is limited to the lifetime of each `curl` process, but repeated API operations create repeated opportunities for collection. The token is not hardcoded in the repository and is transmitted to the legitimate Cloudflare HTTPS endpoint. The issue specifically concerns local disclosure through process arguments. ### Attack Path 1. The operator configures `CLOUDFLARE_API_TOKEN` and invokes a command provided by `scripts/cf.sh`. 2. The script launches `curl` with an argument containing `Authorization: Bearer <token>`. 3. An attacker with sufficient local process-inspection access monitors running processes or obtains command-line telemetry collected by system monitoring software. 4. The attacker captures the `curl` argument while the API request is in progress and extracts the bearer token. 5. The attacker submits requests directly to the Cloudflare API using the stolen token. 6. Successful actions are limited by the token's configured Cloudflare scopes and resource restrictions. ### Impact Assessment A stolen token grants access to every Cloudflare API capability authorized by that token. Depending on ...[truncated 606 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Avoid passing the bearer token directly as a command-line argument. 1. Provide the sensitive header to `curl` through a configuration stream or a securely created temporary configuration file rather than through `-H` on the command line. 2. If a temporary file is necessary: - Create it with `mktemp`. - Set a restrictive `umask`, such as `077`, before creation. - Ensure only the current user can read it. - Register a `trap` to remove it on normal exit and interruption. - Do not place it in a shared or predictable path. 3. Ensure shell tracing is disabled around credential handling so that the token is not written to logs. 4. Use narrowly scoped Cloudflare API tokens restricted to only the required permissions, accounts, and zones. 5. Rotate the token if process arguments may already have been captured by monitoring, audit, or diagnostic systems. 6. Review operating-system process visibility controls and restrict access to process metadata where possible. One possible approach is to pass a curl configuration through standard input: ```bash _curl() { printf '%s\n' \ 'silent' \ 'show-error' \ "header = \"Authorization: Bearer $TOKEN\"" \ 'header = "Content-Type: application/json"' | curl --config - "$@" } ``` The implementation should also be tested on all supported curl versions to confirm that configuration input and diagnostic output do not expose the credential. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (14)

Ae1

High
Category
analysis-evasion
Content
Manage Cloudflare zones, DNS, SSL, tunnels, and settings via the bundled `scripts/cf.sh` bash script.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Manage Cloudflare zones, DNS, SSL, tunnels, and settings via the bundled `scripts/cf.sh` bash script.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Manage Cloudflare zones, DNS, SSL, tunnels, and settings via the bundled `scripts/cf.sh` bash script.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Manage Cloudflare zones, DNS, SSL, tunnels, and settings via the bundled `scripts/cf.sh` bash script.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill exposes shell-based operational capabilities via a bundled bash script, but it does not declare an explicit tool scope such as permissions or allowed-tools. That increases the risk that an agent runtime may grant broader execution authority than intended, especially for commands that can modify DNS, SSL, firewall, cache, and tunnel configuration in a live Cloudflare account using a privileged API token.

External Transmission

Medium
Category
Data Exfiltration
Content
set -euo pipefail

CF_API="https://api.cloudflare.com/client/v4"
TOKEN="${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN}"

# --- helpers ---
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
# --- helpers ---

_curl() {
  curl -sS -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" "$@"
}

_get()    { _curl "$CF_API$1"; }
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script exposes a command that deletes DNS records via the Cloudflare API, but the function performs the irreversible action immediately without any confirmation prompt or warning message. Although the help text names the command, there is no explicit disclosure at the point of execution that this operation is destructive.

Missing User Warnings

Medium
Confidence
84% confidence
Finding
This command reads records from a local file and creates DNS records remotely in a loop, which can materially alter a zone's configuration. The function only reports the import count afterward and does not warn the user beforehand about the scope of the write operation or validate intent.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The function updates arbitrary Cloudflare zone settings over the network, potentially affecting availability, security, or traffic handling, but it executes silently. There is no confirmation prompt, cautionary message, or inline warning describing the impact of modifying production settings.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
Changing SSL mode can affect site reachability and security posture, but the command delegates directly to the setting update without any user-facing caution. The help text lists accepted values, yet it does not warn that this change impacts live traffic handling.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
When invoked without URLs, this command sends purge_everything=true, which can invalidate all cached content for a zone. The code performs this action immediately and provides no confirmation or warning that omitting URLs triggers a full purge.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The function deletes a Cloudflare tunnel through the API without any confirmation prompt or user-facing warning. Because deletion is destructive and may disrupt service connectivity, the current implementation does not provide sufficient disclosure at execution time.

Missing User Warnings

Low
Confidence
81% confidence
Finding
This is a markdown file, so SQP-2 applies to omissions in user-facing warnings. The guide instructs users to create and use Cloudflare API tokens with edit-capable scopes, but it does not warn that these tokens are sensitive credentials that should not be exposed, shared, or stored insecurely.

Static analysis

No suspicious patterns detected.