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 →
- Rotate the instance role credentials immediately and check CloudTrail for their use from outside our IPs.
- Enforce IMDSv2 with hop limit 1 so a plain GET cannot read credentials.
- 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.
- Route outbound webhook calls through an egress proxy that only allows public destinations.
- 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.
More on Vulnerability Management and OWASP
A pentest report shows SQL injection in a search endpoint of a Java service. How do you handle it end to end?BeginnerA scanner reports 4,000 open CVEs across 300 images. The team can fix maybe 100 a month. How do you prioritise?IntermediateA user reports they can see another customer's invoice by changing the ID in the URL. What do you do?BeginnerA team still runs Log4j 2.14 in an internal service and says it is not internet-facing. How do you respond?IntermediateA security review finds passwords stored as unsalted MD5 hashes. How do you migrate without forcing every user to reset?AdvancedYour DAST scan in staging finds reflected XSS in a React app. The developers say React escapes everything. Who is right?Intermediate