🛡️ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#596
🛡️ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#596mudcube wants to merge 1 commit into
Conversation
Mitigate SSRF in `handle_web_fetch` by replacing `reqwest::blocking::get` with a manual IP resolution and validation loop. * Implement `is_allowed_ip` to strictly filter loopback, private (10.x, 172.16..=31, 192.168), link-local, unspecified (0.0.0.0/8), multicast, and broadcast addresses across IPv4 and IPv6 (including IPv4-mapped IPv6). * Prevent TOCTOU DNS Rebinding by explicitly pinning the validated IP address using `reqwest::blocking::ClientBuilder::resolve()`. * Disable automatic redirects and handle `Location` headers manually to ensure redirect targets undergo the same IP validation loop, preventing SSRF bypasses via external redirects. * Preserve original hostname for SNI and HTTPS compatibility. Co-authored-by: mudcube <101564+mudcube@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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Deploying typemill with
|
| Latest commit: |
1300429
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4fd8cb88.typemill.pages.dev |
| Branch Preview URL: | https://sentinel-fix-ssrf-web-fetch-47fw.typemill.pages.dev |
🚨 Severity: CRITICAL
💡 Vulnerability: Server-Side Request Forgery (SSRF) in the
web_fetchtool. The tool previously usedreqwest::blocking::getdirectly with user-supplied URLs, allowing an attacker to request internal network services and bypass DNS-based validation due to TOCTOU DNS Rebinding.🎯 Impact: An attacker could use the
web_fetchtool to access and exfiltrate data from internal or restricted network services (e.g., localhost, AWS metadata service, private subnets) that the agent host has access to.🔧 Fix:
reqwest::blocking::getcall with a manual DNS resolution loop.is_allowed_ipblocklist that correctly validates all returned IP addresses, explicitly blocking 0.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, IPv4-mapped IPv6 addresses, and IPv6 unique-local/link-local ranges.reqwest::blocking::ClientBuilder::resolve(). This preserves the original hostname, allowing SNI and HTTPS to continue functioning.Url::join, ensuring that any external redirect target also undergoes the same strict IP validation.✅ Verification:
cargo check -p mill-plugin-system).cargo test -p mill-plugin-system).cargo fmt -p mill-plugin-systemandcargo clippy -p mill-plugin-system)..jules/sentinel.mddocumenting the SSRF mitigation and DNS Rebinding prevention strategy.PR created automatically by Jules for task 55156631330636357 started by @mudcube