OWASP A10:2021 - Server-Side Request Forgery (SSRF)

Overview

Server-Side Request Forgery (SSRF) flaws occur whenever a web application is fetching a remote resource without validating the user-supplied URL. It allows an attacker to coerce the application to send a crafted request to an unexpected destination, even when protected by a firewall, VPN, or another type of network access control list (ACL).

CWE Mappings: CWE-918 (Server-Side Request Forgery)

Attack Vectors and Impact

Internal Network Access

  • Access internal services (databases, admin panels, metadata services)

  • Port scanning internal networks

  • Bypassing network-level access controls

  • Reading internal configuration files

Cloud Metadata Exploitation

  • AWS EC2 metadata (169.254.169.254)

  • Google Cloud metadata (metadata.google.internal)

  • Azure metadata (169.254.169.254)

  • Accessing IAM credentials and sensitive configuration

Data Exfiltration

  • Reading local files via file:// protocol

  • Accessing internal APIs and databases

  • Retrieving sensitive information from internal services

Common Vulnerable Patterns

URL/Webhook Parameters

Image/File Processing

API Integrations

URL Shortener Services

Detection and Reconnaissance

Initial Discovery

Burp Suite Detection

Manual Testing Checklist

Advanced Exploitation Techniques

Cloud Metadata Exploitation

AWS EC2 Metadata

Google Cloud Metadata

Azure Metadata

Protocol-Specific Attacks

File Protocol Exploitation

Gopher Protocol for Service Interaction

Dict Protocol for Port Scanning

Bypass Techniques

IP Address Obfuscation

DNS-Based Bypasses

URL Encoding and Manipulation

Redirect-Based Bypasses

Automated Testing Tools

Custom Python Scanner

Burp Suite Extensions

  • SSRF Sheriff: Automated SSRF detection

  • Collaborator Everywhere: Inject collaborator payloads

  • Backslash Powered Scanner: Advanced payload testing

Nuclei Templates

Internal Network Reconnaissance

Port Scanning via SSRF

Service Discovery

Exploitation Scenarios

AWS Credential Extraction

Internal API Access

File Disclosure

Defense Evasion

Time-Based Detection Evasion

Response Size Variation

Testing Methodology

1. Discovery Phase

  • Identify parameters that accept URLs/URIs

  • Test with external collaborator services

  • Check for different input methods (GET, POST, JSON, XML)

2. Validation Phase

  • Test bypass techniques for filters

  • Try different protocols and encodings

  • Verify actual request is made (timing, collaborator, errors)

3. Exploitation Phase

  • Access cloud metadata services

  • Scan internal networks

  • Access internal services and APIs

  • Attempt file disclosure

4. Impact Assessment

  • Document accessible internal resources

  • Identify sensitive data exposure

  • Assess potential for further exploitation

Mitigation Strategies

Input Validation

Network Segmentation

Application-Level Controls

Detection and Monitoring

Log Analysis

Network Monitoring

Common Testing Pitfalls

False Negatives

  • Application might make request but not return response

  • Timeouts might indicate successful connection

  • Error messages might reveal internal information

False Positives

  • External services might be accessible for legitimate reasons

  • Some "internal" IPs might be intentionally accessible

  • Applications might have legitimate reasons to access metadata

Business Impact

High Impact Scenarios

  • Cloud credentials exposure leading to full account compromise

  • Internal network access bypassing security controls

  • Sensitive file disclosure (configuration, source code)

  • Internal service manipulation (databases, caches)

Compliance Considerations

  • PCI DSS: Network segmentation requirements

  • SOX: Internal controls access

  • HIPAA: Protected health information access

  • GDPR: Unauthorized personal data access

Tools and Resources

Detection Tools

  • Burp Suite: Manual testing and extensions

  • OWASP ZAP: Automated SSRF detection

  • Nuclei: Template-based scanning

  • SSRFmap: Automated SSRF exploitation tool

Collaborator Services

  • Burp Collaborator: Built-in to Burp Suite

  • interactsh: Open source interaction server

  • Pingb: Online HTTP request bin

  • RequestBin: Request capture and analysis

Cloud-Specific Tools

  • pacu: AWS exploitation framework

  • ScoutSuite: Multi-cloud security auditing

  • CloudMapper: AWS network visualization


Server-Side Request Forgery represents one of the most critical vulnerabilities in modern web applications, especially in cloud environments. Always test thoroughly and document the full scope of accessible internal resources.

Last updated