Skip to content
File upload Disclosed report Beginner CVE-2020-8181

Unrestricted file upload on the image of contacts

The contact image upload accepted a file of any type, including an executable, rather than restricting uploads to images. An attacker could upload a malicious executable, though the report does not show it being executed or served to other users.

hitman_47 Follow

Originally disclosed on HackerOne

Bounty$100 Low 2.6 View original
  • Triaged in 15 hours
  • Fixed in 2 months
  • Paid in 3 months
  • Disclosed after 4 months

When uploading an image for a contact, on the file upload pop up window it shows that it can accept all files of any data type. For my testing I uploaded a sample executable, named 'SimpleCrackMe.exe' which doesn't do really do anything without passing parameters to it on a terminal when running it. The file was uploaded successfully.

Impact

An attacker could upload a dangerous executable file like a virus, malware, etc.. If you don't think this is a vulnerability, please let me close the report myself so that I don't lose points

The original report as published on HackerOne, by hitman_47. 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. 5 min read.

What the report shows

The target is the Nextcloud server, and the feature under test is the image upload for a contact. When the researcher opened the file upload pop-up window for a contact's image, the window indicated that it would accept files of any data type. To test that, the researcher uploaded a sample executable named SimpleCrackMe.exe. According to the report, the file does nothing meaningful unless it is run from a terminal with parameters passed to it. The upload succeeded.

The report records the outcome as a low severity finding, CVSS 2.6, classified as a business logic error, with a bounty of 100.00 USD, disclosed on 2020-07-08. The report does not describe any fix, and it does not include the request that carried the file.

Root cause

The report notes that the upload window for a contact's image indicated it would accept files of any data type. The report describes the upload window's stated types and the successful upload, without analysing the server-side check. The report states the observation at the level of the upload window and the successful upload; it does not analyse the server-side check, so the exact place where validation is absent is not established in the text.

Impact

The report's own framing is that an attacker could upload a dangerous executable file such as a virus or malware. That is the claim as written, and it is hedged: the researcher notes that the uploaded sample does not really do anything without parameters passed to it on a terminal. The report does not show the file being executed, served to another user, or opened by any client, so the practical consequence demonstrated is that a non-image file is accepted and stored by the contact image upload. Whether that stored file can later be delivered to or run by anyone else is not shown.

How this kind of bug works

Unrestricted file upload is a validation gap: a feature that is meant to accept one class of content accepts another. The mechanism is usually one of the following.

  1. The client-side control (the file picker's accept attribute, or a JavaScript check) is the only restriction, and the server trusts whatever arrives.
  2. The server checks the declared content type or the file extension, both of which the client controls, instead of inspecting the actual bytes.
  3. The server checks the extension against a blocklist, which misses variants, double extensions or alternative executable types.
  4. The file is stored under a path that is later served back, so the stored content becomes reachable.

The severity depends entirely on what happens after storage. A file that is stored but never served, never parsed and never executed is a much smaller problem than one that lands in a web-reachable directory, is rendered by a browser, or is processed by a parser with known weaknesses. That is why the same missing check can be a low-severity logic issue in one feature and a serious remote code execution path in another.

How to test for it

  1. Find every feature that accepts a file: profile and contact images, attachments, import functions, document previews, avatar uploads, archive extraction.
  2. Note what the interface claims to accept. The upload window's stated types are a hint, not proof of what the server enforces.
  3. Send a file of a type the feature should not accept. Start with a harmless marker file rather than real malware: a text file renamed to an executable extension, a tiny script, or an image with a different extension. Keep the content inert.
  4. Observe the response: status code, error message, and whether the stored object is retrievable afterwards.
  5. If it is stored, request it back and check the response headers, particularly the content type the server assigns and whether it is served inline or as a download.
  6. Check whether the stored file is reachable by other users or unauthenticated visitors, and whether any component parses it.

A positive result is a file the feature should have rejected being accepted and then retrievable. Common false positives are: the server accepts the upload but strips or re-encodes the content, the file is stored outside any served path, the response is a download with a safe content type, or the acceptance is limited to the uploader's own session with no path to anyone else. Each of these weakens the finding, so establish reachability before writing it up.

How it is fixed

The standard fix is to validate on the server, not in the browser. Accept only the formats the feature needs, decide by inspecting the file's actual content rather than its name or declared type, and reject everything else. Store uploaded files outside the web root or behind a handler that sets a safe content type and forces download where inline rendering is not needed. Give stored files names the server chooses, not names supplied by the client. Where a file must be processed, do so in a sandbox with resource limits.

Hunting notes

This class tends to hide in secondary upload surfaces: contact and profile images, organisation logos, signature blocks, comment attachments, import and restore features, and anything with a preview or thumbnail pipeline. Recon signals include upload windows that advertise broad type support, endpoints that return a stored file path, and features where the same file is later rendered to other users. To make a report land, show the full chain: the request that uploads the disallowed file, the response that confirms storage, the request that retrieves it, and the headers proving how it is served. If the file is only stored and nothing else follows, say so plainly and frame the finding as the validation gap it is, because overstating execution that was never demonstrated is the fastest way to have a low-severity upload report closed.

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 self-hosted service for storing files and working with them through a browser, a bit like having your own private Google Drive or Dropbox on a server you control. One of its features lets you attach a picture to a contact in your address book, so that the person shows up with a photo instead of initials.

The researcher opened the upload window for a contact's image and noticed that it said it would accept files of any data type, not just pictures. To check whether that was really true, they uploaded a sample executable named SimpleCrackMe.exe. An executable is a program file: on Windows it is the kind of file you double-click to run something. According to the report, this particular sample does nothing meaningful unless it is started from a terminal with parameters passed to it, so it was a harmless stand-in rather than real malware.

The upload succeeded. That is the whole finding: a field meant for a contact photo accepted a program file.

The report records this as a low severity issue, CVSS 2.6, classified as a business logic error, with a bounty of 100.00 USD, disclosed on 2020-07-08. It does not describe a fix, and it does not include the request that carried the file.

Why the upload window's message matters

When you pick a file in a browser, the page can tell the browser which kinds of file to offer you. This is a convenience for the user, not a security control: it is enforced by the browser on your own machine, and anyone can bypass it. So the message in the upload window is only a hint about what the developers intended. The real question is what the server does when a file arrives, and the researcher answered it by sending a file the feature was not meant for.

What the report does and does not show

The report's own framing of the impact is that an attacker could upload a dangerous executable file such as a virus or malware. That claim is hedged: the researcher notes the sample does nothing without parameters on a terminal. The report does not show the file being run, served to another user, or opened by any client. What was demonstrated is that a non-image file is accepted and stored by the contact image upload. Whether that stored file can later be delivered to someone else or executed is not shown.

The root cause

The upload window for a contact's image indicated it would accept files of any data type rather than only pictures. The report describes the upload window and the successful upload; it does not analyse the server-side check. The report describes this at the level of the upload window and the successful upload; it does not analyse the server-side check, so the exact place where validation is absent is not established.

In general, unrestricted file upload

Unrestricted file upload is a validation gap: a feature meant to accept one class of content accepts another. Think of a nightclub with a dress code. If the door staff only glance at what you are carrying and wave you through, the rule exists on paper but not in practice. Here the rule is "images only" and the door is the upload handler.

The mechanism is usually one of these:

  1. The only restriction is in the browser (the file picker's accept attribute, or a JavaScript check), and the server trusts whatever arrives.
  2. The server checks the declared content type or the file extension, both of which the client controls, instead of inspecting the actual bytes.
  3. The server checks the extension against a blocklist, which misses variants, double extensions or alternative executable types.
  4. The file is stored under a path that is later served back, so the stored content becomes reachable.

Severity depends entirely on what happens after storage. A file that is stored but never served, never parsed and never executed is a much smaller problem than one that lands in a web-reachable directory, is rendered by a browser, or is processed by a parser with known weaknesses. That is why the same missing check can be a low-severity logic issue in one feature and a serious remote code execution path in another.

How to test for it

  1. Find every feature that accepts a file: profile and contact images, attachments, import functions, document previews, avatar uploads, archive extraction.
  2. Note what the interface claims to accept. The upload window's stated types are a hint, not proof of what the server enforces.
  3. Send a file of a type the feature should not accept. Start with a harmless marker file rather than real malware: a text file renamed to an executable extension, a tiny script, or an image with a different extension. Keep the content inert.
  4. Observe the response: status code, error message, and whether the stored object is retrievable afterwards.
  5. If it is stored, request it back and check the response headers, particularly the content type the server assigns and whether it is served inline or as a download.
  6. Check whether the stored file is reachable by other users or unauthenticated visitors, and whether any component parses it.

A positive result is a file the feature should have rejected being accepted and then retrievable. Common false positives: the server accepts the upload but strips or re-encodes the content, the file is stored outside any served path, the response is a download with a safe content type, or the acceptance is limited to the uploader's own session with no path to anyone else. Each of these weakens the finding, so establish reachability before writing it up.

How it is fixed

The standard fix is to validate on the server, not in the browser. Accept only the formats the feature needs, decide by inspecting the file's actual content rather than its name or declared type, and reject everything else. Store uploaded files outside the web root or behind a handler that sets a safe content type and forces download where inline rendering is not needed. Give stored files names the server chooses, not names supplied by the client. Where a file must be processed, do so in a sandbox with resource limits.

Hunting notes

This class tends to hide in secondary upload surfaces: contact and profile images, organisation logos, signature blocks, comment attachments, import and restore features, and anything with a preview or thumbnail pipeline. Recon signals include upload windows that advertise broad type support, endpoints that return a stored file path, and features where the same file is later rendered to other users. To make a report land, show the full chain: the request that uploads the disallowed file, the response that confirms storage, the request that retrieves it, and the headers proving how it is served. If the file is only stored and nothing else follows, say so plainly and frame the finding as the validation gap it is, because overstating execution that was never demonstrated is the fastest way to have a low-severity upload report closed.

Glossary

  • Nextcloud: a self-hosted suite for storing and sharing files and working with them in a browser.
  • Contact image: the photo attached to a person in an address book.
  • Executable: a program file that can be run, such as a .exe on Windows.
  • Parameters: extra values passed to a program when it is started from a terminal, which change what it does.
  • Terminal: a text window where you type commands to run programs.
  • Upload: sending a file from your computer to a server.
  • Server: the remote computer that stores data and answers requests from browsers.
  • Client: the browser or program on your own machine that sends requests.
  • Business logic error: a flaw in how a feature's rules are applied, rather than in low-level code such as memory handling.
  • CVSS: a scoring system that rates the severity of a vulnerability, here 2.6 out of 10.
  • Severity: how serious a finding is judged to be, often low, medium, high or critical.
  • Bounty: money paid by a bug bounty programme for a valid report.
  • Disclosed: made public, here on 2020-07-08.
  • Validation: checking that input meets the rules before accepting it.
  • Content type: a label saying what kind of data something is, such as an image or a program.
  • File extension: the part of a filename after the dot, such as .exe or .jpg.
  • Blocklist: a list of things that are forbidden, as opposed to an allowlist of things that are permitted.
  • Web root: the directory on a server whose contents can be fetched through a URL.
  • Response headers: extra information a server sends alongside a file, including its content type and whether it should be shown or downloaded.
  • Inline: displayed directly in the browser rather than saved to disk.
  • Remote code execution: a flaw that lets an attacker run their own code on a server.
  • Sandbox: an isolated environment with limits, used to process risky files safely.
  • False positive: a finding that looks like a vulnerability but is not, or is far less serious than it appears.
  • Reachability: whether an attacker or another user can actually get to the stored file.

More by hitman_47

View all

5 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.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.