Created
January 27, 2016 06:49
-
-
Save jonasfj/80e26e48cd126f859a04 to your computer and use it in GitHub Desktop.
Example XSS
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
<b>Hi, <span id="name"></span>,</b><br> | |
Enter your deepest secret and I'll remeber it:<br> | |
<input type="text" id="secret"><button onClick="save()">Save</button> | |
<script> | |
// Load name from location.hash | |
document.getElementById("name").innerHTML = decodeURIComponent(window.location.hash); | |
// Load existing secret | |
document.getElementById("secret").value = (localStorage.secret || 42); | |
// Save secret | |
function save() { | |
localStorage.secret = document.getElementById("secret").value; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment