Summary
OpenClaw before 2026.3.31 contains an authorization flaw where operator scopes are not fully cleared in trusted-proxy authentication mode. Under specific identity-bearing request flows, self-declared scopes from non-Control-UI clients can persist and be treated as trusted.
This can allow an attacker to escalate to operator.admin privileges when they can influence scope declarations on requests passing through the trusted proxy.
Affected context
The vulnerability appears in OpenClaw deployments configured to use a trusted-proxy authentication mode, where upstream proxies forward identity and scope information to OpenClaw.
It mainly affects flows where:
- Non-Control-UI clients can send or influence scope declarations,
- The proxy or gateway forwards those scopes as part of the authenticated context, and
- The application relies on scope-clearing or re-mapping logic before assigning final privileges.
When scope-clearing is incomplete on these paths, self-declared scopes can be misinterpreted as trusted operator scopes.
Exploit preconditions
- Attack surface: HTTP or API endpoints behind the trusted proxy that accept or propagate identity and scope information.
- Required access: Ability to send requests through the trusted proxy as, or on behalf of, an authenticated client (e.g., possessing a valid session, token, or network position to reach the proxy).
- Trigger point: Declaring or manipulating operator-like scopes on non-Control-UI client requests and causing those requests to reach an identity-bearing authentication path.
- Why exploitation is possible: The authorization layer does not fully clear or re-evaluate self-declared scopes when transitioning from untrusted to trusted context, allowing attacker-controlled scope values to be treated as authoritative and granting operator.admin privileges.
Why this happens
This issue stems from incomplete authorization scoping and sanitization in the trusted-proxy mode.
The system treats scopes coming from certain client contexts as if they were fully validated, but fails to reliably clear or overwrite scopes that originated from non-privileged, self-declared sources.
This aligns with CWE-863: Improper Authorization, where enforcement decisions are based on incomplete or improperly sanitized context, enabling users to gain access to resources or operations beyond their intended privileges.
Conceptually, the authorization logic couples trust in the proxy with trust in all scope attributes forwarded by it, instead of enforcing a strict boundary between user-controlled scope declarations and server-assigned privileges.
Potential impact
- Escalation of a regular user or operator to operator.admin privileges.
- Unauthorized access to administrative or operator-only functions.
- Modification of critical configuration, policies, or operational workflows.
- Potential disruption of service operation through misuse of elevated capabilities.
- Increased blast radius for any compromised user account or API token.
General mitigation guidance
Mitigation typically focuses on tightening the authorization model around scopes and trusted headers in proxy-based authentication setups.
Useful defensive patterns include:
- Treating all client-declared scopes and roles as untrusted inputs, independent of transport path, and re-deriving effective scopes on the server side.
- Explicitly clearing or overwriting any incoming scope/role attributes when transitioning into an authenticated identity context, then rebuilding the allowed scopes from authoritative sources (e.g., identity provider claims, server-side role mappings).
- Restricting which headers or parameters the trusted proxy is allowed to set, and whitelisting only those that are strictly necessary.
- Adding defense-in-depth checks in authorization middleware so only server-assigned scopes can unlock operator or admin actions.
- Applying least-privilege defaults, ensuring that if scope processing fails or is ambiguous, the user receives the lowest practical level of access.
How teams detect issues like this
Detection can focus on both code-level signals and runtime behavior:
- Static analysis / code review:
- Identify code paths where scopes or roles are derived from request headers, query parameters, or client-controlled data in trusted-proxy mode.
- Flag any authorization decision that depends on unvalidated or partially cleared scope information.
- Look for conditional logic where some paths clear scopes and others do not, especially across UI vs non-UI flows.
- Configuration and policy review:
- Inspect reverse proxy or gateway configs to see which identity and scope headers are trusted and how they are mapped.
- Ensure that only the proxy can inject identity headers, and that their usage is documented and constrained.
- Runtime monitoring:
- Log scope values and decision points for privileged actions, and alert on unusual patterns, such as non-Control-UI clients invoking operator or admin operations.
- Automated tooling:
- Use automated security testing tools or custom scripts to send crafted requests with elevated scopes and observe whether unauthorized access is granted.

