reverse_cipher
Problem
We have recovered a binary and a text file. Can you reverse the flag. Its also found in /problems/reverse-cipher_0_b784b7d0e499d532eba7269bfdf6a21d on the shell server.
Solution
cat rev_this
showspicoCTF{w1{1wq87g_9654g}
.Decompile the binary file using Ghidra (cheat sheet):
This is just a simple script that performs a few shifts on the characters of the flag. Characters 0-7 are left as is. Characters 8-22 alternate between adding 5 and subtracting 2, starting with adding 5.
local_14 & 1
does a bitwise AND between the current iteration number and 1. The if statement checks if this equals0
. It will equal0
every other iteration because& 1
checks if the last bit is 0 or 1 and returns 1 if the last bit is 1, and otherwise returns 0. Finally, the last character (the 23rd one) is added on to the file as is.Run the script.py to reverse this logic and get the flag.
Flag
picoCTF{r3v3rs39ba4806b}
Last updated