Tags: reverse-engineering 

Rating:

# One Bite

We're given a program that prompts us for the flag. Let's run `ltrace` on it to see what kind of comparisons it might be making.

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-ANGSTROM/images/one-bite-1.png)

It looks like it encodes our input one byte at a time, and then compares it to some sort of a string. As you can see, the beginning of the flag seemed to be encoded just fine, so it looks like these one-byte conversions are independent of other conversions. Let's see if these conversions are reversible by entering in some testing strings.

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-ANGSTROM/images/one-bite-2.png)

The mechanism that encodes our input byte-by-byte does seem to be reversible, meaning that a given input's output, when used as an input, will produce the output's input. Using this, let's go ahead and try to pass the string it makes a comparison to in order to see what the reverse of it is, which should logically be the flag.

![](https://raw.githubusercontent.com/shawnduong/ctf-writeups/master/2019-ANGSTROM/images/one-bite-3.png)

Original writeup (https://github.com/shawnduong/ctf-writeups/blob/master/2019-ANGSTROM/Rev/one-bite.md).