Unsafe Deserialization in langchain-core
Summary
Vulnerability in langchain-core (CVE-2025-68664). Confidential information can be exposed externally. Mitigation: upgrade to 0.3.81, 1.2.5 or later.
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
A vulnerability tracked as CVE-2025-68664 has been found in langchain-core.
Confidential information can be exposed externally. CVSS score: 9.3/10.
What to do: upgrade langchain-core to 0.3.81, 1.2.5 or later.
If unsure, ask your IT team or search "langchain-core CVE-2025-68664" on the vendor's site.
CVE-2025-68664 (langchain-core) — CWE-502 / CVSS v3 9.3
Attack vector: remote (network-reachable) / unauthenticated / no user interaction
Patched: 0.3.81, 1.2.5 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Unsafe deserialization (CWE-502) exists in langchain-core.
Check the vendor advisory for the affected versions of langchain-core.
Severity: Critical (CVSS 9.3/10). Confidential information can be exposed externally.
Update to 0.3.81, 1.2.5.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'langchain-core' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1
Identify exposureidentify
grep -r 'langchain-core' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
langchain-coreを grep し、稼働しているサービス・バージョンを把握する。 -
2
Apply patchpatch
Upgrade langchain-core to 0.3.81, 1.2.5ステージング環境で 0.3.81, 1.2.5 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3
Post-deployment verificationverify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| PyPIlangchain-core |
< 0.3.81→ 0.3.81 |
0.3.81 |
| piplangchain-core |
< 0.3.81→ 0.3.81 |
0.3.81 |
Original description The description as published by the source.
Summary
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.
Attack surface
The core vulnerability was in dumps() and dumpd(): these functions failed to escape user-controlled dictionaries containing 'lc' keys. When this unescaped data was later deserialized via load() or loads(), the injected structures were treated as legitimate LangChain objects rather than plain user data.
This escaping bug enabled several attack vectors:
- Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like
metadata,additional_kwargs, orresponse_metadata - Class instantiation within trusted namespaces: Injected manifests could instantiate any
Serializablesubclass, but only within the pre-approved trusted namespaces (langchain_core,langchain,langchain_community). This includes classes with side effects in__init__(network calls, file operations, etc.). Note that namespace validation was already enforced before this patch, so arbitrary classes outside these trusted namespaces could not be instantiated.
Security hardenin…
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
References
- advisory nvd.nist.gov
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web pypi.org
- web github.com
- web github.com