LlamaIndex vulnerable to data loss through hash collisions in its DocugamiReader class
The DocugamiReader class used MD5 hashing to generate IDs for document chunks, so structurally distinct chunks with identical text received the same ID and one overwrote the other. This could cause loss of important document content, broken chunk hierarchies, and inaccurate AI responses.
run-llama/llama_index
Originally disclosed on huntr
A vulnerability in the DocugamiReader class of the run-llama/llama_index repository, up to but excluding version 0.12.41, involves the use of MD5 hashing to generate IDs for document chunks. This approach leads to hash collisions when structurally distinct chunks contain identical text, resulting in one chunk overwriting another. This can cause loss of semantically or legally important document content, breakage of parent-child chunk hierarchies, and inaccurate or hallucinated responses in AI outputs. The issue is resolved in version 0.3.1.
From the GitHub Advisory Database (GHSA-5hq9-5r78-2gjh, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code generated chunk IDs by hashing only the chunk text with MD5, without including structural context, so identical text in different places produced the same ID.
Impact
This could cause loss of semantically or legally important document content, break parent-child chunk hierarchies, and lead to inaccurate or hallucinated AI responses.
What the attacker needed
Use of DocugamiReader; document with identical text in different chunks
The fix
The issue was fixed in version 0.3.1, though the text also says versions up to but excluding 0.12.41 are affected, which is inconsistent.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A hash is a short fingerprint of data, and MD5 is an old hashing method that can give the same fingerprint to different inputs. Here, two different parts of a document that happened to contain the same text got the same fingerprint, so one part replaced the other. That meant the AI system could lose parts of a document and give wrong answers.
What is AI / LLM?
Prompt injection, data exfiltration and tool abuse in features built on language models, and the ordinary bugs around them.