diff --git a/src/pentesting-web/xss-cross-site-scripting/README.md b/src/pentesting-web/xss-cross-site-scripting/README.md index 9c36bb96e..b173eb4af 100644 --- a/src/pentesting-web/xss-cross-site-scripting/README.md +++ b/src/pentesting-web/xss-cross-site-scripting/README.md @@ -543,6 +543,25 @@ If `<>` are being sanitised you can still **escape the string** where your input \';alert(document.domain)// ``` +#### JS-in-JS string break → inject → repair pattern + +When user input lands inside a quoted JavaScript string (e.g., server-side echo into an inline script), you can terminate the string, inject code, and repair the syntax to keep parsing valid. Generic skeleton: + +``` +" // end original string +; // safely terminate the statement + // attacker-controlled JS +; a = " // repair and resume expected string/statement +``` + +Example URL pattern when the vulnerable parameter is reflected into a JS string: + +``` +?param=test";;a=" +``` + +This executes attacker JS without needing to touch HTML context (pure JS-in-JS). Combine with blacklist bypasses below when filters block keywords. + ### Template literals \`\` In order to construct **strings** apart from single and double quotes JS also accepts **backticks** **` `` `** . This is known as template literals as they allow to **embedded JS expressions** using `${ ... }` syntax.\ @@ -571,6 +590,25 @@ loop``