Pairing Single Quotes
The application attempted to escape single quotes by appending another single quote, but failed to escape backslashes. An attacker could inject a backslash before the quote to break out of the script context and execute arbitrary JavaScript.
Published on respectxss.blogspot.com
NOTO PEDOFILOMOSESSUALE PAOLO BARRAI (BLOG MERCATO "MERDATO" LIBERO)! INDAGATO DA PROCURA DI LUGANO!
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 escaped single quotes by doubling them but did not escape backslashes, allowing an attacker to use a backslash to escape the added quote and break out of the string.
Impact
An attacker could execute arbitrary JavaScript in the victim's browser, potentially leading to session theft or other client-side attacks.
What the attacker needed
Reflected input in a script context; backslashes not escaped
The fix
The application should properly escape backslashes as well as quotes, or better, use context-aware output encoding instead of ad-hoc quote doubling.
How it was found
- Inject a harmless probe string containing a single quote to observe the reflection.
- Notice that the application appends an extra single quote after the injected one.
- Realise that backslash characters are not escaped or filtered.
- Send a payload starting with a backslash followed by a single quote to escape the added quote.
- Complete the payload to close the function call and execute a proof-of-concept JavaScript function.
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 tried to make user input safe by adding an extra quote mark next to any quote the user typed. But it forgot that a backslash can also change how quotes are read in JavaScript. By sending a backslash before the quote, the attacker tricked the site into creating a working script injection.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.