Description

A critical vulnerability, tracked as CVE-2025-9556, has been discovered in LangChainGo, the Go-based version of the LangChain framework. With a CVSS score of 9.8, this flaw stems from the use of the Gonja template engine, a Go implementation similar to Python’s Jinja2. The vulnerability allows attackers to inject specially crafted prompts that exploit server-side template injection (SSTI), enabling them to read sensitive files without requiring backend access or elevated privileges. This vulnerability poses a serious threat to LLM-powered applications, especially those that allow open-ended user input. Since the flaw exploits the prompt-processing pipeline itself, even simple chat interfaces become attack vectors. Input validation alone may not be enough to prevent this form of exploitation, making unpatched deployments highly vulnerable. In response, LangChainGo maintainers have issued a patch that significantly enhances security. A new RenderTemplateFS function has been introduced, which blocks default filesystem access and supports secure file template referencing. Developers are strongly urged to upgrade immediately. For those unable to do so, it is critical to restrict prompt input to trusted sources and actively monitor for anomalous behavior. As LLM-based systems continue to proliferate, securing the interface between prompts and backend logic is no longer optional it's essential.