Interview Prep/DevSecOps/Vulnerability Management and OWASP

A webhook feature lets users enter a URL, and a pentester used it to read the cloud metadata endpoint. How do you fix it?

AdvancedScenarioVulnerability Management and OWASP
Answer

Situation read → Classic SSRF (OWASP A10). The server fetched http://169.254.169.254/ on behalf of the attacker and could leak instance credentials.

What I'd do →

  1. Rotate the instance role credentials immediately and check CloudTrail for their use from outside our IPs.
  2. Enforce IMDSv2 with hop limit 1 so a plain GET cannot read credentials.
  3. In code: resolve the hostname, reject private, loopback, link-local and metadata ranges, then connect to the resolved IP (prevents DNS rebinding). Disable redirects or re-check each hop.
  4. Route outbound webhook calls through an egress proxy that only allows public destinations.
  5. Run the webhook sender in an isolated network segment with no internal access.

Why → Blocklists in code alone get bypassed (decimal IPs, IPv6, redirects). Network isolation and IMDSv2 are the backstops.

Interview tip → Mention DNS rebinding; it shows you know why "validate the URL string" is not enough.

All DevSecOps questions Roadmap: Security in the pipeline

More on Vulnerability Management and OWASP