Back to skill

Security audit

Cloudflare Global

Security checks for vulnerabilities and agentic risk

Overview

This Cloudflare helper is coherent and not deceptive, but it gives an agent broad live Cloudflare control using a Global API Key without strong guardrails.

Use this only if you intentionally need legacy Global API Key automation for Cloudflare. Prefer a scoped API-token-based workflow when possible, run it only on trusted systems, verify zone and record IDs before mutations, and add your own confirmation process before delete, import, SSL, cache purge, or tunnel operations.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cf-global.sh:7
Finding
Global API Key Exposed Through Process Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/cf-global.sh`, lines 7-15 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```bash CF_API="https://api.cloudflare.com/client/v4" AUTH=(-H "X-Auth-Email: ${CLOUDFLARE_EMAIL}" -H "X-Auth-Key: ${CLOUDFLARE_GLOBAL_API_KEY}" -H "Content-Type: application/json") cf_request() { local method="$1" path="$2" data="${3:-}" if [[ -n "$data" ]]; then curl -fsS -X "$method" "${AUTH[@]}" -d "$data" "$CF_API$path" else curl -fsS -X "$method" "${AUTH[@]}" "$CF_API$path" fi } ``` ### Technical Analysis The script expands `X-Auth-Key` and `X-Auth-Email` directly into the argument vector of every spawned `curl` process. On systems where process command lines are visible through process inspection interfaces, monitoring agents, diagnostic tooling, or command telemetry, the complete Global API Key may be exposed while `curl` is running. This issue is particularly significant because a Cloudflare Global API Key is a highly privileged account-level credential. Although the request is sent over HTTPS to the legitimate Cloudflare API, transport encryption does not protect the credential from local process inspection before transmission. Exploitation requires local access to process metadata or access to monitoring or logging infrastructure that captures process arguments. ### Attack Path 1. A legitimate user configures `CLOUDFLARE_GLOBAL_API_KEY` and runs an operation through `cf-global.sh`. 2. The script creates a `curl` process with the API key embedded in an `-H` command-line argument. 3. A local user, process-monitoring agent, diagnostic collector, or compromised administrative tool records the process argument vector. 4. The observer extracts the value following `X-Auth-Key:`. 5. The stolen Global API Key and associated account email are reused to authenticate directly to Cloudflare. 6. The attacker performs operations per ...[truncated 813 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Do not place authentication secrets directly in command-line arguments. - Provide sensitive curl headers through a protected temporary configuration file or file descriptor that is readable only by the current user. - If a temporary file is used: - Create it with restrictive permissions such as mode `0600`. - Use a securely created unpredictable path. - Install an exit trap to remove it on normal termination and errors. - Avoid shared or predictable temporary filenames. - Disable implicit curl configuration loading with `--disable` to prevent unexpected behavior from user-controlled curl configuration. - Ensure monitoring and debug tooling does not capture authentication headers. - Prefer narrowly scoped Cloudflare API tokens over the legacy Global API Key. - Rotate the Global API Key if process telemetry or command-line logs may already have captured it. ]]>

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/cf-global.sh:4
Finding
All Operations Require an Overprivileged Account-Wide Global API Key<![CDATA[ ## Vulnerability Details **File Location**: `scripts/cf-global.sh`, lines 4-7; `SKILL.md`, lines 3 and 9-18 **Vulnerability Type**: Violation of least privilege through mandatory use of an account-wide credential **Risk Level**: Medium ### Vulnerable Code ```bash : "${CLOUDFLARE_GLOBAL_API_KEY:?Set CLOUDFLARE_GLOBAL_API_KEY}" : "${CLOUDFLARE_EMAIL:?Set CLOUDFLARE_EMAIL}" CF_API="https://api.cloudflare.com/client/v4" AUTH=(-H "X-Auth-Email: ${CLOUDFLARE_EMAIL}" -H "X-Auth-Key: ${CLOUDFLARE_GLOBAL_API_KEY}" -H "Content-Type: application/json") ``` The corresponding skill instructions explicitly require the legacy authentication flow: ```markdown description: Cloudflare DNS and zone operations using a Global API Key. Use when the user needs to list, create, update, delete, export, or import DNS records, inspect zone settings or SSL mode, purge cache, inspect page rules or firewall rules, or work with Cloudflare tunnels using a Global API Key instead of a modern API token. ## Authentication Read credentials from environment variables: - `CLOUDFLARE_GLOBAL_API_KEY` — required - `CLOUDFLARE_EMAIL` — required - `CLOUDFLARE_ACCOUNT_ID` — required only for tunnel operations Do not use Bearer auth for this flow. ``` ### Technical Analysis The script mandates use of Cloudflare's legacy Global API Key for every operation, including read-only actions such as listing zones, inspecting settings, and retrieving analytics. The implementation does not support narrowly scoped API tokens or operation-specific permissions. A Global API Key has substantially broader authority than most individual actions provided by the script require. Consequently, any disclosure through the local environment, process inspection, shell diagnostics, crash collection, or another compromised process can expose permissions unrelated to the user's intended task. This is a least-privilege failure rather than evidence that the script intentionally acquires unauthorized access. The r ...[truncated 1669 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Add support for modern Cloudflare API tokens using Bearer authentication. - Make scoped API tokens the default and recommended authentication method. - Request only the permissions required by each operation, such as: - Zone read access for listing and inspection. - DNS edit access only for DNS mutations. - Cache purge access only for cache operations. - Tunnel-specific account permissions only for tunnel operations. - Restrict tokens to the specific zones or accounts involved in the task. - Retain Global API Key support only as an explicitly selected legacy compatibility mode. - Display a clear warning before accepting a Global API Key, explaining its account-wide impact. - Separate read-only and mutation workflows so read-only operations do not require write-capable credentials. - Avoid exporting long-lived Global API Keys into broadly inherited environments. - Rotate credentials after suspected exposure and regularly review Cloudflare audit logs for unauthorized activity. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Ae1

