The vulnerability in OpenClaw's gateway tool was due to an insecure implementation of a configuration mutation guard. The system used a denylist (PROTECTED_GATEWAY_CONFIG_PATHS) to prevent model-driven agents from modifying sensitive configuration settings via the config.apply and config.patch actions. However, this denylist was incomplete and did not cover all sensitive configuration paths. As a result, a compromised or malicious agent could modify critical settings, leading to a persistent security compromise.
The core of the vulnerability lies in the assertGatewayConfigMutationAllowed function in src/agents/tools/gateway-tool.ts. Before the patch, this function, along with its helpers isProtectedPathEqual, getValueAtPath, and getValueAtCanonicalPath, would check if any of the paths in the denylist were being modified. If a sensitive path was not on the list, the change would be allowed.
The fix, implemented in commit bceda6089aa7b3695cc7696b43c61ae3d01bb0ec, replaces this flawed denylist mechanism with a fail-safe allowlist (ALLOWED_GATEWAY_CONFIG_PATHS). The assertGatewayConfigMutationAllowed function was rewritten to only permit changes to a small, well-defined set of configuration paths that are safe for an agent to modify. Any attempt to change a path not on the allowlist is rejected. This change effectively closes the vulnerability by ensuring that any new, potentially sensitive configuration paths are protected by default.