Hunting For Vulnerable SSRF Mitigations
The project's SSRF mitigation validated the user-supplied webhook URL as a string but then passed it to fetch, which follows redirects by default. An attacker could supply a legitimate external URL that redirects to an internal address such as the cloud metadata endpoint, bypassing the blocklist.
Published on medium.com
During my daily work, I love from time to time make a side quest to search for vulnerabilities in different software, especially open source projects where I can see everything that happens under the hood.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the URL was validated only as a string before the request, while the HTTP client followed redirects without re-validating the destination address.
Impact
An attacker could make the server send requests to internal addresses such as localhost or the cloud metadata endpoint, potentially reaching services not meant to be exposed.
What the attacker needed
Ability to supply a webhook URL; attacker-controlled external server
The fix
The fetch call should be configured not to follow redirects, or each redirect target should be re-validated against the blocklist; the text does not say a fix was applied.
How it was found
- Find the isValidWebhookURL function and where it is called before a fetch.
- Provide a legitimate external URL that passes the string checks.
- Configure that external server to respond with an HTTP 302 redirect to an internal address.
- The fetch call follows the redirect and requests the internal address.
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 write-up has not been written yet. The Original tab links to the source.
Server-side request forgery (SSRF) is when an attacker makes a server fetch a URL of their choosing, potentially reaching internal services. Here the code checked the URL text against a list of blocked addresses, but the fetch call then followed a redirect to a different address that was never checked. So the check happened too early and on the wrong thing.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.