Last active
August 29, 2015 14:17
-
-
Save OddBloke/211ff98b63a8cfb3f6d4 to your computer and use it in GitHub Desktop.
CVE-2015-2296 Reproduction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bottle | |
requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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