Skip to content
XSS Write-up Intermediate

My Autonomous Hunt Harness Found a Reflected XSS That Could Expose a Billing Session

A path parameter on a billing endpoint was reflected into an HTML attribute without encoding, allowing reflected XSS. Because the session cookie lacked HttpOnly and was not bound to IP or User-Agent, an attacker could steal and replay the victim's billing session.

redhunter01 Follow

Published on medium.com

Bug Bounty

redhunter01, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

The injected script executed on the billing origin https://gtfcharge.com. The feature in question is the authentication confirmation flow: The affected endpoint followed the structure GET /authenticate/confirm/{token}. and the {token} path segment is rendered back into the confirmation page inside an anchor element.

Normally the page emits something like:

HTML
<a href='/authenticate/{token}' class='btn btn-custom ...'>

The token is URL-decoded and then placed into the href attribute. The finding is that it is not HTML-entity encoded first, so the path segment is an HTML injection sink that reaches executable context on the billing origin.

Setup

The work was done with an autonomous web-security hunting workflow rather than manual browsing. The harness performs endpoint discovery, parameter extraction, reflection detection, context identification, encoding analysis, metacharacter testing, HTML breakout, browser execution, origin verification, cookie accessibility checks and session replay analysis. Browser-level confirmation used a real headless Chromium instance driven by the workflow.

No account, role or credential is described as a precondition. The vulnerable page rendered successfully even when the supplied token was invalid or arbitrary, so the attack did not depend on first obtaining a legitimate authentication token. The attack relied on the victim's browser processing an attacker-constructed URL.

Finding it

The harness flagged the {token} parameter because it behaved differently from normally encoded parameters:

  1. The parameter was reflected into the response.
  2. HTML metacharacters were preserved.
  3. The response was returned with HTTP 200 even for arbitrary token values.
  4. The reflected value appeared inside an HTML attribute.
  5. There was no effective Content Security Policy.

That combination was enough to classify the endpoint as a potential reflected-XSS candidate. The point the author stresses is that reflection alone does not mean XSS; the question is whether attacker-controlled data can transition into executable browser context.

Exploitation

Step 1: establish normal behaviour

A benign request was sent first to record how the page looks when nothing is injected. The server returned content equivalent to:

HTML
<a href='/authenticate/BENIGN123' class='btn btn-custom ...'>

This gives the baseline: the token lands inside the href attribute of the anchor.

Step 2: test attribute delimiters

The next test checked whether HTML attribute delimiters were encoded. They were not. The response reflected attacker-controlled characters directly:

HTML
<a href='/authenticate/x'><svg onload=...>' class='btn btn-custom...'>

The characters that matter are:

The single quote terminates the original href attribute, the > closes the opening anchor element, and the injected SVG element then becomes part of the browser's DOM. This showed the server was not merely displaying the input, it was placing it into an executable HTML context.

Step 3: confirm no valid token is needed

The endpoint rendered successfully even when the supplied token was invalid or completely arbitrary. The vulnerable page therefore did not require possession of a legitimate authentication token, and the attack did not depend on obtaining one first. An attacker can construct a malicious URL against the endpoint and rely on the victim's browser to process it.

Step 4: confirm execution in a real browser

The workflow launched a real headless Chromium instance and loaded the crafted URL. The injected JavaScript executed successfully, and the browser reported the execution origin as:

Text
https://gtfcharge.com

This matters because the script was not running in an unrelated origin or an isolated context: it ran with the privileges of the billing domain. The chain reflected input, DOM injection and JavaScript execution in the target origin was now established, turning the HTML-injection hypothesis into a confirmed reflected XSS.

Step 5: inspect what JavaScript can reach

With execution proven, the next question was what security-sensitive data is accessible from JavaScript on that origin. The application issued a billing session cookie named:

Text
ACCIDSESSID

A representative cookie configuration was:

Text
ACCIDSESSID=<value>

There was no HttpOnly flag. JavaScript on the billing origin could therefore read it through:

JavaScript
document.cookie

The browser confirmed that the injected JavaScript could read the cookie, so the session cookie was not protected from JavaScript execution.

Step 6: test whether the stolen cookie is reusable

A reflected XSS gives JavaScript execution in the victim's browser; a missing HttpOnly makes the session cookie readable to that JavaScript. Together they form a chain from an attacker-controlled URL through reflected XSS, JavaScript execution, document.cookie, ACCIDSESSID and potential session takeover. The open question was whether the cookie could actually be reused from another client.

Rather than assume, the session behaviour was tested directly. A session was minted from one network and client context. The same ACCIDSESSID value was then presented from a different network path and a different User-Agent. The server returned:

HTTP
HTTP/2 200

and did not issue a replacement Set-Cookie. The session was not tied to the original IP address or User-Agent: the cookie behaved as a portable bearer token, which significantly strengthened the impact of the XSS.

