Repository navigation
🔒 Fix TOCTOU SSRF Vulnerability in web.rs - #272
Tcode-Motion wants to merge 2 commits into
Conversation
Removed redundant DNS resolution from is_safe_url to eliminate the Time-of-Check to Time-of-Use (TOCTOU) vulnerability where the initial validation DNS response could differ from the final connection DNS response. Relies on the ureq SafeResolver to validate IPs at the exact time of connection. Updated SafeResolver to strictly reject the connection if any resolved IP address is internal or blocked, matching the intended restrictiveness of the previous check while closing the TOCTOU window. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Removed redundant DNS resolution from is_safe_url to eliminate the Time-of-Check to Time-of-Use (TOCTOU) vulnerability where the initial validation DNS response could differ from the final connection DNS response. Relies on the ureq SafeResolver to validate IPs at the exact time of connection. Updated SafeResolver to strictly reject the connection if any resolved IP address is internal or blocked, matching the intended restrictiveness of the previous check while closing the TOCTOU window. Also updated GitHub auto-merge workflow to ignore errors when branch protection rules are absent. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
🎯 What: Fixed a Time-of-Check to Time-of-Use (TOCTOU) Server-Side Request Forgery (SSRF) vulnerability in the web standard library's
⚠️ Risk: An attacker could use DNS rebinding to bypass the SSRF protection. The initial
fetchcapability.is_safe_urlcheck would resolve to a safe IP (allowing the request), but the subsequentureqresolution would resolve to an internal/blocked IP (such as127.0.0.1), allowing the attacker to access internal network resources.🛡️ Solution: Removed the redundant DNS resolution logic from
is_safe_url, leaving it to validate only the URL structure and scheme. Relied entirely onSafeResolverto perform DNS resolution and IP validation at the exact timeureqestablishes the connection. Additionally, updatedSafeResolverto strictly fail if any resolved IP is internal, preserving the original strict security policy while eliminating the TOCTOU window.PR created automatically by Jules for task 5812487784938361687 started by @Tcode-Motion