Skip to content

CVE-2026-40087 LangChain has incomplete f-string validation in prompt templates

MediumCVSS 5.3 EPSS 0.27%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: yes · technical impact: partial
Technology
Red Hat

Description

LangChain is a framework for building agents and LLM-powered applications. Prior to 0.3.84 and 1.2.28, 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. Second, f-string validation based on parsed top-level field names did not reject nested replacement fields inside format specifiers. 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 Python formatting would still attempt to resolve the nested expression at runtime. This vulnerability is fixed in 0.3.84 and 1.2.28.

Upgrade path

13 packages: 2 fixed, 10 with no fix yet.

PackageAffectedFixed inStatus
redhat/ansible-automation-platform-24/lightspeed-rhel8-operator(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/ansible-automation-platform-25/lightspeed-chatbot-rhel8(Red Hat ansible_automation_platform 2) All versions No fix listed No fix yet
redhat/openshift-lightspeed/lightspeed-service-api-rhel9(Red Hat openshift_lightspeed 1) All versions No fix listed No fix yet
redhat/redhat-user-workloads/art-images(Red Hat migration_toolkit_applications 8) All versions No fix listed No fix yet
redhat/rhelai3/bootc-cuda-rhel9(Red Hat enterprise_linux_ai 3) All versions No fix listed No fix yet
redhat/rhelai3/bootc-rocm-rhel9(Red Hat enterprise_linux_ai 3) All versions No fix listed No fix yet
redhat/rhelai3/disk-image-cuda-rhel9(Red Hat enterprise_linux_ai 3) All versions No fix listed No fix yet
redhat/rhoai/odh-llama-stack-core-rhel9(Red Hat openshift_ai) All versions No fix listed No fix yet
redhat/rhoai/odh-mlflow-rhel9(Red Hat openshift_ai) All versions No fix listed No fix yet
redhat/rhoai/odh-trustyai-nemo-guardrails-server-rhel9(Red Hat openshift_ai) All versions No fix listed No fix yet
@langchain langchain core < 0.3.84; >= 1.0.0, < 1.2.28 0.3.84, 1.2.28 Fixed
pypi langchain-core(PyPI) < 0.3.83; < 0.3.84; = 0.0.1; = 0.0.2 +265 more 0.3.83, 0.3.84, 1.2.28 Fixed
langchain-ai langchain = < 0.3.83; = >= 1.0.0a1, < 1.2.28 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
pypi langchain-core(PyPI) < 0.3.84 0.3.84
pypi langchain-core(PyPI) = 0.0.1 No fix listed
pypi langchain-core(PyPI) = 0.0.10 No fix listed
pypi langchain-core(PyPI) = 0.0.11 No fix listed
pypi langchain-core(PyPI) = 0.0.12 No fix listed
pypi langchain-core(PyPI) = 0.0.13 No fix listed
pypi langchain-core(PyPI) = 0.0.13rc1 No fix listed
pypi langchain-core(PyPI) = 0.0.13rc2 No fix listed
pypi langchain-core(PyPI) = 0.0.2 No fix listed
pypi langchain-core(PyPI) = 0.0.3 No fix listed
pypi langchain-core(PyPI) = 0.0.4 No fix listed
pypi langchain-core(PyPI) = 0.0.5 No fix listed
pypi langchain-core(PyPI) = 0.0.6 No fix listed
pypi langchain-core(PyPI) = 0.0.7 No fix listed
pypi langchain-core(PyPI) = 0.0.8 No fix listed
pypi langchain-core(PyPI) = 0.0.9 No fix listed
pypi langchain-core(PyPI) = 0.1.0 No fix listed
pypi langchain-core(PyPI) = 0.1.1 No fix listed
pypi langchain-core(PyPI) = 0.1.10 No fix listed
pypi langchain-core(PyPI) = 0.1.11 No fix listed
pypi langchain-core(PyPI) = 0.1.12 No fix listed
pypi langchain-core(PyPI) = 0.1.12rc1 No fix listed
pypi langchain-core(PyPI) = 0.1.13 No fix listed
pypi langchain-core(PyPI) = 0.1.14 No fix listed
pypi langchain-core(PyPI) = 0.1.15 No fix listed
Show 175 more
ProductAffected versionsFixed in
pypi langchain-core(PyPI) = 0.1.15rc1 No fix listed
pypi langchain-core(PyPI) = 0.1.15rc2 No fix listed
pypi langchain-core(PyPI) = 0.1.16 No fix listed
pypi langchain-core(PyPI) = 0.1.17 No fix listed
pypi langchain-core(PyPI) = 0.1.18 No fix listed
pypi langchain-core(PyPI) = 0.1.19 No fix listed
pypi langchain-core(PyPI) = 0.1.2 No fix listed
pypi langchain-core(PyPI) = 0.1.20 No fix listed
pypi langchain-core(PyPI) = 0.1.21 No fix listed
pypi langchain-core(PyPI) = 0.1.22 No fix listed
pypi langchain-core(PyPI) = 0.1.23 No fix listed
pypi langchain-core(PyPI) = 0.1.24 No fix listed
pypi langchain-core(PyPI) = 0.1.25 No fix listed
pypi langchain-core(PyPI) = 0.1.26 No fix listed
pypi langchain-core(PyPI) = 0.1.27 No fix listed
pypi langchain-core(PyPI) = 0.1.28 No fix listed
pypi langchain-core(PyPI) = 0.1.29 No fix listed
pypi langchain-core(PyPI) = 0.1.3 No fix listed
pypi langchain-core(PyPI) = 0.1.30 No fix listed
pypi langchain-core(PyPI) = 0.1.31 No fix listed
pypi langchain-core(PyPI) = 0.1.32 No fix listed
pypi langchain-core(PyPI) = 0.1.33 No fix listed
pypi langchain-core(PyPI) = 0.1.33rc1 No fix listed
pypi langchain-core(PyPI) = 0.1.34 No fix listed
pypi langchain-core(PyPI) = 0.1.35 No fix listed
pypi langchain-core(PyPI) = 0.1.36 No fix listed
pypi langchain-core(PyPI) = 0.1.37 No fix listed
pypi langchain-core(PyPI) = 0.1.38 No fix listed
pypi langchain-core(PyPI) = 0.1.39 No fix listed
pypi langchain-core(PyPI) = 0.1.4 No fix listed
pypi langchain-core(PyPI) = 0.1.40 No fix listed
pypi langchain-core(PyPI) = 0.1.41 No fix listed
pypi langchain-core(PyPI) = 0.1.42 No fix listed
pypi langchain-core(PyPI) = 0.1.42rc1 No fix listed
pypi langchain-core(PyPI) = 0.1.43 No fix listed
pypi langchain-core(PyPI) = 0.1.44 No fix listed
pypi langchain-core(PyPI) = 0.1.45 No fix listed
pypi langchain-core(PyPI) = 0.1.46 No fix listed
pypi langchain-core(PyPI) = 0.1.47 No fix listed
pypi langchain-core(PyPI) = 0.1.47rc1 No fix listed
pypi langchain-core(PyPI) = 0.1.48 No fix listed
pypi langchain-core(PyPI) = 0.1.49 No fix listed
pypi langchain-core(PyPI) = 0.1.5 No fix listed
pypi langchain-core(PyPI) = 0.1.50 No fix listed
pypi langchain-core(PyPI) = 0.1.51 No fix listed
pypi langchain-core(PyPI) = 0.1.52 No fix listed
pypi langchain-core(PyPI) = 0.1.53 No fix listed
pypi langchain-core(PyPI) = 0.1.6 No fix listed
pypi langchain-core(PyPI) = 0.1.7 No fix listed
pypi langchain-core(PyPI) = 0.1.8 No fix listed
pypi langchain-core(PyPI) = 0.1.9 No fix listed
pypi langchain-core(PyPI) = 0.2.0 No fix listed
pypi langchain-core(PyPI) = 0.2.0rc1 No fix listed
pypi langchain-core(PyPI) = 0.2.1 No fix listed
pypi langchain-core(PyPI) = 0.2.10 No fix listed
pypi langchain-core(PyPI) = 0.2.11 No fix listed
pypi langchain-core(PyPI) = 0.2.12 No fix listed
pypi langchain-core(PyPI) = 0.2.13 No fix listed
pypi langchain-core(PyPI) = 0.2.15 No fix listed
pypi langchain-core(PyPI) = 0.2.16 No fix listed
pypi langchain-core(PyPI) = 0.2.17 No fix listed
pypi langchain-core(PyPI) = 0.2.18 No fix listed
pypi langchain-core(PyPI) = 0.2.19 No fix listed
pypi langchain-core(PyPI) = 0.2.2 No fix listed
pypi langchain-core(PyPI) = 0.2.20 No fix listed
pypi langchain-core(PyPI) = 0.2.21 No fix listed
pypi langchain-core(PyPI) = 0.2.22 No fix listed
pypi langchain-core(PyPI) = 0.2.23 No fix listed
pypi langchain-core(PyPI) = 0.2.24 No fix listed
pypi langchain-core(PyPI) = 0.2.25 No fix listed
pypi langchain-core(PyPI) = 0.2.26 No fix listed
pypi langchain-core(PyPI) = 0.2.27 No fix listed
pypi langchain-core(PyPI) = 0.2.28 No fix listed
pypi langchain-core(PyPI) = 0.2.29 No fix listed
pypi langchain-core(PyPI) = 0.2.29rc1 No fix listed
pypi langchain-core(PyPI) = 0.2.2rc1 No fix listed
pypi langchain-core(PyPI) = 0.2.3 No fix listed
pypi langchain-core(PyPI) = 0.2.30 No fix listed
pypi langchain-core(PyPI) = 0.2.31 No fix listed
pypi langchain-core(PyPI) = 0.2.32 No fix listed
pypi langchain-core(PyPI) = 0.2.33 No fix listed
pypi langchain-core(PyPI) = 0.2.34 No fix listed
pypi langchain-core(PyPI) = 0.2.35 No fix listed
pypi langchain-core(PyPI) = 0.2.36 No fix listed
pypi langchain-core(PyPI) = 0.2.37 No fix listed
pypi langchain-core(PyPI) = 0.2.38 No fix listed
pypi langchain-core(PyPI) = 0.2.39 No fix listed
pypi langchain-core(PyPI) = 0.2.4 No fix listed
pypi langchain-core(PyPI) = 0.2.40 No fix listed
pypi langchain-core(PyPI) = 0.2.41 No fix listed
pypi langchain-core(PyPI) = 0.2.42 No fix listed
pypi langchain-core(PyPI) = 0.2.43 No fix listed
pypi langchain-core(PyPI) = 0.2.5 No fix listed
pypi langchain-core(PyPI) = 0.2.6 No fix listed
pypi langchain-core(PyPI) = 0.2.7 No fix listed
pypi langchain-core(PyPI) = 0.2.8 No fix listed
pypi langchain-core(PyPI) = 0.2.9 No fix listed
pypi langchain-core(PyPI) = 0.3.0 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev0 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev1 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev2 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev3 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev4 No fix listed
pypi langchain-core(PyPI) = 0.3.0.dev5 No fix listed
pypi langchain-core(PyPI) = 0.3.1 No fix listed
pypi langchain-core(PyPI) = 0.3.10 No fix listed
pypi langchain-core(PyPI) = 0.3.11 No fix listed
pypi langchain-core(PyPI) = 0.3.12 No fix listed
pypi langchain-core(PyPI) = 0.3.13 No fix listed
pypi langchain-core(PyPI) = 0.3.14 No fix listed
pypi langchain-core(PyPI) = 0.3.15 No fix listed
pypi langchain-core(PyPI) = 0.3.16 No fix listed
pypi langchain-core(PyPI) = 0.3.17 No fix listed
pypi langchain-core(PyPI) = 0.3.18 No fix listed
pypi langchain-core(PyPI) = 0.3.19 No fix listed
pypi langchain-core(PyPI) = 0.3.2 No fix listed
pypi langchain-core(PyPI) = 0.3.20 No fix listed
pypi langchain-core(PyPI) = 0.3.21 No fix listed
pypi langchain-core(PyPI) = 0.3.22 No fix listed
pypi langchain-core(PyPI) = 0.3.23 No fix listed
pypi langchain-core(PyPI) = 0.3.24 No fix listed
pypi langchain-core(PyPI) = 0.3.25 No fix listed
pypi langchain-core(PyPI) = 0.3.26 No fix listed
pypi langchain-core(PyPI) = 0.3.27 No fix listed
pypi langchain-core(PyPI) = 0.3.28 No fix listed
pypi langchain-core(PyPI) = 0.3.29 No fix listed
pypi langchain-core(PyPI) = 0.3.3 No fix listed
pypi langchain-core(PyPI) = 0.3.30 No fix listed
pypi langchain-core(PyPI) = 0.3.31 No fix listed
pypi langchain-core(PyPI) = 0.3.32 No fix listed
pypi langchain-core(PyPI) = 0.3.33 No fix listed
pypi langchain-core(PyPI) = 0.3.34 No fix listed
pypi langchain-core(PyPI) = 0.3.34rc1 No fix listed
pypi langchain-core(PyPI) = 0.3.34rc2 No fix listed
pypi langchain-core(PyPI) = 0.3.35 No fix listed
pypi langchain-core(PyPI) = 0.3.36 No fix listed
pypi langchain-core(PyPI) = 0.3.37 No fix listed
pypi langchain-core(PyPI) = 0.3.38 No fix listed
pypi langchain-core(PyPI) = 0.3.39 No fix listed
pypi langchain-core(PyPI) = 0.3.4 No fix listed
pypi langchain-core(PyPI) = 0.3.40 No fix listed
pypi langchain-core(PyPI) = 0.3.41 No fix listed
pypi langchain-core(PyPI) = 0.3.42 No fix listed
pypi langchain-core(PyPI) = 0.3.43 No fix listed
pypi langchain-core(PyPI) = 0.3.44 No fix listed
pypi langchain-core(PyPI) = 0.3.45 No fix listed
pypi langchain-core(PyPI) = 0.3.45rc1 No fix listed
pypi langchain-core(PyPI) = 0.3.46 No fix listed
pypi langchain-core(PyPI) = 0.3.47 No fix listed
pypi langchain-core(PyPI) = 0.3.48 No fix listed
pypi langchain-core(PyPI) = 0.3.49 No fix listed
pypi langchain-core(PyPI) = 0.3.5 No fix listed
pypi langchain-core(PyPI) = 0.3.50 No fix listed
pypi langchain-core(PyPI) = 0.3.51 No fix listed
pypi langchain-core(PyPI) = 0.3.52 No fix listed
pypi langchain-core(PyPI) = 0.3.53 No fix listed
pypi langchain-core(PyPI) = 0.3.54 No fix listed
pypi langchain-core(PyPI) = 0.3.55 No fix listed
pypi langchain-core(PyPI) = 0.3.56 No fix listed
pypi langchain-core(PyPI) = 0.3.56rc1 No fix listed
pypi langchain-core(PyPI) = 0.3.57 No fix listed
pypi langchain-core(PyPI) = 0.3.58 No fix listed
pypi langchain-core(PyPI) = 0.3.59 No fix listed
pypi langchain-core(PyPI) = 0.3.6 No fix listed
pypi langchain-core(PyPI) = 0.3.60 No fix listed
pypi langchain-core(PyPI) = 0.3.61 No fix listed
pypi langchain-core(PyPI) = 0.3.62 No fix listed
pypi langchain-core(PyPI) = 0.3.63 No fix listed
pypi langchain-core(PyPI) = 0.3.64 No fix listed
pypi langchain-core(PyPI) = 0.3.65 No fix listed
pypi langchain-core(PyPI) = 0.3.66 No fix listed
pypi langchain-core(PyPI) = 0.3.67 No fix listed
pypi langchain-core(PyPI) = 0.3.68 No fix listed
pypi langchain-core(PyPI) = 0.3.69 No fix listed
pypi langchain-core(PyPI) = 0.3.7 No fix listed

References