Configure your HTTP client to not follow redirects automatically:
• Python requests: requests.get(url, allow_redirects=False)
• Node.js axios: maxRedirects: 0
• curl: do not pass -L
• Java HttpClient: HttpClient.Redirect.NEVER
If your feature genuinely needs to follow redirects (e.g., shortened URLs), apply the same IP validation (MIT 02) to each redirect destination before following it.
An attacker registers https://legitimate-looking-domain.com/redirect which returns HTTP 302 Location: http://169.254.169.254/latest/meta-data/iam/security-credentials/. The URL validation checks legitimate-looking-domain.com — it passes. The HTTP client follows the redirect to the metadata endpoint. The metadata response is returned. The allowlist check on the original URL is completely bypassed.
Attackers use legitimate sites with open redirect vulnerabilities as bypass tools: https://trusted-site.com/redirect?url=http://169.254.169.254/. If trusted-site.com is on the allowlist and the client follows redirects, the attacker reaches the metadata endpoint through a trusted domain. Disabling redirects eliminates this entirely.
Ask your team whether your HTTP libraries follow redirects automatically by default. If they do, ask whether redirect destinations are validated with the same strictness as the original URL — or whether redirects bypass the check entirely.