SSRF
SSRF
# WHAT IS SSRF
1. Basic SSRF
The attacker uses the vulnerability to access both internal and
external resources directly.
Example:
Input: http://internal-api.local/admin
Effect: The server fetches an internal URL, exposing
sensitive data.
2. Blind SSRF
In blind SSRF, the attacker cannot see the direct response but
can infer success or failure indirectly (e.g., by observing server
behavior, logs, or timing).
Example Exploits:
o Trigger DNS lookups by inputting: http://attacker-
domain.com. The attacker detects the server's IP by
monitoring DNS queries.
o Use timing to detect differences in how long the
server takes to respond to different requests.
8. Time-Based SSRF
The attacker infers success or failure by observing differences in
server response times, often used in blind SSRF scenarios.
Example:
o Query an internal service, causing a delay due to
resource contention.
o Query a non-existent service, resulting in an
immediate error.
Preventing SSRF
Enforce strict input validation and URL whitelisting.
Restrict outgoing requests to known, trusted domains.
Use network segmentation to isolate sensitive services.
Block access to IP ranges like 169.254.0.0/16 (cloud
metadata) and private IP ranges (10.x.x.x, 192.168.x.x).
Monitor and log unusual server requests.
Impact of SSRF
1. Access Internal Systems: Exploit private services like APIs,
databases, or admin panels.
2. Data Leakage: Steal sensitive information (e.g., credentials,
configuration files).
3. Remote Code Execution (RCE): Execute malicious code via
misconfigured services.
4. Port Scanning: Discover open ports and services for
further attacks.
5. Abuse and DDoS: Use the server as a proxy for malicious
activities.
6. Cloud Exploits: Access cloud metadata to hijack
credentials.
Mitigation Measures
1. Validate Inputs: Whitelist trusted URLs/domains; block
private IPs.
2. Restrict Network Access: Limit outbound requests and
block internal IP ranges.
3. Enforce URL Restrictions: Allow only approved schemes
(e.g., http://).
4. Cloud Protections: Use secure configurations like AWS
IMDSv2.
5. Use a WAF: Block SSRF patterns with Web Application
Firewalls.
6. Monitor and Log: Detect unusual request behavior.
7. Rate Limits and Timeouts: Prevent abuse and mitigate
blind SSRF.
8. Test Regularly: Identify vulnerabilities via pentests and
scans.
# LABS