CVE-2025-68664
LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs
Record summary
CVE-2025-68664 has a selected CVSS score of 9.3 (critical); EIP currently links 1 catalogued exploit and 3 repository PoCs.
Description
LangChain is a framework for building agents and LLM-powered applications. Prior to versions 0.3.81 and 1.2.5, a serialization injection vulnerability exists in LangChain's dumps() and dumpd() functions. The functions do not escape dictionaries with 'lc' keys when serializing free-form dictionaries. The 'lc' key is used internally by LangChain to mark serialized objects. When user-controlled data contains this key structure, it is treated as a legitimate LangChain object during deserialization rather than plain user data. This issue has been patched in versions 0.3.81 and 1.2.5.
Exploitation context
Affected products and versions
2| Product | Source | Version range | Status |
|---|---|---|---|
langchainBrowse langchain-ai / langchain | CVE List | >= 1.0.0, < 1.2.5 | affected |
| < 0.3.81 | affected | ||
langchain-coreBrowse PyPI / langchain-core | GitHub Advisory | 1.0.0 to < 1.2.5 · Fixed in 1.2.5 | affected |
| Before 0.3.81 · Fixed in 0.3.81 | affected |
Proofs of concept
4Catalogued exploits
ExploitDBLangChain Core 1.2.4 - SSTI/RCEExploitDB exploitby banyamerExploit1 file
Analysis
Technical assessment
The artifact is a Python script that exploits CVE-2025-68664, a serialization injection vulnerability in LangChain Core. It constructs a malicious payload with an 'lc' key, uses the vulnerable dumps() function to serialize it, and then uses load() to deserialize it, which instantiates a PromptTemplate containing a Jinja2 Server-Side Template Injection (SSTI) payload. The script then invokes the template to achieve arbitrary command execution (RCE).
Backdoor review
No backdoor observed in reviewed code
The PoC demonstrates the claimed CVE-2025-68664 SSTI/RCE vulnerability in LangChain Core. It constructs a malicious serialized payload, deserializes it, and triggers command execution via Jinja2 template injection. All actions are consistent with a standard exploit demonstration; no concealed backdoor, unrelated payload, or operator-directed harm is present.
Classification basis and observed behavior
Classification basis
The script's primary purpose is to exercise the CVE-2025-68664 vulnerability by constructing a malicious payload, exploiting the unsafe deserialization, and executing an arbitrary system command ('id'). This constitutes an exploit.
exploits/multiple/webapps/52514.py:1-47Requirements
- The target application must use a vulnerable version of langchain-core (< 0.3.81 or >= 1.0.0, < 1.2.5) and call load() on attacker-controlled data.
exploits/multiple/webapps/52514.py:9-13
Observed behavior
- The script constructs a dictionary payload containing an 'lc' key with a 'constructor' type that targets langchain_core.prompts.prompt.PromptTemplate.
exploits/multiple/webapps/52514.py:23-34 - The payload's template is a Jinja2 expression that uses Python's built-in import function to execute the system command 'id'.
exploits/multiple/webapps/52514.py:30 - The script serializes the payload using the vulnerable dumps() function.
exploits/multiple/webapps/52514.py:37 - The script deserializes the payload using load(), which instantiates the malicious PromptTemplate object.
exploits/multiple/webapps/52514.py:40 - The script invokes the deserialized PromptTemplate's format() method, which triggers the SSTI and executes the 'id' command.
exploits/multiple/webapps/52514.py:43-44
Behaviors behind the backdoor verdict
Observables
- Exploit Mechanism
- Payload withheldThe payload uses a constructor type with id ['langchain_core', 'prompts', 'prompt', 'PromptTemplate'] and a Jinja2 template that calls payload withheld. This matches the described CVE-2025-68664 serialization injection.
exploits/multiple/webapps/52514.py:23-34 - Command Execution
- Payload withheldThe injected template executes the 'id' command, a benign system information command commonly used in PoCs to demonstrate RCE.
exploits/multiple/webapps/52514.py:30 - Environment Variable
- Payload withheldA dummy environment variable is set to demonstrate potential secret access, but it is not exfiltrated or used for harm. The comment on line 19 explains its purpose.
exploits/multiple/webapps/52514.py:19-20
What the analysis did not establish
- The analysis is based solely on the static source code of the exploit script. The script was not executed, and its effectiveness against a live target is not verified.
- The evidence does not include the target application or environment, so the exact context of the vulnerability (e.g., how user input reaches the load() function) is inferred from the CVE description and script comments.
- Only the single Python file was reviewed; no external dependencies or network resources were inspected.
- Binary files were flagged but not analyzed; none were present in this artifact.
This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.
Repository PoCs
GitHubAk-cybe/CVE-2025-68664-LangGrinch-PoCRepository PoCby Ak-cybeStars: 3Scanner5 files
Analysis
Technical assessment
The artifact is a payload generator and documentation for CVE-2025-68664. The Python script (payload withheld) generates JSON payloads for testing the vulnerability but does not contain code to send them to a target or exploit a live system. The README provides a technical writeup and instructions for using the generator. The primary operation is generating and listing test payloads, which is characteristic of a scanner/validator, not an exploit.
Backdoor review
No backdoor observed in reviewed code
The repository contains a documented proof-of-concept (PoC) for CVE-2025-68664, a LangChain serialization injection vulnerability. The supplied text files (README.md, payload withheld, requirements.txt) describe the vulnerability, provide payload examples, and implement a payload generator. No concealed executable behavior, operator-directed harm, persistence, credential theft, or unrelated payloads were observed. The code generates and displays JSON payloads for authorized testing; it does not execute them against any target. The artifact is consistent with a legitimate security research PoC.
Classification basis and observed behavior
Classification basis
The artifact's primary executable component (payload withheld) is a payload generator that creates JSON strings for testing. It does not contain any code to send these payloads to a target, trigger deserialization, or otherwise exploit a vulnerability. The README describes the vulnerability and provides a version detection script. This is consistent with a scanner (code that checks for a vulnerability without exploiting it).
langgrinch_fuzzer.py:1-406README.md:420-464Requirements
- A target application using a vulnerable version of langchain-core (< 0.3.81 or >= 1.0.0 < 1.2.5) that deserializes user-controlled data containing the 'lc' key.
README.md:164-170
Observed behavior
- Generates JSON payloads containing the 'lc' marker for secret extraction, SSRF, RCE, and file read attacks.
langgrinch_fuzzer.py:54-240 - Lists available payloads by category and exports them to a JSON file.
langgrinch_fuzzer.py:346-381 - Provides a version detection script to check if the installed langchain-core is vulnerable.
README.md:420-464
Behaviors behind the backdoor verdict
Observables
- Vulnerability Poc
- Payload withheldThe entire repository is a PoC writeup and payload generator for the stated CVE.
README.md:1-626langgrinch_fuzzer.py:1-406 - Payload Generator
- Payload withheldA Python script that generates and displays JSON payloads for the vulnerability. It does not execute the payloads or connect to any remote service.
langgrinch_fuzzer.py:1-406 - Author Attribution
- Payload withheldThe author is identified in the README and source code. This is metadata and not a backdoor indicator.
README.md:607langgrinch_fuzzer.py:9
What the analysis did not establish
- Two files (PAYLOADS.md and LICENSE) are omitted from the evidence, so the full payload arsenal and license terms are not available for review.
- The evidence does not include any execution logs or network traffic to confirm the payloads work as described.
- Two files (PAYLOADS.md, LICENSE) were present in the repository but not included in the text evidence; only their metadata was provided. No binary or non-text content was identified in the artifact.
This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.
GitHubcomerc/CVE-2025-68664Repository PoCby comercStars: 0Writeup5 files
Analysis
Technical assessment
A technical writeup in Russian describing payload withheld, a serialization injection vulnerability in LangChain's dumps()/dumpd() functions. The document explains the vulnerability mechanism, attack vectors, potential impact (secret extraction, object instantiation, possible code execution), and defensive recommendations. It explicitly states that a ready-to-use exploit is not published.
Backdoor review
No backdoor observed in reviewed code
The supplied evidence is a single README.md file that describes the payload withheld vulnerability in LangChain. It contains no executable code, no instructions for the reader to run, and no concealed payload. The text is a technical disclosure and marketing article for a security product.
Classification basis and observed behavior
Classification basis
The artifact is a blog post/writeup providing a technical analysis of payload withheld. It contains no executable exploit or scanner code. The author explicitly states 'Мы намеренно не публикуем здесь готовый эксплойт' (We intentionally do not publish a ready-to-use exploit here).
README.md:131Requirements
- User-controlled data containing an 'lc' key must be serialized by dumps() or dumpd() and later deserialized by load() or loads().
README.md:29-31 - The attacker must be able to influence fields like additional_kwargs or response_metadata, often via prompt injection.
README.md:23
Observed behavior
- The document describes how an attacker can craft a dictionary with an 'lc' key to be treated as a legitimate LangChain object during deserialization, leading to secret extraction from environment variables or instantiation of objects from an allowlist.
README.md:29-31README.md:107-121 - The writeup mentions a specific exfiltration path using ChatBedrockConverse to make a GET request with an attacker-controlled endpoint and an environment variable in a header.
README.md:125-129 - The author states that a ready-to-use exploit is intentionally not published to give security teams time to patch.
README.md:131
Behaviors behind the backdoor verdict
Observables
- Vulnerability Disclosure
- Payload withheldThe document describes a serialization injection vulnerability in LangChain's dumps()/dumpd() functions.
README.md:1-265 - Marketing Content
- Payload withheldThe document includes promotional content for a security product called Cyata, describing its features for AI risk management.
README.md:193-257
What the analysis did not establish
- The evidence packet contains only the README.md file; four non-text media files (images) are omitted, which may contain additional technical details.
- The analysis is based solely on the provided text; no code execution or dynamic analysis was performed.
- Four non-text media files (images) are present in the repository but were not analyzed; they are flagged as metadata-only and could theoretically contain steganographic payloads, though no evidence suggests this.
- The review covers only the supplied README.md text; no other source files were provided for analysis.
This review is limited to the supplied PoC code and context. It does not assert that the code works or is safe to execute.