The vulnerability, GHSA-8fmp-37rc-p5g7, stems from OpenClaw's failure to properly sanitize environment variables across multiple parts of its codebase. The core issue was that several functions responsible for handling environment variables used incomplete, decentralized blocklists, allowing malicious actors to inject dangerous variables (e.g., BASH_ENV, LD_PRELOAD, DYLD_INSERT_LIBRARIES). These variables could be used to control the application's runtime behavior and achieve arbitrary code execution at startup.
The patch addresses this by introducing a centralized and more comprehensive sanitization mechanism in src/infra/host-env-security.ts for TypeScript code and apps/macos/Sources/OpenClaw/HostEnvSanitizer.swift for Swift code. The vulnerable functions, which previously had their own flawed sanitization logic, were refactored to use these new, secure utilities.
The analysis identified the key functions that were vulnerable prior to the patch. These include collectConfigEnvVars, which ingested unsanitized variables from configuration, and several sanitizeEnv or sanitizedEnv methods across the Node.js and macOS components that failed to block all dangerous variables.