Skip to main content

SSRF Notes


SSRF Notes

NOTE :  Wanted to have everything at one place,  these are my reference notes from various bug bounty write ups & security research, I thank all the authors of the write ups mentioned below [will update if i find anything interesting]



Description


In an SSRF attack against the server itself, the attacker induces the  application to make an HTTP request back to the server that is hosting  the application, via its loopback network interface. This will typically  involve supplying a URL with a hostname like 127.0.0.1 (a reserved IP address that points to the loopback adapter) or localhost (a commonly used name for the same adapter).         

Many server-side request forgery vulnerabilities are relatively easy to  spot, because the application's normal traffic involves request  parameters containing full URLs

Blind SSRF


Blind SSRF vulnerabilities arise when an application can be induced to  issue a back-end HTTP request to a supplied URL, but the response from  the back-end request is not returned in the application's front-end  response.         


IP Filter bypass [IP to Integer]: 



Private IP Space



Practice



Breaches


Capital One Breach : https://ejj.io/blog/capital-one


Payloads




SSRF Write Ups














Ways to find SSRF :




CapitalOne Breach Preview : https://application.security/ - Awesome



Prevention


There is no universal protection against SSRF attacks, however there are a few things to have in mind:

  • A blacklist is not a good protection because with so many different protocols, schemes, encodings and super complex URI syntax, bypasses will most certainly occur. Because of this, a whitelist is a better approach.
  • When developing REST API’s, it is better to accept other HTTP verbs than POST and GET which will make it harder for a SSRF vulnerability to make correct requests to the API service. If a SSRF vulnerability is only able to make internal GET requests it won’t be able to speak with the API. It is also important to validate both the request and response to internal services.
  • Services such as Kibana, Redis, Elasticsearch, MongoDB and Memcached do not per default require authentication, and adding that to those services may make it harder to exploit a SSRF vulnerability.  

Testing Methodlogies 


When testing for SSRF using a black list, take internal IP addresses and when encoding them, dont encode entire IP. Encode 1 octet of the IP address, or 2 or 3. For Instance: AWS Metadata - 0251.254.169.254 

Found an API endpoint used for uploading, change the upload file param to URL and test for SSRF. Many times it can lead you to full blown SSRF.

Got an SSRF? But app prevents trying to connect to localhost https://bbt.com/redirect.php? DNS Pinning for the win, create, set subdomain, point it to 127.0.0.1>use remote red>
<?php
header("Location: https://localhost.bbt.com");
die();
?>



 If you have an SSRF with file system access on an ECS instance then try extracting /proc/self/environ to get UUID and then try hitting ECS metadata 
curl http://169.254.170.2/v2/credentials/<UUID>
This way you'll extract IAM keys of the attached role


SSRF advice: 

- Test every parameter and input fetching external resources
- Once it hit's your server plan your attack
- Blind SSRF Try XSPA
- SSRF Try fetching the secret access keys


Sometimes you got to keep it simple in #bugbounty. Just got an #SSRF, steps (credits below):

1 Run getallurls for all assets & merge results
2 `cat results | grep "url="| anti-burl | tee ssrf.txt`
3 Review & cleanup list 
4 Fuzz all "url-like" params w/ Burp collab & #ffuf


Comments

Popular posts from this blog

WordPress Common Issue Notes

  WordPress: /wp-content/plugins/sfwd-lms/wpml-config.xml /wp-content/plugins/omni-secure-files/plupload/examples/upload.php /wp-content/plugins/contus-hd-flv-player/uploadVideo.php wp-json/th/v1/user_generation /wp-admin/admin-ajax.php?do_reset_wordpress=1 Wordpress xmlrpc.php -common vulnerabilites & how to exploit them https://medium.com/@the.bilal.rizwan/wordpress-xmlrpc-php-common-vulnerabilites-how-to-exploit-them-d8d3c8600b32

Electron JS Security Checklist

Electron Js Security Checklist Disable nodeIntegration for untrusted origins/Do-not Enable Node-Integration Risk  If enabled, nodeIntegration allows JavaScript to leverage Node.js primitives and modules. This could lead to full remote system compromise if you are rendering untrusted content. Auditing nodeIntegration and nodeIntegrationInWorker are boolean options that can be used to determine whether node integration is enabled.  Auditing For BrowserWindow, default is true. If the option is not present, or is set to true/1, nodeIntegration is enabled as in the following examples:  mainWindow = new BrowserWindow({ "webPreferences": { "nodeIntegration": true, “nodeIntegrationInWorker": 1 } });  Or simply:  mainWindow = new BrowserWindow() For webview tag, default is false.  When this attribute is present, the guest page in webview will have node integration: When sanbox is enabled (see below), nodeintegration is disabled. Please note that it is also possible to u

Threat Intelligence in Sagan Using Bro Intelligence Framework

Introduction Monitoring Network Traffic for malicious activities is one of the priorities for an network IDS, what if the network IDS can take in threat intelligence data to look out for malicious domains, Ip addresses, emails,file-hashes and so on, sagan has one such feature called Bro intelligence framework this write up  will give you an insight on how to install configure and use bro intel framework in sagan. I have been working with sagan for few months now, it has been really hard to put all the pieces together and you don't really find any perfect documentation or tutorials regarding sagan and its features at one place. Sagan is an open source real time log analysis and correlation engine that runs on Unix Operating Systems, sagan's rules are quite similar to SNORT. Sagan can record events to the snort unified 2 output format which allows it to be compatible with user interfaces such as Squil,Snorby,Graylog. Sagan has lot more capabilities than being a Log Anal