XSS Reflected
A reflected cross-site scripting flaw exists because the application includes untrusted request data in its response without proper sanitisation. An attacker could craft a link that, when clicked, executes script in the victim's browser and potentially compromise that user's session.
- Triaged in 15 hours
- Fixed in 13 days
- Disclosed after 3 months
Description
Reflected Cross-Site Scripting (XSS) occurs when a web application accepts untrusted data in an HTTP request and includes that data in its immediate response without proper sanitization or validation. This vulnerability allows an attacker to inject malicious scripts into web pages viewed by other users. When victims click on a specially crafted link containing the attacker's payload, the server reflects the input back to the user's browser, executing the malicious script within the context of the victim’s session. This can lead to various attacks, such as cookie theft, session hijacking, or phishing.
References
- OWASP XSS (Cross Site Scripting)
- MDN Web Docs on XSS
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Impact
If an attacker can control a script that is executed in the victim's browser, then they can typically fully compromise that user. Amongst other things, the attacker can:
- Perform any action within the application that the user can perform.
- View any information that the user is able to view.
- Modify any information that the user is able to modify.
- Initiate interactions with other application users, including malicious attacks, that will appear to originate from the initial victim user.
There are various means by which an attacker might induce a victim user to make a request that they control, to deliver a reflected XSS attack. These include placing links on a website controlled by the attacker, or on another website that allows content to be generated, or by sending a link in an email, tweet or other message. The attack could be targeted directly against a known user, or could be an indiscriminate attack against any users of the application.
System Host(s)
www.████
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
This URL demonstrates a potential XSS (Cross-Site Scripting) attack by injecting hidden JavaScript code. Here’s how it works:
- Open the URL: When the user navigates to the URL, the server processes the request with the embedded parameters.
https://www.██████/tags/image/sizzle-reel?&view=K0X%22%20AutoFocus%20%2526%252362%20OnFocus%0c%3dprompt%601%60%20kaos%3d%22uwps2&sort=date
- Hidden code execution: The URL contains special characters and encoded payloads (
%22,%2526,%252362,%60, etc.) that are interpreted in different ways by the browser or the application.
███████
- XSS attack: Specifically, the injected code (
AutoFocus,OnFocus,kaos="uwps2") attempts to execute when a particular event occurs. In this case, it could be something like a focus event (OnFocus). When a user interacts with an element on the page (for example, clicks a link or inputs data), the hidden code executes, potentially triggering the XSS payload.
████████
Suggested Mitigation/Remediation Actions
Context
This report describes a reflected cross-site scripting (XSS) issue on a U.S. Department of Defence web property, reported through HackerOne by the researcher k0x and disclosed on 18 December 2024. The platform classifies it as CWE-79, Cross-site Scripting (Reflected), with medium severity and a CVSS score of 5.3.
The affected host is given only as www.████, and the vulnerable feature is a tag image page. The URL in the reproduction steps points at a path of the form /tags/image/<tag-name>, here sizzle-reel, with query parameters view and sort. The URL points at a tag image page with query parameters view and sort; the report does not describe what they control. The report does not describe the application further, and the affected product and version fields are empty.
Setup
No accounts, roles, tools or versions are described. The reproduction is a single URL that can be opened in a browser; no authentication, special headers or prior state are mentioned. The only precondition implied is that a victim can be induced to open a crafted link, which is inherent to reflected XSS.
Finding it
The researcher starts from the general definition of reflected XSS: the application accepts untrusted data in an HTTP request and includes it in the immediate response without proper sanitisation or validation, so a crafted link causes the server to reflect attacker-controlled input back to the victim's browser, where it executes in the context of the victim's session.
What it does show is that the view parameter of the tag image page accepts a value containing quote characters, encoded ampersands, encoded hash characters, backticks and a form-feed character, and that this value ends up in the page in a position where the injected attributes and event handler are interpreted by the browser.
Exploitation
Step 1: Open the crafted URL
The researcher supplies one URL that demonstrates the issue:
https://www.██████/tags/image/sizzle-reel?&view=K0X%22%20AutoFocus%20%2526%252362%20OnFocus%0c%3dprompt%601%60%20kaos%3d%22uwps2&sort=date
Decoding the view value layer by layer shows the intent:
| Encoded | Decodes to | Role |
|---|---|---|
K0X |
K0X |
Researcher marker prefix |
%22 |
" |
Closes an attribute value in the reflected context |
%20 |
space | Separates injected attributes |
%2526%252362 |
&#x62; after one decode, i.e. a double-encoded entity |
Entity encoding intended to survive one round of decoding |
%0c |
form feed | Whitespace/control character between tokens |
%3d |
= |
Assigns the event handler |
%60 |
backtick | Delimits the JavaScript expression |
kaos%3d%22uwps2 |
kaos="uwps2" |
Extra attribute with a quoted value |
The payload therefore injects AutoFocus and OnFocus attributes, with a trailing kaos="uwps2" attribute. The sort=date parameter is carried along unchanged.
Step 2: Hidden code execution
The report explains that the special characters and encoded payloads (%22, %2526, %252362, %60, and so on) are interpreted in different ways by the browser or the application. The double encoding of the ampersand and hash is the interesting part: after the first decode the value still contains an entity rather than a literal #, so the meaning changes depending on how many decoding passes the application and the browser apply.
Step 3: The XSS fires
The injected code (AutoFocus, OnFocus, kaos="uwps2") is designed to execute when a particular event occurs, in this case a focus event. When the user interacts with an element on the page, for example by clicking a link or entering data, the hidden code executes and the payload runs. The report does not include the resulting response body or a screenshot of the dialog.
Root cause
The report frames the cause in general terms: the application takes untrusted data from the request and places it into the immediate response without proper sanitisation or validation. The report frames the cause only in general terms and does not show the reflection context.
Impact
The report lists the standard consequences of script execution in a victim's browser. An attacker who controls a script running in that context can typically fully compromise the user, and can:
- perform any action within the application that the user can perform;
- view any information that the user is able to view;
- modify any information that the user is able to modify;
- initiate interactions with other application users, including malicious attacks, that appear to originate from the victim.
Delivery requires inducing a victim to make a request the attacker controls. The report names several channels: links placed on a website controlled by the attacker, content generated on another site, or a link sent by email, tweet or other message. The attack can be targeted at a known user or indiscriminate against any user of the application.
Fix
The report's remediation section is titled "Suggested Mitigation/Remediation Actions" but contains no content, so no fix is described and no confirmation of a patch is given. The general remedy for this class of bug is to context-aware encode reflected input so that quotes and angle brackets cannot break out of the attribute, and to validate the view parameter against an allowlist of expected values rather than reflecting it verbatim.
Variants to test
- Other parameters on the same page. Try
sortand any other query parameter with the same quote-and-attribute payload. A positive result is the injected attribute appearing unencoded in the response and the handler firing on focus. - Different reflection contexts. Place the payload where the value lands inside a script block, a URL attribute (
href,src) or an HTML comment. A positive result is a context-appropriate breakout, such as</script>followed by a new script, or ajavascript:URL. - Decoding depth. Vary the number of encoding layers (
%22versus%2522,&#x62;versusb) to find how many times the application decodes before reflecting. A positive result is a payload that only fires at a specific depth, which indicates a decode-then-reflect pipeline. - Path segments. Test the tag name in
/tags/image/<tag>itself, not just the query string. A positive result is the tag name reflected unencoded into the page. - Control characters. Keep the form feed (
%0c) and try other whitespace or control characters between attributes. A positive result is the browser still parsing the injected attributes despite the unusual separator.
What happened, in plain words
A security researcher found a bug on a website belonging to the U.S. Department of Defence. The bug is called reflected cross-site scripting, usually shortened to XSS. In everyday terms, imagine a website that acts like a photocopier: you hand it a piece of paper with something written on it, and it copies whatever you wrote straight back onto the page it shows you. If the website copies your text without checking it first, you can write instructions that the browser will follow as if the website itself had written them. That is the essence of reflected XSS.
The researcher reported the issue through HackerOne, a platform where people report security problems to organisations. The report was disclosed on 18 December 2024. The platform classifies the weakness as CWE-79, Cross-site Scripting (Reflected), rates it medium severity, and gives it a CVSS score of 5.3. CVSS is a standard scoring system: 5.3 out of 10 means the issue is real but not the most dangerous kind.
The affected host is written only as www.████, with the middle of the name hidden. The vulnerable feature is a tag image page. A tag is a label attached to content, like a sticker on a folder; a tag image page shows the picture associated with one such label. The URL in the report points at a path of the form /tags/image/<tag-name>, here sizzle-reel, and carries two extra pieces of information called query parameters: view and sort. The URL carries two query parameters, view and sort; the report does not explain what they control. The report does not describe the application any further, and the affected product and version fields are left empty.
Setup
The report describes no accounts, roles, tools or versions. The reproduction is a single URL that anyone can open in a browser. No login, no special headers and no prior state are mentioned. The only precondition is the one built into reflected XSS: a victim has to be persuaded to open a crafted link.
Finding it
The researcher starts from the general definition of reflected XSS. A web application accepts untrusted data in an HTTP request and includes that data in its immediate response without proper sanitisation or validation. Sanitisation means cleaning input so that dangerous characters lose their power; validation means checking that input matches what is expected. When neither happens, a crafted link makes the server echo attacker-controlled input back to the victim's browser, where it runs in the context of the victim's session. A session is the browser's ongoing conversation with the site, usually identified by a cookie, which is a small piece of data the site stores in your browser so it can recognise you on the next request.
What it does show is that the view parameter of the tag image page accepts a value containing quote characters, encoded ampersands, encoded hash characters, backticks and a form-feed character, and that this value ends up in the page in a position where the injected attributes and event handler are interpreted by the browser. An attribute is an extra setting written inside an HTML tag, like id="x"; an event handler is an attribute whose value is a small piece of JavaScript that the browser runs when something happens, such as a click or a focus.
Exploitation
Step 1: Open the crafted URL
The researcher supplies one URL that demonstrates the issue:
https://www.██████/tags/image/sizzle-reel?&view=K0X%22%20AutoFocus%20%2526%252362%20OnFocus%0c%3dprompt%601%60%20kaos%3d%22uwps2&sort=date
Line by line, in plain words:
https://www.██████is the site, with the name partly hidden./tags/image/sizzle-reelis the path to the tag image page for the tagsizzle-reel.?starts the query string, the part of a URL that carries extra parameters.&view=begins theviewparameter. The value that follows is the payload, the malicious input.K0Xis a marker prefix chosen by the researcher, so the injected text is easy to recognise.%22is the URL encoding of a double quote". A double quote is what usually closes an attribute value in HTML, so this is the character that breaks out of the attribute the page author wrote.%20is a space, used to separate one injected attribute from the next.%2526%252362is a double-encoded entity. After one round of decoding it becomes&#x62;, which is itself an entity rather than a literal#. Entities are HTML's way of writing special characters, for examplebstands for the letterb.%0cis a form feed, a whitespace control character, placed between tokens.%3dis=, which assigns a value to an attribute.%60is a backtick, used here to delimit the JavaScript expression.kaos%3d%22uwps2decodes tokaos="uwps2", an extra attribute with a quoted value.&sort=dateis the second parameter, carried along unchanged.
The payload therefore injects AutoFocus and OnFocus attributes, with the handler body prompt1`` and a trailing kaos="uwps2" attribute.
| Encoded | Decodes to | Role |
|---|---|---|
K0X |
K0X |
Researcher marker prefix |
%22 |
" |
Closes an attribute value in the reflected context |
%20 |
space | Separates injected attributes |
%2526%252362 |
&#x62; after one decode, i.e. a double-encoded entity |
Entity encoding intended to survive one round of decoding |
%0c |
form feed | Whitespace/control character between tokens |
%3d |
= |
Assigns the event handler |
%60 |
backtick | Delimits the JavaScript expression |
kaos%3d%22uwps2 |
kaos="uwps2" |
Extra attribute with a quoted value |
Step 2: Hidden code execution
The report explains that the special characters and encoded payloads (%22, %2526, %252362, %60, and so on) are interpreted in different ways by the browser or the application. The double encoding of the ampersand and hash is the interesting part. After the first decode the value still contains an entity rather than a literal #, so the meaning changes depending on how many decoding passes the application and the browser apply. Think of it like a letter inside an envelope inside another envelope: what the reader sees depends on how many envelopes they open.
Step 3: The XSS fires
The injected code (AutoFocus, OnFocus, kaos="uwps2") is designed to execute when a particular event occurs, in this case a focus event. When the user interacts with an element on the page, for example by clicking a link or entering data, the hidden code executes and the payload runs. The report does not include the resulting response body or a screenshot of the dialog.
Root cause
The report frames the cause in general terms: the application takes untrusted data from the request and places it into the immediate response without proper sanitisation or validation. The report frames the cause only in general terms and does not show the reflection context. A sink is the place in the page where the input finally lands.
Impact
The report lists the standard consequences of script execution in a victim's browser. An attacker who controls a script running in that context can typically fully compromise the user, and can:
- perform any action within the application that the user can perform;
- view any information that the user is able to view;
- modify any information that the user is able to modify;
- initiate interactions with other application users, including malicious attacks, that appear to originate from the victim.
Delivery requires inducing a victim to make a request the attacker controls. The report names several channels: links placed on a website controlled by the attacker, content generated on another site, or a link sent by email, tweet or other message. The attack can be targeted at a known user or indiscriminate against any user of the application.
Fix
The report's remediation section is titled "Suggested Mitigation/Remediation Actions" but contains no content, so no fix is described and no confirmation of a patch is given. The general remedy for this class of bug is to context-aware encode reflected input so that quotes and angle brackets cannot break out of the attribute, and to validate the view parameter against an allowlist of expected values rather than reflecting it verbatim. Context-aware encoding means choosing the right escaping for wherever the value lands, for example HTML-encoding inside an attribute; an allowlist is a list of values that are known to be safe, and anything not on the list is rejected.
Variants to test
- Other parameters on the same page. Try
sortand any other query parameter with the same quote-and-attribute payload. A positive result is the injected attribute appearing unencoded in the response and the handler firing on focus. - Different reflection contexts. Place the payload where the value lands inside a script block, a URL attribute (
href,src) or an HTML comment. A positive result is a context-appropriate breakout, such as</script>followed by a new script, or ajavascript:URL. - Decoding depth. Vary the number of encoding layers (
%22versus%2522,&#x62;versusb) to find how many times the application decodes before reflecting. A positive result is a payload that only fires at a specific depth, which indicates a decode-then-reflect pipeline. - Path segments. Test the tag name in
/tags/image/<tag>itself, not just the query string. A positive result is the tag name reflected unencoded into the page. - Control characters. Keep the form feed (
%0c) and try other whitespace or control characters between attributes. A positive result is the browser still parsing the injected attributes despite the unusual separator.
Glossary
- Reflected XSS: the attacker's input is echoed straight back in the immediate response, so the attack travels in a crafted link.
- HackerOne: a platform where researchers report security issues to organisations.
- CWE-79: the standard catalogue entry for cross-site scripting.
- CVSS: a scoring system for the severity of a vulnerability, from 0 to 10.
- Host: the server name in a URL, for example
www.example.com. - Tag: a label attached to content, used here to find an associated image.
- Query parameter: a
name=valuepair after the?in a URL that passes extra information to the server. - HTTP request: the message a browser sends to a server to ask for a page or data.
- Sanitisation: cleaning input so dangerous characters cannot do harm.
- Validation: checking that input matches what is expected.
- Session: the browser's ongoing conversation with a site, usually identified by a cookie.
- Cookie: a small piece of data a site stores in the browser to recognise it later.
- Attribute: an extra setting written inside an HTML tag, such as
id="x". - Event handler: an attribute whose value is JavaScript that runs when something happens, such as a click or focus.
- Payload: the malicious input an attacker sends.
- URL encoding: writing special characters as
%followed by two hex digits, for example%22for". - Entity: HTML's way of writing special characters, for example
bforb. - Form feed: a whitespace control character, encoded as
%0c. - Backtick: the
`character, used here to delimit a JavaScript expression. prompt: a JavaScript function that opens a small dialog box; used here as a harmless proof that code ran.- Sink: the place in the page where input finally lands.
- Context-aware encoding: escaping input according to where it will appear, so it cannot break out of that context.
- Allowlist: a list of values known to be safe; anything else is rejected.
- Decoding depth: how many times an application decodes input before using it.