Back to skill

Security audit

Willow Context Sentinel

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Willow context checker, but its bundled script has an unsafe path-handling flaw that could run injected Python in a manipulated environment.

Review before installing. Use only in a trusted local Willow/OpenClaw environment, and patch the script to pass file paths to Python via arguments instead of embedding them in generated Python source. Also declare python3 as a runtime requirement and be aware the skill encourages recurring automatic execution through heartbeat integration.

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

Error
Location
scripts/check_context.sh:16
Finding

Arbitrary Python Code Execution Through Unsafe HOME Path Interpolation

Content
View full analysis
/dev/null || true) if [[ "$pg_status" == "down" || "$pg_status" == "false" ]]; then echo "POSTGRES_DOWN" exit 0 fi else echo "WARNING: $SESSION_ANCHOR not found — skipping postgres check" >&2 fi # --------------------------------------------------------------------------- # Context check via prompt_count # --------------------------------------------------------------------------- if [[ ! -f "$ANCHOR_STATE" ]]; then echo "WARNING: $ANCHOR_STATE not found — cannot read prompt_count, defaulting to STATUS_OK" >&2 echo "STATUS_OK" exit 0 fi prompt_count=$(python3 -c " import json, sys try: data = json.load(open('$ANCHOR_STATE')) val = data.get('prompt_count', 0) print(int(val)) except Exception as e: print('ERROR reading prompt_count: ' + str(e), file=sys.stderr) sys.exit(1) " 2>/dev/null) || { ``` ### Technical Analysis The script constructs both state-file paths from the process-controlled `HOME` environment variable and then directly embeds those paths inside Python source code supplied to `python3 -c`. Shell quotin ...[truncated 2784 chars]
Remediation
View remediation
&2 echo "STATUS_OK" exit 0 } ``` Additional hardening measures should include: 1. Validate that `HOME` is nonempty and resolves to an expected absolute directory. 2. Avoid `python3 -c` whenever external values would become part of generated source. 3. Consider moving JSON parsing into a checked-in Python file with paths supplied only as command-line arguments. 4. Resolve and validate state-file paths before opening them if the execution environment has a defined trusted home directory. 5. Add regression tests using paths containing quotes, spaces, newlines, semicolons, parentheses, and other metacharacters. 6. Declare `python3` as a required runtime binary in the Skill metadata, since the script depends on it. ]]>
Vulnerability Patterns
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to read local state files and execute a shell script, but it does not declare any explicit tool scope such as permissions or allowed-tools. That creates an authorization gap: an orchestrator or reviewer cannot reliably constrain or audit the file-read capability the skill depends on, which can lead to unintended access beyond the intended Willow state files.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.