Server-Side Request Forgery

Server-Side Request Forgery (SSRF) is a web security vulnerability that arises when remote resources are obtained by an application without verifying the URL entered by the user. Attackers leverage this vulnerability to abuse the functionalities of a server to read or modify internal resources and steal sensitive information by sending malicious requests. SSRF vulnerabilities also ==allow attackers to send malicious requests to internal systems, even if they are secured by Firewalls. ==

Example

sequenceDiagram
    participant Attacker
    participant WebApp as Vulnerable Web Application
    participant InternalService as Internal Service/Resource
    participant ExternalService as External Service
    participant MetadataService as Cloud Metadata Service

    Note over Attacker, MetadataService: SSRF Attack Flow

    %% Initial reconnaissance
    Attacker->>WebApp: 1. Discover URL parameter/input field
    Note right of Attacker: e.g., ?url=http://example.com

    %% Basic SSRF attempt
    Attacker->>WebApp: 2. Submit malicious URL pointing to internal resource
    Note right of Attacker: ?url=http://192.168.1.10:8080/admin

    WebApp->>InternalService: 3. Server makes request to internal resource
    Note over WebApp: App doesn't validate/sanitize URL

    InternalService->>WebApp: 4. Return sensitive internal data
    WebApp->>Attacker: 5. Application returns response to attacker
    Note left of Attacker: Internal data exposed!

    %% Cloud metadata attack
    Attacker->>WebApp: 6. Target cloud metadata service
    Note right of Attacker: ?url=http://169.254.169.254/latest/meta-data/

    WebApp->>MetadataService: 7. Request cloud instance metadata
    MetadataService->>WebApp: 8. Return cloud credentials/config
    WebApp->>Attacker: 9. Expose cloud credentials to attacker
    Note left of Attacker: Cloud access gained!

    %% Port scanning
    Attacker->>WebApp: 10. Probe internal network ports
    Note right of Attacker: ?url=http://192.168.1.1:22

    WebApp->>InternalService: 11. Attempt connection to various ports
    InternalService->>WebApp: 12. Connection response (success/timeout)
    WebApp->>Attacker: 13. Response reveals open/closed ports
    Note left of Attacker: Network mapping complete

    %% External service abuse
    Attacker->>WebApp: 14. Use server to attack external targets
    Note right of Attacker: ?url=http://target-victim.com/attack

    WebApp->>ExternalService: 15. Server makes request to external target
    Note over WebApp: Server's IP used for attack

    ExternalService->>WebApp: 16. External service responds
    WebApp->>Attacker: 17. Attack executed via server's IP
    Note left of Attacker: Attack attribution to server, not attacker

Attack Phases