The complete chain

Text
Attacker
   │
   │ malicious URL
   ▼
/authenticate/confirm/{token}
   │
   │ token reflected without HTML encoding
   ▼
HTML injection
   │
   ▼
Reflected XSS
   │
   │ executes on billing origin
   ▼
JavaScript
   │
   │ document.cookie
   ▼
ACCIDSESSID
   │
   │ portable across clients
   ▼
Victim's billing session

What was proven, and what was not

The author deliberately separated confirmed behaviour from assumptions. The following was demonstrated directly:

  1. Reflected XSS: attacker-controlled input was reflected into an HTML attribute without proper HTML encoding.
  2. JavaScript execution: the injected payload executed successfully in a real Chromium browser.
  3. Correct security origin: the JavaScript executed under https://gtfcharge.com.
  4. Cookie accessibility: injected JavaScript successfully accessed document.cookie, and the response included the ACCIDSESSID session cookie.
  5. Missing HttpOnly: ACCIDSESSID was issued without HttpOnly.
  6. No effective CSP: the page did not deploy a restrictive Content Security Policy preventing this execution path.
  7. Session portability: an ACCIDSESSID session could be replayed from a different client and network context without IP or User-Agent binding.

What was not claimed is the exact authenticated billing data and actions available after replaying a stolen session. The broader authentication flow indicated that an authenticated billing session could expose sensitive customer information and billing functionality, but end-to-end victim-account compromise was not claimed because that specific path was not reproduced. The distinction between "this should probably work" and "I tested this and here is the evidence" is presented as a strength of the report.

Root cause

The core issue is improper output encoding. The application effectively performed:

Text
User input
   ↓
URL decoding
   ↓
HTML attribute

without encoding the value for the HTML context it lands in. The correct model is:

Text
User input
   ↓
Validation
   ↓
Context-aware HTML encoding
   ↓
HTML attribute

or, where appropriate, rejecting values that do not match the expected token format. If tokens are strictly alphanumeric, accepting only a constrained format would substantially reduce the attack surface.

Existing defences did not stop the chain: there was no effective Content Security Policy on the page, and the session cookie was issued without HttpOnly, so the XSS could read it. The session was not tied to the original IP address or User-Agent, so the stolen cookie remained usable elsewhere.

Impact

An attacker who can get a victim with an active billing session to load a crafted URL on /authenticate/confirm/{token} obtains JavaScript execution in the billing origin. That script can read ACCIDSESSID through document.cookie, and the cookie can be replayed from a different client and network context, so it acts as a portable session bearer. The chain reached a portable session bearer, with potential session takeover.

The exact authenticated billing data and actions reachable after replay were not reproduced. The application's broader authentication flow indicated that an authenticated billing session could expose sensitive customer information and billing functionality, but that end-to-end compromise is stated as an inference, not a demonstrated fact.

Fix

The author recommends addressing the issue at several layers:

  1. Properly HTML-encode the token. The {token} value must be contextually encoded before being inserted into the HTML attribute.
  2. Validate the token format. If legitimate tokens only contain a restricted character set, reject unexpected characters server-side, for example with:
Text
^[A-Za-z0-9]+$

if that matches the application's actual token specification. 3. Add a restrictive CSP as defence in depth. At minimum, consider restrictions for script-src, object-src and base-uri, for example a policy containing:

Text
script-src 'self';object-src 'none';base-uri 'none';

CSP is not a replacement for output encoding; the primary fix remains treating attacker-controlled input as data, not HTML. 4. Protect session cookies. Sensitive authentication cookies should use HttpOnly, Secure and SameSite, with the appropriate SameSite policy for the application's architecture. A recommended configuration looks conceptually like:

Text
Set-Cookie: ACCIDSESSID=<value>;Path=/;Secure;HttpOnly;SameSite=...
  1. Avoid security decisions in the browser. Client-side protections should never be the primary security boundary; the server should always assume attacker-controlled input can reach it.

The report does not state that any of these changes were applied. The bug bounty status at the time of writing was that the report had been validated during triage and moved forward for program review, with the bounty decision still pending.

Variants to test

  • Other path parameters rendered into attributes. Look for endpoints that echo a path segment into href, src, value or class. A positive result is a response where ', ", > or < survive into the attribute, followed by execution in a headless browser.
  • Invalid or arbitrary identifiers. Send a token that cannot exist and check the status code and body. A positive result is HTTP 200 with the value still reflected, meaning no valid token is needed to reach the sink.
  • Cookie flags on session cookies. Inspect Set-Cookie for HttpOnly, Secure and SameSite. A positive result is a session cookie readable from document.cookie in the browser console on the target origin.
  • Session binding. Mint a session in one client, then replay the cookie from a different IP and User-Agent. A positive result is a 200 response with no replacement Set-Cookie, showing the session is a portable bearer token.
  • CSP coverage. Check the response headers on the vulnerable page. A positive result is the absence of a restrictive script-src, allowing inline or injected script to run.
  • Token format assumptions. Where tokens are documented as alphanumeric, try characters outside that set. A positive result is acceptance and reflection of characters that the format should exclude.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 27 min read.

What happened, in plain words

A security researcher was testing a payment and billing application; the injected script executed on the origin https://gtfcharge.com. The affected endpoint followed the structure GET /authenticate/confirm/{token}. The link looks like GET /authenticate/confirm/{token}, where {token} is a short piece of text that identifies the confirmation. When the page opens, the site takes that piece of text and puts it back into the page, inside a link element.

The problem is that the site puts the text in without cleaning it first. If someone puts special characters into the {token} part of the address, those characters are treated as part of the page's structure rather than as harmless text. That lets an attacker slip their own code into the page. When a victim opens the crafted link, that code runs in the victim's browser, on the billing site itself.

That alone would be bad but limited. What made it serious is what the code could then reach: a cookie called ACCIDSESSID, which is the site's way of remembering that you are logged in. The cookie could be read by the injected code, and when the researcher tried using that cookie from a different computer and network, the site accepted it. So a stolen cookie could be used to take over someone's billing session.

The researcher found and checked all of this with an automated tool they built, called a hunt harness, rather than by clicking around by hand. The report was validated during triage and moved forward for program review; the bounty decision was still pending when the write-up was published.

The target and the feature

Before the details, a few basics.

A web application is a program you use through your browser. You type an address, the browser asks a server for a page, and the server sends back HTML, which is the language that describes what a page contains: headings, links, buttons, images.

An endpoint is a specific address on a server that does one job. Think of a large office building: the building is the website, and each endpoint is a particular desk you can walk up to and ask for something. GET /authenticate/confirm/{token} is one such desk. GET is the type of request: it means "please give me this page". The part after the domain, /authenticate/confirm/..., is the path, and it tells the server which desk you want.

A parameter is a piece of information you hand to that desk. Here the parameter is written {token} and it sits inside the path itself. If the token were ABC123, the full address would be https://gtfcharge.com/authenticate/confirm/ABC123.

A token in this context is a short string of characters that stands in for something, like the claim ticket you get at a cloakroom. The site gives you a token, and when you come back with it, the site knows which confirmation you mean.

The feature in question is the authentication confirmation flow. Authentication means proving who you are, usually by logging in. A confirmation flow is a step where the site asks you to click a link to say "yes, that was me". The page you land on shows a button, and that button is built from an anchor element, written in HTML as <a>. An anchor is just a link. Its href attribute holds the address the link points to. An attribute is extra information attached to an HTML element, written inside the opening tag, like href='/authenticate/ABC123'.

Normally the page emits something like:

HTML
<a href='/authenticate/{token}' class='btn btn-custom ...'>

Line by line:

  • <a starts an anchor element, which is a link.
  • href='/authenticate/{token}' is the attribute that says where the link goes. The single quotes mark where the address begins and ends. {token} is the placeholder where the site inserts the token it received.
  • class='btn btn-custom ...' is another attribute that tells the page's styling which look to give this link, here a button style.
  • > closes the opening tag. What follows in the real page would be the link text and a closing </a>.

The token is URL-decoded and then placed into the href attribute. URL decoding needs a short explanation. Some characters are not allowed to appear literally in a web address, so they are written in a coded form. A space, for example, is written %20. When the server receives the address, it turns %20 back into a space. That turning back is URL decoding. It is a normal and necessary step, but it means the server is now holding the raw character, and it must handle it carefully.

The finding is that the token is not HTML-entity encoded first. HTML encoding means replacing characters that have a special meaning in HTML with safe stand-ins. For example, < becomes &lt; and > becomes &gt;. When the browser sees &lt;, it displays a less-than sign but does not treat it as the start of an element. Without that step, a < in the token is read by the browser as "a new element starts here". The path segment therefore becomes an HTML injection sink: a place where outside input flows into the page's structure. And because this page lives on the billing site, the injected content ends up in an executable context, meaning the browser will actually run code placed there.

How the testing was set up

The work was done with an autonomous web-security hunting workflow rather than manual browsing. Autonomous here means the tool runs a sequence of checks by itself and moves from one stage to the next based on what it finds, instead of a person deciding each next click. A harness is the surrounding setup that drives such a tool: it launches the browser, sends the requests, records the answers and decides what to try next.

The harness performs a fixed sequence of stages: endpoint discovery, parameter extraction, reflection detection, context identification, encoding analysis, metacharacter testing, HTML breakout, browser execution, origin verification, cookie accessibility checks and session replay analysis. Each of these is explained where it comes up below.

