Skip to content
XSS Write-up Intermediate

RXSS in uncalled function

A reflected cross-site scripting injection landed inside a JavaScript function, so a simple payload did not execute because the surrounding script was left syntactically broken. By closing the function and adding a dummy function declaration to balance the remaining brace, the attacker made the script valid and the alert fired.

medium.com

Published on medium.com

Ever hit injection but XSS won’t just trigger ? That’s exactly the case I’m about to talk about.

Sevada797, 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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application reflected user input into a JavaScript context without proper encoding, and the injected code only executed once the surrounding script syntax was made valid.

Impact

An attacker could execute arbitrary JavaScript in a victim's browser, though a WAF blocked the simpler script-tag breakout approach.

What the attacker needed

Reflected input in a JS context; WAF present but bypassable via logic

How it was found

  1. Find a reflected injection point inside a JavaScript function.
  2. Try a simple quote-based payload and observe it does not fire.
  3. Attempt to break out of the script tag but be blocked by a WAF.
  4. Close the function with a brace and add a dummy function to balance the trailing brace.
  5. Observe the alert firing once the script is syntactically valid.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A website took text from the URL and pasted it into a piece of JavaScript code on the page. If an attacker can make that pasted text run as code, they can execute their own script in a victim's browser, which is called cross-site scripting. Here the pasted text sat inside a function, so the attacker had to close the function and keep the rest of the script valid before their code would run.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

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.