From e43a1147c1e84a9fe32b54fa66ca8cd867fd3ac4 Mon Sep 17 00:00:00 2001 From: HackTricks News Bot Date: Wed, 27 Aug 2025 06:35:05 +0000 Subject: [PATCH] Add content from: From "Low-Impact" RXSS to Credential Stealer: A JS-in-JS Wal... --- .../xss-cross-site-scripting/README.md | 60 +++++++++++++++++++ .../xss-cross-site-scripting/js-hoisting.md | 25 +++++++- 2 files changed, 82 insertions(+), 3 deletions(-) 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``