Reflected isn't exploitable: the checks my scanner runs before it says "XSS"
If you've ever run a web scanner against a real site, you know the feeling: 40 "high" findings, and after an afternoon of checking, maybe two are real. After a few reports like that, people stop reading them, and then th
If you've ever run a web scanner against a real site, you know the feeling: 40 "high" findings, and after an afternoon of checking, maybe two are real. After a few reports like that, people stop reading them, and then the real bugs get ignored too.
I build Helmet, a hosted website security scanner. The rule I hold it to is simple: a finding has to come with proof, or it doesn't get reported as confirmed. This post walks through what that means for reflected XSS, the most common source of noise, with the real logic (simplified C++ from the scanner) and an honest list of what it still can't do.
The three classic XSS false positives
Almost every bogus XSS report I've seen is one of these:
-
The payload was already in the page. You inject
<script>alert(1)</script>and find it in the response... because the page is a security blog that always contains that string. -
It came back encoded. The response contains
<script>alert(1)</script>. That's the app doing its job. A naive "is the payload text in the body?" check, after decoding, calls it a hit. -
It came back in JSON. An API echoes your input inside
{"q": "<script>..."}withContent-Type: application/json. The browser will never render that as HTML, so nothing executes.
A fourth one shows up once you scan real sites behind Cloudflare or a WAF: the response wasn't from the app at all. A block page or a 429 Too Many Requests looks "different from the baseline", so a careless diff calls it a vulnerability.
Check 1: baseline first, then the probe
Before sending a single payload, Helmet requests the page clean (no query string) and keeps that as the baseline. A reflection only counts if the payload is in the probe response and not in the baseline:
auto baseline = http.get(clean_url);
auto resp = http.get(base + payload);
bool in_resp = xss_reflected_unencoded(resp.body, payload);
bool in_baseline = has_indicator_in_resp(baseline.body, payload);
That kills false positive #1 outright.
Check 2: raw, not encoded
"The payload text is in the body" isn't enough. It has to be there verbatim, with its angle brackets intact, and the reflection must not start with an escaped copy:
bool xss_reflected_unencoded(const std::string& body, const std::string& payload) {
auto pos = body.find(payload);
if (pos == std::string::npos) return false; // not reflected verbatim
bool has_angle = payload.find_first_of("<>") != std::string::npos;
if (!has_angle) return true;
return body.compare(pos, 4, "<") != 0 && // not an entity-escaped copy
body.compare(pos, 4, "<") != 0;
}
During verification (more on that below) the check also goes the other way: Helmet builds the HTML-entity-encoded form of the payload, and if that is what came back, the finding is marked as affirmatively not exploitable, with the reason recorded:
payload reflected HTML-entity-encoded (
<img src=x onerror=alert(1)>...): not executable
Check 3: would a browser actually render it?
Raw reflection only matters if the browser treats the response as markup. So the scanner looks at the Content-Type:
bool is_browser_rendered(const Response& r) {
const std::string ct = content_type_of(r);
for (const char* t : {"text/html", "xhtml", "image/svg", "text/xml", "application/xml"})
if (ct.find(t) != std::string::npos) return true;
if (!ct.empty()) return false; // JSON, text/plain, ... won't render
// No Content-Type at all: browsers sniff, unless the server said nosniff.
auto it = r.headers.find("X-Content-Type-Options");
return it == r.headers.end() || lower_copy(it->second).find("nosniff") == std::string::npos;
}
The missing-header case matters: with no Content-Type and no nosniff, a browser may sniff the body as HTML, so that still counts as exploitable. An un-encoded reflection in a JSON response is recorded as refuted, not quietly dropped, so you can see why.
Check 4: was it the app, or the WAF?
Both the probe and the baseline go through a block-page detector. A 429 always counts as the rate limiter answering, whatever the body says. Other block statuses (403, 406, 503...) count when the body contains things like "checking your browser", "request blocked" or "mod_security". A normal 200 page that merely mentions those words only counts if it's short, because real block pages are small and a blog post about WAFs is not.
The important design decision is what happens next: a blocked re-test is not evidence either way. It doesn't confirm the finding, and it doesn't refute it either.
The second pass: re-test, and never silently delete
High and critical findings then go through a separate verification pass (always on, with a budget of 15 to 40 re-tests per scan depending on the mode, so a huge scan doesn't hammer the target). It replays the exact request against a fresh baseline and records three things:
-
supporting: the evidence for it (e.g. "payload reflected un-encoded in a browser-rendered (HTML) response") -
contradicting: the evidence against it, filled in only when there's a definitive negative -
conclusive: whether the re-test could actually tell
The rule I'm strictest about: if verification is inconclusive, the finding can never be auto-classified as a false positive. WAF in the way, timeout, flaky endpoint: it goes to needs review, not to the bin. Precision matters, but a scanner that quietly throws away real bugs to look clean is worse than a noisy one.
What it looks like on a real target
Here's Helmet against ginandjuice.shop, PortSwigger's deliberately vulnerable test shop, filmed in a real browser on the live product. It ends at grade F, 18/100, with 4 high findings. The XSS findings carry their evidence, e.g. "Differential confirmed: XSS reflection (un-encoded) in a text/html; charset=utf-8 response", plus the exact payload that worked. Pointed at our own site, the same scanner gives A+ and 0 findings.
What this does not catch (yet)
I'd rather you hear the limits from me:
-
No headless browser. Helmet decides "executable" from raw reflection plus content type. It doesn't load the page and watch
alert()fire. A payload reflected raw inside a<textarea>, an HTML comment, or a<title>would still be counted, even though it may not execute there. Context-aware checks are on the list. - Reflected XSS only, via query parameters. DOM-based XSS (sinks in client-side JS) and stored XSS need different techniques, and this check doesn't cover them.
- Payload-list driven. If the app filters the specific payloads in the list but has a bypass, this check won't find it. A human tester still beats it there.
That's the trade-off: fewer, provable findings over many maybe-findings. If you see Helmet report something you can't reproduce, I genuinely want to know: that's a bug in my scanner, and I'd rather fix it than have you stop trusting the report.
Only scan sites you own or have written permission to test. ginandjuice.shop is PortSwigger's public test site, built to be scanned.
Helmet is at republicofzani.com/helmet. Code WINTEREXTREME gives 2 months of the Helmet plan free until 28 Feb 2027.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.