A security team is reviewing a web microservice that accepts user-supplied remote image URLs to generate user avatar previews. During testing, an analyst discovers that submitting a URL directed to `http://169.254.169.254/latest/meta-data/` allows the server to fetch and return sensitive cloud instance credentials to the client.
Which of the following mitigation controls should the development team implement to remediate this application vulnerability? (Select TWO.)
- Restrict the application server from initiating outbound network connections to internal IP address ranges and cloud metadata endpointsAnswer
- Implement strict input validation using an allowlist of approved URL schemes and external domain destinationsAnswer
- CApply contextual HTML entity encoding to user inputs prior to rendering response pages in the browser
- DEnforce parameterized SQL queries and prepared statements for all database retrieval functions
Answer
The correct remediation controls are restricting the application server from initiating outbound network connections to internal IP addresses and cloud metadata endpoints, and implementing strict input validation using an allowlist of approved URL schemes and external domains.
The scenario describes a Server-Side Request Forgery (SSRF) vulnerability where an attacker manipulates the server into fetching cloud metadata (`169.254.169.254`). Remediating SSRF requires preventing the server from connecting to internal endpoints by restricting outbound network connections to private IP spaces and validating user-supplied URLs against an explicit allowlist of domain names and protocols.
Step-by-Step Solution
Key Concept
Server-Side Request Forgery (SSRF) Remediation