The vulnerability, identified as GHSA-mhr7-2xmv-4c4q, is a Cross-Site Request Forgery (CSRF) issue in OpenClaw's HTTP operator endpoints when running in trusted-proxy mode. The root cause was the lack of validation for the Origin header in incoming HTTP requests from browsers.
The analysis of the patch commit 6b3f99a11f4d070fa5ed2533abbb3d7329ea4f0d reveals that the core of the vulnerability was in the authorizeGatewayConnect function within src/gateway/auth.ts. This function handled authentication logic but, prior to the patch, did not perform any origin checks for requests authenticated via a trusted proxy. This allowed a malicious website to forge requests on behalf of an authenticated user.
The patch introduces a new function, authorizeTrustedProxyBrowserOrigin, which is now called from within authorizeGatewayConnect to validate the request's origin against a list of allowed origins.
Additionally, several higher-level functions that orchestrate HTTP request authorization were updated to propagate the necessary origin information down to authorizeGatewayConnect. These functions, authorizeGatewayHttpRequestOrReply and authorizeGatewayBearerRequestOrReply, are also identified as vulnerable because their previous implementation facilitated the bypass of origin checks. During a profiling session of an exploit, these functions would likely appear in the stack trace leading to the vulnerable code path.