Files
ruflo/v3/@claude-flow/cli/src
Reuven fb256ac596 fix(security): denylist loader-hijack env vars in terminal_create (audit_1776853149979)
terminal_create accepted a Record<string,string> of env vars and merged it
straight into execSync's process env for every subsequent command in the
session. A caller that controls MCP input could set LD_PRELOAD,
DYLD_INSERT_LIBRARIES, or NODE_OPTIONS=--require ./evil.js — functionally
RCE on the host running the MCP server.

Added validateEnv() in validate-input.ts:
  - names must match /^[A-Za-z_][A-Za-z0-9_]{0,127}$/ (POSIX shape)
  - rejects LD_PRELOAD, LD_LIBRARY_PATH, LD_AUDIT, DYLD_INSERT_LIBRARIES,
    DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, DYLD_FORCE_FLAT_NAMESPACE,
    NODE_OPTIONS, NODE_PATH (loader/runtime hijack vectors)
  - values must be string, no null bytes, ≤32K
  - undefined/null env yields {} (preserves existing API)

Wired through terminal_create. Replaced unchecked cast with sanitized output.

Verified via tsx fixture: 11 cases — empty/undefined/valid pass, all three
loader-hijack vectors rejected, bad names (= in key, digit-first) rejected,
non-object/non-string-value/null-byte rejected.

Closes audit_1776853149979 finding "missing input validation on session.update/
memory.set" — the session/memory tools already validate identifiers and value
sizes via validateMemoryInput / validateText / validateIdentifier; the actual
hole was env passthrough in terminal_create, which the audit's wording missed
but which has the same root cause (untrusted input reaches a privileged
context unfiltered).
2026-05-03 20:22:01 -04:00
..
2026-01-04 23:50:45 +00:00
2026-01-05 19:40:01 +00:00
2026-01-07 04:36:20 +00:00
2026-01-14 18:48:53 +00:00