UTC
Low

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

CVE-2026-26013 · GHSA-2g6r-c272-w58r · published 2026-02-11

Severity
Low
CVSS score
3.7
Chance of exploitation (EPSS)
0.42%
Fixed in
1.2.11
  • Exploitation No known exploitation
  • Automatable No
  • Technical impact Partial
  • CISA SSVC
What it is

An attacker who can control image URLs passed to get_num_tokens_from_messages() 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 token counting, which may happen outside of model invocation (e.g., in logging, metrics, or token budgeting flows).

What to do

Upgrade langchain-core to 1.2.11 or later. If you start it from an MCP config with npx or uvx, pin that version so an old cached copy is not used.

The vulnerability has been patched in langchain-openai==1.1.9 (requires langchain-core==1.2.11). The patch adds: 1. SSRF validation using to block: Private IP ranges (RFC 1918, loopback, link-local) Cloud metadata endpoints (169.254.169.254, etc.) Invalid URL schemes 2. Explicit size limits (50 MB maximum, matching OpenAI's payload limit) 3. Explicit timeout (5 seconds, same as httpx.get default) 4. Allow disabling image fetching via allow_fetching_images=False parameter

If you cannot upgrade yet

If you cannot upgrade immediately: 1. Sanitize input: Validate and filter image_url values before passing messages to token counting or model invocation 2. Use network controls: Implement egress filtering to prevent outbound requests to private IPs

Affected
PackageRegistryAffectedFixed in
langchain-corePyPI< 1.2.111.2.11
Downstream in the Official MCP Registry

1 registered MCP server installs an affected version today, by the dependency versions a fresh install resolves.

  • io.github.jahanv01/sec-intelligence-mcplangchain-core@0.3.86
See the trace →

The impact, patch and workaround text comes from the advisory, shortened (GitHub Advisory Database, CC BY 4.0). Proof-of-concept and reproduction sections and code are left out; the original advisory has them.

Sources: GitHub Advisory Database, reviewed and malware advisories (CC BY 4.0, https://github.com/advisories); advisories published by Cursor (https://github.com/cursor/cursor/security/advisories); advisories published by OpenClaw (https://github.com/openclaw/openclaw/security/advisories); advisories published by vLLM (https://github.com/vllm-project/vllm/security/advisories); advisories published by Open WebUI (https://github.com/open-webui/open-webui/security/advisories); advisories published by n8n (https://github.com/n8n-io/n8n/security/advisories); advisories published by Flowise (https://github.com/FlowiseAI/Flowise/security/advisories); advisories published by Langflow (https://github.com/langflow-ai/langflow/security/advisories); advisories published by the MCP Python SDK project (https://github.com/modelcontextprotocol/python-sdk/security/advisories); advisories published by MLflow (https://github.com/mlflow/mlflow/security/advisories); CISA Known Exploited Vulnerabilities catalog (CC0). Data as of 2026-11-22. ShieldMap describes how each problem works and how to fix it; it does not publish exploit code. Report a correction to [email protected].