https://app.hackthebox.com/challenges/803

Description

I think my new kitchen is haunted - can you uncover what the ghosts want cooked?

Exploitation

#!/usr/bin/python3
from pwn import *
import string

r = process("./fryer")
inp = string.printable[:48]
r.sendlineafter(b"frying: ", inp.encode())
r.recvuntil(b'`')
scrambled = r.recvline().strip(b'`\n').decode()
r.recvuntil(b'`')
expected_output = r.recvline().strip(b'`\n').decode()
flag = []
for char in inp:
    index_in_scrambled = scrambled.index(char)
    flag.append(expected_output[index_in_scrambled])
print(''.join(flag))

Summary

Terrorfryer: reverse the validation logic, model the transform, and recover the accepted input.