Summary
OpenClaw before 2026.4.20 exposes a guard bypass in the agent-facing config.patch and config.apply gateway endpoints, allowing modification of operator-trusted settings without proper authorization checks.
A prompt-injected model that can access the owner-only gateway tool may persist unauthorized changes to sandbox policies, plugins, gateway auth/TLS, routing hooks, MCP servers, SSRF controls, and filesystem hardening, potentially weakening overall system security.
Affected context
The vulnerability appears in OpenClaw deployments where:
- Agent-facing gateway endpoints (
config.patchandconfig.apply) are exposed for configuration management - Operator-trusted settings (sandbox policy, plugin enablement, gateway auth/TLS, hook routing, MCP server configuration, SSRF policy, filesystem hardening) are intended to be protected from routine agent-level changes
- Models or agents can invoke an "owner-only" gateway tool, but the backend endpoints do not consistently enforce the stricter authorization rules for protected settings
In such contexts, a compromised or prompt-injected model can act through the gateway tool to alter security-sensitive configuration that operators normally treat as static or tightly controlled.
Exploit preconditions
- Attack surface: Agent-facing gateway API, specifically the
config.patchandconfig.applyendpoints. - Required access: Ability for a model or automated agent to invoke the owner-only gateway tool, either legitimately (via intended capabilities) or via prompt injection / model misuse.
- Trigger point: Submission of configuration updates that include operator-trusted fields (sandbox policies, plugin toggles, authentication/TLS, routing hooks, MCP endpoints, SSRF rules, filesystem protections).
- Why exploitation is possible: The endpoints perform configuration changes without reliably enforcing fine-grained authorization on protected settings, allowing a caller with generic tool access to bypass intended operator-only guards and persist policy downgrades.
Why this happens
The root cause is incomplete authorization enforcement on sensitive configuration paths, aligning with CWE-862: Missing Authorization.
The gateway exposes configuration mutation endpoints that treat all configuration fields similarly, without consistently distinguishing operator-trusted settings from routine, agent-tunable options.
As a result, calls originating from models via the owner-only tool are trusted as if they were operator actions, even when they target critical security controls like sandboxing, network egress rules, or filesystem hardening.
This design pattern places too much trust in the caller identity (the tool) rather than enforcing explicit, server-side checks for each protected configuration domain.
Potential impact
- A prompt-injected or compromised model can weaken or disable sandbox policies, increasing the blast radius of subsequent compromises.
- Plugins may be silently enabled, disabled, or reconfigured, altering the agent's capability surface and enabling abuse of powerful integrations.
- Gateway authentication or TLS settings can be downgraded, misconfigured, or turned off, exposing traffic to interception or impersonation.
- Hook routing and MCP server configurations can be modified to redirect data flows, exfiltrate information, or inject untrusted external control planes.
- SSRF policies may be relaxed, allowing the system to reach internal services or metadata endpoints previously restricted.
- Filesystem hardening options can be reduced, giving agents broader read/write access to local data and configuration.
- Overall, operators may lose assurance that their security posture remains as configured, because unauthorized changes can persist without clear visibility.
General mitigation guidance
Mitigation typically focuses on reinforcing authorization boundaries around configuration management and segregating sensitive controls from routine agent operations.
Recommended patterns include:
- Field-level authorization: Apply explicit server-side checks that distinguish operator-trusted settings (sandbox, auth/TLS, SSRF, filesystem, routing, MCP endpoints, plugin controls) from regular configuration, enforcing stricter roles or trust levels for protected fields.
- Config tiering: Split configuration into separate domains (e.g., operator-only security baseline vs. agent-tunable preferences) and expose only the safe tier through agent-facing tools.
- Policy-as-code with approval workflows: Require human/operator approval or out-of-band verification for changes to critical security policies or network-related knobs.
- Defense-in-depth at the gateway: Enforce immutable or minimally mutable defaults for high-risk options, such as mandatory TLS, non-bypassable sandbox boundaries, and non-relaxable SSRF rules.
- Least-privilege for tools: Design gateway tools so models have the smallest feasible configuration surface, avoiding general-purpose config mutation APIs where possible.
How teams detect issues like this
Effective detection focuses on both code-level authorization gaps and runtime configuration anomalies.
Potential strategies include:
- Static analysis and code review:
- Search for configuration endpoints that update security-sensitive fields without explicit role or capability checks.
- Flag handlers that accept generic configuration blobs and apply them directly without field-by-field authorization logic.
- Review any "owner-only" or privileged tools to ensure that their backend implementations enforce the intended access model.
- Configuration change monitoring:
- Log all changes to operator-trusted settings, including who/what initiated the change and via which tool or endpoint.
- Establish alerts for modifications to sandbox policies, plugin enablement, auth/TLS parameters, SSRF rules, MCP endpoints, and filesystem protections.
- Policy enforcement:
- Apply centralized policy engines (e.g., authorization middlewares or policy-as-code frameworks) to enforce that only authorized principals can mutate high-risk configuration keys.
- Automated review tooling:
- Use security scanners or CI checks tuned to flag missing authorization around configuration APIs, as well as unexpected diffs in security-related configuration files.

