CVE-2025-68665

8.6 HIGH

📋 TL;DR

This vulnerability allows attackers to inject malicious serialized objects into LangChain applications by exploiting improper escaping of user-controlled data containing the 'lc' key. When deserialized, these objects are treated as legitimate LangChain objects rather than plain user data, potentially leading to remote code execution. All applications using vulnerable versions of LangChain JS are affected.

💻 Affected Systems

Products:
  • LangChain JS
  • @langchain/core
Versions: LangChain JS versions <0.3.37 and <1.2.3; @langchain/core versions <0.3.80 and <1.1.8
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Applications using toJSON() or JSON.stringify() on user-controlled data containing 'lc' keys are vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or lateral movement within the environment.

🟠

Likely Case

Arbitrary code execution within the application context, potentially allowing data exfiltration or privilege escalation.

🟢

If Mitigated

Limited impact with proper input validation and sanitization, potentially reduced to denial of service or information disclosure.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires user input containing specially crafted 'lc' key structures that get serialized.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: LangChain JS 0.3.37, 1.2.3; @langchain/core 0.3.80, 1.1.8

Vendor Advisory: https://github.com/langchain-ai/langchainjs/security/advisories/GHSA-r399-636x-v7f6

Restart Required: Yes

Instructions:

1. Update LangChain JS to version 0.3.37 or 1.2.3. 2. Update @langchain/core to version 0.3.80 or 1.1.8. 3. Restart the application. 4. Test functionality.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation to reject or sanitize user data containing 'lc' keys before serialization.

🧯 If You Can't Patch

  • Implement strict input validation to reject user data containing 'lc' keys.
  • Use alternative serialization methods that properly escape special keys.

🔍 How to Verify

Check if Vulnerable:

Check package.json for LangChain JS version <0.3.37 or <1.2.3, or @langchain/core version <0.3.80 or <1.1.8.

Check Version:

npm list langchain @langchain/core

Verify Fix Applied:

Verify package.json shows LangChain JS version >=0.3.37 or >=1.2.3, and @langchain/core version >=0.3.80 or >=1.1.8.

📡 Detection & Monitoring

Log Indicators:

  • Unusual serialization errors
  • Unexpected 'lc' key in user input logs
  • Abnormal application behavior post-serialization

Network Indicators:

  • Unexpected outbound connections from the application
  • Suspicious data exfiltration patterns

SIEM Query:

source="application_logs" AND ("lc" OR "serialization" OR "toJSON") AND severity="ERROR"

🔗 References

📤 Share & Export