T09 · Insecure Skill Coding Practices
- Location
integrations/generic.md:82- Finding
Shell Command Injection in the JavaScript Meme Generation Example
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This meme-generation skill is mostly on-purpose, but optional scripts and examples introduce unsafe command/code injection paths and raw Reddit credential handling that need review before installation.
Install only if you are comfortable with a meme skill that contacts several third-party services and may write image files locally. Avoid the Reddit OAuth script unless rewritten to avoid raw passwords, and harden or skip the JavaScript and Giphy examples before using them with untrusted input.
integrations/generic.md:82Shell Command Injection in the JavaScript Meme Generation Example
scripts/giphy-search.sh:20Python Code Injection Through the Giphy Search Query
integrations/langchain.md:41Unsafe Temporary-File Creation in LangChain Integration Examples
The skill advertises meme generation via memegen.link, but it also instructs use of Imgflip for trending templates and local file creation/workflow support not reflected in the top-level declaration. This kind of description-behavior drift can mislead users and reviewers about what data leaves the environment and what side effects occur.
The skill advertises meme generation via memegen.link, but it also instructs use of Imgflip for trending templates and local file creation/workflow support not reflected in the top-level declaration. This kind of description-behavior drift can mislead users and reviewers about what data leaves the environment and what side effects occur.
The skill advertises meme generation via memegen.link, but it also instructs use of Imgflip for trending templates and local file creation/workflow support not reflected in the top-level declaration. This kind of description-behavior drift can mislead users and reviewers about what data leaves the environment and what side effects occur.
The skill advertises meme generation via memegen.link, but it also instructs use of Imgflip for trending templates and local file creation/workflow support not reflected in the top-level declaration. This kind of description-behavior drift can mislead users and reviewers about what data leaves the environment and what side effects occur.
The skill advertises meme generation via memegen.link, but it also instructs use of Imgflip for trending templates and local file creation/workflow support not reflected in the top-level declaration. This kind of description-behavior drift can mislead users and reviewers about what data leaves the environment and what side effects occur.
The skill pipes data fetched with curl directly into python3 -c, which is a risky shell pattern that reduces inspection boundaries and encourages command-line parsing of untrusted remote input. Although this example parses JSON rather than executing returned code, the pattern is unsafe and easy to misuse or extend insecurely.
When you want the freshest templates (not just built-in IDs):
curl -s "https://api.imgflip.com/get_memes" | python3 -c "
import sys, json
memes = json.load(sys.stdin)['data']['memes'][:20]
for m in memes:
The 'Level 5: Nuclear' section explicitly describes maximum-edge content, line-crossing as a punchline, and acknowledges likely platform moderation issues. For a meme-generation skill, this is dangerous because it operationalizes production of borderline abusive or policy-violating content and may steer the agent toward generating harmful material under the guise of humor.
Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.
url = f"https://api.memegen.link/images/{template}/{top_enc}/{bottom_enc}.png?width={width}"
output = "/tmp/meme.png"
subprocess.run(["curl", "-s", "-o", output, url], check=True)
return output
# Usage
The code feeds untrusted, user-influenced URL content to curl and writes the response directly to a local file without validating scheme, destination, response type, or size. Although subprocess.run is used without a shell, this still enables an agent user to trigger arbitrary remote fetches through the memegen service flow and persist attacker-controlled bytes locally, which is more dangerous in a skill advertised as URL-only meme generation.
# Download to temp file
output = tempfile.mktemp(suffix=".png")
result = subprocess.run(
["curl", "-s", "-o", output, url],
capture_output=True, text=True
)
The structured variant has the same issue: it fetches user-influenced remote content and stores it locally with no validation of what is returned. In agent environments, persisting untrusted files can enable follow-on abuse, such as disk exhaustion, confusing downstream workflows, or handing attacker-controlled files to other tools.
url += f"&background={bg}"
output = tempfile.mktemp(suffix=".png")
subprocess.run(["curl", "-s", "-o", output, url], capture_output=True)
return f"Meme saved to: {output}"
Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.
"blank": "https://api.memegen.link/images/wddth.jpg",
"example": {
"text": [
"when someone calls your phone without warning",
"We don't do that here."
],
"url": "https://api.memegen.link/images/wddth/when_someone_calls_your_phone_without_warning/We_don't_do_that_here..jpg"
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
- **Pattern**: Escalation
- **Tone**: Frustrated teaching, stubborn misunderstanding
- **Best for**: Teaching someone who keeps getting the wrong answer, coaching frustrations, language learning
- **Example**: "Say git" / "git" / "rebase" / "rebase" / "git rebase" / "git rebase" / "Now do it." / "git push --force"
---
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
The Imgflip API returns ~100 popular templates. Not truly "trending" (ranked by all-time popularity), but a good general catalog.
curl -s "https://api.imgflip.com/get_memes" | python3 -c "
import sys, json
memes = json.load(sys.stdin)['data']['memes'][:20]
for m in memes:
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
The Imgflip API returns ~100 popular templates. Not truly "trending" (ranked by all-time popularity), but a good general catalog.
curl -s "https://api.imgflip.com/get_memes" | python3 -c "
import sys, json
memes = json.load(sys.stdin)['data']['memes'][:20]
for m in memes:
The manifest says this skill generates meme images using the memegen.link API and emphasizes URL-based meme production without local image generation. This script instead performs local image manipulation on arbitrary input files using Pillow, adding effects like saturation, JPEG artifacts, emoji overlays, and lens flare, with no memegen.link API usage at all.
The script’s stated behavior—searching Giphy and downloading GIFs—materially diverges from the skill’s declared purpose of generating meme image URLs via memegen.link. This kind of capability drift is dangerous because it introduces undeclared external service usage, extra data flow, and functionality users and reviewers would not reasonably expect from the skill.
The header explicitly advertises GIF search and local download behavior that conflicts with the documented memegen.link meme-generation purpose. Such inconsistencies increase security risk because they conceal real capabilities from operators and make review, consent, and policy enforcement less reliable.
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
ENCODED_QUERY=$(python3 -c "from urllib.parse import quote; print(quote('${QUERY}'))")
# Fetch top 5 results
RESPONSE=$(curl -s "https://api.giphy.com/v1/gifs/search?api_key=${GIPHY_API_KEY}&q=${ENCODED_QUERY}&limit=5&rating=pg-13")
# Extract and display URLs
echo "$RESPONSE" | python3 -c "
Requiring a Reddit username and password for a meme-generation skill is unjustified and materially increases risk by introducing unnecessary credential collection and authenticated third-party access. In this skill context, the capability is more dangerous because the declared purpose does not require any account-level access, making the credential use unexpected and hard to justify.
The script is explicitly designed to obtain an OAuth access token using supplied Reddit credentials, which constitutes credential handling and account access capability. In this skill’s context, that capability is unnecessary for simple meme generation and therefore represents an unjustified elevation of sensitivity and abuse potential.
fi
done
# Step 1: Get OAuth access token
TOKEN_RESPONSE=$(curl -s -X POST \
-d "grant_type=password&username=${REDDIT_USERNAME}&password=${REDDIT_PASSWORD}" \
--user "${REDDIT_CLIENT_ID}:${REDDIT_CLIENT_SECRET}" \
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
done
# Step 1: Get OAuth access token
TOKEN_RESPONSE=$(curl -s -X POST \
-d "grant_type=password&username=${REDDIT_USERNAME}&password=${REDDIT_PASSWORD}" \
--user "${REDDIT_CLIENT_ID}:${REDDIT_CLIENT_SECRET}" \
-H "User-Agent: MemeBot/1.0" \
The code parses and stores the returned access token for subsequent authenticated requests, extending the credential-handling chain beyond initial submission. This increases the blast radius of any logging, error handling, or environment leakage issue because a valid bearer token can be replayed to access Reddit resources.
ACCESS_TOKEN=$(echo "$TOKEN_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])" 2>/dev/null)
if [ -z "$ACCESS_TOKEN" ] || [ "$ACCESS_TOKEN" = "null" ]; then
echo "Error: Failed to get access token. Response: $TOKEN_RESPONSE" >&2
exit 1
fi
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
fi
# Step 2: Fetch trending templates from r/MemeTemplates
POSTS=$(curl -s \
-H "Authorization: bearer ${ACCESS_TOKEN}" \
-H "User-Agent: MemeBot/1.0" \
"https://oauth.reddit.com/r/MemeTemplates/hot?limit=${LIMIT}")
The manifest frames this skill as generating meme images using the memegen.link API with no local image generation needed. The README claims support for trending template sources from Imgflip/Reddit/Giphy and an included Pillow renderer for offline generation, which expands behavior beyond the manifest's stated API-based meme URL generation scope.
This command sends user-supplied meme text to an external third-party service and writes the returned content to a local file. In an agent setting, that creates a data-exfiltration/privacy risk if prompts or sensitive data are embedded in the meme text without user awareness.
# Drake meme
curl -s -o meme.png "https://api.memegen.link/images/drake/Writing_docs/Writing_memes.png?width=800"
# Custom background from Imgflip
curl -s -o meme.png "https://api.memegen.link/images/custom/Top/Bottom.png?background=https%3A//i.imgflip.com/30b1gx.jpg&width=800"