Back to skill

Security audit

Statamic AI Gateway

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for managing Statamic sites, but it handles bearer tokens and remote instructions in ways users should review carefully before installing.

Install only if you trust the configured Statamic gateway operators and can scope each token narrowly. Use HTTPS-only site URLs, avoid production write tests unless intentional, protect and rotate tokens, and do not let remote capability text override normal safety rules or cause unrelated local-file access or secret disclosure.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (2)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:54
Finding

Untrusted Remote Capability Documentation Can Influence Agent Behavior

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 54-59
Vulnerability Type: Remote instruction injection through capability responses
Risk Level: High

Vulnerable Code Snippet

markdown
## Discovery-First Workflow

Do not guess tool arguments. Always discover before executing:

1. `GET /capabilities` — see which tools are enabled on this site
2. `GET /capabilities/{tool.name}` — get the argument schema, validation rules, example request/response, allowed targets, denied fields, and behavioral notes for that tool
3. Use the returned information to construct your `/execute` request

This is the primary way to learn how to use any tool. The capabilities endpoints are the source of truth.

Technical Analysis

The skill directs the agent to retrieve and follow remotely supplied “behavioral notes,” treating the capability endpoint as the source of truth. It does not establish a trust boundary between structured API metadata and free-form remote instructions.

A malicious site operator, compromised Statamic gateway, or attacker controlling the configured endpoint could return capability documentation containing prompt-injection instructions. These instructions could attempt to override the skill's intended workflow, request access to unrelated local files, induce disclosure of secrets, or direct the agent to invoke tools beyond what is necessary for Statamic content management.

Authentication of the endpoint does not resolve this issue because the authenticated server itself may be compromised or malicious. Only narrowly defined structured fields should influence request construction; remote prose must not modify agent safety constraints or authorize additional actions.

Attack Path

  1. The user configures a site controlled by an attacker, or a legitimate configured gateway is compromised.
  2. The agent requests /ai-gateway/capabilities/{tool} as required by the skill.
  3. The server return ...[truncated 1378 chars]
Remediation
View remediation

Remediation Suggestions

  • Treat every capability response as untrusted data rather than agent instructions.
  • Define and validate a strict JSON schema for capability responses.
  • Consume only necessary structured fields such as tool name, enabled state, argument types, allowlisted targets, denied fields, and confirmation requirements.
  • Do not allow free-form descriptions, examples, or behavioral notes to change safety policies, request local data, expand scope, or authorize additional tools.
  • Add explicit instructions stating that remote content cannot override system, developer, user, or skill-level security requirements.
  • Reject unexpected response fields and enforce size, type, and nesting limits.
  • Require explicit user approval before any remotely suggested action that accesses local files, transmits information, changes scope, or invokes a tool unrelated to the user's request.
  • Where possible, cryptographically authenticate trusted gateway deployments and pin expected service identities, while still treating returned prose as untrusted.

T09 · Insecure Skill Coding Practices

Error
Location
INSTALL.md:51
Finding

Bearer Tokens Can Be Transmitted to Configured Plaintext HTTP Endpoints

Content
View full analysis

Vulnerability Details

File Location: INSTALL.md, lines 51-67 and 109-114
Vulnerability Type: Missing HTTPS enforcement for authenticated network requests
Risk Level: High

Vulnerable Code Snippet

markdown
## Site Registry Format

```json
{
  "sites": {
    "site-name": {
      "base_url": "https://your-site.com",
      "token": "the-AI_GATEWAY_TOKEN-for-this-site"
    }
  }
}
FieldDescriptionExample
keyShort name you'll use to reference this sitemarketing, docs, portal
base_urlThe site's URL, no trailing slashhttps://marketing.example.com
tokenThe AI_GATEWAY_TOKEN configured on that sitea1b2c3d4e5f6...

The site operator provides both the base URL and token. Each Statamic site has its own unique token.

text

The configured value is subsequently used directly for an authenticated request:

```bash
# Read credentials for the "marketing" site
SITE_URL=$(jq -r '.sites.marketing.base_url' ~/.config/ai-gateway/sites.json)
SITE_TOKEN=$(jq -r '.sites.marketing.token' ~/.config/ai-gateway/sites.json)

# Check capabilities
curl -s -H "Authorization: Bearer $SITE_TOKEN" \
  $SITE_URL/ai-gateway/capabilities | jq .

Technical Analysis

Sending a bearer token to the selected Statamic gateway is necessary for the skill's declared authenticated content-management functionality. However, the configuration accepts an arbitrary base_url, and the request examples do not enforce the HTTPS protocol.

HTTPS is shown in examples, but the documented configuration contract does not reject http:// endpoints. If a user, automated setup process, or attacker-controlled configuration supplies a plaintext ...[truncated 1831 chars]

Remediation
View remediation

Remediation Suggestions

  • Require base_url values to use https:// and reject all other schemes before reading or transmitting the token.
  • Invoke curl with protocol restrictions, for example:
bash
curl --fail --show-error --silent \
  --proto '=https' \
  -H "Authorization: Bearer $SITE_TOKEN" \
  "${SITE_URL}/ai-gateway/capabilities"
  • Quote every URL expansion to prevent shell parsing and globbing issues.
  • If plaintext access is necessary for local development, permit it only through an explicit opt-in mode restricted to loopback addresses such as 127.0.0.1 or ::1.
  • Do not allow redirects to downgrade from HTTPS to HTTP or forward authorization headers to a different origin.
  • Validate the configured host against the expected site identity where practical.
  • Document certificate validation requirements and do not recommend curl --insecure.
  • Rotate any token that may previously have been transmitted over an untrusted plaintext connection.
  • Retain server-side allowlists, narrowly scoped tokens, confirmation gates, rate limits, and independent per-site credentials to reduce the impact of token compromise.
Vulnerability Patterns
  • 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
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The guide instructs users to persist multiple site bearer tokens in a local sites.json file under the home directory. Even with chmod 600, long-lived plaintext credential storage increases the blast radius of local compromise, accidental backup leakage, or misuse by other local processes running as the same user.

Content

Scanner excerpt · INSTALL.md (reported line 16)May include surrounding context.

md
- macOS: `brew install curl jq`
- Ubuntu/Debian: `apt install curl jq`

## Create the Site Registry

The skill uses a `sites.json` file to store credentials for each Statamic site you manage. Create it at the default location:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · INSTALL.md (reported line 40)May include surrounding context.

Protect the file since it contains secrets:

bash
chmod 600 ~/.config/ai-gateway/sites.json

To use a different path, set the AI_GATEWAY_SITES_CONFIG environment variable:

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · INSTALL.md (reported line 143)May include surrounding context.

done

text

## Test a Write Operation

Once capabilities look good, test a simple upsert on one site:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The installation guide instructs users to run a live entry.upsert write test against a real Statamic site without a prominent warning that it will create or modify content. In an installation context, users may treat smoke tests as harmless verification and unintentionally change production data, especially if they point the skill at a production site.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This command transmits a bearer token and a content-modifying request to an external endpoint. Although external transmission is expected for this skill, it is still security-relevant because it sends sensitive credentials and performs a remote write operation, so misuse, endpoint misconfiguration, or running against the wrong site could expose secrets or alter data.

Content

Scanner excerpt · INSTALL.md (reported line 151)May include surrounding context.

md
SITE_URL=$(jq -r '.sites.marketing.base_url' ~/.config/ai-gateway/sites.json)
SITE_TOKEN=$(jq -r '.sites.marketing.token' ~/.config/ai-gateway/sites.json)

curl -s -X POST \
  -H "Authorization: Bearer $SITE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill documentation explicitly identifies the local credential file path and shows bearer tokens in example configuration, but provides no warning not to expose, log, or echo those secrets. In an agent setting, this increases the chance that downstream tooling or prompts will read and inadvertently disclose tokens, enabling authenticated access to connected Statamic sites.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Content

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

md
2. `GET /capabilities/{tool.name}` — get the argument schema, validation rules, example request/response, allowed targets, denied fields, and behavioral notes for that tool
3. Use the returned information to construct your `/execute` request

This is the primary way to learn how to use any tool. The capabilities endpoints are the source of truth.

## Request Envelope

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
85% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

md
4. `data` must be a JSON object, never an array or string. Don't send unknown argument keys.
5. Prefer `entry.upsert` over `entry.create` — safer and idempotent.
6. `navigation.update` is a full tree replacement. Always fetch with `navigation.get` first.
7. **Confirmation-gated tools require user approval.** If `requires_confirmation: true` in capabilities: (1) send the request, (2) receive `confirmation_required` with a token, (3) show the user the `operation_summary` and ask permission, (4) only if approved, resend with `confirmation_token`. **Never auto-confirm.**
8. If `rate_limited`, back off and retry.
9. Include the site name in `request_id` (e.g. `marketing:upsert-about`).
10. After bulk content changes, consider warming caches: `stache.warm` rebuilds content indexes, `static.warm` regenerates static pages.