Skip to content
XSS Disclosed report Beginner

Reflected xss in https://sh.reddit.com

A reflected cross-site scripting flaw was reported on the sh.reddit.com site, where data from an HTTP request is echoed back into the response unsafely. The reporter claims an attacker could run malicious JavaScript and steal cookies, though the write-up gives no concrete payload or technical detail.

abhiramsita Follow

Originally disclosed on HackerOne

Bounty$5,000 High View original
  • Triaged in 3 days
  • Fixed in 11 days
  • Paid in 4 days
  • Disclosed after 14 days

Summary:

Reflected cross-site scripting (or XSS) arises when an application receives data in an HTTP request and includes that data within the immediate response in an unsafe way.

Impact:

attacker can execute malicious java script and steal cookies

Steps To Reproduce:

[add details for how we can reproduce the issue]

Hi team ,

Navigate to below url scroll to page end find a option see more Move mouse over there and observe the execution of javascript

Supporting Material/References:

[list any additional material (e.g. screenshots, logs, etc.)]

  • [attachment / reference]

Impact

attacker can execute malicious java script and steal cookies

The original report as published on HackerOne, by abhiramsita. 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 sh.reddit.com, and the bug class is reflected cross-site scripting. The researcher's summary defines the class plainly: reflected XSS arises when an application receives data in an HTTP request and includes that data within the immediate response in an unsafe way. The stated impact is that an attacker can execute malicious JavaScript and steal cookies.

The reproduction steps are short. The researcher asks the team to navigate to a URL, but the report does not include that URL, so there is nothing to copy here. From the page, the steps are:

  1. Scroll to the end of the page and find an option labelled "see more".
  2. Move the mouse over that option.
  3. Observe the execution of JavaScript.

The trigger is described as moving the mouse over a "see more" option at the end of the page. The report gives no request, no parameter name, no payload and no response excerpt, so the exact injection point and the exact script that ran are not documented in the text. The supporting material section is an empty placeholder for an attachment or reference.

The platform records the report as high severity, with a bounty of 5,000 USD, disclosed on 8 May 2022. The report itself does not describe a fix.

Root cause

The report does not analyse the cause. The report does not analyse the cause. That is an inference from the reproduction steps, not something the report states.

Impact

In the researcher's words, an attacker can execute malicious JavaScript and steal cookies. That is the whole of the claimed impact. Whether session cookies on the target are reachable from script depends on cookie flags such as HttpOnly, which the report does not discuss. The practical ceiling of a reflected XSS is usually set by what the victim's browser will do in the origin of the vulnerable page: read data the page can read, act as the user, or redirect them.

How this kind of bug works

Reflected XSS happens when three things line up. First, some part of the request (a query string value, a path segment, a header the application echoes) is treated as data. Second, the application places that data into the response without context-appropriate encoding. Third, the browser parses the result as markup or script rather than as inert text.

The context matters more than the payload. A value placed between HTML tags needs < and > to be neutralised; a value placed inside an attribute needs quotes handled; a value placed inside a JavaScript string, a URL, or a CSS block needs its own escaping rules. Encoding that is correct for one context is often wrong for another, which is why generic "sanitise the input" filters fail and why output encoding at the sink is the reliable control.

Defences that stop the class: contextual output encoding on every sink, a strict Content Security Policy that blocks inline and injected script, HttpOnly on session cookies so script cannot read them, and correct handling of the Content-Type and X-Content-Type-Options headers so browsers do not reinterpret responses. Input validation helps but is not a substitute for encoding at output.

How to test for it

Work from the places where the application echoes request data back into the page.

  1. Map reflected inputs. Submit a unique, harmless marker string in every parameter you can influence (query string, path, form fields, and headers the application might echo such as referrer or user agent) and search the response body for the marker.
  2. Identify the context. For each reflection, note whether the marker lands in text, an attribute value, a script block, a URL or a style block. The context decides which characters matter.
  3. Probe the delimiting characters. Send the characters that would break out of that context, one at a time, and watch how the response changes: are they encoded, stripped, or passed through unchanged?
  4. Confirm execution, not just reflection. A reflection is not a finding. Build a payload that proves script runs in the page's origin, and verify it in a real browser rather than only in the raw response.
  5. Check event-driven sinks. The report's trigger is a mouse-over, so remember that attributes such as onmouseover execute without a click. Test interactions, not only page load.

A positive result is a response where your marker appears unencoded in an executable position and the browser runs your proof. Common false positives: the marker is reflected but fully encoded; the reflection sits inside a JavaScript string that is itself escaped; the payload only fires in a browser with protections disabled; the value is reflected on a different host or scheme than the one you are testing; or the input is reflected only after a server-side transformation that neutralises it. Also beware of self-XSS, where the payload only affects the person who types it.

