{"id":"CVE-2026-22176","aliases":["CVE-2026-22176","GHSA-pj5x-38rw-6fph"],"related":[],"kind":"vulnerability","state":"published","title":"OpenClaw < 2026.2.19 - Command Injection via Unescaped Environment Variables in Windows Scheduled Task Script Generation","summary":"OpenClaw versions prior to 2026.2.19 contain a command injection vulnerability in Windows Scheduled Task script generation where environment variables are written to gateway.cmd using unquoted set KEY=VALUE assignments, allowing shell metacharacters to break out of assignment context. Attackers can inject arbitrary commands through environment variable values containing metacharacters like &, |, ^, %, or ! to achieve command execution when the scheduled task script is generated and executed.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"OpenClaw versions prior to 2026.2.19 contain a command injection vulnerability in Windows Scheduled Task script generation where environment variables are written to gateway.cmd using unquoted set KEY=VALUE assignments, allowing shell metacharacters to break out of assignment context. Attackers can inject arbitrary commands through environment variable values containing metacharacters like &, |, ^, %, or ! to achieve command execution when the scheduled task script is generated and executed.","source":"cvelist"},{"lang":"en","text":"### Summary\nA command injection vulnerability existed in Windows Scheduled Task script generation for OpenClaw. Environment values were written into `gateway.cmd` using unquoted `set KEY=VALUE`, which allowed Windows shell metacharacters in config-provided environment variables to break out of assignment context.\n\n### Affected Packages / Versions\n- Package: `openclaw` (npm)\n- Affected versions: `<= 2026.2.17`\n- Patched version: `>= 2026.2.19`\n- Latest published vulnerable version at review time (2026-02-19): `2026.2.17`\n\n### Practical Risk Context\nFor a single-user, localhost-only setup on a personally controlled machine, practical risk is typically low.\n\nThis issue becomes materially relevant when configuration or environment values are sourced from less-trusted inputs, for example:\n- shared/team config templates,\n- copied config snippets,\n- setup scripts, automation, or repos that write config,\n- any workflow where another party can influence env values before `gateway install`/reinstall.\n\nIn those scenarios, it provides a reliable config-to-command-execution path when the scheduled task script is generated and run.\n\n### Details\nOn Windows, gateway service installation writes a helper batch script and then registers it via Scheduled Task (`schtasks`).\nBefore the fix, env lines were rendered as `set KEY=VALUE` in `src/daemon/schtasks.ts`, so values containing metacharacters (for example `&`, `|`, `^`, `%`, `!`) could alter command behavior in `cmd.exe`.\n\nThe fix now renders quoted assignments (`set \"KEY=VALUE\"`) with explicit escaping for cmd metacharacters, updates parser compatibility for quoted assignments, and adds regression tests for metacharacter handling and round-trip parsing.\n\n### Fix Commit(s)\n- `dafe52e8cf1a041d898cfb304a485fa05e5f58fb`\n\nOpenClaw thanks @tdjackey for reporting.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Las versiones de OpenClaw anteriores a la 2026.2.19 contienen una vulnerabilidad de inyección de comandos en la generación de scripts de Tareas Programadas de Windows, donde las variables de entorno se escriben en gateway.cmd utilizando asignaciones set KEY=VALUE sin comillas, permitiendo que los metacaracteres de shell escapen del contexto de asignación. Los atacantes pueden inyectar comandos arbitrarios a través de valores de variables de entorno que contengan metacaracteres como &amp;, |, ^, %, o ! para lograr la ejecución de comandos cuando el script de la tarea programada se genera y ejecuta.","source":"nvd"}],"published":"2026-03-03T21:50:05.000Z","modified":"2026-06-23T16:13:49.077Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N","score":6.9,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-78"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"2026.2.19","status":"affected"},{"type":"semver","version":"2026.2.19","status":"unaffected"}],"vendor":"OpenClaw","product":"OpenClaw","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2026.2.19"}],"ecosystem":"npm","package":"openclaw","purl":"pkg:npm/openclaw","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2026.2.19"}],"vendor":"openclaw","product":"openclaw","cpe":"cpe:2.3:a:openclaw:openclaw:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/openclaw/openclaw/security/advisories/GHSA-pj5x-38rw-6fph","tags":["mitigation","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/openclaw/openclaw/commit/dafe52e8cf1a041d898cfb304a485fa05e5f58fb","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/openclaw-command-injection-via-unescaped-environment-variables-in-windows-scheduled-task","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-22176","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/openclaw/openclaw","tags":["package"],"sources":["ghsa"]}],"credits":["tdjackey"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-03-23T16:44:22.121Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-22176","url":"https://www.cve.org/CVERecord?id=CVE-2026-22176","licence":"CVE Terms of Use","modified":"2026-06-23T16:13:49.077Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pj5x-38rw-6fph","url":"https://github.com/advisories/GHSA-pj5x-38rw-6fph","licence":"CC-BY-4.0","modified":"2026-03-20T21:56:22.292Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-22176","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-22176","licence":"Public domain","modified":"2026-06-17T10:19:29.097Z"}],"updatedAt":"2026-11-25T22:59:16.153Z","epss":{"score":0.00746,"percentile":0.56043,"date":"2026-12-01T12:00:22.000Z"}}