NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · OpenClaw

CVE-2026-31994: OpenClaw Windows Scheduled Task script generation allowed local command injection via unsafe cmd argument handling

highCVSS 4.0 8.5GHSA-mqr9-vqhq-3jxw

OpenClaw before 2026.2.19 built the Windows `gateway.cmd` startup script from arguments that were not fully quoted or escaped. Values made only of cmd metacharacters, `%` or `!` expansions, and CR/LF line breaks could add commands that run when the scheduled task starts. Upgrade `openclaw` to 2026.2.19.

Published Mar 3, 2026 · Updated Mar 19, 2026 · Analysis Oct 31, 2026

What an attacker can do

The flaw sits in Windows daemon script generation, src/daemon/schtasks.ts. The advisory lists three gaps: incomplete cmd quoting for values that consist only of metacharacters, incomplete handling of expansion-sensitive characters in script arguments, and no check for CR/LF in rendered fields (CWE-116). A line break in a value lets an attacker start a new line in the batch file, which is a new command.

This is local to Windows. The attacker must control a value that feeds script generation: an install-time or runtime argument, a task description, or an environment-derived value. The CVSS 4.0 vector shows local access, low privileges and high impact on confidentiality, integrity and availability.

The injected command runs in the scheduled task's context each time the task fires. If the task runs as a more privileged account than the person who supplied the value, this is a privilege-escalation route. It is a sibling of the environment-assignment injection in CVE-2026-22176, with a different input path: command arguments, task descriptions and CR/LF, not only set KEY=VALUE lines.

Who is affected

The openclaw npm package below 2026.2.19 (2026.2.17 was the latest published version on 2026-02-19), on Windows installs that register the gateway as a Scheduled Task. Check with:

npm ls -g openclaw

Open the generated gateway.cmd and look for argument lines with stray &, |, % or !, or lines you did not expect.

openclaw

Ecosystem
npm
Affected
< 2026.2.19
Fixed in
2026.2.19
Check
npm ls openclaw

How to fix it

Upgrade to openclaw 2026.2.19 or later and regenerate the service script by reinstalling the gateway task.

The fix commit is 280c6b117b2f0e24f398e5219048cd4cc3b82396. It separates schtasks argument quoting from batch-script quoting, quotes metacharacter arguments, escapes % and !, and rejects CR/LF in command arguments, task descriptions and rendered environment assignments. Regression tests cover metacharacter and line-break injection. The advisory lists no workaround.

How to tell if you were hit

Read gateway.cmd and the Scheduled Task definition for extra lines or odd characters in arguments and descriptions. In Windows event logs, look for child processes of cmd.exe launched by the OpenClaw task that are not the gateway itself. The advisory gives no log signature and no report of exploitation.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

OpenClaw Windows Scheduled Task script generation allowed unsafe argument handling in generated gateway.cmd files. In vulnerable versions, cmd metacharacter-only values could be emitted without safe quoting/escaping, which could lead to unintended command execution when the scheduled task runs.

Details

The issue affected Windows daemon startup script generation in src/daemon/schtasks.ts.

Vulnerable behavior included:

  • Incomplete cmd argument quoting for metacharacter-only values.
  • Incomplete handling of cmd expansion-sensitive characters in script arguments.
  • Missing CR/LF guards for script-rendered fields.

The fix hardens Windows script generation by:

  • Separating schtasks argument quoting from batch script argument quoting.
  • Quoting cmd metacharacter arguments and escaping % / ! expansion cases.
  • Rejecting CR/LF in command arguments, task descriptions, and rendered environment assignments.
  • Adding regression tests for metacharacter and line-break injection paths.

Impact

This issue is local to Windows deployments and requires control over values that feed service script generation (for example install-time/runtime arguments or environment-derived values). It can result in unintended command execution in the scheduled task context.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Vulnerable versions: <= 2026.2.17
  • Patched version: >= 2026.2.19 (planned next npm release)
  • Latest published npm version at update time (2026-02-19): 2026.2.17

Fix Commit(s)

  • 280c6b117b2f0e24f398e5219048cd4cc3b82396

OpenClaw thanks @tdjackey for reporting.

Credited to tdjackey.

Questions

How is CVE-2026-31994 different from CVE-2026-22176?

Both affect Windows Scheduled Task script generation. This one covers argument quoting, % and ! expansion and CR/LF in fields. CVE-2026-22176 covers unquoted environment assignments.

Is it remotely exploitable?

The advisory calls it local to Windows. It needs control over values that feed service script generation.

Which version fixes it?

openclaw 2026.2.19. Earlier versions are listed as vulnerable.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More OpenClaw vulnerabilities

All OpenClaw entries