Saturday, November 14, 2026

LangChainGo Vulnerability Allows Malicious Prompt Injection to Access Sensitive Data

A recently discovered flaw in LangChainGo, the Go implementation of the LangChain framework for large language models, permits attackers to read arbitrary files on a server by injecting malicious prompt templates.

Tracked as CVE-2025-9556, this vulnerability arises from the use of the Gonja template engine, which supports Jinja2 syntax and can be manipulated to perform unauthorized file reads.

CVE IDOriginal Release DateDescription
CVE-2025-95562025-09-12Arbitrary file read via malicious prompt templates in LangChainGo using Gonja engine

Overview of the Vulnerability

LangChainGo is a Go port of the LangChain orchestration framework, designed to help developers build applications that leverage large language models.

It uses Gonja, a Go-based implementation of the Jinja2 templating engine, for parsing and rendering dynamic prompt templates.

Critically, Gonja retains Jinja2 directives such as {% include %}, {% from %}, and {% extends %}. These directives can be repurposed by an attacker to load and read files from the server’s filesystem.

Under normal use, these features enable the creation of modular and reusable templates. However, when user-controlled input is passed directly to the template engine, an attacker can inject template code that references critical system files, for example /etc/passwd.

The injected code is then executed on the server, leading to a server-side template injection (SSTI) that discloses sensitive data.

The arbitrary file read vulnerability undermines the confidentiality of systems running LangChainGo. Attackers only need access to the prompt input field to craft malicious templates that expose any file readable by the application.

In environments where LangChainGo is used to power chatbot interfaces or other LLM-based services, an attacker could exploit this flaw without needing any additional privileges.

Sensitive files such as configuration files, private keys, or user credentials may be exposed, potentially enabling further attacks like privilege escalation or lateral movement within the network, as per a report by KBCert.

The LangChainGo maintainer has released an update that adds the RenderTemplateFS function.

This new function isolates template rendering from direct filesystem access by default and provides a secure mechanism for including only approved files.

The update also blocks unauthorized file access at the template engine level. Users should upgrade to the latest LangChainGo release immediately to apply these security enhancements.

To update, run:

go get github.com/tmc/langchaingo@latest

After upgrading, review any custom template code and ensure that template rendering uses RenderTemplateFS rather than the previous rendering functions.

Find this Story Interesting! Follow us on LinkedIn and X to Get More Instant Updates.

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Hot this week

How To Access Dark Web Anonymously and know its Secretive and Mysterious Activities

What is Deep Web The deep web, invisible web, or...

How to Build and Run a Security Operations Center (SOC Guide) – 2023

Today’s Cyber security operations center (CSOC) should have everything...

Russian Hackers Bypass EDR to Deliver a Weaponized TeamViewer Component

TeamViewer's popularity and remote access capabilities make it an...

Web Server Penetration Testing Checklist – 2026

Web server pentesting is performed under three significant categories: identity,...

ATM Penetration Testing – Advanced Testing Methods to Find The Vulnerabilities

ATM Penetration testing, Hackers have found different approaches to...

Hackers Disguise XLoader Malware as Purchase Order Confirmations to Infect Windows Computers

Hackers are distributing XLoader malware through phishing emails disguised...

Hackers Exploit Check Point PHP2Shell Flaws to Gain Root Access and Deploy Wiper Malware

Attackers are exploiting a remote code execution vulnerability in...

Chinese-Speaking Hackers Weaponize Cairn AI Framework to Breach Semiconductor and Defense Organizations

Chinese-speaking attackers weaponized the open-source Cairn penetration-testing framework to...

Related Articles

Recent News