Server-Side Request Forgery in gogs webhook
Gogs did not revalidate webhook payload URLs before each delivery, so a malicious user could make the server send requests to internal network addresses. This allowed discovery of services on the internal network.
gogs/gogs
Originally disclosed on huntr
Impact
The malicious user is able to discover services in the internal network through webhook functionality. All installations accepting public traffic are affected.
Patches
Webhook payload URLs are revalidated before each delivery to make sure they are not resolved to blocked local network addresses. Users should upgrade to 0.12.8 or the latest 0.13.0+dev.
Workarounds
Run Gogs in its own private network.
References
https://huntr.dev/bounties/da1fbd6e-7a02-458e-9c2e-6d226c47046d/
For more information
If you have any questions or comments about this advisory, please post on https://github.com/gogs/gogs/issues/6901.
From the GitHub Advisory Database (GHSA-w689-557m-2cvq, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the webhook URL was only validated when it was first saved, not revalidated before each delivery, so a URL that initially resolved to a public address could later resolve to a blocked local address.
Impact
An attacker could discover services on the internal network; all installations accepting public traffic are affected.
What the attacker needed
A Gogs account able to configure webhooks; Gogs instance reachable from the internet
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A webhook is a feature where a service automatically sends a request to a URL you provide when something happens. Here, the server did not check that the URL still pointed to a safe place each time it sent the request, so an attacker could point it at internal services that are not normally reachable from the internet. This let the attacker probe the internal network.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.