top of page

SSRF’s: A Gateway Drug To Other Vulnerabilities

  • Writer: Jen C
    Jen C
  • Oct 8
  • 4 min read

Server-Side Request Forgery (SSRF) is a security vulnerability that allows an attacker to induce the server-side application to make HTTP requests to an arbitrary domain of the attacker's choosing.


Whew, that’s a mouthful. And that’s just the beginning of what makes SSRF so dangerous. Let’s unpack it a bit further:


It is similar to cross-site scripting except it is gaining control of a server versus a URL and bypassing the firewall entirely. This attack typically targets internal systems that the web server can access but are not accessible from the external network. Essentially, the server attacks itself. It could be the relationship between server-to-server communications. It could be talking to a database. It could be the API layer. Either way, it’s executing bad code on a server, like any command injection via any input field.


SSRF vs. XSS: A Crucial Distinction

  • Cross-Site Scripting (XSS): Targets users by injecting malicious scripts into web pages viewed by others. It’s client-side.

  • Server-Side Request Forgery (SSRF): Targets the server itself, tricking it into making unauthorized requests. It’s server-side.


So while XSS hijacks the user’s browser, SSRF hijacks the server’s trust and privileges.


SSRF is like the skeleton key of web vulnerabilities. Once an attacker gets it working, it often unlocks a whole suite of other exploits.


SSRF vulnerabilities are usually the first step (a gateway drug!) before exploiting another type of vulnerability. SSRF is rarely the endgame — it’s the entry point. This sounds bad! SSRFs have many risks to our internal network resources, remote systems, local files, third-party services, and authentication credentials. An SSRF attack could cause a DoS (Denial of Service) attack on an internal network server. It can also bypass the firewall completely. I said it was bad!


SSRFs are increasing in the number of vulnerabilities and severity, and are most common in web applications. They are not programming language specific.


Here’s a quick explanation of how this can play out...


The vulnerability starts with a server-side application that fetches data from

a URL. Maybe the reasoning is to load a user's profile image, import data from a partner service, or integrate with a webhook or API.


The attacker can then manipulate the URL that the server is supposed to

access. This can be done by submitting forms, altering query parameters, or

through other means where URLs are accepted as inputs. They can do this by altering query parameters, form fields, or headers. The attacker crafts

a URL pointing to an internal system. They may even hide the real source of

the connection to cover their tracks. They can make it appear as though it is

originating from the back-end of an application. Uh oh!


When the server receives the manipulated URL, it tries to fetch the data from the specified location. The application trusts the inpur and fetches the resource. Since the server can send requests to both external and internal networks, the attacker can exploit this to target internal systems. If user data is sent to be processed and not handled properly, it’s easier to perform an injection attack. Through the manipulated request, attackers could gain access to services that are not directly exposed to the internet. This could include database management systems, application servers, administration interfaces, supply chain internal APIs, and other sensitive components. It appears to originate from inside the app.


Once the attacker has access to these internal resources, they can do some serious damage. They can access database management systems, admin panels and dashboards, supply chain APIs and internal services, and cloud metadata endpoints leaking credentials. They can either extract sensitive data (PII), disrupt/interfere with internal processes, launch privilege escalation, trigger DoS flooding internal services, or use this foothold to perform more extensive attacks within the network. In other words, no bueno.


There are three types of SSRF vulnerabilities: regular old non-blind vulnerabilities, semi-blind and blind vulnerabilities.


SSRF’s are tricky and hard to detect. So how can we mitigate SSRF attacks? By practicing defense in depth controls. Good news, there are a few things we have in our bag of tricks.


  • Whitelisting of Allowed URLs: We can only allow the server to make requests to “safe URLs or IP Addresses” versus blacklisting (and regular expressions), where we call out everywhere we can’t make requests to. Trying to think of every possible place we don’t want to touch seems overwhelming? That’s because it is. Whitelisting is much easier.

  • Response Handling: Ensure that the response received from other servers is in an expected format. Do not send raw responses to clients.

  • Disable HTTP Redirects: We can configure the server to not automatically follow redirects. This prevents attackers from redirecting requests to bad places.

  • Input Validation: On any user-supplied URL inputs, implement strict validation, especially schema validation, ensuring we only use allowed protocols. It’s best to also only use HTTP or HTTPS to make requests. Make sure data is always encoded, validate,d and sanitized. Ideally, don’t allow user input to make calls to other servers.

  • Least Privilege: You can limit what the server and its application can access internally and externally. This can help minimize damage from an attacker if they exploit an SSRF vulnerability.

  • Logging and Monitoring: Another best practice is to implement detailed logging on all requests outbound from the server, but you have to monitor the logs for things that look unusual.

  • If the application uses third-party software, ensure that the latest and greatest version (non-vulnerable, of course) is used.

  • Pen testing, manual or with specific tooling.


So there you have it. SSRF vulnerabilities, though tough to detect, are super

easy to exploit and a gateway drug to other vulnerability exploits. OK, that

might be a little cheeky.


For more reading, check out:

 
 
 

Recent Posts

See All
The Nativity And The Mummified Mouse (2021)

Oh my sweet Lord, and I say that not to use his name in vain, but wow, folks, just wow…we almost had to cancel Christmas. Last weekend I cleaned out our storage area in the basement. I tossed a lot of

 
 
 

Comments


© 2021 by Jen Cracchiola. Powered by Wix

bottom of page