SSRF via Improper Redirect Validation in Rocket.Chat oEmbed Function
The oEmbed preview feature validated the initial URL for internal addresses but followed redirects without re-checking, so a shortened URL pointing to an internal host was fetched. An attacker could reach internal network services and view parts of their responses through the preview.
Originally disclosed on HackerOne
- Disclosed after 8 months
Summary
In Rocket.Chat version 7.10.1, the oEmbed feature is enabled by default and automatically generates a preview whenever a valid URL is posted in a chat. If the URL redirects to another site, the feature follows the redirect to the final destination. While the initial URL is filtered for local IP addresses and other checks—so SSRF protections are effective—the same protections are not applied to the redirected URL. Therefore, an attacker can use a shortened URL or similar to access hosts on the internal network and obtain a preview.
Details
In my test environment, I set up an httpbin server on the same LAN as the Rocket.Chat server to verify whether SSRF was possible. The httpbin server is running at 192.168.100.9:8080, and the attacker cannot reach this server directly.
Step 1. The attacker uses a URL-shortening service to create a valid URL that redirects to http://192.168.100.9:8080. In this case I used "https://tinyurl.com/".
Step 2. The attacker posts that URL to any channel or DM. Then the Rocket.Chat server sends a GET request to the httpbin server on the internal network, resulting in SSRF. Additionally, the attacker can view parts of the httpbin server’s web page via the oEmbed preview feature.
PoC
In the attached PoC video (PoC_SSRF.mp4) we performed the following three attempts.
・Posting http://example.com Because this is a valid URL, a preview was displayed.
・Posting http://192.168.100.9:8080 Because this is a host on the internal network, the SSRF protection prevented a preview from being displayed.
・Posting https://tinyurl.com/bdhdhmrn This is a shortened URL that redirects to http://192.168.100.9:8080, but because the redirect destination is not validated. That is why the Rocket.Chat server finally accessed http://192.168.100.9:8080 and displayed a preview.
Impact
Impact
This allows an attacker to access internal network resources that would otherwise be unreachable and to perform network scanning. Because the attacker can receive portions of responses from internal hosts, the risk of data leakage is extremely high and urgent remediation is required. Furthermore, the same technique could be used to reach cloud services and metadata endpoints (for example, AWS IMDS), potentially exposing sensitive cloud-side data and credentials, so there is also a significant risk of cloud information leakage. To fix this, it is necessary to properly validate not only the posted URL but also the URL(s) of any redirect destinations.
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 SSRF protection only checked the original URL and did not re-validate the destination after following redirects.
Impact
An attacker could access internal network resources, perform network scanning, and potentially reach cloud metadata endpoints, though the preview only exposed portions of responses.
What the attacker needed
OEmbed enabled (default); ability to post a URL in a channel or DM; a redirect service reachable by the server
The fix
The fix should validate not only the posted URL but also every redirect destination.
How it was found
- Create a shortened URL that redirects to an internal host.
- Post the shortened URL in a channel or direct message.
- The server follows the redirect and fetches the internal host.
- The oEmbed preview shows parts of the internal page.
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.
When you paste a link, Rocket.Chat fetches it to show a preview. It checked the pasted link for private addresses but not the address it was redirected to. A short link can redirect to an internal machine, and the preview then shows part of that machine's page.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.