High
Category
analysis-evasion
Content
Use `scripts/cf-global.sh` for repeatable Cloudflare operations.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
Use `scripts/cf-global.sh` for repeatable Cloudflare operations.
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Missing User Warnings

High
Confidence
96% confidence
Finding
The `dns-delete` operation permanently deletes DNS records immediately with no confirmation, dry-run mode, or safeguard. In an agent setting, a mistaken or malicious invocation could cause domain outage, traffic hijacking recovery delays, or service disruption by removing critical records.

Missing User Warnings

High
Confidence
95% confidence
Finding
Changing SSL mode or purging cache can immediately affect site availability, origin connectivity, and user-facing behavior, yet the script executes these actions without warning or confirmation. In production environments, accidental SSL downgrades or full cache purges can create outages, expose insecure configurations, or cause severe performance regressions.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill advertises shell-backed operational capability but does not declare any explicit tool scope or permission boundary. That increases the chance an agent can invoke shell actions with broader-than-expected authority, especially for live Cloudflare administration tasks that can modify DNS, SSL, cache, and tunnels.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The description includes destructive and high-impact operations such as delete, import, SSL changes, cache purge, and tunnel deletion without any prominent warning or confirmation requirement. In a production DNS/control-plane context, accidental or coerced execution could cause outages, traffic interception, or service disruption.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The script requires and directly uses a Cloudflare Global API Key and email to authenticate requests, but provides no user-facing warning that a highly privileged long-lived credential will be consumed and transmitted to an external service. In agent contexts, lack of disclosure increases the risk of users unknowingly granting broad account access, especially because Global API Keys are significantly more dangerous than scoped API tokens.

External Transmission

Medium
Category
Data Exfiltration
Content
: "${CLOUDFLARE_GLOBAL_API_KEY:?Set CLOUDFLARE_GLOBAL_API_KEY}"
: "${CLOUDFLARE_EMAIL:?Set CLOUDFLARE_EMAIL}"

CF_API="https://api.cloudflare.com/client/v4"
AUTH=(-H "X-Auth-Email: ${CLOUDFLARE_EMAIL}" -H "X-Auth-Key: ${CLOUDFLARE_GLOBAL_API_KEY}" -H "Content-Type: application/json")

cf_request() {
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
cf_request() {
  local method="$1" path="$2" data="${3:-}"
  if [[ -n "$data" ]]; then
    curl -fsS -X "$method" "${AUTH[@]}" -d "$data" "$CF_API$path"
  else
    curl -fsS -X "$method" "${AUTH[@]}" "$CF_API$path"
  fi
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
90% confidence
Finding
Bulk DNS import and settings modification perform write operations that can materially alter production infrastructure without any warning, preview, or approval boundary. This makes accidental mass misconfiguration easier and increases the blast radius of prompt mistakes or misuse in an automated agent workflow.

Missing User Warnings

Low
Confidence
84% confidence
Finding
The skill instructs use of highly sensitive environment credentials, including a legacy Global API Key with broad account power, but does not include strong handling guidance or warnings about least privilege and exposure. If logs, subprocess output, prompts, or misconfigured environments leak these values, an attacker could gain extensive control over Cloudflare-managed assets.

Description-Behavior Mismatch

Low
Confidence
93% confidence
Finding
The manifest describes DNS, zone settings, SSL, cache purge, page rules, firewall rules, and tunnels, but it does not mention analytics access. The code adds an `analytics` command that queries zone analytics totals, which extends behavior beyond the stated description.

Static analysis

No suspicious patterns detected.