The vulnerability, identified as GHSA-j425-whc4-4jgc, is a security bypass in OpenClaw's system.run functionality. The root cause was an incomplete environment variable sanitization process. The core logic flaw resided in the isDangerousHostEnvOverrideVarName function (and its Swift equivalent in HostEnvSanitizer), which was responsible for identifying and blocking potentially malicious environment variables supplied by a user.
The original implementation only checked for an exact match against a denylist of variable names. This left the system open to attacks using variables that were not on the exact-match list but are known to be dangerous, such as GIT_SSH_COMMAND, or variables that work as a family using a common prefix, like GIT_CONFIG_* and NPM_CONFIG_*.
An attacker with the ability to invoke system.run and provide environment variable overrides could exploit this flaw. By setting a variable like GIT_SSH_COMMAND, they could force an allowlisted tool (e.g., git) to execute an arbitrary command, effectively bypassing the security controls and command-line review process.
The patch addresses this by extending the sanitization logic. It adds a new denylist for variable prefixes (blockedOverridePrefixes) and expands the list of exact-match keys. The isDangerousHostEnvOverrideVarName function was updated to check both the exact-match list and the new prefix list, ensuring a much broader range of dangerous variables are caught and removed. The functions sanitizeSystemRunEnvOverrides and sanitizeHostExecEnv, which are called to prepare the environment for subprocesses, now correctly filter out these malicious variables, closing the bypass vulnerability.