Skip to content

Instantly share code, notes, and snippets.

@theMiddleBlue
Created August 21, 2020 14:15
Show Gist options
  • Save theMiddleBlue/a098f37fbc08b47b2f2ddad8d1579b21 to your computer and use it in GitHub Desktop.
Save theMiddleBlue/a098f37fbc08b47b2f2ddad8d1579b21 to your computer and use it in GitHub Desktop.
XSS Vulnerable Web Application
<html>
<body>
<?php
function sanitize_username($username) {
return strtr(
htmlentities($username, ENT_QUOTES),
[';' => '']
);
}
?>
<a href="#!" onclick="javascript:myFunction('/profile/<?php echo sanitize_username($_GET["user"]) ?>')">Profile</a>
<script>
function myFunction(url) {
// do something...
location.href=url
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment