Skip to content
XSS Disclosed report Beginner

Unrestricted File Upload Results in Cross-Site Scripting Attacks

An unrestricted file upload endpoint allowed HTML or SVG files to be uploaded, and because these files were served inline, an attacker could achieve stored cross-site scripting.

hunt4p1zza Follow

Originally disclosed on HackerOne

Medium 4.7 View original
  • Triaged in 23 hours
  • Fixed in 8 days
  • Paid in 4 months
  • Disclosed after 7 months

Summary by the program

It was found that an attacker can upload any type of file including HTML files when adding a menu during the onboarding process after signing up at https://www.ubereats.com/restaurant/en-CA/signup.

Summary by the researcher

The hacker identified a file upload endpoint used by restaurants applying for Uber Eats which was unrestricted, in the sense that HTML or SVG files could be uploaded. Due to the fact that the contents of the files uploaded were being displayed in-browser (Content-Disposition: inline) this led to stored cross-site scripting.

The original report as published on HackerOne, by hunt4p1zza. 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 Uber Eats restaurant onboarding flow. A restaurant signs up at https://www.ubereats.com/restaurant/en-CA/signup and, during onboarding, adds a menu. That menu step includes a file upload endpoint, and the researcher found that it accepted any file type, including HTML and SVG.

The program's summary states the finding plainly: an attacker can upload any type of file, including HTML files, when adding a menu during onboarding after signing up at the signup URL above.

The researcher's summary adds the mechanism. The upload endpoint used by restaurants applying for Uber Eats was unrestricted, so HTML or SVG files could be uploaded. The contents of uploaded files were then served in the browser with Content-Disposition: inline, which means the browser renders the file rather than downloading it. An HTML or SVG document rendered from the application's own origin can carry script, so the upload becomes stored cross-site scripting.

It does not give a bounty amount, a reproduction request, a payload, or details of the fix.

Root cause

The report shows two conditions together: the upload endpoint was unrestricted, and uploaded files were served with Content-Disposition: inline. Two controls were missing together:

  1. No content-type or extension restriction on upload. The endpoint accepted HTML and SVG files.
  2. Inline disposition on retrieval. Files were returned with Content-Disposition: inline, so the browser rendered them as documents in the context of the site that served them.

Either control alone would have broken the chain. Restricting uploads to safe image types stops the malicious document from being stored; forcing Content-Disposition: attachment (or serving from a separate, script-free origin) stops a stored document from executing even if it is uploaded.

Impact

The report frames the impact as stored cross-site scripting: script embedded in an uploaded HTML or SVG file runs when the file is viewed in the browser. The report does not describe who views the uploaded file, what session or data the script could reach, or any exploitation beyond the rendering itself. Those details are not stated, so the practical reach of the attack is not established by the text.

How this kind of bug works

File upload features usually store a file and later serve it back through a URL. The bug class appears when the server treats the stored bytes as trusted content rather than as an opaque blob.

Browsers decide how to handle a response from its Content-Type and Content-Disposition headers. If a file is served as text/html or image/svg+xml with inline disposition, the browser parses it as a document. HTML can contain <script>; SVG is an XML format that supports <script> elements and event attributes. Any script in that document executes in the origin of the URL that served it, with access to that origin's cookies (subject to cookie flags), storage and DOM.

This is why upload features are a classic stored XSS vector. The upload itself is often harmless-looking, and the payload only fires when someone opens the file's URL. Defences work at three layers: validate what is accepted (allow-list of types, check magic bytes, re-encode images server-side), control how it is served (a dedicated domain with no session cookies, Content-Disposition: attachment, a restrictive Content-Security-Policy, X-Content-Type-Options: nosniff), and treat uploaded content as untrusted everywhere it is displayed.

How to test for it

  1. Find upload points. Look at profile pictures, attachments, menu or product images, support tickets, import features and onboarding flows. Note every place a file is accepted and every URL where it can be retrieved.
  2. Map the retrieval. After a normal upload, inspect the response headers for the file URL: Content-Type, Content-Disposition, and whether the file is served from the main application origin or a separate one.
  3. Probe the accepted types. Upload a harmless HTML file and an SVG file containing a script. If the server rejects them, try changing the extension, the declared Content-Type in the multipart part, or the file's magic bytes.
  4. Check rendering. Request the stored file URL in a browser. A positive result is the browser rendering the document and executing the script, with the URL on the application's origin.
  5. Confirm the origin. Verify which origin the script runs in, for example by checking document.domain or reading a cookie the application sets. Execution on a sandboxed or cookieless domain is a much weaker finding.

