{% extends 'introduction/base.html' %} {% block content %} {% block title %} SSRF {% endblock %}

Server-Side Request Forgery

What is Server-Side Request Forgery (SSRF)

SSRF flaws occur whenever a web application is fetching a remote resource without validating the user-supplied URL. It allows an attacker to coerce the application to send a crafted request to an unexpected destination, even when protected by a firewall, VPN, or another type of network access control list (ACL). As modern web applications provide end-users with convenient features, fetching a URL becomes a common scenario. As a result, the incidence of SSRF is increasing. Also, the severity of SSRF is becoming higher due to cloud services and the complexity of architectures.

This lab helps you to get an idea of how SSRF can result in major Security flaw. The next pages shows some blog, but can you figure out how the blogs are presented?

This website sends a request to the given url and displays the page withing the page. now there is a page at /ssrf_target which only allowes request from localhost ( ie 127.0.0.1 )
now start the server using python manage.py runserver 0:8000
get your network ip using ifconfig or ipcofig(in windows)
now go to http://[your ip]/ssrf_target
Now you can't access the page because it is not from localhost. Try to get access to this page content now using the utility.



Mitigation

    From Network layer
  • Segment remote resource access functionality in separate networks to reduce the impact of SSRF
  • Enforce “deny by default” firewall policies or network access control rules to block all but essential intranet traffic.
  • From Application layer
  • Sanitize and validate all client-supplied input data
  • Enforce the URL schema, port, and destination with a positive allow list
  • Do not send raw responses to clients
  • Disable HTTP redirections
  • Be aware of the URL consistency to avoid attacks such as DNS rebinding and “time of check, time of use” (TOCTOU) race conditions
  • Additional Measures to consider
  • Don't deploy other security relevant services on front systems (e.g. OpenID). Control local traffic on these systems (e.g. localhost)
  • For frontends with dedicated and manageable user groups use network encryption (e.g. VPNs) on independent systems to consider very high protection needs

{% endblock %}