For the browser-level confirmation, the workflow used a real headless Chromium instance. Chromium is the open-source browser engine behind Google Chrome. Headless means it runs without a visible window: it loads pages and runs their code exactly as a normal browser would, but nobody is watching a screen. This matters because a server can return text that looks dangerous, yet only a real browser can tell you whether that text actually turns into running code.

No account, role or credential is described as a precondition. The vulnerable page rendered successfully even when the supplied token was invalid or arbitrary, so the attack did not depend on first obtaining a legitimate authentication token. The attack relied on the victim's browser processing an attacker-constructed URL.

Finding it

The harness flagged the {token} parameter because it behaved differently from normally encoded parameters. Five observations together were enough to classify the endpoint as a potential reflected-XSS candidate:

  1. The parameter was reflected into the response. Reflection means the server sends your input back to you in the page it returns. It is extremely common and usually harmless: search boxes echo your search term, for example.
  2. HTML metacharacters were preserved. Metacharacters are characters with a special meaning in HTML, chiefly <, >, ' and ". "Preserved" means they came back unchanged instead of being turned into safe stand-ins.
  3. The response was returned with HTTP 200 even for arbitrary token values. HTTP 200 is the status code a server sends to mean "here is the page, all fine". A server that rejects bad input would normally send a different code, such as 404 for not found or 400 for bad request.
  4. The reflected value appeared inside an HTML attribute. Where your input lands decides what it can do. Text between tags is one situation; text inside an attribute is another; text inside a script block is a third. This is called the context.
  5. There was no effective Content Security Policy. A Content Security Policy, or CSP, is a set of rules a site sends to the browser saying which sources of code are allowed to run. It is like a guest list at a door: even if someone slips in, the bouncer checks the list. No effective policy means no such check.

XSS stands for cross-site scripting. Despite the name, it is not really about scripting across sites; it is about getting your code to run inside someone else's site, in the victim's browser, with that site's privileges. Reflected XSS means the malicious input travels in the request and comes straight back in the response, rather than being stored on the server for later visitors.

The point the author stresses is that reflection alone does not mean XSS. Plenty of pages echo your input safely. The real question is whether attacker-controlled data can transition into executable browser context. That is the difference between a page that shows your text and a page that obeys your text.

Exploitation

Step 1: establish normal behaviour

A benign request was sent first, meaning one with ordinary, harmless input, to record how the page looks when nothing is injected. This is the same idea as taking a photo of a room before moving the furniture: later you can tell exactly what changed. The server returned content equivalent to:

HTML
<a href='/authenticate/BENIGN123' class='btn btn-custom ...'>

Line by line:

  • <a opens the anchor element.
  • href='/authenticate/BENIGN123' is the link address. BENIGN123 is the harmless token that was sent, and it appears exactly where it was placed.
  • class='btn btn-custom ...' is the styling attribute, unchanged.
  • > closes the opening tag.

This gives the baseline: the token lands inside the href attribute of the anchor. Knowing the exact position is essential, because the characters needed to break out depend on where you are. Breaking out of an attribute is different from breaking out of ordinary text between tags.

Step 2: test attribute delimiters

The next test checked whether HTML attribute delimiters were encoded. A delimiter is the character that marks where a value starts and stops. In href='/authenticate/BENIGN123', the single quotes are the delimiters. If the server lets you supply your own quote, you can end the attribute early and start writing your own HTML.

They were not encoded. The response reflected attacker-controlled characters directly:

HTML
<a href='/authenticate/x'><svg onload=...>' class='btn btn-custom...'>

Line by line, and this is the heart of the whole finding:

  • <a href='/authenticate/x' is the original anchor, but the address now ends at the quote after x. The server put the attacker's x and then the attacker's quote there.
  • > closes the anchor element. Everything after this point is no longer inside the link; it is a new element at the top level of the page.
  • <svg onload=...> starts an SVG element. SVG is a format for drawing shapes on a web page, and browsers treat it as part of the page. The onload attribute is an event handler: a piece of code the browser runs when something happens. Here it runs when the SVG finishes loading, which is immediately.
  • ' class='btn btn-custom...'> is the leftover tail of the original markup, now sitting after the injected element. It is harmless clutter, but it shows how the original structure was split apart.

The characters that matter are:

In order:

  • The single quote ' terminates the original href attribute. The browser thinks the address value has ended.
  • The > closes the opening anchor element. The browser thinks the link tag is finished.
  • The < opens a brand-new element that the attacker controls.

The injected SVG element then becomes part of the browser's DOM. The DOM, or Document Object Model, is the browser's live, in-memory model of the page: a tree of elements that the browser builds from the HTML and then uses for everything, including running scripts. Once your element is in that tree, the browser treats it as a genuine part of the page, not as text to display.

This showed the server was not merely displaying the input, it was placing it into an executable HTML context. Displaying is what a noticeboard does with a poster. Placing into executable context is more like handing someone a form that the office will actually process.

