{"schemaVersion":3,"id":"CVE-2026-40087","aliases":["GHSA-926x-3r5x-gfhw","PYSEC-2026-2563","CGA-h9qq-qw3w-4vcv","CGA-rf7q-x769-vjpj","CGA-49gv-2v6j-pjwm","CGA-7j3w-98c2-9289","CGA-7jqp-fr37-mh35","CGA-92ch-7cch-j63f","CGA-c3j7-2jj3-4wm3","CGA-g7q7-9qmq-x695","CGA-hf5w-vmg9-cqg9","CGA-jp42-ww69-q97m","CGA-v984-g369-25r2","CGA-wc34-pp9j-h84v"],"status":"published","duplicateOf":null,"title":null,"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.","dates":{"published":"2026-04-09T19:34:55.198Z","modified":"2026-04-14T14:48:03.160Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":5.3,"severity":"medium","version":"3.1","versionLabel":"v3.1","source":"CVE.org","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":5.3,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","exploitability":null,"impact":null,"computed":false},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Pypi","score":5.3,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","exploitability":10,"impact":2.3,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Wolfi","score":5.3,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","exploitability":10,"impact":2.3,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Chainguard","score":5.3,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","exploitability":10,"impact":2.3,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":5.3,"severity":"medium","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.00454,"percentile":0.38129,"severity":"low","asOf":"2026-10-20T00:00:00.000Z","change":{"pp":0.19199999999999998,"baselineDate":"2026-09-20T00:00:00.000Z","baselineScore":0.00262},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.00454,"percentile":0.38129}],"last30":[{"date":"2026-09-20T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.00262,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.00454,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.00454,"percentile":0.38129}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-1336","name":"Improper Neutralization of Special Elements Used in a Template Engine","description":"The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.","type":"weakness","status":"Incomplete","abstraction":"Base","likelihoodOfExploit":null,"url":"https://cwe.mitre.org/data/definitions/1336.html"}],"affected":[{"vendor":"chainguard","product":"open-webui","name":"open-webui","label":"open-webui","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/open-webui","purlType":"apk","versions":[{"text":"< 0.8.12-r3","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 0.8.12-r3","eol":null,"hubHref":null},{"vendor":"chainguard","product":"py3-langchain","name":"py3-langchain","label":"py3-langchain","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/py3-langchain","purlType":"apk","versions":[{"text":"< 1.3.0-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 1.3.0-r0","eol":null,"hubHref":null},{"vendor":"chainguard","product":"py3.10-langchain","name":"py3.10-langchain","label":"py3.10-langchain","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/py3.10-langchain","purlType":"apk","versions":[{"text":"< 1.3.0-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 1.3.0-r0","eol":null,"hubHref":null},{"vendor":"chainguard","product":"py3.11-langchain","name":"py3.11-langchain","label":"py3.11-langchain","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/py3.11-langchain","purlType":"apk","versions":[{"text":"< 1.3.0-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 1.3.0-r0","eol":null,"hubHref":null},{"vendor":"chainguard","product":"py3.12-langchain","name":"py3.12-langchain","label":"py3.12-langchain","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/py3.12-langchain","purlType":"apk","versions":[{"text":"< 1.3.0-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 1.3.0-r0","eol":null,"hubHref":null},{"vendor":"chainguard","product":"py3.13-langchain","name":"py3.13-langchain","label":"py3.13-langchain","ecosystem":"Chainguard","cpePart":null,"purl":"pkg:apk/chainguard/py3.13-langchain","purlType":"apk","versions":[{"text":"< 1.3.0-r0","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 1.3.0-r0","eol":null,"hubHref":null},{"vendor":"wolfi","product":"open-webui","name":"open-webui","label":"open-webui","ecosystem":"Wolfi","cpePart":null,"purl":"pkg:apk/wolfi/open-webui","purlType":"apk","versions":[{"text":"< 0.8.12-r3","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 0.8.12-r3","eol":null,"hubHref":null},{"vendor":"langchain-ai","product":"langchain","name":"langchain","label":"langchain","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"< 0.3.83","noFixRecorded":false,"fixedIn":null},{"text":"≥ 1.0.0a1, < 1.2.28","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 0.3.83 | ≥ 1.0.0a1, < 1.2.28","eol":null,"hubHref":"/vendor/langchain-ai/langchain"},{"vendor":"langchain","product":"langchain_core","name":"langchain core","label":"langchain_core","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"< 0.3.84","noFixRecorded":false,"fixedIn":null},{"text":"≥ 1.0.0, < 1.2.28","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 0.3.84 | ≥ 1.0.0, < 1.2.28","eol":null,"hubHref":"/vendor/langchain/langchain_core"},{"vendor":"PyPI","product":"langchain-core","name":"langchain-core","label":"langchain-core","ecosystem":"PyPI","cpePart":null,"purl":"pkg:pypi/langchain-core","purlType":"pypi","versions":[{"text":"< 0.3.84","noFixRecorded":false,"fixedIn":null},{"text":"≥ 1.0.0a1, < 1.2.28","noFixRecorded":false,"fixedIn":null}],"versionsText":"< 0.3.84 | ≥ 1.0.0a1, < 1.2.28","eol":null,"hubHref":null}],"affectedCount":10,"eol":{"hasEol":false,"count":0},"references":[{"url":"https://github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gfhw","label":"github.com/langchain-ai/langchain/security/advisories/GHSA-926x-3r5x-gfhw","hostname":"github.com","tags":["X Refsource CONFIRM","WEB","Advisory","Mitigation","Vendor Advisory"]},{"url":"https://github.com/langchain-ai/langchain/pull/36612","label":"github.com/langchain-ai/langchain/pull/36612","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Issue Tracking","Patch"]},{"url":"https://github.com/langchain-ai/langchain/pull/36613","label":"github.com/langchain-ai/langchain/pull/36613","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Issue Tracking","Patch"]},{"url":"https://github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a6151cd27b","label":"github.com/langchain-ai/langchain/commit/6bab0ba3c12328008ddca3e0d54ff5a6151cd27b","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Patch"]},{"url":"https://github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db3774c8dfe258","label":"github.com/langchain-ai/langchain/commit/af2ed47c6f008cdd551f3c0d87db3774c8dfe258","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","Patch"]},{"url":"https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.84","label":"github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D0.3.84","hostname":"github.com","tags":["X Refsource MISC","WEB","Product","Release Notes"]},{"url":"https://github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.28","label":"github.com/langchain-ai/langchain/releases/tag/langchain-core%3D%3D1.2.28","hostname":"github.com","tags":["X Refsource MISC","WEB","Product","Release Notes"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40087","label":"nvd.nist.gov/vuln/detail/CVE-2026-40087","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/langchain-ai/langchain","label":"github.com/langchain-ai/langchain","hostname":"github.com","tags":["PACKAGE"]},{"url":"https://pypi.org/project/langchain-core","label":"pypi.org/project/langchain-core","hostname":"pypi.org","tags":["PACKAGE"]},{"url":"https://github.com/advisories/GHSA-926x-3r5x-gfhw","label":"github.com/advisories/GHSA-926x-3r5x-gfhw","hostname":"github.com","tags":["Advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40087.json","label":"github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40087.json","hostname":"github.com","tags":["Advisory"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":["CGA-X2G4-JF4R-VMF4"]},"timeline":[{"kind":"published","date":"2026-04-09T19:34:55.198Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2026-04-14T14:48:03.160Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"risk":{"score":21,"level":"low","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-21T00:30:14.336Z","stale":false,"partial":false}}