What is a Server Side Request Forgery attack?
TechnicalSecurity Operations EngineerWeb Application Security EngineerPenetration TesterA Server Side Request Forgery (SSRF) attack occurs when an attacker is able to send crafted requests from a vulnerable server to internal or external resources. This typically exploits the server's ability to make HTTP requests on behalf of the attacker, potentially exposing sensitive data or services that are not directly accessible from the outside.
SSRF works because many applications, especially web applications, often rely on server-side requests to fetch data from other services. If the application does not properly validate or sanitize the input used to construct these requests, an attacker can manipulate it to target internal systems, such as databases or metadata services, which may contain sensitive information.
For example, if a web application allows users to input a URL to fetch an image, an attacker could input a URL like http://169.254.169.254/latest/meta-data/ to access AWS instance metadata. This can lead to the exposure of secrets like IAM roles. The main trade-off here is between functionality and security; allowing flexible URL fetching can enhance user experience but also increases the risk of SSRF attacks. Proper input validation and restricting internal network access can mitigate these risks.