GHSA-597M-W632-P8QV
Unauthenticated cache poisoning of query responses: `conversation_history` is missing from the query cache key
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-597M-W632-P8QV divulgada · CVSS 6.5 (GitHub) | |
| Remediación | Parche 1.5.5 | lightrag-hku · 2 d desde divulgación | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
LightRAG caches generated query answers under a key built by `compute_args_hash`
over the query text, mode, retrieval and token parameters, `user_prompt`,
`enable_rerank`, and the LLM identity. `conversation_history` is not part of that
key, yet it is passed to the model as `history_messages=` and materially changes
the generated answer.
As a result, a caller who supplies `conversation_history` can determine the answer
that gets stored for a given question, and that stored answer is later returned
verbatim to callers who supplied no history — without any LLM call, without the
system prompt, and without any model-side guardrail.
Because `WHITELIST_PATHS` defaults to `/health,/api/*`, the writing caller can be
unauthenticated (via `POST /api/chat`, which treats every message except the
last as conversation history) while the reading caller is authenticated (via
`POST /query`). Both paths resolve to the same default mode (`mix`) and the same
`TOP_K`, so their cache keys collide by construction rather than by coincidence.
The poisoned answer is served alongside genuine `references`, because retrieval
still runs and the reference list is derived from live retrieval rather than from
the cached text. This makes the substituted answer look well-sourced.
What is by design, and what the bug actually is
LightRAG is a knowledge-base query system. **Different users asking the same
question receiving the same cached answer is intended behaviour and is not a
vulnerability.** The cache is deliberately shared across callers.
The defect is not that the answer is shared — it is that an input which is neither
the question nor the knowledge base gets to decide what the shared answer is.
`conversation_history` is caller-supplied request data that is never ingested into
the knowledge base, so it must not be able to write the canonical cached answer
for a question.
Impact
- Integrity (primary). An unauthenticated caller can durably set the answer
- Confidentiality (secondary, low). An answer generated under one caller's
- Most likely real-world manifestation is not an attack. A legitimate
The `/api/*` whitelist exemption is documented, but its accepted scope is
read-only — the startup warning states "These routes invoke the LLM and read your
knowledge base." Writing state that authenticated callers later consume as
authoritative output is outside that documented scope. This is why the issue is
tracked separately from the previously reported `/api/*` authentication reports.
Preconditions and limits
These bound the severity and are the reason this is rated Medium rather than High:
- First writer wins. The cache is read before it is written, so an attacker
- Exact key match required. The attacker must match the victim's query text,
- Prompt injection must succeed. `conversation_history` is the attacker's only
`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N` (6.5, Medium).
Not affected
- The keyword-extraction cache (`cache_type="keywords"`): keywords are derived from
- The entity-extraction and summary caches: ingestion-side, unrelated to
- `bypass` mode: does not use the query-answer cache.
- Streaming responses: never cached.
- The bundled WebUI: `history_turns` is pinned to 0, so it sends an empty history
Affected versions
`lightrag-hku` <= 1.5.5.
Patch
When `conversation_history` is non-empty, the query-answer cache is bypassed for
both read and write. Single-turn queries — the pure knowledge-base query case —
keep sharing the cache exactly as before, so the intended shared-cache behaviour is
preserved. Bypassing the write closes the poisoning path, since history is the only
unkeyed input that reaches the model; bypassing the read additionally ensures a
multi-turn caller is never served an answer that ignored their history.
`conversation_history` was deliberately not added to the cache key: every turn
of a conversation carries a different history, which would make each key unique and
turn an intentionally shared cache into a per-session one.
Fixed in <VERSION>.
Workarounds
If you cannot upgrade immediately, any one of the following removes the exposure:
- `WHITELIST_PATHS=/health` — requires authentication on the Ollama-compatible
- `ENABLE_LLM_CACHE=false` — disables the query cache entirely.
- Do not send `conversation_history` from your clients.
After upgrading or applying a workaround, clear any entries that may already have
been poisoned — they have no TTL and persist across restarts:
`POST /documents/clear_cache`.
Credit
Reported by @santhreal.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypilightrag-hku |
Corregida | 1.5.5 | 2 d | 1.5.7 no afectada |
1.5.5Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/HKUDS/LightRAG/security/advisories/GHSA-597m-w632-p8qvLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
