Back to skill

Security audit

Twitch Clip

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it says by creating Twitch clips, but its generic trigger wording and unsafe shared temporary cooldown file make it worth reviewing before installation.

Install only if you are comfortable granting a Twitch token with clip creation permission. Prefer using it in an environment where clip requests require an explicit authorized command or confirmation, and consider fixing the cooldown file to use a private per-user state directory before running it on a shared machine.

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/create_clip.sh:9
Finding

Predictable Shared Temporary File Enables Symlink Overwrite and Cooldown Manipulation

Content
View full analysis
&2 exit 1 fi # Cooldown check — prevent spam clipping if [ -f "$LOCKFILE" ]; then LAST_CLIP=$(cat "$LOCKFILE") NOW=$(date +%s) ELAPSED=$(( NOW - LAST_CLIP )) REMAINING=$(( COOLDOWN_SECONDS - ELAPSED )) if [ "$ELAPSED" -lt "$COOLDOWN_SECONDS" ]; then echo "COOLDOWN: Please wait ${REMAINING}s before clipping again." >&2 exit 2 fi fi RESPONSE=$(curl -s -X POST \ "https://api.twitch.tv/helix/clips?broadcaster_id=${BROADCASTER_ID}&has_delay=false" \ -H "Authorization: Bearer ${TOKEN}" \ -H "Client-Id: ${CLIENT_ID}") CLIP_ID=$(echo "$RESPONSE" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['data'][0]['id'])" 2>/dev/null) EDIT_URL=$(echo "$RESPONSE" | python3 -c "import json,sys; d=json.load(sys.stdin); print(d['data'][0]['edit_url'])" 2>/dev/null) if [ -z "$CLIP_ID" ]; then echo "ERROR: Failed to create clip. Response: $RESPONSE" >&2 exit 1 fi # Write cooldown timestamp on success date +%s > "$LOCKFILE" ``` ### Technical Analysis The cooldown state is stored at the fixed path `/tmp/twitch_clip_cooldown`. On multi-user systems, `/tmp` is normally globally writable. The script neither creates a private state directory nor verifies the ownership, type, or symlink status of this path. The test `[ -f "$LOCKFILE" ]`, the subsequent `cat`, and the final shell redirection all follow symbolic links. Consequently, another local user can create or replace the cooldown path before the Skill executes. The final redirection opens the resolved target with truncation enabled and writes the current epoch timestamp to it. An attacker can ...[truncated 2337 chars]
Remediation
View remediation
&2 exit 1 fi ``` 4. Serialize the entire cooldown check, Twitch request, and timestamp update with `flock` or an equivalent locking mechanism. Locking only the final write does not prevent concurrent requests from bypassing the cooldown. 5. Write updates atomically to a securely created temporary file in the same private directory, then rename it into place: ```bash tmp=$(mktemp "$STATE_DIR/cooldown.XXXXXX") || exit 1 printf '%s\n' "$(date +%s)" > "$tmp" chmod 600 "$tmp" mv -fT -- "$tmp" "$LOCKFILE" ``` 6. Validate cooldown content before arithmetic use. Accept only a bounded sequence of decimal digits and fail safely if validation fails: ```bash case "$LAST_CLIP" in ''|*[!0-9]*) echo "ERROR: Invalid cooldown state" >&2 exit 1 ;; esac ``` These changes isolate state to the invoking user, prevent symlink-following attacks, reduce race conditions, and preserve the intended anti-spam behavior. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

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

To find your broadcaster ID:

bash
curl -s -H "Authorization: Bearer $TWITCH_ACCESS_TOKEN" \
  -H "Client-Id: $TWITCH_CLIENT_ID" \
  https://api.twitch.tv/helix/users | python3 -c "import json,sys; print(json.load(sys.stdin)['data'][0]['id'])"

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · scripts/create_clip.sh (reported line 30)May include surrounding context.

sh
fi
fi

RESPONSE=$(curl -s -X POST \
  "https://api.twitch.tv/helix/clips?broadcaster_id=${BROADCASTER_ID}&has_delay=false" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Client-Id: ${CLIENT_ID}")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill invokes shell functionality (bash scripts/create_clip.sh and curl) but does not declare any explicit tool scope such as permissions or allowed-tools. This can cause the agent runtime to grant broader-than-necessary execution capability or make security review and enforcement ambiguous, increasing the chance of unintended command execution paths.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description advertises broad natural-language triggers like 'clip that' and 'clip it' without strong contextual constraints. In an agent environment, these phrases can be activated accidentally during normal conversation or by untrusted third parties, causing unintended API actions on the user's Twitch account.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The listed trigger phrases are short, generic commands that overlap with ordinary speech and do not define clear scope, speaker authorization, or disambiguation rules. This makes accidental or malicious prompting more likely, especially in live or shared chat environments where others can induce the skill to perform actions.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
fi

RESPONSE=$(curl -s -X POST \
  "https://api.twitch.tv/helix/clips?broadcaster_id=${BROADCASTER_ID}&has_delay=false" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Client-Id: ${CLIENT_ID}")

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/create_clip.sh (reported line 31)May include surrounding context.

sh
fi

RESPONSE=$(curl -s -X POST \
  "https://api.twitch.tv/helix/clips?broadcaster_id=${BROADCASTER_ID}&has_delay=false" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Client-Id: ${CLIENT_ID}")

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The script accesses sensitive credentials from environment variables (TWITCH_CLIENT_ID, TWITCH_ACCESS_TOKEN, and TWITCH_BROADCASTER_ID). While it reports when credentials are missing, it does not include a user-facing warning, comment, or confirmation that the script will use these sensitive values for an authenticated API call.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.