Common false positives: the file downloads instead of rendering; the response carries Content-Disposition: attachment; the file is served from a separate domain without the application's cookies; a strict CSP blocks inline script; or the browser sniffs the type and refuses to render it. Each of these breaks the chain, so confirm execution before reporting.

How it is fixed

The standard fixes are:

  • Allow-list accepted file types and verify content, not just the extension or client-supplied Content-Type.
  • Re-encode uploaded images server-side so embedded markup is stripped.
  • Serve user files with Content-Disposition: attachment, or from a separate domain that holds no session, with X-Content-Type-Options: nosniff.
  • Apply a restrictive Content-Security-Policy to any response that can contain user-supplied content.

Hunting notes

Upload features are common in onboarding, profile and support flows, and they are often built quickly with weak validation. Recon signals worth following: endpoints that accept multipart form data, file URLs that return text/html or image/svg+xml, and files served from the main application origin. To make a report land, show the full chain: the upload request, the retrieval response headers, and the script executing in the application's origin, ideally demonstrating access to something the victim's session holds. Without that last step, programs often treat the finding as low impact.

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

Uber Eats lets restaurants sign up online. During sign-up, a restaurant goes through an onboarding process, and one of the steps is adding a menu. That menu step lets the restaurant upload files.

The researcher found that this upload feature did not check what kind of file was being sent. It accepted any file, including HTML files and SVG files. HTML is the language web pages are written in, and SVG is a picture format that can also contain code. Because the uploaded files were later shown in the browser as web pages rather than downloaded, any code inside them would run. That turns a simple upload box into stored cross-site scripting, usually shortened to XSS.

The report does not give a bounty amount, a reproduction request, a payload, or details of the fix.

What the report shows

The target is the Uber Eats restaurant onboarding flow. A restaurant signs up at:

Text
https://www.ubereats.com/restaurant/en-CA/signup

During onboarding it adds a menu, and that step includes a file upload endpoint. An endpoint is simply a specific address on a server that accepts a particular kind of request, like a service counter in a large building: the building is the website, the counter is the endpoint. The researcher found that this endpoint accepted any file type, including HTML and SVG.

The program's own summary states the finding plainly: an attacker can upload any type of file, including HTML files, when adding a menu during onboarding after signing up at the URL above.

The researcher's summary adds the mechanism. The upload endpoint used by restaurants applying for Uber Eats was unrestricted, so HTML or SVG files could be uploaded. The contents of uploaded files were then served in the browser with:

HTTP
Content-Disposition: inline

This is a response header, a small piece of information the server sends alongside a file to tell the browser what to do with it. inline means "show this in the window", as opposed to attachment, which means "save this to disk". So the browser rendered the uploaded file as a document rather than downloading it. An HTML or SVG document rendered from the application's own origin can carry script, so the upload becomes stored cross-site scripting.

Origin is the combination of scheme, host and port that a browser uses to decide which site a page belongs to, for example https://www.ubereats.com. Script running on the application's origin is treated as part of the application, which is what makes this serious.

Root cause

The report shows two conditions together: the upload endpoint was unrestricted, and uploaded files were served with Content-Disposition: inline. Two controls were missing together:

  1. No content-type or extension restriction on upload. The endpoint accepted HTML and SVG files.
  2. Inline disposition on retrieval. Files were returned with Content-Disposition: inline, so the browser rendered them as documents in the context of the site that served them.

Either control alone would have broken the chain. Restricting uploads to safe image types stops the malicious document from being stored; forcing Content-Disposition: attachment, or serving from a separate, script-free origin, stops a stored document from executing even if it is uploaded.

Impact

The report frames the impact as stored cross-site scripting: script embedded in an uploaded HTML or SVG file runs when the file is viewed in the browser. The report does not describe who views the uploaded file, what session or data the script could reach, or any exploitation beyond the rendering itself. Those details are not stated, so the practical reach of the attack is not established by the text.

In general, how this kind of bug works

File upload features usually store a file and later serve it back through a URL. The bug class appears when the server treats the stored bytes as trusted content rather than as an opaque blob. Think of a cloakroom: if the attendant hands your coat back to anyone who asks, it does not matter how carefully the coat was checked in.

