Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#576

Open
mudcube wants to merge 1 commit into
mainfrom
sentinel-ssrf-web-fetch-15401487702068249879
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool#576
mudcube wants to merge 1 commit into
mainfrom
sentinel-ssrf-web-fetch-15401487702068249879

Conversation

@mudcube

@mudcube mudcube commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

πŸ›‘οΈ Sentinel: [CRITICAL] Fix SSRF vulnerability in web_fetch tool

🚨 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.

PR created automatically by Jules for task 15401487702068249879 started by @mudcube

🚨 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>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 1, 2026

Copy link
Copy Markdown

Deploying typemill with Β Cloudflare Pages Β Cloudflare Pages

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

View logs

@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ 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".

Comment on lines +28 to +32
|| 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 πŸ‘Β / πŸ‘Ž.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant