π‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#576
π‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#576mudcube wants to merge 1 commit into
Conversation
π¨ Severity: CRITICAL π‘ Vulnerability: The `web_fetch` tool used `reqwest::blocking::get` without any validation of the target URL or IPs, allowing it to fetch arbitrary internal network resources, rendering it vulnerable to Server-Side Request Forgery (SSRF) and Time-of-Check to Time-of-Use (TOCTOU) DNS Rebinding attacks. π― Impact: Attackers could trick the server into interacting with internal network services (e.g. metadata servers, internal databases) or bypassing external firewalls. π§ Fix: - Added `is_allowed_ip` helper function to block loopback, private networks, unspecified, multicast, broadcast, and link-local IPs across both IPv4 and IPv6. - Overhauled `handle_web_fetch` to manually resolve DNS, validate *all* returned IPs against the blocklist, and pin the validated IP to the HTTP client using `reqwest::blocking::ClientBuilder::resolve`. - Disabled automatic redirects and implemented manual redirect tracking (up to 5 redirects) through the same strict validation pipeline. β Verification: `cargo test --package mill-plugin-system` passed. Tested with internal IPs (127.0.0.1) which are now successfully blocked. Recorded the vulnerability pattern in `.jules/sentinel.md`. Co-authored-by: mudcube <101564+mudcube@users.noreply.github.com>
Deploying typemill with Β
|
| Latest commit: |
7974192
|
| Status: | Β β Β Deploy successful! |
| Preview URL: | https://a5ba07bc.typemill.pages.dev |
| Branch Preview URL: | https://sentinel-ssrf-web-fetch-1540.typemill.pages.dev |
|
π 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. |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7974192c8c
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| || o[0] == 10 | ||
| || o[0] == 127 | ||
| || (o[0] == 169 && o[1] == 254) | ||
| || (o[0] == 172 && (16..=31).contains(&o[1])) | ||
| || (o[0] == 192 && o[1] == 168) |
There was a problem hiding this comment.
Block shared-address IPv4 ranges as internal
In environments that use carrier-grade/shared address space internally, URLs such as http://100.64.0.1/ still pass this predicate because 100.64.0.0/10 is not included in the disallowed IPv4 ranges. That leaves a practical SSRF path to non-public infrastructure even though the new resolver guard is meant to reject internal or otherwise non-routable targets; prefer denying all non-global/special-use IPv4 ranges rather than only RFC1918 plus a few others.
Useful? React with πΒ / π.
π‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool
π¨ Severity: CRITICAL
π‘ Vulnerability: The
web_fetchtool usedreqwest::blocking::getwithout any validation of the target URL or IPs, allowing it to fetch arbitrary internal network resources, rendering it vulnerable to Server-Side Request Forgery (SSRF) and Time-of-Check to Time-of-Use (TOCTOU) DNS Rebinding attacks.π― Impact: Attackers could trick the server into interacting with internal network services (e.g. metadata servers, internal databases) or bypassing external firewalls.
π§ Fix:
is_allowed_iphelper function to block loopback, private networks, unspecified, multicast, broadcast, and link-local IPs across both IPv4 and IPv6.handle_web_fetchto manually resolve DNS, validate all returned IPs against the blocklist, and pin the validated IP to the HTTP client usingreqwest::blocking::ClientBuilder::resolve.β Verification:
cargo test --package mill-plugin-systempassed. Tested with internal IPs (127.0.0.1) which are now successfully blocked. Recorded the vulnerability pattern in.jules/sentinel.md.PR created automatically by Jules for task 15401487702068249879 started by @mudcube