Created
April 7, 2020 15:03
-
-
Save chooper/e7633ac9d8f49477099f3adb54a61cb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!-- Demonstration of how a JavaScript redirect can be used as an XSS --> | |
<!-- For more more detail see https://subfn.net --> | |
<!-- Authored by Charles H ("subfn") <[email protected]> --> | |
<html> | |
<head> | |
<title>Testing JS redirect as XSS vector</title> | |
<script> | |
function goNext() { | |
current_url = new URL(window.location.href); | |
next_url = current_url.searchParams.get("next"); | |
console.log("Redirecting to " + next_url); | |
window.location.href = decodeURIComponent(next_url); | |
} | |
</script> | |
</head> | |
<body> | |
<p>Try <a href="?next=javascript:alert('xss')">redirect-to-xss.html?next=javascript:alert('xss')</a> and click the button</p> | |
<button onClick="goNext();">Go</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment