CVE-2026-41488

angchain-openai: Image token counting SSRF protection can be bypassed via DNS rebinding

Published Apr 24, 2026 CVSS 3.1 · 3.1 Low EPSS < 1% KEV · Not listed
Description
LangChain is a framework for building agents and LLM-powered applications. Prior to 1.1.14, langchain-openai's _url_to_size() helper (used by get_num_tokens_from_messages for image token counting) validated URLs for SSRF protection and then fetched them in a separate network operation with independent DNS resolution. This left a TOCTOU / DNS rebinding window: an attacker-controlled hostname could resolve to a public IP during validation and then to a private/localhost IP during the actual fetch.

Analysis

AI-generated

Technical impact

This vulnerability resides in LangChain’s langchain-openai module. Prior to version 1.1.14 the helper that counts image tokens performs initial SSRF validation on a URL and then fetches the image in a separate network operation with an independent DNS lookup. The separation creates a time‑of‑check to time‑of‑use window; an attacker who supplies a domain that resolves to a public IP during validation can later cause the fetch to resolve to a private or localhost IP, enabling SSRF. The weakness is a classic DNS rebinding flaw (CWE‑918) and a time‑of‑check to time‑of‑use flaw (CWE‑367). The impact is that an attacker can cause the application to make internal network requests that it was not intended to perform.

Affected Systems

LangChain – specifically the langchain-openai package – is affected in all releases prior to 1.1.14. The fix was introduced in version 1.1.14 and later releases protect against the DNS rebinding window.

Risk and Exploitability

The CVSS score is 3.1, indicating low overall severity, and the EPSS score is less than 1%, suggesting a low probability of exploitation. The vulnerability is not listed in the CISA KEV catalog. Because the flaw relies on control of a DNS name that can be made to resolve to internal addresses, it is most likely to be exploited by an attacker who can supply image URLs or otherwise invoke the token counting function with a crafted hostname.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade langchain-openai to version 1.1.14 or later, which closes the DNS rebinding window.
  • If an upgrade is not immediately possible, restrict the image token counting feature to URLs whose hosts are known, trusted domains and block any DNS responses that resolve to private addresses such as 10.x.x.x, 172.16‑172.31.x, 192.168.x.x and 127.0.0.1.
  • Implement an additional post‑fetch validation step that re‑resolves the hostname and verifies that the final IP address is not internal; reject the request if it is.

Generated by OpenCVE AI on April 28, 2026 at 19:59 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-r7w7-9xr2-qq2r langchain-openai: Image token counting SSRF protection can be bypassed via DNS rebinding
History
Type Values Removed Values Added
First Time appeared Langchain
Langchain langchain-openai
CPEs cpe:2.3:a:langchain:langchain-openai:*:*:*:*:*:*:*:*
Vendors & Products Langchain
Langchain langchain-openai
Type Values Removed Values Added
First Time appeared Langchain-ai
Langchain-ai langchain
Vendors & Products Langchain-ai
Langchain-ai langchain
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description LangChain is a framework for building agents and LLM-powered applications. Prior to 1.1.14, langchain-openai's _url_to_size() helper (used by get_num_tokens_from_messages for image token counting) validated URLs for SSRF protection and then fetched them in a separate network operation with independent DNS resolution. This left a TOCTOU / DNS rebinding window: an attacker-controlled hostname could resolve to a public IP during validation and then to a private/localhost IP during the actual fetch.
Title angchain-openai: Image token counting SSRF protection can be bypassed via DNS rebinding
Weaknesses CWE-918
References
Metrics cvssV3_1

{'score': 3.1, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N'}

Weaknesses
  • CWE-367

    Time-of-check Time-of-use (TOCTOU) Race Condition

  • CWE-918

    Server-Side Request Forgery (SSRF)

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Apr 27, 2026, 1:40 PM
Reserved
Apr 20, 2026, 4:14 PM
Status
Analyzed
Published
Apr 24, 2026, 9:16 PM
Modified
Oct 26, 2026, 9:10 PM
Severity
Low
Public date
Apr 24, 2026, 8:57 PM