# GPUStack: Authentication bypass via trusted loopback source (reverse-proxy TCP peer or X-GPUStack-Real-IP header) grants unauthenticated admin

GPUStack trusted loopback source (reverse-proxy TCP peer or forged X-GPUStack-Real-IP header) as admin, giving unauthenticated remote attackers full admin and RCE on workers.

- Payout: Research
- Severity: critical
- Program: GPUStack
- Found by: nikkoenggaliano, Shadowoyz
- Disclosed: 2026-11-09
- CVE: CVE-2026-102895
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-gj9m-f8ph-pmhr
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-gj9m-f8ph-pmhr
- Tags: area:web domain:api domain:web impact:privesc impact:rce kind:research platform:ghsa sev:critical tech:python technique:source-review vuln:access-control vuln:auth-bypass

**Target:** GPUStack API auth (gpustack/api/auth.py get_current_user / client_ip_getter)
**Root cause:** get_current_user promotes any request whose source resolves to loopback to the built-in admin when force_auth_localhost is False (default). Source is derived from TCP peer or client-supplied X-GPUStack-Real-IP header, both attacker-controllable.
**Steps:**
1. Deploy GPUStack < 2.2.0 behind a same-host reverse proxy with `proxy_pass http://127.0.0.1:<port>` (default force_auth_localhost=False).
2. Send any unauthenticated request through the proxy; GPUStack sees TCP peer 127.0.0.1 and the loopback auto-admin branch fires.
3. Alternatively send `X-GPUStack-Real-IP: 127.0.0.1` directly to make client_ip_getter report loopback.
4. Use resulting admin access to mint a persistent API key with scope `["*"]` valid from any source IP.
5. Use admin-only `POST /v2/inference-backends/from yaml` to run code on worker hosts.
**How found:** Recognized that the canonical self-hosted deployment (same-host reverse proxy) makes every remote request arrive with TCP peer 127.0.0.1, invalidating the 'localhost is trusted' assumption; also noted client_ip_getter honors a client-supplied X-GPUStack-Real-IP header. Verified end-to-end against HEAD 6bee5883.
**Exploitation:** Attacker reaches the API through a same-host reverse proxy (or forges the real-IP header), is treated as loopback and auto-authenticated as admin. They then mint persistent admin API keys, read worker credentials and cloud/provider secrets, and deploy custom inference backends via the admin-only YAML endpoint to execute reverse shells on worker hosts. Observed in the wild against a v2.1.1 deployment with attacker-created backends running reverse shells.
**Escalation:** Unauthenticated network access -> admin -> persistent wildcard API key -> worker credential/secret theft -> code execution on worker hosts via custom backend YAML.
**Insight:** When a service auto-trusts loopback, check the deployment topology: any same-host reverse proxy collapses all remote clients to 127.0.0.1. Also grep client-IP resolution code for headers (X-Real-IP style) accepted without a trusted-gateway check.

