Skip to content

Instantly share code, notes, and snippets.

@OddBloke
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OddBloke/211ff98b63a8cfb3f6d4 to your computer and use it in GitHub Desktop.
Save OddBloke/211ff98b63a8cfb3f6d4 to your computer and use it in GitHub Desktop.
CVE-2015-2296 Reproduction
#!/bin/bash
set -m
cleanup () {
jobs -p | xargs kill -INT
}
python source.py &
python target.py &
sleep 1
# Note that we get 127.0.0.1 but are redirected to localhost; we need
# different host names (not just different ports)
COOKIES=$(python -c "import requests; print requests.get('http://127.0.0.1:9001').content")
if [[ "$COOKIES" == *"super secret"* ]]; then
echo "TEST FAILED; FOUND COOKIE AFTER REDIRECT"
cleanup
exit 1
fi
echo "TEST PASSED"
trap 'cleanup' EXIT
from bottle import redirect, response, route, run
@route('/')
def index():
response.set_cookie('source_cookie', 'super secret')
redirect('http://localhost:9002/')
run(host='localhost', port=9001)
from bottle import request, route, run
@route('/')
def index():
return '\n'.join([
'{}: {}'.format(key, value)
for key, value in request.cookies.items()])
run(host='localhost', port=9002)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment