Back to skill

Security audit

ClawDefender - OpenClaw Security - Prompt injection, rogue skills etc

Security checks for vulnerabilities and agentic risk

Overview

This skill is a mostly coherent security helper, but its “safe install” path executes an unpinned installer before scanning and its sanitizer/URL checks are weaker than advertised.

Install only if you treat this as a lightweight regex helper, not a security boundary. Avoid using its --install mode for untrusted skills, use strict blocking for agent-facing input pipelines, and do not rely on its URL validator as the only SSRF protection before fetching external URLs.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (3)

T08 · Insecure Dependencies

Error
Location
scripts/clawdefender.sh:598
Finding

Unpinned Third-Party Installer Executes Before Security Scanning

Content
View full analysis
&1; then echo -e "${RED}✗${NC} Installation failed" return 1 fi echo -e "${GREEN}✓${NC} Installed" # Scan echo "" echo -e "${BLUE}[2/2] Security scan...${NC}" local installed_path="$SKILLS_DIR/$skill_name" if [ -d "$installed_path" ]; then scan_skill_files "$installed_path" local findings=$? if [ $findings -gt 0 ]; then echo "" echo -e "${YELLOW}⚠️ Security issues detected!${NC}" read -p "Keep this skill? (y/N) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then rm -rf "$installed_path" ``` ### Technical Analysis The purportedly safe installation process invokes `npx clawhub install` before inspecting the downloaded skill. The `clawhub` package is not pinned to a specific version or verified using an integrity digest. Depending on package-manager state and registry behavior, `npx` may retrieve and execute package code. The installed skill or its installation mechanism may also perform lifecycle actions before `scan_skill_files` is reached. Consequently, the scan is retrospective and cannot prevent execution-time side effects. Deleting the installed directory after detecting a finding does not reverse commands already executed, files written elsewhere, credentials accessed, network requests made, or persistence created by an installer. The scanner also only performs regex-based inspection of selected file extensions. This is not a reliable sandbox and cannot establish that an installed package is safe to execute. ### Attack Path 1. An attacker publishes or compromises the package resolved as `clawhub`, or provides a malicious skill through the associat ...[truncated 1166 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/clawdefender.sh:294
Finding

Substring-Based Domain Allowlist Permits SSRF Validation Bypass

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/sanitize.sh:78
Finding

Default Sanitization Mode Passes Detected Prompt Injection Through Unchanged

Content
View full analysis
&1) || true # Parse result if echo "$RESULT" | grep -q "CRITICAL\|WARNING"; then # Injection detected SEVERITY="WARNING" echo "$RESULT" | grep -q "CRITICAL" && SEVERITY="CRITICAL" # Extract pattern matches PATTERNS=$(echo "$RESULT" | grep -oE "Pattern: [^(]+" | head -3 | tr '\n' ', ' | sed 's/, $//') if $REPORT_ONLY; then echo "⚠️ INJECTION DETECTED [$SEVERITY]" echo "Patterns: $PATTERNS" echo "" echo "--- Raw Detection ---" echo "$RESULT" exit 0 fi if $STRICT; then if ! $SILENT; then echo -e "${RED}⛔ BLOCKED: Prompt injection detected [$SEVERITY]${NC}" >&2 echo -e "${YELLOW}Patterns: $PATTERNS${NC}" >&2 fi exit 1 fi if ! $SILENT; then echo -e "${YELLOW}⚠️ SUSPICIOUS CONTENT DETECTED [$SEVERITY]${NC}" >&2 echo -e "${YELLOW}Patterns: $PATTERNS${NC}" >&2 echo -e "${YELLOW}--- Content follows (review carefully) ---${NC}" >&2 fi # Output with visible warning marker echo "⚠️ [FLAGGED - Potential prompt injection detected]" echo "$INPUT" echo "⚠️ [END FLAGGED CONTENT]" ``` ### Technical Analysis The default mode detects suspicious instructions but still emits the original input unchanged to standard output. Adding warning markers does not remove, neutralize, encode, or structurally isolate the hostile instructions. This behavior is particularly risky because the documented usage pipes external email and API content through `sanitize.sh` before Agent processing. In such a pipeline, stdout is likely to become part of the Agent's context. An AI model may still interpret and follow instructions enc ...[truncated 1781 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
Findings (59)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill claims broad protection against prompt injection, command injection, SSRF, credential exfiltration, path traversal, and workspace auditing, but the provided documentation does not substantiate those capabilities. Overstated security claims are dangerous because operators may trust the skill as a protective control and skip real validation, creating a false sense of safety.

Content

No source excerpt is available for this finding.

YARA rule 'agent_skill_prompt_injection_hidden_instructions': Prompt injection or hidden instructions embedded in AI agent skill text [agent_skills]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

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

md
---
name: clawdefender
description: Security scanner and input sanitizer for AI agents. Detects prompt injection, command injection, SSRF, credential exfiltration, and path traversal attacks. Use when (1) installing new skills from ClawHub, (2) processing external input like emails, calendar events, Trello cards, or API responses, (3) validating URLs before fetching, (4) running security audits on your workspace. Protects agents from malicious content in untrusted data sources.
---

# ClawDefender

Security toolkit for AI agents. Scans skills for malware, sanitizes external input, and blocks prompt injection attacks.

## Installation

Copy scripts to your workspace:

`

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
chmod +x scripts/clawdefender.sh scripts/sanitize.sh

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

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.

Content

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

md
# Silent mode - no warnings, just filter

Cloud Metadata Access

High
Category
Server-Side Request Forgery
Confidence
90% confidence
Finding

Code accesses a cloud instance metadata endpoint (e.g. 169.254.169.254). A single request can return temporary IAM credentials, making this a high-value SSRF target for credential theft.

Content

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

md
./scripts/clawdefender.sh --check-url "https://github.com"
# ✅ URL appears safe

./scripts/clawdefender.sh --check-url "http://169.254.169.254/latest/meta-data"
# 🔴 SSRF: metadata endpoint

./scripts/clawdefender.sh --check-url "https://webhook.site/abc123"

Cloud Metadata Access

High
Category
Server-Side Request Forgery
Confidence
90% confidence
Finding

Code accesses a cloud instance metadata endpoint (e.g. 169.254.169.254). A single request can return temporary IAM credentials, making this a high-value SSRF target for credential theft.

Content

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

md
./scripts/clawdefender.sh --check-url "https://github.com"
# ✅ URL appears safe

./scripts/clawdefender.sh --check-url "http://169.254.169.254/latest/meta-data"
# 🔴 SSRF: metadata endpoint

./scripts/clawdefender.sh --check-url "https://webhook.site/abc123"

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

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).

Content

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

Check any text for all threat patterns:

bash
./scripts/clawdefender.sh --validate "rm -rf / --no-preserve-root"
# 🔴 CRITICAL [command_injection]: Dangerous command pattern

YARA rule 'agent_skill_destructive_autonomous_actions': Autonomous destructive filesystem, shell history, or repository actions in AI agent skills [agent_skills]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

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

wdefender.sh --check-prompt

✅ Clean

text

### Safe Skill Installation (`--install`)

Scan a skill after installing:

```bash
./scripts/clawdefender.sh --install some-new-skill

Runs npx clawhub install, then scans the installed skill. Warns if critical issues found.

Text Validation (--validate)

Check any text for all threat patterns:

bash
./scripts/clawdefender.sh --validate "rm -rf / --no-preserve-root"
# 🔴 CRITICAL [command_injection]: Dangerous command pattern

Detection Categories

Prompt Injection (90+ patterns)

Critical - Direct instruction override:

  • ignore previous instructions, disregard.*instructions
  • forget everything, override your instructions
  • new system prompt, reset to default
  • you are no longer, you have no restrictions
  • reveal the system prompt, what instructions were you given

Warning - Manipulation attempts:

  • pretend to be, act as if, roleplay as
  • hypothetically, in a fictional world

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
90% confidence
Finding

Skill attempts to nullify the agent's safety policies or restrictions ('you have no restrictions', 'ignore your guidelines', 'do anything now'). This is a direct jailbreak that disables guardrails.

Content

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

md
- `you are no longer`, `you have no restrictions`

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
### Path Traversal

- `../../../` sequences
- `/etc/passwd`, `/etc/shadow`, `/root/`
- URL-encoded variants (`%2e%2e%2f`)

## Automation Examples

Static analysis

Detected: suspicious.prompt_injection_instructions

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
SKILL.md:103