Step 3: confirm no valid token is needed

The endpoint rendered successfully even when the supplied token was invalid or completely arbitrary. The vulnerable page therefore did not require possession of a legitimate authentication token, and the attack did not depend on obtaining one first.

Why does this matter so much? Many attacks need a foothold: you must be logged in, or you must have been sent a real link. Here, the page that contains the flaw will happily render for any made-up token. An attacker can construct a malicious URL against the endpoint and rely on the victim's browser to process it. The attacker never needs an account on the confirmation flow, and never needs to guess a real token. They only need the victim to open a link.

Step 4: confirm execution in a real browser

The workflow launched a real headless Chromium instance and loaded the crafted URL. The injected JavaScript executed successfully, and the browser reported the execution origin as:

Text
https://gtfcharge.com

An origin is the combination of scheme, host and port: here https, gtfcharge.com and the default port for HTTPS. Browsers use the origin as the basic unit of trust. Code running on one origin can read that origin's cookies and data; code on another origin cannot. Think of it as the difference between a contractor who has been given keys to your building and one who is standing on the pavement outside.

This matters because the script was not running in an unrelated origin or an isolated context: it ran with the privileges of the billing domain. The chain of reflected input, DOM injection and JavaScript execution in the target origin was now established, turning the HTML-injection hypothesis into a confirmed reflected XSS. A hypothesis is a reasonable guess; a confirmation is a demonstrated fact. The headless browser is what turned one into the other.

Step 5: inspect what JavaScript can reach

With execution proven, the next question was what security-sensitive data is accessible from JavaScript on that origin. This is the step most testers skip. Proving you can run code is only half the story; the impact depends on what that code can touch.

A cookie is a small piece of data a website asks your browser to store and send back with every request to that site. It is how a site remembers you between page loads, because the web itself has no memory. When you log in, the server sends a cookie containing a session identifier; on every later request your browser presents it, and the server looks it up to know who you are. A session is that server-side record of you being logged in.

The application issued a billing session cookie named:

Text
ACCIDSESSID

A representative cookie configuration was:

Text
ACCIDSESSID=<value>

Line by line:

  • ACCIDSESSID is the cookie's name. The name is just a label; the site chose it.
  • = separates the name from the value.
  • <value> is a placeholder for the actual session identifier. In a real response this would be a long random-looking string. It is deliberately not reproduced here, because anyone holding it could act as the logged-in user.

There was no HttpOnly flag. A flag is an extra instruction attached to a cookie. HttpOnly is a specific instruction that tells the browser: never let JavaScript read this cookie. It exists precisely because of attacks like this one. The browser will still send the cookie with requests, so the site keeps working, but scripts on the page are locked out of it.

JavaScript on the billing origin could therefore read the cookie through:

JavaScript
 document.cookie

Line by line:

  • document is the browser's built-in object representing the current page.
  • .cookie is a property of that object holding the cookies visible to scripts on this page.
  • Reading it returns a string of name-value pairs. If ACCIDSESSID is not marked HttpOnly, it appears in that string.

The browser confirmed that the injected JavaScript could read the cookie, so the session cookie was not protected from JavaScript execution. In everyday terms: the cloakroom ticket was left lying on the counter where anyone standing there could read it.

Step 6: test whether the stolen cookie is reusable

A reflected XSS gives JavaScript execution in the victim's browser; a missing HttpOnly makes the session cookie readable to that JavaScript. Together they form a chain from an attacker-controlled URL through reflected XSS, JavaScript execution, document.cookie, ACCIDSESSID and potential session takeover.

But there was still an open question, and it is a good one. Many sites tie a session to the context it was created in. If the session only works from the same network address or the same browser, a stolen cookie is much less useful. The open question was whether the cookie could actually be reused from another client.

Rather than assume, the session behaviour was tested directly. A session was minted from one network and client context. Minted means created: the researcher logged in or otherwise obtained a fresh session, and recorded its cookie. The same ACCIDSESSID value was then presented from a different network path and a different User-Agent. A User-Agent is a line of text your browser sends with every request identifying itself, something like "this is Chrome on Windows". Sites can use it to tell clients apart. The server returned:

HTTP
HTTP/2 200

Line by line:

  • HTTP/2 is the version of the protocol used for the conversation between browser and server. It is simply the modern version of the language they speak.
  • 200 is the status code meaning the request succeeded and the page was served.

And it did not issue a replacement Set-Cookie. Set-Cookie is the response header a server uses to hand a cookie to the browser. If the server had considered this a new or suspicious client, it would typically have sent a fresh Set-Cookie, giving a new session and effectively cutting off the old one. It did not.

