GBHackersDivya
LangChainGo Vulnerability Allows Malicious Prompt Injection to Access Sensitive Data
A recently disclosed flaw in LangChainGo, the Go port of the LangChain framework for large language models, allows attackers to read arbitrary files on a server by injecting malicious prompt templates. Tracked as CVE-2025-9556, the vulnerability stems from the Gonja template engine, which supports Jinja2 syntax and can be manipulated to perform unauthorized file reads, potentially via a server-side template injection that discloses sensitive data.
The CVE details note an arbitrary file read through malicious prompt templates in LangChainGo using the Gonja engine, with an original release date of 12 September 2025. The LangChainGo maintainer has released an update introducing the RenderTemplateFS function to isolate template rendering from direct filesystem access and to block unauthorized file access at the template engine level; users are urged to upgrade to the latest LangChainGo release.
To update, run go get github[.]com/tmc/langchaingo@latest, and then review custom template code to ensure rendering uses RenderTemplateFS rather than prior functions. According to the article by Divya, published on 15 September 2025.