fix: patch CWE-78 OS command injection in acceptance verify commands#236
Closed
yabets4 wants to merge 1 commit into
Closed
fix: patch CWE-78 OS command injection in acceptance verify commands#236yabets4 wants to merge 1 commit into
yabets4 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vulnerability Report — 2026-05-31
[CRITICAL] CWE-78 — OS Command Injection via
shell: truein Acceptance Verify CommandsCVSS: 9.1 (Critical) | CWE: CWE-78 | KEV: N/A (not a CVE — general vulnerability pattern)
OWASP: A01:2017 - Injection, A03:2021 - Injection, A05:2025 - Injection
ATT&CK Techniques:
CAPEC Patterns:
Finding:
src/runs/shared/acceptance.ts:469-477—spawn()called withshell: trueandcommand.commandfrom user/LLM-controlled acceptance configSeverity: CRITICAL — remote code execution if attacker can influence agent chain definitions or acceptance verify commands
Kill Chain Analysis
Entry Point: An attacker controls
AcceptanceVerifyCommand.commandvia:chain-serializer.tsPrecondition: Attacker must be able to write/modify an agent chain config file or influence the LLM-generated acceptance criteria
Exploitation: With
shell: true, any shell metacharacters in the command string are interpreted:Impact: Arbitrary OS command execution on the agent machine, leading to:
CVSS v3.1 Vector: AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H = 9.1 Critical
Files Patched
src/runs/shared/acceptance.tsshell: true→shell: false; added explicit args array with auto-split fallbacksrc/shared/types.tsargs: string[]field toAcceptanceVerifyCommandinterfacetest/unit/acceptance.test.tsPatch Diff
src/runs/shared/acceptance.ts (key changes):
Why this fixes the vulnerability:
shell: falsemeans Node.js spawns the executable directly, bypassing shell interpretation;,&&,|,$(), backticks) are no longer interpreted"node --version"style command stringsRemaining Semgrep Findings (Informational — False Positives)
The remaining 11 Semgrep findings on
subagent-runner.ts:244flagchild_process.spawn/execFilecalls as potentially dangerous when args come from function arguments. These are false positives:shell: falseshell: false, command injection is not possible regardless of args contentThe fix for the acceptance.ts vulnerability also partially mitigates these by ensuring all spawn calls consistently use
shell: false.Summary
PR:
fix/heal-yabets4-pi-subagents-1780236810