The session was not tied to the original IP address or User-Agent. An IP address is the number that identifies a device's location on a network; it is roughly like a postal address for a computer. The cookie behaved as a portable bearer token. Bearer means: whoever holds it is treated as the owner. Like a paper ticket to a concert, it does not matter who bought it; the door accepts whoever presents it. This significantly strengthened the impact of the XSS, because it meant the stolen cookie was not confined to the victim's own machine.

The complete chain

Text
Attacker
   │
   │ malicious URL
   ▼
/authenticate/confirm/{token}
   │
   │ token reflected without HTML encoding
   ▼
HTML injection
   │
   ▼
Reflected XSS
   │
   │ executes on billing origin
   ▼
JavaScript
   │
   │ document.cookie
   ▼
ACCIDSESSID
   │
   │ portable across clients
   ▼
Victim's billing session

Read it top to bottom as a sequence of causes. The attacker builds a malicious URL. The victim opens it, and the request reaches /authenticate/confirm/{token}. The server reflects the token without HTML encoding. That produces HTML injection. The injection becomes reflected XSS. The XSS executes on the billing origin. The running JavaScript reads document.cookie. It obtains ACCIDSESSID. That cookie is portable across clients. The attacker ends up with the victim's billing session.

Each arrow is a step that had to be checked, not assumed. That is why the chain is drawn rather than described in a sentence: it makes clear where each link depends on the previous one, and where a single fix would break the whole thing.

What was proven, and what was not

The author deliberately separated confirmed behaviour from assumptions. This is a discipline worth copying: in a report, a claim you tested and a claim you expect are different things, and mixing them weakens both. The following was demonstrated directly:

  1. Reflected XSS: attacker-controlled input was reflected into an HTML attribute without proper HTML encoding.
  2. JavaScript execution: the injected payload executed successfully in a real Chromium browser. A payload is the specific piece of code or input crafted to trigger the behaviour.
  3. Correct security origin: the JavaScript executed under https://gtfcharge.com.
  4. Cookie accessibility: injected JavaScript successfully accessed document.cookie, and the response included the ACCIDSESSID session cookie.
  5. Missing HttpOnly: ACCIDSESSID was issued without HttpOnly.
  6. No effective CSP: the page did not deploy a restrictive Content Security Policy preventing this execution path.
  7. Session portability: an ACCIDSESSID session could be replayed from a different client and network context without IP or User-Agent binding. Replay means taking a recorded piece of authentication data and presenting it again later, from somewhere else, to see whether the server accepts it.

What was not claimed is the exact authenticated billing data and actions available after replaying a stolen session. The broader authentication flow indicated that an authenticated billing session could expose sensitive customer information and billing functionality, but end-to-end victim-account compromise was not claimed because that specific path was not reproduced. In other words: the researcher proved they could get the key, and proved the key works in another door, but did not claim to have opened every room inside.

The distinction between "this should probably work" and "I tested this and here is the evidence" is presented as a strength of the report. It is also practical: a triage team can act on tested facts, and an overclaim that turns out false damages the whole report.

Root cause

The core issue is improper output encoding. Encoding, in this context, means transforming data so that it cannot be mistaken for instructions. The application effectively performed:

Text
User input
   ↓
URL decoding
   ↓
HTML attribute

Line by line:

  • User input is whatever arrived in the {token} position, fully under the attacker's control.
  • URL decoding turns coded characters back into their raw form. Necessary, but it means raw <, > and ' are now in hand.
  • HTML attribute is where that raw value is placed, with no step in between to make it safe.

The missing step is the whole bug. The correct model is:

Text
User input
   ↓
Validation
   ↓
Context-aware HTML encoding
   ↓
HTML attribute

Line by line:

  • User input arrives as before.
  • Validation checks that the value is the kind of thing it claims to be. If a token should be letters and digits only, anything else is rejected.
  • Context-aware HTML encoding converts the value so it is safe for the exact place it will sit. "Context-aware" means the encoding is chosen for the destination: an attribute needs different treatment from a script block or plain text.
  • HTML attribute receives a value that can only ever be displayed, never interpreted.

Or, where appropriate, rejecting values that do not match the expected token format. If tokens are strictly alphanumeric, accepting only a constrained format would substantially reduce the attack surface. Attack surface is the total set of ways an attacker can try to get in; shrinking it means fewer doors to check.

Existing defences did not stop the chain: there was no effective Content Security Policy on the page, and the session cookie was issued without HttpOnly, so the XSS could read it. The session was not tied to the original IP address or User-Agent, so the stolen cookie remained usable elsewhere. Three separate safety nets were missing.

Impact

An attacker who can get a victim with an active billing session to load a crafted URL on /authenticate/confirm/{token} obtains JavaScript execution in the billing origin. That script can read ACCIDSESSID through document.cookie, and the cookie can be replayed from a different client and network context, so it acts as a portable session bearer. The chain reached a portable session bearer, with potential session takeover.

