Skip to content
Access control Disclosed report Intermediate CVE-2018-3762

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.

reinism Follow

Originally disclosed on HackerOne

  • Triaged in 28 hours
  • Fixed in 10 days
  • Paid in 7 days
  • Disclosed after 18 days
  1. Installed Nextcloud from Snap package (version 13.0.2snap1, revision 6916) on fresh Ubuntu 18.04 LTS install.

  2. Installed and enabled Files access control (v1.3.0) and Files automated tagging (v1.3.0) apps.

  3. As an administrator created an invisible collaborative tag Secret.

  4. Added Files automated tagging rule to add the Secret tag for all files with user membership of admin group.

  5. Added Files access control rule restricting the access for all files with the Secret tag and user who is not a member of admin group.

  6. Created unprivileged user user.

  7. Accessed the admin account 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
    
  8. Shared the Secret_Folder from admin user to the unprivileged user user with no edit rights.

  9. From client computer authorized as the unprivileged user user and used WebDAV search to recursively list all files with their MIME types with the following curl command: (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).

  10. Identified an image file Secret_Folder/Secret_Subfolder/Secret_Picture.jpeg from the file list and accessed its contents through files preview API with the following curl command:

    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

  1. The unauthorized attacker can list all files recursively for an unlimited depth, even if explicitly denied by Files access control rules.

  2. 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 GET query 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.

  3. 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 curl command 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:

Secret_Text.png
Secret_Text.png From the original on HackerOne

The original report as published on HackerOne, by reinism. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Install Nextcloud from Snap package and enable Files access control and Files automated tagging apps.
  2. As admin, create an invisible tag 'Secret' and a rule to tag all files owned by admin group members.
  3. Add an access control rule to deny access to files with the 'Secret' tag for users not in the admin group.
  4. Create an unprivileged user and, as admin via WebDAV, create a folder with a subfolder containing an image and a text file.
  5. Share the top folder with the unprivileged user without edit rights.
  6. 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.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.