CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-2XCP-X87W-Q377
5.30.01%

GHSA-2xcp-x87w-q377: Incorrect Authorization Bypass via Templated Hook Mappings in OpenClaw

Alon Barad
Alon Barad
Software Engineer

Apr 26, 2026·7 min read·2 visits

PoC Available

Executive Summary (TL;DR)

OpenClaw versions prior to 2026.4.20 fail to enforce the session key opt-in security policy when processing templated hook mappings. Attackers can exploit this by sending crafted webhook payloads that resolve to unauthorized session keys, resulting in session hijacking and information disclosure.

The OpenClaw personal AI assistant framework contains an incorrect authorization vulnerability within its webhook routing logic. An architectural flaw in the processing of hook mapping templates allows external webhook payloads to resolve to arbitrary session keys. This effectively bypasses the framework's 'allowRequestSessionKey' security gate, enabling unauthorized users to hijack sessions, inject messages, and access cross-session data.

Vulnerability Overview

The OpenClaw framework incorporates a webhook gateway designed to route incoming requests to specific AI agents and active sessions. This routing behavior is governed by 'hook mappings' configured within the application. These mappings determine the target sessionKey for an incoming webhook, either by specifying a static string or by defining a dynamic template, such as {{payload.id}}, which resolves based on the incoming request data.

The framework implements a security gate named allowRequestSessionKey to prevent external requests from arbitrarily assigning themselves to existing sessions. By default, this configuration is set to false, ensuring that external callers cannot dictate session routing. The vulnerability, tracked as CWE-863 (Incorrect Authorization), exists because the gateway logic applies this security gate inconsistently.

Prior to version 2026.4.20, the gateway only enforced the allowRequestSessionKey policy when a session key was provided explicitly within the standard request payload structure. The system entirely bypassed this check when the session key was resolved indirectly through a hook mapping template. This permitted external webhook payloads to influence session routing despite the secure default configuration.

The flaw affects all installations of the openclaw NPM package prior to version 2026.4.20. Implementations relying on built-in routing presets, such as the Gmail integration which uses per-message routing templates by default, are particularly exposed. Administrators running these configurations are vulnerable to session hijacking unless explicit prefix restrictions were manually applied.

Root Cause Analysis

The core engineering flaw resides in the lack of origin tracking during the hook mapping resolution phase. The routing logic treated all configurations defined within hooks.mappings as internally trusted data structures. When the gateway processed an incoming webhook, it did not distinguish between a static session key hardcoded by the administrator and a dynamic session key populated by untrusted external input.

The templating engine renders dynamic expressions like {{payload.id}} by substituting the template variables with corresponding values extracted from the incoming HTTP request. Once the template rendering process completes, the system forwards the resulting sessionKey to the resolveHookSessionKey function. At this execution stage, the function receives a plain string without any metadata indicating how the string was constructed.

Within the resolveHookSessionKey function, the logic evaluated the authorization policy based on an inaccurate source categorization. Because the key originated from the hooks.mappings configuration object, the source was tagged generically as mapping. The authorization gate explicitly exempted the mapping source from the allowRequestSessionKey validation check, operating under the false assumption that all mapping values were statically defined by administrators.

This architectural oversight created a direct bypass of the intended security boundaries. Untrusted external input successfully mutated into a trusted internal routing directive. The resulting authorization failure permitted an attacker to inject data into any session key they could derive through the templated expression.

Code Analysis and Patch Verification

The remediation strategy, introduced in commit 5275d008ed33203dba3f98e969ad683a65c416c3, addresses the vulnerability by implementing explicit origin tracking for session keys. The patch modifies the mapping generation logic to analyze the template structure before rendering. This ensures the system retains the necessary context regarding the data's provenance.

In src/gateway/hooks-mapping.ts, the developer introduced a new tracking field named sessionKeySource. The updated buildActionFromMapping function now evaluates the raw mapping configuration using a new helper function, getSessionKeyTemplateSource. This function statically analyzes the configuration string to determine if it contains template syntax, returning templated if variable substitution is required, and static otherwise.

function buildActionFromMapping(mapping, ctx) {
  return {
    // ...
    sessionKey: renderOptional(mapping.sessionKey, ctx),
    sessionKeySource: getSessionKeyTemplateSource(mapping.sessionKey), // Origin tracking introduced
    // ...
  };
}

The most critical component of the patch resides in src/gateway/hooks.ts. The resolveHookSessionKey function incorporates the new origin tracking metadata into its authorization logic. The check now logically blocks session keys originating from either a direct request or a mapping-templated source unless the administrator explicitly sets the allowRequestSessionKey policy to true.

