Skip to content
Access control Disclosed report Beginner CVE-2023-39961

Text does not respect 'Allow download' permissions

A user shared a folder of images with the 'Allow download' permission disabled, but the recipient could create a text file and embed the images in it to view and download them anyway. This let a recipient bypass the sharing restriction and leak sensitive images the owner believed were protected.

rullzer Follow

Originally disclosed on HackerOne

Bounty$250 Low 3.5 View original
  • Triaged in 1 hour
  • Fixed in 2 months
  • Paid in 4 months
  • Disclosed after 4 months

Summary by the program

Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-qhgm-w4gx-gvgp

The report

  1. user0 shares a folder of sensitive images to user1 without the 'Allow download' permission
  2. user1 just creates a new text file and inserts the images into it
  3. Voilla the images appear and can be downloaded easily

These are just previews but still. For the most common types you can even request the raw image https://github.com/nextcloud/text/blob/main/lib/Controller/AttachmentController.php#L57-L67

Impact

A user assume that the allow download feature works can still have their sensitive photos leaked.

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

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is the Nextcloud Text app (nextcloud/text), and the feature under scrutiny is the sharing permission that is meant to stop a recipient from downloading files. The program published a security advisory for the issue at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-qhgm-w4gx-gvgp.

The researcher describes a short sequence of steps:

  1. user0 shares a folder of sensitive images with user1 without the 'Allow download' permission.
  2. user1 creates a new text file and inserts the images into it.
  3. The images appear in the text file and can be downloaded easily.

The researcher notes that what is shown are "just previews but still", and adds that for the most common file types the raw image can be requested as well. The report points at the attachment controller in the Text app as the place where this happens:

Text
https://github.com/nextcloud/text/blob/main/lib/Controller/AttachmentController.php#L57-L67

The impact, in the researcher's words, is that a user who assumes the allow download feature works can still have their sensitive photos leaked.

The report was rated low severity with a CVSS score of 3.5, classified as improper access control, and paid a bounty of 250.00 USD. It was disclosed on 2023-08-23.

Root cause

The report points to the attachment handling in the Text app: when a user inserts an image from a shared folder into a text document, the Text app serves that image (as a preview, and for common types as the raw file) without checking whether the sharing user allowed downloads. The report does not describe where the download restriction is enforced. The report does not describe the exact check that is missing; the likely cause is that the attachment endpoint authorises access to the file but does not evaluate the download permission on the share.

Impact

A recipient of a share that was deliberately restricted to view-only can pull the underlying image content out through the Text app. The researcher is careful to frame this as a leak of sensitive photos that the owner believed were protected by the allow download setting. The researcher frames this as a leak of sensitive photos the owner believed were protected.

How this kind of bug works

Access control decisions are usually made in one place: the file or share layer. Any feature that renders or transforms file content (text editors, preview generators, thumbnail services, export endpoints, PDF converters, attachment proxies) reads the same bytes through a different code path. If that path checks only "can this user see the file?" and not "is this user allowed to download it?", the stricter permission is silently dropped.

The bug class is a permission bypass through an alternate content route. It happens because permissions are modelled as properties of the share, while the alternate route treats the file as an ordinary object. Defences are straightforward in principle: every route that returns file bytes, including previews and derived formats, must evaluate the same permission set as the canonical download route, and the check should live in shared code rather than being reimplemented per controller.

How to test for it

  1. Identify a target with granular sharing permissions, especially a view-only or no-download option.
  2. Create two accounts. Share a file or folder from one to the other with the restrictive permission set, and confirm the direct download is refused.
  3. Enumerate every feature that consumes file content: editors, preview and thumbnail endpoints, attachment handlers, export and print functions, archive creation, link previews, and any API that returns file data or a URL to it.
  4. Through each feature, attempt to obtain the content. A positive result is any response that returns the file bytes, a full-resolution preview, or a URL that can be fetched without the download permission, where the canonical route refuses.
  5. Compare responses carefully: a low-resolution thumbnail may be an accepted design choice, so establish what the program considers a leak before reporting.

Common false positives are cached previews generated before the permission changed, content the recipient could already download through another legitimate route, and metadata such as filenames or sizes that is not the protected content itself. Confirm the bypass with a fresh share and a fresh session.

How it is fixed

Hunting notes

This bug class hides wherever a product has more than one way to reach file bytes. Rich integrations are the best hunting ground: document editors, chat apps with file previews, mail clients with attachments, and any service that generates thumbnails or converts formats. Recon signals include a documented "no download" or "view only" permission, a separate preview or attachment host, and API documentation listing endpoints that return file content outside the main files API.

To get a report accepted, demonstrate the restriction working on the canonical route and failing on the alternate one, using two accounts and a file whose content is unmistakable. Show the exact request and response that returns the protected bytes, and state the owner's expectation that the setting enforces. Keep the demonstration minimal and avoid touching data that is not yours.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

Nextcloud is a piece of software that lets people store files on a server and share them with other people, a bit like running your own private version of a cloud drive. One of its features is a sharing permission called 'Allow download'. When you share a folder with someone, you can switch this permission off, and the idea is that the other person can look at the files but cannot save copies of them.

The researcher found that this promise can be broken. The problem lives in the Nextcloud Text app (nextcloud/text), which is the part of Nextcloud that lets people write documents and drop images into them. The program published a security advisory for the issue at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-qhgm-w4gx-gvgp.

The researcher describes a short sequence of steps:

  1. user0 shares a folder of sensitive images with user1 without the 'Allow download' permission.
  2. user1 creates a new text file and inserts the images into it.
  3. The images appear in the text file and can be downloaded easily.

