Skip to content

← Public intelligence

PyPI package

langchain-core

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

9 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. High, CVSS 8.2PyPIAmendedPublished

    LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad load() allowlists

    CVE-2026-44843 · GHSA-pjwx-r37v-7724

    Affected
    • PyPI langchain-core >= 1.0.0, <= 1.3.2; <= 0.3.84
    Fixed in
    0.3.851.3.3· Vendor fix available
    Issue
    LangChain contains older runtime code paths that deserialize run inputs, run outputs, or other application-controlled payloads using overly broad object allowlists. These paths may call load() with allowedobjects="all". This does not enable arbitrary Python object deserialization, but it does allow any trusted LangChain-serializable object to be revived, which is broader than these runtime paths require. As a result, attacker-supplied LangChain serialized constructor dictionaries may cause trusted runtime paths to instantiate classes with untrusted constructor arguments. Applications are exposed only when all of the following are true: 1. The application accepts untrusted structured input, such as JSON, from a user or network request. 2. The application does not validate or canonicalize that input into an inert schema before invoking LangChain. 3. Attacker-controlled nested dictionaries or lists are preserved in LangChain run inputs or outputs. 4. The application uses an affected API…

    Recommended action: Upgrade to 1.3.3 or 0.3.85 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  2. Medium, CVSS 5.3PyPIPublished

    LangChain has incomplete f-string validation in prompt templates

    CVE-2026-40087 · GHSA-926x-3r5x-gfhw

    Affected
    • PyPI langchain-core < 0.3.84; >= 1.0.0a1, < 1.2.28
    Fixed in
    0.3.841.2.28· Vendor fix available
    Issue
    LangChain's f-string prompt-template validation was incomplete in two respects. First, some prompt template classes accepted f-string templates and formatted them without enforcing the same attribute-access validation as `PromptTemplate`. In particular, `DictPromptTemplate` and `ImagePromptTemplate` could accept templates containing attribute access or indexing expressions and subsequently evaluate those expressions during formatting. Examples of the affected shape include: ```python "{message.additional_kwargs[secret]}" "https://example.com/{image.class.name}.png" ``` Second, f-string validation based on parsed top-level field names did not reject nested replacement fields inside format specifiers. For example: ```python "{name:{name.class.name}}" ``` In this pattern, the nested replacement field appears in the format specifier rather than in the top-level field name. As a result, earlier validation based on parsed field names did not reject the template even though…

    Recommended action: Upgrade to 1.2.28 or 0.3.84 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.devSource checked Evidence →
  3. High, CVSS 7.5PyPIAmendedPublished

    LangChain Core has Path Traversal vulnerabilites in legacy load_prompt functions

    CVE-2026-34070 · GHSA-qh6h-p6c9-ff54

    Affected
    • PyPI langchain-core < 1.2.22
    Fixed in
    1.2.22· Vendor fix available
    Issue
    Multiple functions in langchaincore.prompts.loading read files from paths embedded in deserialized config dicts without validating against directory traversal or absolute path injection. When an application passes user-influenced prompt configurations to loadprompt() or loadpromptfromconfig(), an attacker can read arbitrary files on the host filesystem, constrained only by file-extension checks (.txt for templates, .json/.yaml for examples). Note: The affected functions (loadprompt, loadpromptfromconfig, and the .save() method on prompt classes) are undocumented legacy APIs. They are superseded by the dumpd/dumps/load/loads serialization APIs in langchaincore.load, which do not perform filesystem reads and use an allowlist-based security model. As part of this fix, the legacy APIs have been formally deprecated and will be removed in 2.0.0. Affected component Package: langchain-core File: langchaincore/prompts/loading.py Affected functions: loadtemplate(), loadexamples(),…

    Recommended action: Upgrade to 1.2.22 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  4. Low, CVSS 3.7PyPIAmendedPublished

    LangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_tokens_from_messages

    CVE-2026-26013 · GHSA-2g6r-c272-w58r

    Affected
    • PyPI langchain-core < 1.2.11
    Fixed in
    1.2.11· Vendor fix available
    Issue
    Server-Side Request Forgery (SSRF) in ChatOpenAI Image Token Counting Summary The ChatOpenAI.getnumtokensfrommessages() method fetches arbitrary imageurl values without validation when computing token counts for vision-enabled models. This allows attackers to trigger Server-Side Request Forgery (SSRF) attacks by providing malicious image URLs in user input. Severity Low - The vulnerability allows SSRF attacks but has limited impact due to: - Responses are not returned to the attacker (blind SSRF) - Default 5-second timeout limits resource exhaustion - Non-image responses fail at PIL image parsing Impact An attacker who can control image URLs passed to getnumtokensfrommessages() can: - Trigger HTTP requests from the application server to arbitrary internal or external URLs - Cause the server to access internal network resources (private IPs, cloud metadata endpoints) - Cause minor resource consumption through image downloads (bounded by timeout) Note: This vulnerability occurs during…

    Recommended action: Upgrade to 1.2.11 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  5. Critical, CVSS 9.3PyPIAmendedPublished

    LangChain serialization injection vulnerability enables secret extraction in dumps/loads APIs

    CVE-2025-68664 · GHSA-c67j-w6g6-q2cm

    Affected
    • PyPI langchain-core >= 1.0.0, < 1.2.5; < 0.3.81
    Fixed in
    0.3.811.2.5· Vendor fix available
    Issue
    A serialization injection vulnerability exists in LangChain's `dumps()` and `dumpd()` functions. The functions do not escape dictionaries with `'lc'` keys when serializing free-form dictionaries. The `'lc'` key is used internally by LangChain to mark serialized objects. When user-controlled data contains this key structure, it is treated as a legitimate LangChain object during deserialization rather than plain user data. Attack surface The core vulnerability was in `dumps()` and `dumpd()`: these functions failed to escape user-controlled dictionaries containing `'lc'` keys. When this unescaped data was later deserialized via `load()` or `loads()`, the injected structures were treated as legitimate LangChain objects rather than plain user data. This escaping bug enabled several attack vectors: 1. Injection via user data: Malicious LangChain object structures could be injected through user-controlled fields like `metadata`, `additional_kwargs`, or `response_metadata`…

    Recommended action: Upgrade to 1.2.5 or 0.3.81 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  6. High, CVSS 8.3PyPIAmendedPublished

    LangChain Vulnerable to Template Injection via Attribute Access in Prompt Templates

    CVE-2025-65106 · GHSA-6qv9-48xg-fc7f

    Affected
    • PyPI langchain-core >= 1.0.0, <= 1.0.6; <= 0.3.79
    Fixed in
    0.3.801.0.7· Vendor fix available
    Issue
    Context A template injection vulnerability exists in LangChain's prompt template system that allows attackers to access Python object internals through template syntax. This vulnerability affects applications that accept untrusted template strings (not just template variables) in ChatPromptTemplate and related prompt template classes. Templates allow attribute access (.) and indexing ([]) but not method invocation (()). The combination of attribute access and indexing may enable exploitation depending on which objects are passed to templates. When template variables are simple strings (the common case), the impact is limited. However, when using MessagesPlaceholder with chat message objects, attackers can traverse through object attributes and dictionary lookups (e.g., globals) to reach sensitive data such as environment variables. The vulnerability specifically requires that applications accept template strings (the structure) from untrusted sources, not just template variables (the…

    Recommended action: Upgrade to 1.0.7 or 0.3.80 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  7. Medium, CVSS 5.3PyPIAmendedPublished

    langchain-core allows unauthorized users to read arbitrary files from the host file system

    CVE-2024-10940 · GHSA-5chr-fjjv-38qv

    Affected
    • PyPI langchain-core >= 0.1.17, < 0.1.53; >= 0.2.0, < 0.2.43; >= 0.3.0, < 0.3.15
    Fixed in
    0.1.530.3.150.2.43· Vendor fix available
    Issue
    A vulnerability in langchain-core versions =0.1.17,<0.1.53, =0.2.0,<0.2.43, and =0.3.0,<0.3.15 allows unauthorized users to read arbitrary files from the host file system. The issue arises from the ability to create langchaincore.prompts.ImagePromptTemplate's (and by extension langchaincore.prompts.ChatPromptTemplate's) with input variables that can read any user-specified path from the server file system. If the outputs of these prompt templates are exposed to the user, either directly or through downstream model outputs, it can lead to the exposure of sensitive information.

    Recommended action: Upgrade to 0.3.15, 0.2.43 or 0.1.53 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  8. Medium, CVSS 5.9PyPIAmendedPublished

    LangChain's XMLOutputParser vulnerable to XML Entity Expansion

    CVE-2024-1455 · GHSA-q84m-rmw3-4382

    Affected
    • PyPI langchain-core < 0.1.35
    Fixed in
    0.1.35· Vendor fix available
    Issue
    The XMLOutputParser in LangChain uses the etree module from the XML parser in the standard python library which has some XML vulnerabilities; see: https://docs.python.org/3/library/xml.html This primarily affects users that combine an LLM (or agent) with the XMLOutputParser and expose the component via an endpoint on a web-service. This would allow a malicious party to attempt to manipulate the LLM to produce a malicious payload for the parser that would compromise the availability of the service. A successful attack is predicated on: 1. Usage of XMLOutputParser 2. Passing of malicious input into the XMLOutputParser either directly or by trying to manipulate an LLM to do so on the users behalf 3. Exposing the component via a web-service

    Recommended action: Upgrade to 0.1.35 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  9. UnratedPyPIAmendedPublished

    LangChain directory traversal vulnerability

    CVE-2024-28088 · GHSA-h59x-p739-982c

    Affected
    • PyPI langchain-core < 0.1.30
    Fixed in
    0.1.30· Vendor fix available
    Issue
    LangChain through 0.1.10 allows ../ directory traversal by an actor who is able to control the final part of the path parameter in a loadchain call. This bypasses the intended behavior of loading configurations only from the hwchase17/langchain-hub GitHub repository. The outcome can be disclosure of an API key for a large language model online service, or remote code execution.

    Recommended action: Upgrade to 0.1.30 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →