#8515: Lobster: disable Windows shell fallback
extensions: lobster
## Fix Summary
On Windows, the `lobster` tool retries failed spawns with `shell: true` and passes user-controlled `pipeline`, `argsJson`, or `token` directly into the argv list. When the fallback path is triggered (common when `lobster` is a `.cmd` wrapper), `cmd.exe` interprets metacharacters (e.g., `&`, `|`) allowing command injection and arbitrary code execution as the gateway user.
Fixes #8514
## Issue Linkage
Fixes #8514
## Security Snapshot
- CVSS v3.1: 9.9 (Critical)
- CVSS v4.0: 9.4 (Critical)
## Implementation Details
### Files Changed
- `extensions/lobster/src/lobster-tool.test.ts` (+51/-19)
- `extensions/lobster/src/lobster-tool.ts` (+21/-18)
### Technical Analysis
On Windows, the `lobster` tool retries failed spawns with `shell: true` and passes user-controlled `pipeline`, `argsJson`, or `token` directly into the argv list. When the fallback path is triggered (common when `lobster` is a `.cmd` wrapper), `cmd.exe` interprets metacharacters (e.g., `&`, `|`) allowing command injection and arbitrary code execution as the gateway user.
## Validation Evidence
- Command: `lobster`
- Status: failed
## Risk and Compatibility
non-breaking; compatibility impact was not explicitly documented in the original PR body.
## AI-Assisted Disclosure
AI-assisted: Codex CLI
This fix was generated with AI assistance (Codex CLI).
<details>
<summary>Prompt and Log Snippets (truncated)</summary>
_No prompt captured._
_No generation logs captured._
</details>
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR removes the Windows “retry with `shell: true`” spawn fallback for the lobster tool and tightens `lobsterPath` validation to only allow `lobster.exe` on Windows. The goal is to prevent command injection when user-controlled arguments are passed to a shell fallback (especially when lobster is provided via `.cmd`/PATHEXT wrappers).
Tests were updated to assert Windows now errors (asking for an absolute `lobster.exe` path) where previously PATH `.cmd` wrappers would work.
<h3>Confidence Score: 4/5</h3>
- This PR is generally safe to merge and meaningfully reduces a Windows command-injection risk surface.
- The change is localized (spawn options and Windows-specific fallback/validation) and tests were adjusted accordingly. Main residual concern is error handling: mapping broad Windows spawn errors to a single “not found” message can obscure genuine failures and complicate debugging.
- extensions/lobster/src/lobster-tool.ts (Windows error mapping in runLobsterSubprocess)
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19735: fix: inject CLAWD_URL/CLAWD_TOKEN env vars in Lobster plugin
by MisterGuy420 · 2026-02-18
79.8%
#9250: Fix: Add shell:true for Windows .cmd files to prevent spawn EINVAL ...
by vishaltandale00 · 2026-02-05
77.0%
#18143: fix(windows): wrap shell builtins with cmd.exe /c for proper execution
by brandonwise · 2026-02-16
75.3%
#13873: fix(sandbox): prevent Windows PATH from poisoning docker exec
by alessandrorodi · 2026-02-11
73.0%
#16525: fix(shell): stop rejecting newlines in double-quoted args (#16470)
by yinghaosang · 2026-02-14
72.8%
#20330: Fix SSH tunnel startup on Windows by resolving ssh from PATH
by graysurf · 2026-02-18
72.3%
#11159: fix(cli): parse --profile flag after subcommand name
by hclsys · 2026-02-07
71.5%
#5168: Fix: force UTF-8 for Windows exec
by ManojINaik · 2026-01-31
71.2%
#11602: fix(config): skip stale legacy config files when openclaw.json exists
by akoscz · 2026-02-08
70.4%
#5496: Fix: Windows path separators stripped in Gateway scheduled task
by giuliozelante · 2026-01-31
70.4%