Session takeover means the attacker can act as the victim: view what the victim sees, and do what the victim can do, for as long as the session lasts. The word "potential" is doing real work in that sentence, and the report is careful about it.

The exact authenticated billing data and actions reachable after replay were not reproduced. The application's broader authentication flow indicated that an authenticated billing session could expose sensitive customer information and billing functionality, but that end-to-end compromise is stated as an inference, not a demonstrated fact. An inference is a conclusion drawn from evidence without direct testing of that specific step.

Fix

The author recommends addressing the issue at several layers. Defence in layers is the standard approach: if one control fails, another still stands.

  1. Properly HTML-encode the token. The {token} value must be contextually encoded before being inserted into the HTML attribute. This is the primary fix, because it removes the injection at its source.
  2. Validate the token format. If legitimate tokens only contain a restricted character set, reject unexpected characters server-side, for example with:
Text
^[A-Za-z0-9]+$

Line by line, this is a regular expression, a compact pattern for describing which strings are allowed:

  • ^ means the match must start at the beginning of the string.
  • [A-Za-z0-9] means one character that is an uppercase letter, a lowercase letter, or a digit.
  • + means one or more of the preceding item, so at least one such character.
  • $ means the match must run to the end of the string.

Together: the whole string must consist only of letters and digits, with nothing else. The report adds the condition "if that matches the application's actual token specification", because a pattern that rejects legitimate tokens would break the feature.

  1. Add a restrictive CSP as defence in depth. At minimum, consider restrictions for script-src, object-src and base-uri, for example a policy containing:
Text
script-src 'self';object-src 'none';base-uri 'none';

Line by line:

  • script-src 'self' says scripts may only be loaded from the site's own origin. Injected inline code and code from other domains are refused.
  • object-src 'none' says no plugin-style embedded objects may load at all.
  • base-uri 'none' says the page may not set a base address, which otherwise could be abused to redirect where relative links point.

CSP is not a replacement for output encoding; the primary fix remains treating attacker-controlled input as data, not HTML. A useful comparison: encoding is locking the door, CSP is the alarm. You want both, but the alarm is not a reason to leave the door open.

  1. Protect session cookies. Sensitive authentication cookies should use HttpOnly, Secure and SameSite, with the appropriate SameSite policy for the application's architecture. Secure means the cookie is only sent over encrypted HTTPS connections, so it cannot be read off an open network. SameSite controls whether the cookie is sent when the request originates from another site, which limits certain cross-site attacks. A recommended configuration looks conceptually like:
Text
Set-Cookie: ACCIDSESSID=<value>;Path=/;Secure;HttpOnly;SameSite=...

Line by line:

  • Set-Cookie: is the response header that hands the cookie to the browser.
  • ACCIDSESSID=<value> is the cookie's name and its placeholder value.
  • Path=/ says the cookie applies to the whole site, not just one folder.
  • Secure restricts it to HTTPS.
  • HttpOnly hides it from JavaScript.
  • SameSite=... is left as a placeholder because the right setting depends on how the site is built.
  1. Avoid security decisions in the browser. Client-side protections should never be the primary security boundary; the server should always assume attacker-controlled input can reach it. Anything enforced only in the browser can be bypassed, because the attacker controls the browser. The server is the only place a decision can be trusted.

The report does not state that any of these changes were applied. The bug bounty status at the time of writing was that the report had been validated during triage and moved forward for program review, with the bounty decision still pending. Triage is the first stage of a bug bounty programme, where a team checks whether a report is real, in scope and worth pursuing. A bug bounty programme is a scheme where an organisation invites outside researchers to report flaws and pays for valid ones.

Variants to test

The report lists follow-up checks in the same style, useful for anyone learning the method:

  • Other path parameters rendered into attributes. Look for endpoints that echo a path segment into href, src, value or class. A positive result is a response where ', ", > or < survive into the attribute, followed by execution in a headless browser. src is the attribute that names an image or script file to load; value is the attribute holding a form field's contents.
  • Invalid or arbitrary identifiers. Send a token that cannot exist and check the status code and body. A positive result is HTTP 200 with the value still reflected, meaning no valid token is needed to reach the sink.
  • Cookie flags on session cookies. Inspect Set-Cookie for HttpOnly, Secure and SameSite. A positive result is a session cookie readable from document.cookie in the browser console on the target origin. The browser console is the built-in panel where you can type JavaScript and see its output.
  • Session binding. Mint a session in one client, then replay the cookie from a different IP and User-Agent. A positive result is a 200 response with no replacement Set-Cookie, showing the session is a portable bearer token.
  • CSP coverage. Check the response headers on the vulnerable page. A positive result is the absence of a restrictive script-src, allowing inline or injected script to run. Response headers are the lines of metadata a server sends before the page body, describing things like content type and security rules.
  • Token format assumptions. Where tokens are documented as alphanumeric, try characters outside that set. A positive result is acceptance and reflection of characters that the format should exclude.

