You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x509util: harden SSRF guard against DNS rebinding and HTTP redirects
rejectPrivateHost only checked literal IP addresses in the URL.
Two bypasses remained:
1. A hostname resolving to a private/loopback IP (e.g. evil.com → 127.0.0.1)
was not caught because net.ParseIP returns nil for hostnames.
2. An HTTP redirect from a public host to a private IP was followed by
the default http.Client without re-checking the target.
Fix: introduce safeTransport (custom DialContext that resolves and
validates all IPs before connecting) and rejectPrivateRedirect
(CheckRedirect hook that blocks redirects to private literal IPs).
All three URL-fetching helpers (ReadPossiblePEMURL, ReadFileOrURL,
GetIssuer) now use safeClient which combines both guards.
Add tests for redirect-to-loopback and localhost-hostname scenarios.
0 commit comments