Reflected XSS on https://inventory.upserve.com/ (affects IE users only)
The login form reflected the request URI into a hidden field without escaping double quotes, allowing script injection. Only Internet Explorer users with XSS protection disabled could be exploited, and the issue was fixed by improving sanitisation.
- Triaged in 6 hours
- Fixed in 14 days
- Paid in 3 days
- Disclosed after 8 months
Summary by the program
The REQUEST_URI was assigned as the value of a hidden field in the login form without proper escaping resulting in a reflected cross-site scripting bug. Browsers were mitigating the issue and IE was only impacted if XSS protection was disabled. We've improved the sanitization of this field.
Summary by the researcher
The value of REQUEST_URI was not correctly sanitizing user input, in this case, double-quotes. However, due to URL encoding, this was only exploitable in IE.
https://inventory.upserve.com/login/?'"--><script>confirm(document.cookie)</script>
Upserve handled this report quickly and professionally. I am looking forward to working with them again in the future.
What the report shows
The target is the login page of inventory.upserve.com, an Upserve asset. The researcher found a reflected cross-site scripting issue in how the application handled the REQUEST_URI value, and the program's own summary describes the mechanism: the request URI was assigned as the value of a hidden field in the login form without proper escaping.
The payload the researcher used was placed directly in the URL:
https://inventory.upserve.com/login/?'"--><script>confirm(document.cookie)</script>
The payload places a script that reads document.cookie in the URL. The researcher notes that the value of REQUEST_URI was not correctly sanitising user input, specifically double quotes, and that URL encoding limited exploitation to Internet Explorer.
The program's summary adds two details. First, browsers were already mitigating the issue, and IE was only impacted if its XSS protection was disabled. Second, the fix was to improve the sanitisation of the field. The report was rated medium severity with a CVSS score of 4.2, and a bounty of 1,200 USD was paid. It was disclosed on 6 August 2019.
Root cause
The value was not correctly sanitised before being written into the hidden field. The application took the raw request URI and wrote it into an HTML attribute of a hidden form field on the login page. Because the value was not escaped for its HTML context, a double quote in the URI could terminate the attribute value, and the rest of the payload could then introduce new markup and a script element.
The report points to double quotes as the character that was not handled.
Impact
The report's own framing is narrow. Because of URL encoding, the researcher states the issue was only exploitable in IE, and the program states that IE was only impacted when XSS protection was disabled. In that situation, the payload's script would run in the context of the login page, with access to document.cookie. The report does not describe any further consequences, such as session theft or account takeover, and does not claim them.
How this kind of bug works
Reflected XSS happens when data from the request is written back into the response without being encoded for the place it lands. The browser parses the response as HTML, so any characters that the application failed to neutralise are interpreted as markup or script rather than as data.
The context matters. A value placed between tags needs different handling from a value placed inside an attribute, and an attribute delimited by double quotes can be broken out of with a double quote. Once the parser is outside the attribute, an attacker can add event handlers, new elements or a script block.
Several defences reduce or remove the problem. Context-aware output encoding is the primary one: encode ", ', <, > and & according to where the value is inserted. A restrictive Content Security Policy limits what injected script can do. Modern browsers also include reflected XSS filters or auditors; the report notes that browsers were mitigating the issue and IE was only impacted with protection disabled. Server-side input validation can help, but it is not a substitute for encoding at the point of output.
How to test for it
- Identify every place where a value from the request appears in the response. URLs, query strings, path segments, form fields and headers such as the referrer are all candidates. Hidden form fields that echo the current URL are a classic case.
- Send a benign marker value in the parameter and confirm it appears in the response. Note the exact context: inside a quoted attribute, inside an unquoted attribute, between tags, inside a script block or inside a URL.
- Send characters that are special in that context. For a double-quoted attribute, try a double quote followed by a simple tag. For text between tags, try angle brackets. Use a harmless marker such as a confirm dialog rather than anything destructive.
- Check the raw response, not just the rendered page, so you can see whether the characters were encoded or passed through.
- Test in more than one browser. Encoding differences in how browsers normalise URLs can change whether a payload survives the trip from the address bar to the server and back into the page.
A positive result is a response in which your marker characters appear unencoded and the browser executes the injected script. Common false positives include characters that are reflected but encoded, payloads that only appear in a JavaScript string that is itself safely escaped, and reflections that land in a context where the browser will not execute them. A reflection that is visible in the response but inert in the browser is not a finding.
How it is fixed
The standard fix is context-aware output encoding at the point where the value is written into the page. For an HTML attribute, that means encoding the quote characters and the other HTML metacharacters so the value cannot break out of the attribute. The program's summary says it improved the sanitisation of this field.
Additional layers help. A Content Security Policy that disallows inline script reduces the impact of any encoding mistake that slips through. Avoiding the practice of echoing the full request URI into hidden fields, or deriving the value from a validated and normalised source, removes a common source of the problem.
Hunting notes
Login and error pages are frequent homes for this bug class, because they often echo the requested URL back to the user, for example to return them to where they came from after authentication. Hidden fields that store the current URI, redirect parameters, search boxes and 404 pages are all worth checking.
Recon signals include parameters whose values look like URLs or paths, pages that reflect the full request line, and applications that build forms server-side with values taken from the request. Comparing the raw response with the rendered page quickly shows whether encoding is applied.
To make a report land, show the exact request and the exact response, state the browser conditions under which the payload executes, and describe what the script can access in that context. If the impact depends on a specific browser or a disabled protection, say so plainly, as this report does, rather than overstating it.
What happened, in plain words
inventory.upserve.com is an Upserve web address. The researcher looked at its login page, the screen where a user types a username and password to get in. That page had a flaw: it took the address the visitor had typed into the browser and copied it into a hidden field of the login form. A hidden field is a part of a form the visitor does not see, used by the site to carry extra information along with the login. The problem was that the copied address was not cleaned up first, so anything a visitor put in the address could end up being treated as part of the page itself, including code.
This kind of flaw is called reflected cross-site scripting, usually shortened to XSS. The idea is simple: data that comes in with a request is sent straight back out in the response, and the browser reads it as instructions rather than as harmless text. A useful comparison is a noticeboard where someone writes a message on a card and the office pins it up without reading it. If the card says "ignore the previous notice and do this instead", the board now carries an instruction nobody approved.
To show the flaw, the researcher put a crafted value directly in the URL:
https://inventory.upserve.com/login/?'"--><script>confirm(document.cookie)</script>
Reading it piece by piece:
https://inventory.upserve.com/login/?is the normal login address, with a question mark starting the part of the URL that carries extra data.'"-->is the part that breaks out. The single and double quotes and the angle brackets are characters that mean something special in the language web pages are written in. The quotes and angle brackets are characters that mean something special in the language web pages are written in.<script>confirm(document.cookie)</script>is then read by the browser as a small program.document.cookieis the browser's store of cookies for that site, and a cookie is a small piece of data a site asks the browser to keep and send back on later visits, often used to remember who is logged in.confirmshows a pop-up box containing that text.
The researcher notes that the value of REQUEST_URI, which is the address the browser asked for, was not correctly sanitising user input, in this case double quotes. Sanitising means cleaning data so that special characters cannot do anything unexpected. Because of URL encoding, the process by which browsers turn certain characters in an address into a safe coded form, the trick only worked in Internet Explorer. The program's summary adds that browsers were already mitigating the issue, and that IE was only affected if its XSS protection was turned off. The fix was to improve the sanitisation of the field.
The report was rated medium severity with a CVSS score of 4.2, and a bounty of 1,200 USD was paid. It was disclosed on 6 August 2019.
In general, how this kind of bug works
Reflected XSS happens when something from the request is written back into the page without being encoded for the spot where it lands. Encoding means replacing characters that have a special meaning with a safe stand-in, so the browser shows them as text instead of acting on them. The browser reads the response as a page, so any character the site failed to neutralise is treated as part of the page's structure or as code.
The location matters. A value placed between two tags needs different handling from a value placed inside an attribute, which is a setting written inside a tag. An attribute wrapped in double quotes can be escaped from with a double quote, which is exactly what the payload above does. Once the browser is outside the attribute, an attacker can add new elements or a script block.
Several defences reduce the problem. Context-aware output encoding is the main one: encode ", ', <, > and & according to where the value is inserted. A restrictive Content Security Policy, a set of rules the site sends telling the browser which sources of code are allowed, limits what injected script can do. Modern browsers also include reflected XSS filters; the report notes that browsers were mitigating the issue and IE was only affected with protection disabled. Server-side input validation can help, but it is not a substitute for encoding at the point of output.
In general, how to test for it
- Find every place where a value from the request appears in the response. URLs, query strings, path segments, form fields and headers such as the referrer are all candidates. Hidden form fields that echo the current URL are a classic case.
- Send a harmless marker value in the parameter and confirm it appears in the response. Note the exact context: inside a quoted attribute, inside an unquoted attribute, between tags, inside a script block or inside a URL.
- Send characters that are special in that context. For a double-quoted attribute, try a double quote followed by a simple tag. For text between tags, try angle brackets. Use a harmless marker such as a confirm dialog rather than anything destructive.
- Check the raw response, not just the rendered page, so you can see whether the characters were encoded or passed through.
- Test in more than one browser. Differences in how browsers normalise URLs can change whether a payload survives the trip from the address bar to the server and back into the page.
A positive result is a response in which your marker characters appear unencoded and the browser runs the injected script. Common false positives include characters that are reflected but encoded, payloads that only appear inside a JavaScript string that is itself safely escaped, and reflections that land where the browser will not execute them. A reflection that is visible in the response but inert in the browser is not a finding.
In general, how it is fixed
The standard fix is context-aware output encoding where the value is written into the page. For an HTML attribute, that means encoding the quote characters and the other HTML metacharacters so the value cannot break out of the attribute. The program's summary says it improved the sanitisation of this field.
Extra layers help. A Content Security Policy that disallows inline script reduces the impact of any encoding mistake that slips through. Avoiding the practice of echoing the full request URI into hidden fields, or deriving the value from a validated and normalised source, removes a common source of the problem.
In general, where to look
Login and error pages are frequent homes for this bug class, because they often echo the requested URL back to the user, for example to return them to where they came from after logging in. Hidden fields that store the current URI, redirect parameters, search boxes and 404 pages are all worth checking.
Signals worth noticing include parameters whose values look like URLs or paths, pages that reflect the full request line, and applications that build forms on the server with values taken from the request. Comparing the raw response with the rendered page quickly shows whether encoding is applied.
To make a report land, show the exact request and the exact response, state the browser conditions under which the payload runs, and describe what the script can access in that context. If the impact depends on a specific browser or a disabled protection, say so plainly, as this report does, rather than overstating it.
Glossary
- XSS (cross-site scripting): a flaw where a site lets data from a visitor be treated as code by the browser.
- Reflected XSS: the injected data comes back in the same response, rather than being stored on the server.
- Request: the message a browser sends to a server asking for a page or data.
- Response: the message the server sends back.
- URL: the address typed into the browser to reach a page.
- Query string: the part of a URL after the question mark, carrying extra data.
- REQUEST_URI: the address the browser asked for, as seen by the server.
- Cookie: a small piece of data a site asks the browser to keep and send back later, often used to remember a login.
- document.cookie: the browser's store of cookies for the current page, readable from code running on that page.
- Hidden field: a form field the visitor does not see, used to carry extra information with the form.
- Attribute: a setting written inside an HTML tag, such as a value.
- Sanitising: cleaning data so special characters cannot do anything unexpected.
- Encoding (output encoding): replacing characters with safe stand-ins so the browser shows them as text.
- URL encoding: turning certain characters in an address into a safe coded form.
- Content Security Policy: rules a site sends telling the browser which sources of code are allowed.
- CVSS: a scoring system for rating the severity of a security flaw.
- Bounty: a payment a company makes to someone who reports a valid flaw.
- Internet Explorer (IE): an older Microsoft browser, mentioned here because the payload only worked in it.