export function resolveHookSessionKey(params) {
  if (requested) {
    // The authorization gate now explicitly restricts templated mappings
    if (
      (params.source === "request" || params.source === "mapping-templated") && 
      !params.hooksConfig.sessionPolicy.allowRequestSessionKey
    ) {
      return { ok: false, error: "sessionKey is disabled for externally supplied hook payload values..." };
    }
    // ...
  }
}

Exploitation Methodology

Exploitation requires the attacker to identify an exposed OpenClaw webhook endpoint that relies on templated hook mappings. The attacker must also understand the expected JSON schema of the incoming webhook payload, specifically the fields referenced by the target's routing template. No authentication is necessary if the webhook endpoint is exposed publicly.

The attacker constructs a malicious JSON payload where the specific field referenced by the {{ ... }} template contains the identifier of a target session. For example, if the mapping template is defined as {{messages[0].id}}, the attacker crafts an HTTP POST request containing a messages array where the first object's id equals the victim's active session key.

Upon receiving the request, the OpenClaw gateway parses the payload and applies the hook mapping. The templating engine substitutes the malicious input into the sessionKey variable. Due to the lack of origin tracking, the resolveHookSessionKey function approves the routing directive. The gateway subsequently routes the attacker's payload into the victim's session.

Impact Assessment

The primary impact of this vulnerability is unauthorized session hijacking. By successfully routing malicious payloads to arbitrary session keys, an attacker can directly inject instructions, queries, or manipulated data into active AI sessions belonging to other users. This capability compromises the integrity of the AI assistant's interactions.

Information disclosure represents a critical secondary consequence. When an attacker forces a webhook payload into a targeted session, the OpenClaw framework processes the input within that specific context. The resulting AI responses, which may contain sensitive context from the victim's ongoing session, are processed as part of the hijacked interaction flow. Depending on the specific webhook implementation, this output may be returned or forwarded to an attacker-controlled endpoint.

The flaw entirely neutralizes the framework's primary defense-in-depth mechanism. The allowRequestSessionKey: false default configuration is designed to guarantee session isolation against untrusted external inputs. The failure of this control renders environments utilizing dynamic mappings inherently vulnerable, elevating the overall risk profile of the deployment.

Remediation and Configuration Requirements

The definitive remediation strategy is upgrading the openclaw NPM package to version 2026.4.20 or later. This release contains the updated origin tracking logic and strictly enforces the authorization gates for templated mappings. Administrators must verify the package version across all production deployments and continuous integration pipelines.

Following the upgrade, environments utilizing templated sessionKey mappings will experience a functional change. The gateway will actively reject incoming webhooks unless two specific configuration prerequisites are satisfied. Administrators must explicitly set hooks.allowRequestSessionKey to true and define strict routing boundaries within the hooks.allowedSessionKeyPrefixes array.

Organizations unable to immediately apply the patch must implement strict configuration workarounds. Administrators must remove all templated variable expressions ({{ ... }}) from hooks.mappings[].sessionKey configurations. Alternatively, if dynamic routing is strictly required, operators should block external access to the webhook gateway at the reverse proxy or network load balancer level until the software upgrade is complete.

Official Patches

OpenClawOfficial patch implementing session key origin tracking

Fix Analysis (1)

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
EPSS Probability
0.01%
Top 88% most exploited

Affected Systems

OpenClaw FrameworkOpenClaw Webhook Gateway

Affected Versions Detail

Product
Affected Versions
Fixed Version
openclaw
OpenClaw
< 2026.4.202026.4.20
AttributeDetail
CWE IDCWE-863: Incorrect Authorization
Attack VectorNetwork (Unauthenticated)
CVSS v3.1 Score5.3 (Medium)
ImpactSession Hijacking, Information Disclosure
Exploit MaturityProof of Concept (PoC)
Affected Packageopenclaw (NPM)

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1566Phishing
Initial Access
CWE-863
Incorrect Authorization

The software performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check.

Known Exploits & Detection

Official Patch EvidenceThe patch commit includes test cases demonstrating that template-derived session keys bypassed the security gate prior to the fix.

Vulnerability Timeline

Fix commit 5275d00 pushed to openclaw repository.
2026-04-21
Security advisory GHSA-2xcp-x87w-q377 published.
2026-04-26
OpenClaw version 2026.4.20 released addressing the vulnerability.
2026-04-26

References & Sources

  • [1]GitHub Advisory: GHSA-2xcp-x87w-q377
  • [2]Repository Advisory
  • [3]Fix Commit 5275d008ed33203dba3f98e969ad683a65c416c3
  • [4]OpenClaw Changelog

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.