In LangChain, prompt injection is not a single bug to patch. It is an architectural attack surface: the same feature set that makes LangChain powerful — chains that pass model output into the next step, agents that pick tools, retrievers that pull in outside documents, and parsers that deserialize model output back into objects — is the surface an attacker writes to.
A plain chatbot exposes one injection path: the user's message. A LangChain application exposes several, because untrusted text enters at more than one point and the framework then acts on it:
LangChain's own CVE history shows the same pattern repeatedly: a prompt-injection foothold escalates into code execution, data access, or secret theft because the framework treats model output as trusted input to a real operation.
| CVE | Where | Prompt injection leads to |
|---|---|---|
| CVE-2023-29374 | LLMMathChain / PALChain (≤ 0.0.131) | Arbitrary Python execution via exec on model-generated "math" (CVSS 9.8). |
| CVE-2023-46229 | Sitemap loader (< 0.0.317) | Server-side request forgery via crafted sitemaps, reaching internal services. |
| CVE-2024-8309 | GraphCypherQAChain | Injected text shapes the generated Cypher query → database compromise. |
| CVE-2025-68664 | langchain-core ("LangGrinch") | A malicious lc key in metadata/additional_kwargs/response_metadata is deserialized into a trusted object → RCE and exfiltration of env-var secrets: cloud creds, DB/RAG connection strings, LLM API keys (CVSS 9.3). |
The lesson across all four: the dangerous step is never the model "saying" something bad — it is the framework doing something with what the model said.
RedLens does not scan a model in the abstract; it exercises the injection paths above against your deployed application, using the methodologies in its catalogue that map to LangChain's surface. The attacker payloads are generated on RedLens's own self-hosted attacker models and judged for whether the target actually complied — a deflected attempt and a successful one are scored differently, not lumped together.
| RedLens methodology | What it exercises in a LangChain app |
|---|---|
| Indirect Prompt Injection (IPI) | Payloads embedded in retrieved documents / tool outputs the agent ingests — the RAG and tool-result path, where no user is watching. |
| Tool Chain Hijacking (TCH) | Steering the agent's tool selection and arguments toward unintended or sensitive functions. |
| Retrieval-Augmented Poisoning (RAP) | Adversarial content planted in the vector store / knowledge base ahead of retrieval. |
| Instruction Override (IOA) | Direct overrides of the chain's system prompt through user-controlled input. |
| System Prompt Extraction (SPE) | Eliciting the chain's hidden instructions and any business logic embedded in them. |
| Autonomous Action Amplification (AAA) | Exploiting agent self-prompting / recursion to escalate what a single request can do. |
The full methodology, the fixed attacker/judge setup, and the scoring are published on the methodology page — RedLens reports what its scans actually find, and does not publish invented numbers.
exec / deserialize model output into a privileged operation. The LangChain CVEs are all this mistake in different clothes. Keep secrets out of any object the model can influence.langchain / langchain-core — several of the above are fixed only in later versions.RedLens runs the IPI, TCH, RAP, IOA, SPE, and AAA methodologies against your deployed LLM application and reports which attacks actually succeeded, mapped to the OWASP LLM Top 10 (2026), with remediation. The free check flags prompt-template exposure in CI; the platform runs the full adversarial suite.
Run a scan against your app Read the research →Sources for the CVEs referenced: the GitHub Advisory Database, NVD, and vendor disclosures. This page is maintained by RedLens AI Security Research; the RedLens methodology is documented and its published findings come from real scan output.