Server-Side Request Forgery (SSRF)
SSRF allows an attacker to force a vulnerable server to perform HTTP requests to internal resources or remote endpoints. This can bypass firewalls, access metadata, or exfiltrate secrets.
import requests
def fetch_url(url):
response = requests.get(url)
return response.text
url = input('Enter a URL: ')
print(fetch_url(url))
Exploit input:
http://localhost/admin
The server requests the internal admin page and returns it to the attacker.
- Try localhost targets like
http://127.0.0.1,http://169.254.169.254, orfile:///etc/passwd. - Detect SSRF via DNS rebinding or external collaborator interactions.
- Encode payloads or use redirects for blind SSRF exploitation.
- Useful tools:
interactsh,dnslog.cn,ngrokfor callback confirmation.