An attacker can use an SSRF vulnerability as a way to gather information about the server and the local network.
For example, on the "Research" page (
/research
) in the application, a user submits a stock symbol. The stock symbol is concatenated to a Yahoo URL and the server fetches the response and displays the page.
Here is a code snippet from
routes/research.js
,
// If a stock symbol has been submitted, concatenate the symbol to the URL and return the HTTP Response if (req.query.symbol) { var url = req.query.url+req.query.symbol; needle.get(url, function(error, newResponse) { ... }An attacker can change the
url
and symbol
parameters to point to an attacker-controlled website to interact with the server.
To prevent SSRF vulnerabilities in web applications, it is recommended to adhere to the following guidelines: