Blind SSRF to internal services in matrix preview_link API
The Matrix preview_url endpoint did not filter the supplied URL, allowing an attacker to make GET requests to internal services and retrieve their og:title metadata. This enabled enumeration of internal services and port scanning, with a potential but unconfirmed path to remote code execution.
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 24 hours
- Paid in 18 hours
- Disclosed after 42 hours
Summary by the program
Matrix Chat endpoint at https://matrix.redditspace.com/_matrix/media/r0/preview_url/?url=* allowed partially blind SSRF to internal services. The data that could be exfiltrated was limited only to the service names and their IPs before a fix was implemented. This endpoint should not be able to query internal services, but external IPs, domains and services are fine for this to query.
Summary by the researcher
Matrix endpoint at https://matrix.redditspace.com/_matrix/media/r0/preview_url/?url= allowed Partially Blind SSRF which allows attacker to send GET requests and exfiltrate data about internal services
The report
Summary:
Reddit' new chat is based on Matrix software which has preview_link functionality which doesn't filter the URL before sending the request
Impact:
Attacker can enumerate services by grabbing og:title and port scanning, also possible RCE escalation (Asking for permission on this one)
Steps To Reproduce:
- Visit the https://matrix.redditspace.com/_matrix/media/r0/preview_url/?url=*
- Replace * with http://██████ to get og:title ███████
- Replace * with http://█████████ to get og:title ███████
- Replace * with http://██████████to get og:title ██████
- Replace * with ████████ to get og:title █████████
Note: If the request is stuck and not responding in 2 seconds reload the page until it does
Permit for escalation attempt?
Since the ███ URL is accessible it may be possible to run ███: GET █████████
There are also possibilities to test ██████, but I thought that it would be incorrect to do such activity without permission and as such report vulnerability in this state. I also therefore request a permission to try to escalate this to Critical
Impact
Attacker can enumerate services and launch attacks against them
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 preview_url endpoint did not validate or restrict the target URL, allowing requests to internal IP addresses and services.
Impact
An attacker could enumerate internal services and their IP addresses, and potentially escalate to remote code execution, though the report only demonstrates information disclosure.
What the attacker needed
Access to the public endpoint; No authentication required
The fix
A fix was implemented that limited the exfiltration of internal service names and IPs.
How it was found
- Visit the preview_url endpoint with a wildcard URL parameter.
- Replace the wildcard with an internal address to retrieve its og:title.
- Repeat with other internal addresses to enumerate services.
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.
The chat service had a feature that fetched a link to show a preview. It did not check whether the link pointed to an internal server, so an attacker could make the server fetch internal addresses and leak small details like page titles. This is called server-side request forgery (SSRF): the server is tricked into making requests on the attacker's behalf.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.