Allows any user to share their "Root" level folder by sharing "."
The file-sharing API in Nextcloud Talk accepted a path value of '.' to share the root folder, bypassing the intended restriction that only visible subfolders can be shared. An authenticated user could then view all folders in the admin's account, including newly created ones, without the admin seeing a shared icon.
Originally disclosed on HackerOne
- Triaged in 3 hours
- Fixed in 4 hours
- Disclosed after 8 hours
There seems to be a bug in the "File to Share" feature of Nextcloud Talk. This allows any authenticated user/admin to share their "root" level folder by manipulating the "path": parameter in the JSON body request to the remote API /nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares
Steps to repo:
- Create a new user account with no permissions/shared files
- In the admin account enable Nextcloud Talk(speed)
- Invite the new user to the chat
- Click on the file symbol in the chat window
- The file to share dialog window will popup
- select any folder from the admin account.
- Capture tat HTTP POST request in burp repeater
- Change the
"path:"/<folder_name>"topath:"."which indicated the "root level of the folder"
You might get a 403 but if you look at the chat window on the user side you will see the admin "root" folder shared to the user. This also works if you create a group chat and do the same steps.
Expected Request
POST /nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares HTTP/1.1
Host: [removed]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json;charset=utf-8
requesttoken: [removed]
Content-Length: 82
Origin: [removed]
Connection: close
Cookie: [removed]; oc_sessionPassphrase=[removed]; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=[removed]; nc_token=[removed]; nc_session_id=[removed]
{"shareType":10,"path":"/Payroll","shareWith":"4uuxs2yg"}
Expected Behavior
Admin or user is only allowed to share folders that are visible within the "root" folder directory.
Modified Request
POST /nextcloud/ocs/v2.php/apps/files_sharing/api/v1/shares HTTP/1.1
Host: [removed]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json;charset=utf-8
requesttoken: [removed]
Content-Length: 82
Origin: [removed]
Connection: close
Cookie: [removed]; oc_sessionPassphrase=[removed]; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=[removed]; nc_token=[removed]; nc_session_id=[removed]
{"shareType":10,"path":".","shareWith":"4uuxs2yg"}
Modified Behavior
The user is able to see all folders and any newly created folders in the admin account which can lead to sensitive information leakage. The reason this is an issue is once you go back home to the admin account there is no shared icon on the admin folders. This misleads the admin to think that there are no folders being shared.
Impact
An admin can create another user that they trust and that the user can conduct the malicious attack but sharing out the entire root folder without the admin noticing because there are not shared icons on the folders. This can also lead to admin creating sensitive documents/folder in which the user would be able to see everything newly created file and folder.
Attachments
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 authenticated user could view all folders and newly created files in the admin's account, leading to sensitive information leakage, and the admin would not see any shared icon indicating the sharing.
What the attacker needed
Authenticated user account; admin enables Nextcloud Talk; user is invited to a chat
How it was found
- Create a new user account with no permissions or shared files.
- In the admin account, enable Nextcloud Talk and invite the new user to a chat.
- In the chat window, click the file symbol to open the file-to-share dialog.
- Select any folder from the admin account and capture the HTTP POST request.
- Change the 'path' parameter in the request body to '.' and send it.
- Observe that the admin's root folder is shared with the user, even if a 403 response is returned.
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.
A normal user could trick the file-sharing feature into sharing the top-level folder of their own account, not just a specific subfolder, and the owner saw no sign of sharing.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.