Back to skill

Security audit

wsl-windows-bridge

Security checks for vulnerabilities and agentic risk

Overview

This skill openly bridges WSL to Windows, but it needs Review because it creates durable host command and file access and its setup script can persist shell commands from a crafted path value.

Review carefully before installing. Use only in trusted WSL/Windows environments, avoid entering untrusted path values, inspect or fix setup.sh before running it, and treat any win-ps, win-cmd, or win-python use as direct access to your Windows host files and programs.

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/setup.sh:16
Finding
Persistent Shell Command Injection Through Unsafely Generated Environment Configuration<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh`, lines 16–24 and 69–112 **Vulnerability Type**: Shell command injection through unescaped configuration generation **Risk Level**: High The setup script reads an attacker-influenced Windows root path, embeds it directly into an executable shell configuration file, and then sources that file during installation. ### Vulnerable Code Input is accepted without validation or shell-safe encoding: ```bash if [ -z "$DETECTED_WIN_ROOT" ]; then echo "WARNING: Could not auto-detect Windows Python. Please enter path manually." echo "" read -p "Windows root (e.g. D:\ or /mnt/d): " WIN_ROOT_INPUT WIN_ROOT="$WIN_ROOT_INPUT" else echo "Detected Windows root: $DETECTED_WIN_ROOT" WIN_ROOT="$DETECTED_WIN_ROOT" read -p "Python path [default: $WIN_ROOT/app/anaconda/python.exe]: " PYTHON_INPUT PYTHON_INPUT="${PYTHON_INPUT:-$WIN_ROOT/app/anaconda/python.exe}" fi ``` The value is inserted into executable shell source code without escaping: ```bash # 3. Generate env.windows.sh cat > "$OPENCLAW_ENV" << ENVEOF #!/bin/bash # === wsl-windows-bridge environment === # Auto-generated at $(date -u +%Y-%m-%dT%H:%M:%SZ) export WIN_BIN="\$HOME/.openclaw/bin" export PATH="\$WIN_BIN:\$PATH" export WIN_ROOT="$WIN_ROOT" export WIN_ANACONDA="$WIN_ROOT/app/anaconda" export WIN_SCRIPTS="$WIN_ROOT/app/scripts" export WIN_PROJECT="$WIN_ROOT/app/project" export WIN_PYTHON="$PYTHON_PATH" export WIN_PS="/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe" export WIN_CMD="/mnt/c/Windows/System32/cmd.exe" winpath() { wslpath -w "\$1" 2>/dev/null; } wslpath_win() { wslpath -u "\$1" 2>/dev/null; } win-python-check() { if [ -f "$PYTHON_PATH" ]; then echo "OK: $PYTHON_PATH" "$PYTHON_PATH" --version else echo "ERROR: Python not found at $PYTHON_PATH" return 1 fi } win-ps-check() { if [ -f "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powersh ...[truncated 3297 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Validate interactive input before using it.** Accept only expected WSL or Windows path formats and reject control characters, newlines, quotes, backticks, dollar signs, semicolons, and other shell metacharacters. 2. **Serialize values with shell-safe escaping.** Generate assignments using `printf '%q'` rather than interpolating values into a here-document: ```bash { printf '#!/bin/bash\n' printf 'export WIN_BIN=%q\n' "$HOME/.openclaw/bin" printf 'export WIN_ROOT=%q\n' "$WIN_ROOT" printf 'export WIN_ANACONDA=%q\n' "$WIN_ROOT/app/anaconda" printf 'export WIN_SCRIPTS=%q\n' "$WIN_ROOT/app/scripts" printf 'export WIN_PROJECT=%q\n' "$WIN_ROOT/app/project" printf 'export WIN_PYTHON=%q\n' "$PYTHON_PATH" printf 'export WIN_PS=%q\n' "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe" printf 'export WIN_CMD=%q\n' "/mnt/c/Windows/System32/cmd.exe" } > "$OPENCLAW_ENV" ``` 3. **Separate data from executable code.** Prefer storing path values in a non-executable configuration format. If a shell file is required, keep static function definitions in a trusted bundled file and place user-controlled values in a separately parsed data file. 4. **Avoid immediately sourcing generated files.** Perform verification using local variables or launch a clean subprocess only after validating the generated configuration. 5. **Restrict configuration permissions.** Create the file with a restrictive umask and verify that it is owned by the current user: ```bash umask 077 ``` 6. **Use atomic file generation.** Write to a securely created temporary file, validate its contents, set the required permissions, and atomically rename it to `~/.openclaw/env.windows.sh`. 7. **Add regression tests.** Test inputs containing quotes, command substitutions, newlines, semicolons, backticks, spaces, and Windows backslashes to confirm that they remain literal values and ...[truncated 32 chars]
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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
Findings (3)

Session Persistence

Medium
Category
Rogue Agent
Content
## What This Does

Provides six commands (`win-python`, `win-ps`, `win-cmd`, `win-copy`, `win-run-py`, `win-path`) that let OpenClaw agents running in WSL2 seamlessly call Windows Python, execute PowerShell/CMD commands, and read/write Windows files.

## Architecture
Confidence
69% confidence
Finding
The documented architecture installs persistent executables under ~/.openclaw/bin and a generated environment file under ~/.openclaw/env.windows.sh, creating ongoing capability for future sessions to invoke Windows commands and access Windows files. While not persistence in the malware sense by itself, it does establish durable cross-system execution hooks that could be abused later by an agent or another process with access to the account.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The README explicitly advertises that the skill enables agents in WSL to execute Windows PowerShell/CMD/Python and read/write Windows files, but it does not warn about the trust boundary expansion or the risk of modifying host data and system state. In an agent skill, this materially increases blast radius because routine agent actions can cross from the sandboxed Linux environment into the Windows host without prominent operator awareness.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill clearly exposes shell-capable cross-boundary execution primitives (`win-ps`, `win-cmd`, `win-python`) but does not declare any explicit tool scope or permissions metadata. That omission weakens policy enforcement and makes it easier for an agent or user to invoke powerful Windows commands and file operations without clear security boundaries, especially given the bridge spans WSL and the host Windows environment.

Static analysis

No suspicious patterns detected.