The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-65106

CVE-2025-65106: LangChain Template Injection RCE Flaw

CVE-2025-65106 is a template injection vulnerability in LangChain that enables RCE by allowing attackers to access Python internals. This article covers technical details, affected versions, security impact, and mitigation.

Published: May 11, 2026

CVE-2025-65106 Overview

CVE-2025-65106 is a template injection vulnerability in LangChain, a framework for building agents and large language model (LLM) applications. The flaw resides in the prompt template system, specifically ChatPromptTemplate and related classes. Attackers can exploit template syntax to access Python object internals when applications accept untrusted template strings, not just template variables. The vulnerability affects LangChain versions 0.3.79 and prior, and 1.0.0 through 1.0.6. Maintainers patched the issue in versions 0.3.80 and 1.0.7. The weakness is categorized as [CWE-1336] (Improper Neutralization of Special Elements Used in a Template Engine).

Critical Impact

Attackers supplying crafted template strings can traverse Python object hierarchies, potentially exposing sensitive runtime data or escalating to broader code execution within LangChain-powered agents.

Affected Products

  • LangChain versions 0.3.79 and prior
  • LangChain versions 1.0.0 through 1.0.6
  • Applications using ChatPromptTemplate and related prompt template classes with untrusted input

Discovery Timeline

  • 2025-11-21 - CVE-2025-65106 published to NVD
  • 2026-04-15 - Last updated in NVD database

Technical Details for CVE-2025-65106

Vulnerability Analysis

LangChain's prompt template system renders template strings using Python's formatting machinery. When applications pass attacker-controlled strings as templates rather than as template variables, the formatter evaluates embedded syntax against caller-supplied objects. This evaluation exposes attribute access and indexing operations on Python objects passed into the renderer.

The vulnerability is reachable when developers build prompts dynamically from user input, configuration files, or third-party content. An attacker who controls the template body can craft expressions that walk object attributes, including dunder attributes such as __class__, __globals__, or __builtins__. This pattern enables disclosure of internal state and, depending on the runtime context, can be chained to read sensitive variables held by the application.

Root Cause

The root cause is improper neutralization of special elements in the template engine. The prompt template implementation treated the template string itself as trusted, applying Python format-style substitution without restricting access to object internals. Variable-only sanitization is insufficient when the template body itself is attacker-controlled.

Attack Vector

Exploitation occurs over the network when an application accepts template strings from untrusted sources and passes them to LangChain's prompt builders. Common entry points include API endpoints, chatbot configuration interfaces, agent tool definitions, and stored prompt templates loaded from external storage. No authentication is required when the vulnerable endpoint is publicly reachable. See the GitHub Security Advisory GHSA-6qv9-48xg-fc7f for technical details on the vulnerable code paths.

Detection Methods for CVE-2025-65106

Indicators of Compromise

  • Prompt inputs containing dunder attribute references such as {0.__class__}, __globals__, __subclasses__, or __builtins__.
  • Anomalous error traces from LangChain prompt rendering paths referencing ChatPromptTemplate, PromptTemplate, or format methods.
  • Outbound LLM payloads or logs containing strings that resemble Python object representations rather than natural-language prompts.

Detection Strategies

  • Inspect application logs for prompt strings that include format specifiers, brace expressions, or attribute traversal patterns.
  • Audit code paths that pass user-supplied data to ChatPromptTemplate.from_template, PromptTemplate.from_template, or equivalent constructors.
  • Use software composition analysis to flag LangChain installations at versions 0.3.79 or earlier, and 1.0.0 through 1.0.6.

Monitoring Recommendations

  • Alert on requests to LLM-facing endpoints containing brace-delimited expressions or Python dunder attributes.
  • Monitor for unusual ImportError, AttributeError, or KeyError exceptions originating from LangChain template rendering.
  • Track upstream LLM provider request payloads for content that suggests successful introspection of application internals.

How to Mitigate CVE-2025-65106

Immediate Actions Required

  • Upgrade LangChain to version 0.3.80 or 1.0.7 immediately across all environments using the framework.
  • Audit application code to confirm that template strings are sourced only from trusted, developer-controlled locations.
  • Treat any field that becomes a template body as a sensitive control surface and apply strict allowlisting.

Patch Information

The LangChain maintainers released fixes in versions 0.3.80 and 1.0.7. The patches are tracked in commits c4b6ba254e1a49ed91f2e268e6484011c540542a and fa7789d6c21222b85211755d822ef698d3b34e00. Refer to the GitHub Security Advisory GHSA-6qv9-48xg-fc7f for the official advisory.

Workarounds

  • Refactor applications so user input is supplied only as template variables, never as the template string itself.
  • Validate or reject any template input containing brace characters, format specifiers, or dunder attribute names before rendering.
  • Isolate LangChain agents in sandboxed processes with minimal filesystem and environment variable exposure to reduce blast radius.
bash
# Configuration example
pip install --upgrade "langchain>=1.0.7"
# Or for the 0.3.x branch
pip install --upgrade "langchain>=0.3.80,<1.0.0"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechLangchain

  • SeverityHIGH

  • CVSS Score8.3

  • EPSS Probability0.05%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityNone
  • CWE References
  • CWE-1336
  • Technical References
  • GitHub Commit Update

  • GitHub Commit Change

  • GitHub Security Advisory GHSA-6qv9-48xg-fc7f
  • Related CVEs
  • CVE-2026-30617: LangChain-ChatChat 0.3.1 RCE Vulnerability

  • CVE-2026-40087: LangChain RCE Vulnerability

  • CVE-2025-46059: LangChain GmailToolkit RCE Vulnerability

  • CVE-2024-46946: Langchain-experimental RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English