The vulnerability CVE-2026-56681 describes an authentication bypass in 9Router's Public LLM API. The core issue is that the application trusts the X-9r-Real-Ip HTTP header to determine if a request originates from localhost. If the application is deployed without the custom-server.js wrapper, which is designed to strip or regenerate this header from a trusted source, an attacker can spoof X-9r-Real-Ip: 127.0.0.1 to be treated as a local client, bypassing API key requirements.
My analysis focused on identifying the functions that make security decisions based on this untrusted input. The vulnerability description explicitly points to isLocalRequest() and canAccessPublicLlmApi() within src/dashboardGuard.js as the affected components.
I first attempted to find a direct patch to src/dashboardGuard.js by comparing the file content between the last vulnerable version (v0.5.4, commit 7354c5e5f4d0e53d8de9d6edf1773dce74144fec) and the first patched version (v0.5.8, commit 0c47c891e7a6c1a47c35b286235a132c0a5aa0a8). This comparison revealed no changes to src/dashboardGuard.js itself. This indicates that the vulnerable logic within these functions remained the same in the patched version.
The actual fix, as indicated by the remediation steps and the provided commit efd20be8d81ef2e256a7037f3aa78e6b567b5fd3 (which was part of the v0.5.6 release, preceding v0.5.8), is in custom-server.js. This commit adds delete req.headers["x-9r-real-ip"]; to custom-server.js. This change ensures that when the custom-server.js wrapper is used, any client-supplied X-9r-Real-Ip header is removed before it can be processed by isLocalRequest().
Therefore, the functions isLocalRequest and canAccessPublicLlmApi are indeed the vulnerable functions. Their vulnerability lies in their inherent trust of the X-9r-Real-Ip header. The patch in custom-server.js acts as an 'edge' mitigation, preventing the untrusted input from reaching these functions. When the application is run without this mitigation (i.e., in the vulnerable configuration where custom-server.js is not used or improperly configured), these functions are directly exploitable. A runtime profiler would show calls to isLocalRequest and canAccessPublicLlmApi when an attacker successfully bypasses authentication using the spoofed header.