🖥️
Offensive security concepts
  • Introduction
  • 💿Virtualbox network setup
    • What is VirtualBox?
    • NAT
    • NAT network
    • Bridged adapter
    • Internal network
    • pfSense
    • vboxmanage
    • Overview
  • 🕵️OSINT
    • What is OSINT?
    • Google dorks
    • Metadata
    • Social media
      • osintagram
  • Tools
    • waybackurls
    • recon-ng
    • sherlock
    • maltego
    • theHarvester
    • photon
  • 😨Social Engineering
    • What is social engineering?
    • 7 tricks of social engineering
    • Email phishing
    • Typosquatting
    • Compiled resources
  • 😈MitM attack
    • What is MitM attack?
    • ARP spoof/poison
    • DNS spoof/poison
    • HTTP MitM attack
    • ICMP redirect attack
    • DHCP spoofing
    • Evil twin attack
    • Experiment (guest network)
    • Compiled resources
  • 🔌UPnP exploitation
    • What is UPnP?
    • What is SSDP?
    • IGD functions
    • LAN devices
    • Compiled resources
  • Network Reconnaissance & Attacks
    • What is network hacking?
  • 1️⃣Network live host discovery
    • What is network live host discovery?
    • nmap
    • arp-scan
    • masscan
  • 2️⃣Network port scan/services enumeration
    • What is network port scan/services enumeration?
    • nmap
    • netcat
  • 3️⃣Network services vulnerability scanning & exploitation
    • What is network vulnerability scanning/exploitation?
    • 20/21 ~ FTP
    • 22 ~ SSH
    • 25 ~ SMTP
    • 53 ~ DNS
    • 80/443 ~ HTTP/HTTPS
    • 110 ~ POP3
    • 111/2049 ~ RPC/NFS
    • 139/445 ~ SMB
    • 143 ~ IMAP
    • 3389 ~ RDP
  • Vulnerability & exploitation
    • Database
    • Metasploit
    • Msfvenom
  • Misconfigurations
    • .DS_Store
  • Web Application Penetration Testing
    • Introduction
    • Directories/URLs gathering
    • Subdomain enumeration
    • File inclusion & Path traversal
    • Insecure Direct Object Reference (IDOR)
    • Upload vulnerabilities
      • File extension cheat-sheet
    • SSRF
    • CSRF
    • XSS
    • SQL injection
  • Authentication/session management
    • JSON Web Token (JWT)
    • OAuth weaknesses
  • Webshell
  • Web API pentesting
    • Resources
    • Methodology
    • jq
    • httpx
    • ParamSpider
  • Web app pentesting methodology
  • OWASP
    • OWASP top 10
    • OWASP API top 10
    • Web Security Testing Guide (WSTG)
  • General web knowledge
    • URI standard (RFC 3986)
    • HTTP headers
  • 🛣️Attacks on routing protocols
    • What are attacks on routing protocols?
    • BGP hijacking
  • 🏕️To explore
    • MQTT
    • Routersploit
    • DNS rebinding attack
    • LLMNR/mDNS poisoning
  • 👤Anonymity
    • VPN
    • Proxychains
    • TOR
    • Obfuscation
  • Credentials brute-force/cracking
    • Introduction
    • Windows SAM database
    • Dictionary attack
    • Rainbow attack
      • Hash database
    • Tools
      • Hydra
      • John the ripper
      • Hashcat
      • hash-identifier
  • Post-exploitation
    • Gaining shell
      • netcat
      • socat
      • powershell
      • bash
      • PHP
    • Repository
  • Privilege escalation
    • Linux
      • Repositories
      • Enumeration
      • Vulnerabilities exploit
        • General
        • Kernel exploit
        • Sudo
        • SUID
        • Capabilities
        • Cronjobs
        • $PATH
        • NFS (target-machine)
        • Filesystem sharing
          • NFS (attacker-machine)
    • Windows
      • Password harvesting
      • Vulnerabilities exploit
        • Scheduled tasks
        • AlwaysInstallElevated
        • Service misconfigurations
          • Insecure permissions on service executable
          • Unquoted service path
          • Insecure service permission
        • Abusing privileges
  • Ⓜ️MITRE ATT&CK
    • Introduction
  • 🧰Tools/services
    • Introduction
    • Web hacking
      • Password brute-forcing
      • Web fuzzing
      • Burp Suite (Community)
      • nikto
      • ZAP (Zed Attack Proxy)
      • nuclei
    • Information gathering/reconnaissance
    • Network hacking
      • nmap (general overview)
      • scapy
      • bettercap
    • General
      • impacket
    • Wordlists
      • cewl
  • Professional report writing
    • Report template
      • Web applicaton pentesting
        • OWASP report layout
  • Tasks on-the-go
    • Note taking on-the-go
    • Other tips
  • Practice
    • Metasploitable 2
    • TryHackMe
  • Operational Security (OpSec)
    • Hardening
      • General
      • VirtualBox
      • Web Browser
  • Write-ups
    • TryHackMe
      • Silver Platter
      • Light
      • OWASP Top 10 - 2021 (task 22)
      • Pickle Rick
    • OverTheWire
      • Untitled
    • OWASP
      • OWASP Juice Shop
      • OWASP WebGoat
  • AI prompt
    • ChatGPT
