Security mailing lists by PureSourceCode

CVE-2026-40087

MEDIUM 5.3CVSS 3.1

LangChain has incomplete f-string validation in prompt templates

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.

Published
9 Apr 2026
Last modified
25 Oct 2026
Assigned by
security-advisories@github.com
NVD status
Analyzed
Weakness
CWE-1336CWE-20
Also known as
GHSA-926x-3r5x-gfhwPYSEC-2026-2563
Sources
NVDJSONOSV GHSA-926x-3r5x-gfhwJSONOSV PYSEC-2026-2563JSON

Scores

SourceScored byVersionScoreVector / decision
NVD security-advisories@github.com (Secondary) CVSS 3.1 MEDIUM 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
OSV GitHub CVSS 3.1 MEDIUM 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
OSV PyPA CVSS 3.1 MEDIUM 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N

Affected

SourceVendor / ecosystemProduct / packageAffected versionsFixed in
NVD langchain langchain_core
cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:*
< 0.3.84 0.3.84
NVD langchain langchain_core
cpe:2.3:a:langchain:langchain_core:*:*:*:*:*:python:*:*
>= 1.0.0, < 1.2.28 1.2.28
OSV PyPI langchain-core < 0.3.84 0.3.84
OSV PyPI langchain-core >= 1.0.0a1, < 1.2.28 1.2.28
OSV PyPI langchain-core < 0.3.84; >= 1.0.0a1, < 1.2.28 0.3.84, 1.2.28

References

History

  • 25 Nov 2026 21:02 UTC · NVD: first stored (published 9 Apr 2026)
  • 25 Nov 2026 20:12 UTC · OSV: first stored (published 13 Jul 2026)
  • 25 Nov 2026 20:11 UTC · OSV: first stored (published 8 Apr 2026)
An unhandled error has occurred. Reload ×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.