Browsers decide how to handle a response from its Content-Type and Content-Disposition headers. If a file is served as text/html or image/svg+xml with inline disposition, the browser parses it as a document. HTML can contain <script>; SVG is an XML format that supports <script> elements and event attributes. Any script in that document executes in the origin of the URL that served it, with access to that origin's cookies (subject to cookie flags), storage and DOM. A cookie is a small piece of data a site stores in your browser to remember who you are, and the DOM is the browser's live model of the page.

This is why upload features are a classic stored XSS vector. The upload itself is often harmless-looking, and the payload only fires when someone opens the file's URL. Defences work at three layers: validate what is accepted (allow-list of types, check magic bytes, re-encode images server-side), control how it is served (a dedicated domain with no session cookies, Content-Disposition: attachment, a restrictive Content-Security-Policy, X-Content-Type-Options: nosniff), and treat uploaded content as untrusted everywhere it is displayed. Magic bytes are the first few bytes of a file that reveal its real format regardless of its name.

In general, how to test for it

  1. Find upload points. Look at profile pictures, attachments, menu or product images, support tickets, import features and onboarding flows. Note every place a file is accepted and every URL where it can be retrieved.
  2. Map the retrieval. After a normal upload, inspect the response headers for the file URL: Content-Type, Content-Disposition, and whether the file is served from the main application origin or a separate one.
  3. Probe the accepted types. Upload a harmless HTML file and an SVG file containing a script. If the server rejects them, try changing the extension, the declared Content-Type in the multipart part, or the file's magic bytes.
  4. Check rendering. Request the stored file URL in a browser. A positive result is the browser rendering the document and executing the script, with the URL on the application's origin.
  5. Confirm the origin. Verify which origin the script runs in, for example by checking document.domain or reading a cookie the application sets. Execution on a sandboxed or cookieless domain is a much weaker finding.

Common false positives: the file downloads instead of rendering; the response carries Content-Disposition: attachment; the file is served from a separate domain without the application's cookies; a strict CSP blocks inline script; or the browser sniffs the type and refuses to render it. Each of these breaks the chain, so confirm execution before reporting.

In general, how it is fixed

The standard fixes are:

  • Allow-list accepted file types and verify content, not just the extension or client-supplied Content-Type.
  • Re-encode uploaded images server-side so embedded markup is stripped.
  • Serve user files with Content-Disposition: attachment, or from a separate domain that holds no session, with X-Content-Type-Options: nosniff.
  • Apply a restrictive Content-Security-Policy to any response that can contain user-supplied content.

In general, where to look

Upload features are common in onboarding, profile and support flows, and they are often built quickly with weak validation. Recon signals worth following: endpoints that accept multipart form data, file URLs that return text/html or image/svg+xml, and files served from the main application origin. To make a report land, show the full chain: the upload request, the retrieval response headers, and the script executing in the application's origin, ideally demonstrating access to something the victim's session holds. Without that last step, programs often treat the finding as low impact.

Glossary

  • Endpoint: a specific address on a server that accepts a particular kind of request.
  • Onboarding: the step-by-step setup a new user or business completes after signing up.
  • HTML: the language web pages are written in; it can include scripts.
  • SVG: an image format written in XML that can also contain script.
  • XSS (cross-site scripting): a bug where an attacker gets their own code to run inside another site, in that site's context.
  • Stored XSS: XSS where the malicious content is saved on the server and runs when someone later views it.
  • Header: extra information a server or browser sends alongside a request or response.
  • Content-Disposition: a response header telling the browser whether to display a file inline or download it as an attachment.
  • Content-Type: a header stating what format a file or response is in.
  • Origin: the scheme, host and port that identify a site to the browser.
  • Cookie: a small piece of data a site stores in the browser to remember a session or preference.
  • DOM: the browser's live model of the page, which scripts can read and change.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • Magic bytes: the first bytes of a file that reveal its real format.
  • CSP (Content-Security-Policy): a header that restricts what a page is allowed to load or execute.
  • nosniff: a header value that stops the browser from guessing a file's type.
  • Multipart form data: the format browsers use to send files and form fields together.
  • False positive: a finding that looks like a bug but is not actually exploitable.

More by hunt4p1zza

View all

3 more disclosed reports, best first.

More from Uber

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.