Skip to content

Instantly share code, notes, and snippets.

@LIQRGV
Created January 29, 2021 16:10
Show Gist options
  • Save LIQRGV/374b880012d1d84b8703d6339d44f78b to your computer and use it in GitHub Desktop.
Save LIQRGV/374b880012d1d84b8703d6339d44f78b to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
</head>
<body>
<div id="target"></div>
<script>
const malPayload = "<script>alert('1337')<\/script>";
// current code
//const childNode = "<div>Payload: " + malPayload + "<\/div>";
//$('#target').html(childNode);
//proposed code
const childNode = document.createElement('div');
childNode.innerText = "<div>Payload: " + malPayload + "<\/div>";
document.querySelector('#target').appendChild(childNode);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment