Security implications of fetching unknown url from server

Viewed 153

I have an application where users can give an API URL and then that URL is hit on a schedule (example: fetch data from SpaceX API every 25 minutes).

If the server is a node.js app, are there any security implications I need to worry about? By fetching data from an unknown URL (using node-fetch), what could go wrong?

1 Answers

Yes, your app is exposed to SSRF,

In a Server-Side Request Forgery (SSRF) attack, the attacker can abuse functionality on the server to read or update internal resources. The attacker can supply or modify a URL which the code running on the server will read or submit data to, and by carefully selecting the URLs, the attacker may be able to read server configuration such as AWS metadata, connect to internal services like http enabled databases or perform post requests towards internal services which are not intended to be exposed.

For example, if your app is hosted on AWS EC2, your attacker can provide a url (http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name) to local AWS meta-data services, which may expose AWS token to the attacker. This attack assumes that the result of the request is returned to the attacker.

Mitigation of SSRF attacks

Related