Skip to content

Instantly share code, notes, and snippets.

@DeviaVir
Created August 27, 2012 20:52
Show Gist options
  • Save DeviaVir/3492109 to your computer and use it in GitHub Desktop.
Save DeviaVir/3492109 to your computer and use it in GitHub Desktop.
Level 7
#!/usr/bin/env python
# first, download the code from http://www.vnsecurity.net/2010/03/codegate_challenge15_sha1_padding_attack/
import json
import sys
import urllib
import requests
import hashlib
from shaext import shaext
orig_msg = 'count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo'
orig_sig = 'dfc3883e2fe62c923b3fe820f42c8207d1edd853'
keylen = 14
add_msg = '&waffle=liege'
ext = shaext(orig_msg, keylen, orig_sig)
ext.add(add_msg)
(new_msg, new_sig) = ext.final()
print "new msg: " + repr(new_msg)
print "new sig: " + new_sig
query = new_msg + '|sig:' + new_sig
print '\n' + repr(query)
resp = requests.post('https://level07-2.stripe-ctf.com/user-rvkvykcmms/orders', data=query)
print resp
print resp.text
@devongovett
Copy link

Here's the output I got:

new msg: 'count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02(&waffle=liege'
new sig: 490cae06944662c2817c91eed297c7e682092302

'count=10&lat=37.351&user_id=1&long=-119.827&waffle=eggo\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02(&waffle=liege|sig:490cae06944662c2817c91eed297c7e682092302'
<Response [200]>
{"confirm_code": "JYrdMNuLzQ", "message": "Great news: 10 liege waffles will soon be flying your way!", "success": true}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment