CVE-2026-26013Low· 3.7▾ SunlitLangChain affected by SSRF via image_url token counting in ChatOpenAI.get_num_tokens_from_messages
▾ Sunlit zone — Low / medium · no exploitation signal
impact 20.4 · likelihood 0.1 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
Exploit-prediction probability, daily snapshots since Jul 13.
Disclosure to exploitation, from the record and what we observed since indexing it.
Disclosed via OSV
0.4%
Last analysed / modified upstream
0.4% → 0.4%
The ChatOpenAI.get_num_tokens_from_messages() method fetches arbitrary image_url 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.
Low - The vulnerability allows SSRF attacks but has limited impact due to:
An attacker who can control image URLs passed to get_num_tokens_from_messages() can:
Note: This vulnerability occurs during token counting, which may happen outside of model invocation (e.g., in logging, metrics, or token budgeting flows).
The vulnerable code path:
get_num_tokens_from_messages() processes messages containing image_url content blocksdetail: "low", it calls _url_to_size() to fetch the image and compute token counts_url_to_size() performs httpx.get(image_source) on any URL without validationFile: libs/partners/openai/langchain_openai/chat_models/base.py
The vulnerability has been patched in langchain-openai==1.1.9 (requires langchain-core==1.2.11).
The patch adds:
langchain_core._security._ssrf_protection.validate_safe_url() to block:
httpx.get default)allow_fetching_images=False parameterIf you cannot upgrade immediately:
image_url values before passing messages to token counting or model invocationlangchain-core < 1.2.11Upgrade to a patched release:
langchain-core 1.2.11Connected by shared product, vendor, weakness, or advisory.
CVE-2026-44843High· 8.2LangChain vulnerable to unsafe deserialization of attacker-controlled objects through overly broad `load()` allowlists
CVE-2026-40087Medium· 5.3LangChain has incomplete f-string validation in prompt templates
CVE-2024-1455Medium· 5.9LangChain's XMLOutputParser vulnerable to XML Entity Expansion
CVE-2025-65106HighLangChain Vulnerable to Template Injection via Attribute Access in Prompt Templates
CVE-2024-10940Medium· 5.3langchain-core allows unauthorized users to read arbitrary files from the host file system