SSRF protection bypass
The SSRF protection filter in Nextcloud could be bypassed using IPv6/IPv4 address embedding, allowing an attacker to read files from the local network with the server's authorization. This could lead to exfiltration of internal data and performing actions on behalf of the server.
- Triaged in 31 hours
- Fixed in 3 months
- Paid in 3 months
- Disclosed after 4 months
CVSS
High 7.7 CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
Description
The filter which protects Nextcloud from SSRF can be bypassed using IPv6/IPv4 address embedding.
SSRF protection is for example used in the calendar or dav apps. Successful exploitation of the issue will allow reading of files in the local network with the authorization of the server hosting Nextcloud.
POC
The following example can be used to bypass the SSRF filter, where 127.0.0.1 is the server hosting the file:
http://[0:0:0:0:0:ffff:127.0.0.1]/thefile
The issue can for example be exploited in the calendar app with the attached exploit. Usage:
python nextcloud_ssrf.py http://192.168.0.105/nextcloud/nextcloud/ admin "[password]" http://[0:0:0:0:0:ffff:127.0.0.1]:80/secret.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:19970714T170000Z
ORGANIZER;CN=John Doex:MAILTO:[email protected]
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
GEO:48.85299;2.36885
END:VEVENT
END:VCALENDAR
Impact
exfiltrate data from the internal network and perform actions in the name of the server in the internal network
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
Impact
An attacker could exfiltrate data from the internal network and perform actions in the name of the server in the internal network.
What the attacker needed
Authenticated user with calendar app access
How it was found
- Use a crafted URL that embeds an IPv4 address inside an IPv6 address to bypass the SSRF filter.
- Exploit the calendar app by providing a malicious .ics file URL that points to an internal address.
- The server fetches the internal resource, allowing reading of local files.
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.
SSRF (Server-Side Request Forgery) is when an attacker tricks a server into making requests to internal systems that the attacker cannot reach directly. Nextcloud tried to block such requests, but the check could be fooled by writing the address in a special IPv6 format that still points to the same internal machine. This let an attacker read files on the local network as if they were the Nextcloud server.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.