The vulnerability is a Server-Side Request Forgery (SSRF) in the langchain-openai library, specifically in the _url_to_size function located in libs/partners/openai/langchain_openai/chat_models/base.py. The function was responsible for fetching images from a URL to count the number of tokens. The vulnerability arises from a Time-of-Check to Time-of-Use (TOCTOU) flaw. The code first validated the URL to prevent access to private networks, but then made a separate DNS request to fetch the image. This allowed for a DNS rebinding attack, where an attacker could provide a URL that resolves to a safe, public IP during the validation phase, and then resolves to a private, internal IP during the fetching phase. This could allow an attacker to probe internal networks. The patch addresses this by using an SSRF-safe HTTP client that resolves the DNS entry once and uses that resolved IP for the duration of the request, thus preventing the DNS rebinding attack.