Gain adfly SMTP access with SSRF via gopher protocol
The URL shortener fetched a user-supplied URL without restricting the scheme, so a gopher URL could reach the local SMTP service on port 25. An attacker could make the server send email from the site's own mail address to any recipient.
Hi guys, My name is Rafli pasya. Today i want to share my story about SSRF on adfly, this bug i found 4 days ago and already Fixed.
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 shortener's URL fetcher allowed the gopher scheme and did not block requests to localhost, so attacker input reached the internal SMTP service.
Impact
An attacker could send email through the site's SMTP service, which the author says could be used to attack the site's clients; the text does not show any further access.
What the attacker needed
A server to host a redirect file; the shortener fetches submitted URLs
The fix
The report says the issue was fixed one day after being reported, but does not describe the fix.
How it was found
- Create a PHP file on an attacker-controlled server that redirects to a gopher URL targeting the local SMTP port.
- Submit the address of that PHP file to the URL shortener.
- Wait for the shortener to fetch the redirect and follow it to the internal mail service.
- Check the recipient inbox for an email sent from the site's mail 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.
A URL shortener takes a link you give it and visits that link to check it. Here the server would also follow special link types that can talk to other services on the same machine, such as the mail service. That let the attacker use the site's mail server to send messages that looked like they came from the site.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.