How it is fixed

Apply contextual output encoding at the point where data is written into the response, chosen for the exact context (HTML body, attribute, JavaScript, URL, CSS). Where rich HTML must be accepted, use a well-maintained sanitiser with an allowlist rather than pattern matching. Add a Content Security Policy that disallows inline script and restricts script sources. Set HttpOnly and Secure on session cookies so that even successful script execution cannot read them. Review event-handler attributes and any template that builds markup by string concatenation, since these are the usual places where encoding is skipped.

Hunting notes

Reflected XSS tends to hide in search pages, error and not-found pages, redirect and return-URL parameters, pagination and filter controls, and any UI element that reads state from the URL. Single-page applications are worth attention because client-side routing often copies query values into the DOM through innerHTML-style sinks, and the server-side response may look clean while the browser still executes the value.

Recon signals: parameters that appear in the page source as well as the URL, endpoints that echo a search term back in a heading or message, and JavaScript bundles that read from location and write into the document. Grepping front-end code for DOM sinks and for location.search or location.hash usage narrows the search quickly.

To make a report accepted, show the full path from request to execution: the exact request, the exact response fragment with the unencoded value, and a browser demonstration that the script runs in the target origin. State the impact in terms of what the script can do for a victim, and note any cookie flags or CSP that limit it. A reflection alone, without demonstrated execution, is usually closed as informational.

One caution for this class: this report stops at the reproduction steps and shows no payload, which makes a finding hard to triage. Include those artefacts from the start.

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. 8 min read.

What happened, in plain words

This report is about a bug on sh.reddit.com, a Reddit site. The bug class is called reflected cross-site scripting, usually shortened to XSS. The researcher's own summary explains it: reflected XSS happens when a website receives some data in a request and then puts that data straight back into the page it sends in reply, without handling it safely.

To follow this, you need two everyday ideas. A request is what your browser sends to a website when you open a page or click something: a message asking for content. A response is what the server sends back: the page itself. A cookie is a small piece of data the site stores in your browser, often used to remember that you are logged in, a bit like a wristband at an event that proves you already paid to get in.

The researcher says the impact is that an attacker can run malicious JavaScript and steal cookies. JavaScript is the programming language that runs inside web pages and makes them interactive. If an attacker can get their own JavaScript to run inside a page on Reddit's site, that script runs with the same trust the site gives its own code, which is why stolen cookies are the usual worry.

The reproduction steps are short. The researcher tells the team to navigate to a URL, but the report does not include that URL, so there is nothing to copy here. From the page, the steps are:

  1. Scroll to the end of the page and find an option labelled "see more".
  2. Move the mouse over that option.
  3. Observe the execution of JavaScript.

The trigger described is a mouse-over. That detail matters: many people assume a link has to be clicked before anything happens, but a page can be built so that simply hovering over an element runs code. The report gives no request, no parameter name, no payload and no response excerpt, so the exact place where the unsafe data entered the page, and the exact script that ran, are not documented in the text. The supporting material section is an empty placeholder for an attachment or reference.

The platform records the report as high severity, with a bounty of 5,000 USD, disclosed on 8 May 2022. The report itself does not describe a fix.

In general, how this kind of bug works

Reflected XSS needs three things to line up. First, some part of the request is treated as data: a value in the address bar, a piece of the path, or a header the site echoes back. Second, the site places that data into the response without encoding it correctly. Third, the browser reads the result as markup or script rather than as harmless text.

Encoding here means converting characters that have special meaning in a page (such as < and >) into a form the browser displays as plain text instead of acting on. Think of a comment box on a form: if you write a word that looks like an instruction, the form should print it as a word, not carry the instruction out.

The context matters more than the payload. A value placed between HTML tags needs < and > neutralised; a value inside an attribute needs quotes handled; a value inside a JavaScript string, a URL or a style block needs its own escaping rules. Encoding that is right for one context is often wrong for another, which is why generic "clean the input" filters fail and why encoding at the point of output is the reliable control.

Defences that stop the class: contextual output encoding on every output, a strict Content Security Policy that blocks inline and injected script, HttpOnly on session cookies so script cannot read them, and correct handling of the Content-Type and X-Content-Type-Options headers so browsers do not reinterpret responses. Input validation helps but is not a substitute for encoding at output.

How to test for it

