π‘οΈ Sentinel: [CRITICAL] Fix Server-Side Request Forgery (SSRF) vulnerabilities - #232
π‘οΈ Sentinel: [CRITICAL] Fix Server-Side Request Forgery (SSRF) vulnerabilities#232himattm wants to merge 1 commit into
Conversation
Added a custom `net.Dialer` with a `Control` hook to prevent SSRF attacks when fetching plugins from user-provided URLs. The hook verifies the resolved IP address against restricted ranges (e.g., cloud metadata endpoints) before the socket connection is established. This ensures robust protection against DNS rebinding and IP obfuscation. Disables KeepAlives on the custom transport to avoid connection leaks since clients are instantiated per request. Co-authored-by: himattm <6266621+himattm@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. |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
π¨ Severity: CRITICAL
π‘ Vulnerability:
internal/plugin/manager.gousedhttp.Get()to fetch plugins from untrusted, user-provided URLs without restricting the resolved IP addresses, leading to potential Server-Side Request Forgery (SSRF). This could allow an attacker to bypass firewalls and access restricted internal networks, such as cloud metadata endpoints (e.g.,169.254.169.254).π― Impact: Attackers could potentially extract sensitive credentials or enumerate internal infrastructure by tricking the application into making unauthorized HTTP requests.
π§ Fix: Replaced
http.Get()with a customhttp.Clientinitialized vianewSafeClient(). This client utilizes anet.Dialerwith aControlhook that evaluates the resolved IP address after DNS resolution but before the socket connection is made, effectively blocking restricted IPs like169.254.169.254and preventing DNS rebinding attacks. Also disabled KeepAlives on the custom transport since these clients are one-off.β Verification: Ensure the test suite passes (
go test ./...) and that attempting to add a plugin from a prohibited IP (e.g.,http://169.254.169.254/plugin.sh) fails with the intended forbidden error.PR created automatically by Jules for task 10951292170685207095 started by @himattm