Step 1 sets up the situation: the owner of the images has deliberately said "you may look, but you may not take a copy". Step 2 is the trick. Instead of trying to download the image directly, the recipient opens a completely different feature, the text editor, and pulls the image into a document. Step 3 is the result: the image shows up, and from there it can be saved. The image shows up in the text file and can be downloaded from there.

The researcher notes that what is shown are "just previews but still", and adds that for the most common file types the raw image can be requested as well. A preview is a smaller, lighter copy of an image that a program generates so it can show a thumbnail quickly. Even a preview is a copy of the picture, so it is already a leak, but the researcher is saying the problem goes further: for common formats the original full-quality file can be fetched too. The report points at the attachment controller in the Text app as the place where this happens:

Text
https://github.com/nextcloud/text/blob/main/lib/Controller/AttachmentController.php#L57-L67

A controller is simply the piece of code that handles a particular kind of request coming into the app. This link points to the lines in that file that deal with attachments, meaning files such as images that are attached to a text document.

The impact, in the researcher's words, is that a user who assumes the allow download feature works can still have their sensitive photos leaked. That is the heart of it: the owner made a choice, believed the software was enforcing it, and the software was not.

The report was rated low severity with a CVSS score of 3.5, classified as improper access control, and paid a bounty of 250.00 USD. It was disclosed on 2023-08-23. CVSS is a standard scoring system for how serious a security flaw is; 3.5 is on the low end. A bounty is a payment a company makes to a researcher who reports a valid problem. Improper access control means the software let someone do something they were not supposed to be allowed to do.

In general, how this kind of bug works

In general, a program decides who may do what in one central place. For a file-sharing product, that place is the file or share layer: when you click download, the software checks your permissions and either hands over the file or refuses. The trouble starts when a product has more than one way to reach the same file content. Text editors, preview generators, thumbnail services, export buttons, PDF converters and attachment handlers all read the same bytes, but through their own separate code paths. If one of those paths only asks "is this person allowed to see the file?" and forgets to ask "is this person allowed to download it?", the stricter rule is silently dropped.

A useful comparison is a museum. The front desk checks your ticket and decides whether you may take photographs. A side door that leads to the same room, with no guard on it, makes the front desk's decision meaningless. The rule was real, but it was only enforced at one entrance.

The bug class is a permission bypass through an alternate content route. It happens because permissions are stored as properties of the share, while the alternate route treats the file as an ordinary object and never looks at those properties. The defence is straightforward in principle: every route that returns file bytes, including previews and converted formats, must evaluate the same permission set as the normal download route, and that check should live in shared code rather than being rewritten in each controller.

How to test for it

  1. Find a target with detailed sharing permissions, especially a view-only or no-download option.
  2. Create two accounts. Share a file or folder from one to the other with the restrictive permission, and confirm that a direct download is refused. This proves the rule works on the normal route.
  3. List every feature that uses file content: editors, preview and thumbnail endpoints, attachment handlers, export and print functions, archive creation, link previews, and any API that returns file data or a link to it. An endpoint is simply a specific address a program answers requests on.
  4. Through each feature, try to obtain the content. A positive result is any response that returns the file bytes, a full-resolution preview, or a link that can be fetched without the download permission, where the normal route refuses.
  5. Compare responses carefully. A low-resolution thumbnail may be an accepted design choice, so establish what the program considers a leak before reporting.

Common false positives are cached previews generated before the permission changed, content the recipient could already download through another legitimate route, and metadata such as filenames or sizes, which is not the protected content itself. A false positive is a finding that looks like a bug but is not. Confirm the bypass with a fresh share and a fresh session.

How it is fixed

Hunting notes

This bug class hides wherever a product has more than one way to reach file bytes. Rich integrations are the best hunting ground: document editors, chat apps with file previews, mail clients with attachments, and any service that generates thumbnails or converts formats. Signals worth watching for include a documented "no download" or "view only" permission, a separate preview or attachment host, and API documentation listing endpoints that return file content outside the main files API.

To get a report accepted, show the restriction working on the normal route and failing on the alternate one, using two accounts and a file whose content is unmistakable. Show the exact request and response that returns the protected bytes, and state the owner's expectation that the setting enforces. Keep the demonstration minimal and avoid touching data that is not yours.

Glossary

  • Nextcloud: software for storing and sharing files on a server you control.
  • Nextcloud Text app: the part of Nextcloud that lets users write documents and insert images into them.
  • Allow download: a sharing setting that, when switched off, is meant to stop the recipient from saving copies of shared files.
  • Share: a grant of access to a file or folder given by one user to another.
  • Permission: a rule about what a user is allowed to do with a file, such as view it or download it.
  • Preview: a smaller, lighter copy of an image generated so it can be displayed quickly.
  • Raw file: the original, full-quality file rather than a reduced copy.
  • Controller: the piece of code that handles a particular kind of incoming request.
  • Attachment: a file, such as an image, that is attached to a document.
  • Endpoint: a specific address that a program answers requests on.
  • Request: a message a browser or program sends to a server asking for something.
  • Response: the message a server sends back, which may contain the requested content or a refusal.
  • Access control: the rules that decide who may do what.
  • Improper access control: a flaw where those rules are missing or not enforced, letting someone do something they should not.
  • Permission bypass: getting around a restriction by using a different route that does not check it.
  • Alternate content route: any feature that returns file content through a path other than the normal download.
  • CVSS: a standard scoring system for the severity of a security flaw.
  • Bounty: a payment made to a researcher who reports a valid security problem.
  • False positive: a finding that looks like a bug but is not.
  • Regression test: an automated check that a fixed bug stays fixed.
  • Session: a logged-in period for a user, tracked by the server so it knows who is making each request.

More by rullzer

View all

9 more disclosed reports, best first.

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.