File access control rules not enforced on image files
The Files access control app did not enforce its rules on the file preview and WebDAV search endpoints, so an unprivileged user could list and download previews of files that were supposed to be blocked. This allowed the attacker to view the contents of protected image files and, under certain conditions, text files.
- Triaged in 28 hours
- Fixed in 10 days
- Paid in 7 days
- Disclosed after 18 days
-
Installed Nextcloud from Snap package (version 13.0.2snap1, revision 6916) on fresh Ubuntu 18.04 LTS install.
-
Installed and enabled Files access control (v1.3.0) and Files automated tagging (v1.3.0) apps.
-
As an administrator created an invisible collaborative tag
Secret. -
Added Files automated tagging rule to add the
Secrettag for all files with user membership ofadmingroup. -
Added Files access control rule restricting the access for all files with the
Secrettag and user who is not a member ofadmingroup. -
Created unprivileged user
user. -
Accessed the
adminaccount from WebDAV interface (in order to avoid generating automatic file previews) and created the following files/folders on the server:folder: Secret_Folder folder: Secret_Folder/Secret_Subfolder file: Secret_Folder/Secret_Subfolder/Secret_Picture.jpeg file: Secret_Folder/Secret_Subfolder/Secret_Text.txt -
Shared the
Secret_Folderfromadminuser to the unprivileged useruserwith no edit rights. -
From client computer authorized as the unprivileged user
userand used WebDAV search to recursively list all files with their MIME types with the followingcurlcommand: (Attachment on the original report: WebDAV_SEARCH). This command downloaded the list of all shared files as an xml file: (Attachment on the original report: data.xml). -
Identified an image file
Secret_Folder/Secret_Subfolder/Secret_Picture.jpegfrom the file list and accessed its contents through files preview API with the followingcurlcommand:curl -u user 'https://test.frp.lv/index.php/apps/files/api/v1/thumbnail/1212/750/Secret_Folder/Secret_Subfolder/Secret_Picture.jpeg' -H 'Content-Type: application/x-www-form-urlencoded' > Secret_Picture.jpeg
Impact
-
The unauthorized attacker can list all files recursively for an unlimited depth, even if explicitly denied by
Files access controlrules. -
The unauthorized attacker can view the contents of all denied image files up to their maximum resolution. It is up to the attacker to choose the required image resolution (1024 x 768 in the example) and construct corresponding
GETquery through image preview API. Note that it is not even required for the file owner to use web interface and preview the protected image files before the attack. The corresponding image preview files are generated on the server upon the request of the attacker. -
If the file owner has logged in Nextcloud web interface and browsed the protected files, thus automatically rendering thumbnail previews, it also becomes possible for the attacker to access previews of protected text files with the following
curlcommand referencing the text file from the example, choosing 4096x4096 resolution:curl -u user 'https://test.frp.lv/index.php/apps/files/api/v1/thumbnail/4096/4096/Secret_Folder/Secret_Subfolder/Secret_Text.txt' -H 'Content-Type: application/x-www-form-urlencoded' > Secret_Text.png
The obtained preview image can contain critical information that should have been protected - see example of downloaded preview below:

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 with a low-privileged account could list and view the contents of files that were explicitly denied by access control rules, including images and potentially text files if previews were generated.
What the attacker needed
Nextcloud with Files access control app; Admin creates tag and rules; Attacker has a user account; Shared folder with protected files
How it was found
- Install Nextcloud from Snap package and enable Files access control and Files automated tagging apps.
- As admin, create an invisible tag 'Secret' and a rule to tag all files owned by admin group members.
- Add an access control rule to deny access to files with the 'Secret' tag for users not in the admin group.
- Create an unprivileged user and, as admin via WebDAV, create a folder with a subfolder containing an image and a text file.
- Share the top folder with the unprivileged user without edit rights.
- As the unprivileged user, use WebDAV search to list all files and then request a thumbnail of the protected image via the preview API.
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.
Nextcloud is a file-sharing platform. The administrator set up a rule to block certain files from users who are not in the admin group. However, the rule was not applied to two features: the file preview (which generates thumbnails) and the WebDAV search (which lists files). So a normal user could still see the names and previews of those protected files.
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.