Skip to content

Instantly share code, notes, and snippets.

@jwalsh
Created March 26, 2012 21:26
Show Gist options
  • Save jwalsh/2209849 to your computer and use it in GitHub Desktop.
Save jwalsh/2209849 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Script injection</title>
<script>
var script = document.createElement('script');
script.innerHTML = 'alert(1)';
// No dependency management
var loader = document.getElementsByTagName('script')[0];
loader.appendChild(script);
</script>
</head>
<body>
Expect: Should alert "1"
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment