T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Shell Command Injection Through User-Controlled Event Data
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is purpose-aligned for managing site events, but it uses broad Cloudflare credentials and live database mutation commands in ways that need careful review.
Install only if you control the target Cloudflare account and are comfortable with an agent making live event database changes. Before use, pin Wrangler, use a dedicated least-privilege D1 token, avoid sourcing a shared env file, and require explicit confirmation before insert, update, or delete commands.
SKILL.md:43Shell Command Injection Through User-Controlled Event Data
SKILL.md:46Unpinned Wrangler Dependency May Execute Mutable Third-Party Code
SKILL.md:41Broad Credential File Is Executed Instead of Minimally Scoped Credentials Being Loaded
The skill instructs the agent/operator to source ~/.env/.env, directly accessing stored Cloudflare credentials. Exposing credential-loading steps inside an agent skill is dangerous because any misuse of the skill, prompt injection into downstream content, or accidental logging can lead to token disclosure and full remote access to production infrastructure.
source ~/.env/.env
# Provides: $CF_API_TOKEN, $CF_ACCOUNT_ID
This step combines loading credentials from a local env file with immediate remote execution against Cloudflare D1. The context makes the issue more dangerous because the token is used in a production write path, so any compromise of the shell session, package toolchain, or injected command content can result in unauthorized database modification and credential theft.
source ~/.env/.env
cd /Users/viki/Projects/projects/marketing-bull/babenchuk-com
CLOUDFLARE_API_TOKEN="$CF_API_TOKEN" \
Although this example is read-oriented, it still instructs loading Cloudflare credentials from a local env file into a general shell session. That broadens secret exposure unnecessarily and can leak tokens through shell history, debugging, process inspection, or compromised helper tooling.
List all upcoming events:
source ~/.env/.env
CLOUDFLARE_API_TOKEN="$CF_API_TOKEN" CLOUDFLARE_ACCOUNT_ID="$CF_ACCOUNT_ID" \
npx wrangler d1 execute mb-events --remote --command "SELECT id, name, date_start FROM events WHERE date_start >= date('now') ORDER BY date_start ASC;"
The trigger phrase "Add an event to the site" is broad enough to match ordinary conversational requests that may not imply authorization to write directly to a live database. In this skill, activation leads to immediate production D1 modification, so ambiguous triggering increases the risk of unintended or socially engineered execution.
The phrase "Update PI events" does not specify the system, data source, or whether the request is read-only or mutating. Because this skill performs live writes to Cloudflare D1, the ambiguity makes accidental invocation and unauthorized modification more likely in normal conversation.
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.
CREATE TABLE events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
address TEXT,
The skill invokes npx wrangler without pinning a specific package version, which can cause execution of whatever version npm resolves at runtime. In a privileged workflow that loads Cloudflare credentials and performs remote D1 writes, this creates a supply-chain risk where a compromised or incompatible wrangler release could execute with access to live infrastructure.
This instance again uses unpinned npx wrangler for remote database operations. Because the command is run with Cloudflare API credentials in environment variables, any malicious or unexpected package version could abuse those credentials or alter production data.
The verification step still depends on unpinned npx wrangler, preserving the same supply-chain exposure. Even read-oriented commands can leak credentials, query sensitive data, or execute arbitrary package lifecycle behavior when the tool version is not fixed.
This query command uses unpinned npx wrangler while loading Cloudflare credentials from the user's environment. The combination of dynamic package fetching plus privileged remote access increases the chance of supply-chain compromise leading to credential theft or unauthorized D1 actions.
The delete example uses unpinned npx wrangler for a destructive production action. If the fetched package is malicious or unexpectedly changed, it can both tamper with live data and misuse loaded credentials, making this more dangerous than a generic tooling reference.
This update workflow again relies on a dynamically resolved npx wrangler binary in a credentialed, production-facing context. That exposes the operator to package substitution, compromised releases, or breaking changes that could modify data or exfiltrate Cloudflare tokens.