Powered by GitBook
On this page
  • Methods
  • Forming payloads
  • Common endpoints to access
  • Bypass access/deny list filtering
  • Bypass access list filtering
  • Bypass deny list filtering
  1. Web Application Penetration Testing

SSRF

Server Side Request Forgery (SSRF) is a form of attack that allows an attacker to trick a webserver in performing unintended HTTP requests to a resource of the attacker's choice.

PreviousFile extension cheat-sheetNextCSRF

Last updated 2 months ago

Methods

Forming payloads

Refer to the following challenge write-up for more information:

Generally, there are a few HTTP URL symbols that can be used to form payloads for SSRF based attacks: ?, #, %00, etc.

In some instances, the symbols may need to be URL encoded to accurately represent the value, or bypass filter checks:

? -> %3F

# -> %23

%00 -> %2500

Common endpoints to access

  1. 169.254.169.254: A special IP in cloud environments to retrieve user data and instance metadata related to the current instance

  2. localhost, 127.0.0.1, 0.0.0.0, etc.

Bypass access/deny list filtering

Bypass access list filtering

White (access) list filtering is a method to control outgoing requests, by denying all requests unless a certain condition is met.

1. Self hosted domain

For example, a certain access list requires the requested HTTP URL to begin with a certain value , such as: domain.com. This means that only requests to valid URLs such as http://domain.com/apiwill be accepted, while requests to URLs such as: http://malicious.com will not.

However, this can be bypassed by hosting a DNS server to resolve a malicious domain with the required starting value, such as: http://domain.com.malicious.com. In this case, the value: domain.com is the subdomain of the root domain: malicious.com, which is controlled by the attacker. Since the domain starts with the required value of domain.com, it will be accepted.

Bypass deny list filtering

Black (deny) list filtering is a method to control outgoing requests, by denying all requests that matches a certain condition.

1. Alternate IP address representation

Some servers may deny access to a list of IP addresses that may contain sensitive information. This includes localhost, or other special addresses (refer to common endpoints to access above).

However, the deny list may only contain the common representations of the specified addresses such as the dotted decimal representations (127.0.0.1, 169.254.169.254), or localhost for the localhost. This can be bypassed by using the alternate representations for the IP addresses:

  1. localhost: 0, 0.0.0.0, 0000 (default route), 127.1 (shortened dot-notation), 2130706433 (decimal-base10), 017700000001(octal-base8), 0x7f000001(hex-base16)

  2. 169.254.169.254:2852039166(decimal-base10),25177524776(octal-base8), 0xa9fea9fe(hex-base16)

Proof of concept

Try to ping the following addresses listed above:

# localhost addresses
$ ping 0
$ ping 127.1
$ ping 2130706433
$ ping 017700000001
$ ping 0x7f000001

# "special" address
$ ping 2852039166
$ ping 25177524776
$ ping 0xa9fea9fe

2. Malicious DNS resolution

Hosting a DNS server to resolve controlled subdomains to a specified IP address value will be another method to bypass IP address restrictions.

For example a certain deny list includes the localhost addresses. An attacker controlled domain: https://localhost.malicious.com can be created to resolve to the localhost address of 127.0.0.1. However, since this particular domain was not specified in the deny list, the request will be sent, and eventually resolved to the localhost address, completely bypassing the deny list.

This method can be used to bypass IP address restrictions for other addresses besides the localhost, by changing the IP address value in the DNS server.

OWASP Top 10 - 2021 (task 22) | Penetration testing/ethical hacking
Logo