CVE-2025-9556
Description
Langchaingo supports the use of jinja2 syntax when parsing prompts, which is in turn parsed using the gonja library v1.5.3. Gonja supports include and extends syntax to read files, which leads to a server side template injection vulnerability within langchaingo, allowing an attacker to insert a statement into a prompt to read the "etc/passwd" file.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
LangChainGo's use of Gonja template engine with Jinja2 syntax allows server-side template injection, enabling arbitrary file read via crafted prompts.
Vulnerability
Overview
CVE-2025-9556 is a critical server-side template injection (SSTI) vulnerability in LangChainGo, the Go port of the LangChain framework. The root cause lies in LangChainGo's use of the Gonja template engine (v1.5.3) to parse Jinja2 syntax in prompts. Gonja supports Jinja2 directives such as {% include %}, {% from %}, and {% extends %}, which are intended for template reuse but can be abused to read arbitrary files from the server's filesystem [1].
Exploitation
An attacker can exploit this vulnerability by injecting malicious Jinja2 syntax into a prompt processed by LangChainGo. No authentication or special privileges are required; the attacker only needs the ability to submit prompts to an LLM application using LangChainGo. For example, injecting {% include '/etc/passwd' %} would cause the server to read and return the contents of that file [1].
Impact
Successful exploitation allows an attacker to read arbitrary files on the server, compromising the confidentiality of sensitive data such as system configuration files, credentials, or application secrets. This information could be used to further compromise the system or escalate privileges [1].
Mitigation
The LangChainGo maintainer has acknowledged the issue and is working on a fix. Pull request #1348 introduces security tests for path traversal attacks and reorganizes the Jinja2 template implementation to improve security [2]. Users are advised to update to a patched version once released and to avoid processing untrusted prompt inputs in the interim.
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
3(expand)+ 1 more
- (no CPE)
- (no CPE)range: <= v1.5.3 (gonja library)
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
3News mentions
0No linked articles in our index yet.