Glossary

  • Anchor element: the HTML element <a> that creates a link, with its destination held in the href attribute.
  • Attribute: extra information attached to an HTML element, written inside the opening tag, such as href or class.
  • Attack surface: the total set of ways an attacker could try to reach and abuse a system.
  • Authentication: the process of proving who you are, usually by logging in.
  • Autonomous hunting workflow: a tool that runs a sequence of security checks by itself and decides the next step from what it finds, rather than a person choosing each action.
  • Benign request: a request with ordinary, harmless input, sent to record how a page normally behaves.
  • Bug bounty programme: a scheme where an organisation invites outside researchers to report security flaws and pays for valid ones.
  • Content Security Policy (CSP): rules a site sends to the browser stating which sources of code may run on the page.
  • Context: the exact place in a page where input lands, such as inside an attribute, between tags, or inside a script block, which determines what the input can do.
  • Cookie: a small piece of data a site asks the browser to store and send back with later requests, used to remember who you are.
  • Defence in depth: using several independent protections so that if one fails, another still stands.
  • Delimiter: the character marking where a value starts and stops, such as the quotes around an attribute value.
  • DOM (Document Object Model): the browser's live in-memory tree of page elements, built from the HTML and used for everything including running scripts.
  • Endpoint: a specific address on a server that performs one job.
  • Event handler: an attribute containing code the browser runs when something happens, such as onload when an element finishes loading.
  • Executable context: a place in a page where the browser will actually run code rather than merely display text.
  • Flag (cookie flag): an extra instruction attached to a cookie, such as HttpOnly or Secure.
  • Harness: the surrounding setup that drives an automated testing tool, launching browsers, sending requests and recording results.
  • Headless Chromium: the Chromium browser engine running without a visible window, loading pages and executing their code as a normal browser would.
  • HTML: the language describing what a web page contains, such as headings, links and images.
  • HTML encoding (HTML-entity encoding): replacing characters with special meaning in HTML, like < and >, with safe stand-ins so they are displayed rather than interpreted.
  • HTML injection sink: a place where outside input flows into a page's structure and can alter it.
  • href: the attribute of a link that holds its destination address.
  • HTTP 200: the status code meaning the request succeeded and the page was served.
  • HttpOnly: a cookie flag telling the browser never to let JavaScript read that cookie.
  • Inference: a conclusion drawn from evidence without directly testing that specific step.
  • IP address: the number identifying a device's location on a network.
  • Metacharacters: characters with special meaning in HTML, chiefly <, >, ' and ".
  • Minted (session): newly created, as in a fresh session obtained by logging in.
  • Origin: the combination of scheme, host and port, such as https://gtfcharge.com, used by browsers as the basic unit of trust.
  • Output encoding: transforming data so it cannot be mistaken for instructions in the place it is inserted.
  • Parameter: a piece of information passed to an endpoint, here the {token} inside the path.
  • Path: the part of a web address after the domain that identifies which endpoint is wanted.
  • Payload: the specific piece of code or input crafted to trigger a behaviour.
  • Portable bearer token: a credential that works for whoever presents it, regardless of where or by whom it was obtained.
  • Reflected XSS: cross-site scripting where the malicious input travels in the request and is returned in the response, rather than stored on the server.
  • Reflection: the server sending your input back to you in the page it returns.
  • Regular expression: a compact pattern describing which strings are allowed or matched.
  • Replay: presenting recorded authentication data again later, from somewhere else, to see whether the server accepts it.
  • Response headers: metadata lines a server sends before the page body, describing content type and security rules.
  • SameSite: a cookie flag controlling whether the cookie is sent when the request originates from another site.
  • Secure: a cookie flag restricting the cookie to encrypted HTTPS connections.
  • Session: the server-side record that you are logged in, referenced by a session cookie.
  • Session takeover: an attacker acting as the victim, viewing and doing what the victim can, for as long as the session lasts.
  • Set-Cookie: the response header a server uses to hand a cookie to the browser.
  • SVG: a format for drawing shapes on a web page, treated by browsers as part of the page.
  • Token: a short string standing in for something else, like a claim ticket, used here to identify a confirmation.
  • Triage: the first stage of a bug bounty programme, where a team checks whether a report is real, in scope and worth pursuing.
  • URL decoding: turning coded characters in a web address, such as %20 for a space, back into their raw form.
  • User-Agent: a line of text a browser sends with each request identifying itself, such as its name and operating system.
  • Web application: a program used through a browser, where a server sends pages the browser displays and runs.
  • XSS (cross-site scripting): getting attacker code to run inside someone else's site, in the victim's browser, with that site's privileges.

More by redhunter01

View all

24 more disclosed reports, best first.

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.