Work from the places where the site echoes request data back into the page.

  1. Map reflected inputs. Submit a unique, harmless marker string in every parameter you can influence (address bar values, path, form fields, and headers the site might echo such as referrer or user agent) and search the response body for the marker.
  2. Identify the context. For each reflection, note whether the marker lands in text, an attribute value, a script block, a URL or a style block. The context decides which characters matter.
  3. Probe the delimiting characters. Send the characters that would break out of that context, one at a time, and watch how the response changes: are they encoded, stripped, or passed through unchanged?
  4. Confirm execution, not just reflection. A reflection is not a finding. Build a payload that proves script runs in the page's origin, and verify it in a real browser rather than only in the raw response.
  5. Check event-driven outputs. This report's trigger is a mouse-over, so remember that attributes such as onmouseover run without a click. Test interactions, not only page load.

A positive result is a response where your marker appears unencoded in an executable position and the browser runs your proof. Common false positives: the marker is reflected but fully encoded; the reflection sits inside a JavaScript string that is itself escaped; the payload only fires in a browser with protections disabled; the value is reflected on a different host or scheme than the one you are testing; or the input is reflected only after a server-side transformation that neutralises it. Also beware of self-XSS, where the payload only affects the person who types it.

How it is fixed

Apply contextual output encoding where data is written into the response, chosen for the exact context (HTML body, attribute, JavaScript, URL, CSS). Where rich HTML must be accepted, use a well-maintained sanitiser with an allowlist rather than pattern matching. Add a Content Security Policy that disallows inline script and restricts script sources. Set HttpOnly and Secure on session cookies so that even successful script execution cannot read them. Review event-handler attributes and any template that builds markup by string concatenation, since these are the usual places where encoding is skipped.

Hunting notes

Reflected XSS tends to hide in search pages, error and not-found pages, redirect and return-URL parameters, pagination and filter controls, and any interface element that reads state from the URL. Single-page applications are worth attention because client-side routing often copies address-bar values into the page through innerHTML-style outputs, and the server-side response may look clean while the browser still runs the value.

Recon signals: parameters that appear in the page source as well as the address bar, endpoints that echo a search term back in a heading or message, and JavaScript bundles that read from location and write into the document. Searching front-end code for DOM outputs and for location.search or location.hash usage narrows the search quickly.

To make a report accepted, show the full path from request to execution: the exact request, the exact response fragment with the unencoded value, and a browser demonstration that the script runs in the target origin. State the impact in terms of what the script can do for a victim, and note any cookie flags or CSP that limit it. A reflection alone, without demonstrated execution, is usually closed as informational.

One caution for this class: this report stops at the reproduction steps and shows no payload, which makes a finding hard to triage. Include those artefacts from the start.

Glossary

  • Request: the message your browser sends to a server asking for a page or data.
  • Response: the page or data the server sends back.
  • Cookie: a small piece of data a site stores in your browser, often to keep you logged in.
  • JavaScript: the programming language that runs inside web pages.
  • XSS (cross-site scripting): a bug where an attacker gets their own script to run inside a trusted site's page.
  • Reflected XSS: XSS where the unsafe data comes in with the request and is echoed straight back in the response.
  • Payload: the specific input an attacker sends to try to trigger the bug.
  • Parameter: a named value in a request, such as a search term in the address bar.
  • Header: extra information sent alongside a request or response, such as the browser's identity.
  • Encoding: converting special characters into a safe form so the browser shows them as text instead of acting on them.
  • Context: the place in the page where data lands (text, attribute, script, URL, style), which decides how it must be encoded.
  • Attribute: a setting on an HTML element, such as a handler that reacts to a mouse-over.
  • onmouseover: an HTML attribute that runs code when the mouse moves over an element.
  • Content Security Policy (CSP): a rule set a site sends to the browser saying which scripts may run.
  • HttpOnly: a cookie flag that stops JavaScript from reading that cookie.
  • Secure: a cookie flag that sends the cookie only over encrypted connections.
  • Content-Type / X-Content-Type-Options: headers that tell the browser what kind of content it received and stop it guessing.
  • Sanitiser: a tool that cleans HTML by allowing only an approved list of elements.
  • Allowlist: a list of things that are permitted, with everything else rejected.
  • innerHTML: a way for JavaScript to write markup into a page, a common place where unsafe data ends up.
  • DOM: the browser's live model of the page, which scripts read and change.
  • Origin: the combination of scheme, host and port that defines a site's security boundary.
  • Self-XSS: a payload that only affects the person who types it in themselves.
  • False positive: a result that looks like a bug but is not exploitable.
  • Severity: a rating of how serious a bug is.
  • Bounty: a payment a company makes for a valid security report.
  • Triage: the first assessment of a report to decide whether it is valid and how serious.

More from Reddit

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.