ZeroHour

CVE-2026-77972

niche

TOCTOU DNS Race in Slab safeurl Defeats SSRF URL Validation

CVSS 4.0
9.0 critical
EPSS
Published
()
Modified
AI analysis

Slab's safeurl Ruby library, which guards against server-side request forgery (SSRF), suffers a time-of-check to time-of-use (TOCTOU) race condition affecting all versions from 0.1.0 onward. Validation resolves a hostname and checks the resulting address, but returns only a pass/fail verdict — the HTTP clients shipped with the library receive the original hostname and resolve it a second time when the request is actually made. An attacker who controls the authoritative DNS for a requested name can answer the first lookup with a permitted address and the second with a blocked one, causing the request to reach internal network destinations that validation explicitly rejected. The same bypass can occur without an attacker whenever a name legitimately resolves to different addresses across lookups (short DNS TTLs or multi-address rotation). No fixed version is identified in the available data, and no public proof-of-concept or in-the-wild exploitation is known.

What to do: Inventory your Ruby dependency trees for the safeurl gem and treat any version from 0.1.0 onward as affected; watch for a patched release from Slab and upgrade immediately when one ships. Until then, mitigate by resolving the hostname once, using the validated IP for the actual request (DNS pinning) rather than re-resolving the hostname, or routing outbound fetches through an egress proxy that enforces destination checks at connection time. Review application logs for requests where the destination address differed from the validated one, and confirm that internal services require authentication rather than relying on network reachability alone.

Affected
Slab safeurlfrom 0.1.0 onward (no fixed version stated in the data)
Estimated exposure
nicheestimated hundreds to low thousands of applications embedding the gem (clearly an estimate) — safeurl is an optional Ruby SSRF-guard dependency with no public install counts, and only a subset of Ruby web apps that fetch user-supplied URLs adopt it, so the population is plausibly in the low thousands rather than broader.

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Time-of-check Time-of-use (TOCTOU) Race Condition in Slab safeurl allows an attacker who controls a hostname's DNS responses to reach internal network destinations that validation rejected. Validation returns a verdict and not the address it approved, so the HTTP clients the library ships receive the original hostname and resolve it a second time when the request is made. An attacker who controls the authoritative DNS for a name can answer the first lookup with a permitted address and the second with a blocked one, and the request then reaches a destination validation never approved. The same window opens without an attacker whenever a name legitimately resolves to different addresses across lookups, such as short record lifetimes or rotation between several addresses. This issue affects safeurl: from 0.1.0 onward.

Weakness
CWE-367
Vector
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:L/VA:N/SC:H/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

In the news

No ingested article mentions this CVE yet.