Reflected XSS on ██████.mil
A search page on a .mil website reflected user input without encoding, so a script in the search box ran in the browser. An attacker could use this to run code in a victim's session and, if other flaws exist, read cookies or tokens.
- Triaged in 21 hours
- Fixed in 37 days
- Disclosed after 47 days
Description: While looking for *.mil, I found a website that is vulnerable to reflected XSS.
Impact
An attacker can use it to fetch cookies/tokens from any website which requires login by using a CORS bug if the site is vulnerable to CORS.
System Host(s)
████.mil
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
- Go to this URL: https://███████████████████html
- On the search bar, write this payload. <script>alert(document.cookie)</script>
- & you'll see the pop-up.
Suggested Mitigation/Remediation Actions
What the report shows
The target is a website listed in the report as ████.mil. The researcher found it while looking for *.mil sites. The researcher found it while looking through *.mil assets and identified a reflected cross-site scripting issue in a search feature.
The reproduction is short and direct:
- Open the following URL:
https://███████████████████html
- In the search bar, enter this payload:
<script>alert(document.cookie)</script>
- The script executes and a pop-up appears.
The report records the weakness as reflected cross-site scripting. No affected product version or CVE number is given, and the report does not describe a fix. The only remediation content is the heading "Suggested Mitigation/Remediation Actions", which is left empty.
Root cause
The report does not show the response, so the exact cause and reflection point are not established. The report does not include the response body, so the exact reflection point and any surrounding context are not shown.
Impact
The report's stated impact is that an attacker can use the flaw to fetch cookies or tokens from any website that requires login, by abusing a CORS bug if that site is itself vulnerable to CORS. That is a conditional claim: it depends on a second weakness elsewhere, and the report does not demonstrate it. The demonstrated outcome is that the payload typed into the search bar executed and showed a pop-up.
How this kind of bug works
Reflected XSS happens when an application takes input from the request, such as a query string parameter or a form field, and places it into the response without context-aware output encoding. The browser cannot tell developer data from attacker data, so any markup in the value is rendered and any script runs with the privileges of the page's origin: it can read the DOM, act with the user's session, and issue requests the user is authorised to make.
The usual defences are output encoding matched to the context (HTML body, attribute, JavaScript string, URL), a strict Content Security Policy that blocks inline script, and treating all request data as untrusted. HttpOnly cookies reduce the damage of cookie theft but do not stop script from acting inside the page.
How to test for it
- Map every place where request data appears in a response: search boxes, error messages, redirect notices, filter labels, pagination links, and values echoed into hidden fields or JavaScript blocks.
- Send a unique benign marker first, for example a short alphanumeric string, and locate exactly where it lands in the response body. Note whether it sits in HTML text, an attribute, a script block or a URL.
- Replace the marker with a context-appropriate probe. In HTML text, a tag that fires an event handler is enough; inside an attribute, break out of the quoting first; inside a script block, close the string and the statement.
- Confirm execution in a real browser rather than relying on string matching in the response. A positive result is the payload running as script in the page's origin.
- Check whether the reflection is filtered, encoded or truncated, and whether a WAF blocks obvious payloads. Try alternative encodings and event handlers only after establishing that the raw value reaches the page.
Common false positives: the marker appears HTML-encoded (so it is safe), the payload lands inside a comment or a <textarea> where it cannot execute, the response is served with a content type that prevents rendering, or the reflection only occurs in a header that browsers do not interpret as HTML. A payload that appears verbatim in the source but never executes is not a finding.
How it is fixed
Apply context-aware output encoding to every reflected value, so that <, >, quotes and ampersands are escaped in HTML and JavaScript contexts. Validate input against an allowlist where the expected format is narrow. Add a Content Security Policy that disallows inline script and restricts script sources. Set session cookies with HttpOnly and Secure, and review any endpoint that reflects request data into error pages or redirects.
Hunting notes
Reflected XSS tends to hide in search and filter parameters, error and "not found" pages, login redirects that echo a return URL, and parameters consumed by client-side frameworks. Recon signals include large numbers of parameters on a single endpoint, older application stacks, and pages that echo user input into the title or breadcrumb. To make a report land, show the exact request and the response snippet where the payload is reflected unencoded, demonstrate execution in a browser, and describe a realistic delivery path such as a crafted link. Keep impact claims tied to what you actually demonstrated; conditional chains that depend on unrelated bugs are usually treated as speculation.
What happened, in plain words
A security researcher was looking for websites ending in .mil. While doing that, they found one site with a search box that had a serious flaw. The report lists the site only as ████.mil.
The flaw is called reflected cross-site scripting, or XSS for short. To understand it, imagine a shop assistant who repeats back whatever you say, word for word, without thinking. If you say "fire", they shout "fire" and everyone panics. A search box that repeats your search term back on the page without cleaning it first behaves the same way: if you type code instead of a normal word, the browser treats that code as part of the page and runs it.
That is what happened here. The researcher typed a small piece of code into the search bar, and the browser ran it and showed a pop-up. The report records the weakness as reflected cross-site scripting. No affected product version or CVE number is given, and the report does not describe a fix: the section headed "Suggested Mitigation/Remediation Actions" is left empty.
The steps, one by one
The reproduction is short and direct.
- Open the following URL:
https://███████████████████html
This is the page that contains the search feature. Opening it is just the starting point; nothing harmful happens yet.
- In the search bar, enter this payload:
<script>alert(document.cookie)</script>
A payload is simply the input an attacker sends to try to trigger a flaw. This one has three parts:
<script>and</script>are HTML tags. Everything between them is treated by the browser as a program, not as text.alert(...)is a built-in browser function that opens a pop-up box showing whatever is inside the brackets.document.cookieasks the browser for the cookies that belong to the current page.
A cookie is a small piece of data a website stores in your browser, often to remember that you are logged in. A token is a similar kind of value, a string that proves who you are to the server. If a script can read cookies, it may be able to read those login values.
- The script executes and a pop-up appears.
This third step is the proof. The pop-up is not decoration: it shows that the browser ran the researcher's code as if the website itself had written it. The report does not include the page's response, so it does not show exactly where in the page the search term was echoed back.
Why it matters
The report's stated impact is that an attacker can use the flaw to fetch cookies or tokens from any website that requires login, by abusing a CORS bug if that site is itself vulnerable to CORS. CORS is a browser rule that normally stops one website from reading data from another. That claim is conditional: it depends on a second weakness somewhere else, and the report does not demonstrate it. What was actually shown is simpler: the payload typed into the search bar ran and showed a pop-up.
In general, how this kind of bug works
Reflected XSS happens when an application takes input from the request, such as a search term or a form field, and places it into the page it sends back without encoding it first. Encoding means converting special characters like < and > into harmless text so the browser displays them instead of acting on them. The browser cannot tell the developer's data from the attacker's data, so any markup in the value is rendered and any script runs with the privileges of the page: it can read the page, act with the user's session, and send requests the user is allowed to make.
The usual defences are output encoding matched to where the value lands (page text, an attribute, a script block, a URL), a strict Content Security Policy that blocks inline script, and treating all request data as untrusted. HttpOnly cookies, a setting that hides a cookie from scripts, reduce the damage of cookie theft but do not stop a script from acting inside the page.
How to test for it
- Map every place where request data appears in a response: search boxes, error messages, redirect notices, filter labels, pagination links, and values echoed into hidden fields or script blocks.
- Send a unique harmless marker first, for example a short string of letters and numbers, and find exactly where it lands in the page. Note whether it sits in text, an attribute, a script block or a URL.
- Replace the marker with a probe suited to that spot. In page text, a tag that fires an event handler is enough; inside an attribute, break out of the quoting first; inside a script block, close the string and the statement.
- Confirm execution in a real browser rather than relying on string matching in the response. A positive result is the payload running as script in the page's origin.
- Check whether the reflection is filtered, encoded or cut short, and whether a web application firewall blocks obvious payloads. Try alternative encodings and event handlers only after establishing that the raw value reaches the page.
Common false positives: the marker appears encoded (so it is safe), the payload lands inside a comment or a text area where it cannot execute, the response is served with a content type that prevents rendering, or the reflection only occurs in a header that browsers do not interpret as HTML. A payload that appears verbatim in the source but never executes is not a finding.
How it is fixed
Apply context-aware output encoding to every reflected value, so that <, >, quotes and ampersands are escaped in page and script contexts. Validate input against an allowlist where the expected format is narrow. Add a Content Security Policy that disallows inline script and restricts script sources. Set session cookies with HttpOnly and Secure, and review any endpoint that reflects request data into error pages or redirects.
Hunting notes
Reflected XSS tends to hide in search and filter parameters, error and "not found" pages, login redirects that echo a return URL, and parameters used by client-side frameworks. Signals worth watching include large numbers of parameters on a single endpoint, older application stacks, and pages that echo user input into the title or breadcrumb. To make a report land, show the exact request and the response snippet where the payload is reflected unencoded, demonstrate execution in a browser, and describe a realistic delivery path such as a crafted link. Keep impact claims tied to what you actually demonstrated; conditional chains that depend on unrelated bugs are usually treated as speculation.
Glossary
- Cross-site scripting (XSS): a flaw where a website lets attacker-supplied code run in a visitor's browser as part of the page.
- Reflected XSS: a form of XSS where the malicious input is sent in a request and immediately echoed back in the response.
- Payload: the input an attacker sends to try to trigger a flaw.
- HTML: the language that describes the structure and content of a web page.
- Tag: a piece of HTML markup such as
<script>, which tells the browser how to treat what follows. - Script: a small program that the browser runs, usually written in JavaScript.
alert(): a browser function that opens a pop-up box showing a message.document.cookie: the browser property that gives a script access to the cookies of the current page.- Cookie: a small piece of data a website stores in your browser, often to keep you logged in.
- Token: a string that proves who you are to a server, often stored in a cookie or sent with requests.
- Session: the period during which a website remembers that you are logged in.
- Origin: the combination of scheme, host and port that identifies a website; scripts run with the privileges of their page's origin.
- CORS: a browser rule that normally stops one website from reading data from another.
- Encoding: converting special characters into harmless text so the browser displays them instead of acting on them.
- Content Security Policy (CSP): a header that tells the browser which sources of script and other content are allowed.
- HttpOnly: a cookie setting that hides the cookie from scripts running on the page.
- Secure: a cookie setting that sends the cookie only over encrypted connections.
- Web application firewall (WAF): a filter in front of a website that blocks requests matching known attack patterns.
- False positive: a test result that looks like a finding but is not actually exploitable.
- CVSS: a standard scoring system for rating the severity of a vulnerability.
- CVE: a public identifier assigned to a specific known vulnerability.