Description
Can you reverse a series of Linux text transformations to recover the original flag?
Setup
Launch the challenge instance and connect.
You'll be given an obfuscated string and a description of the transformations applied to it.
Solution
Walk me through it- Step 1Identify the transformationsInspect the obfuscated string and pattern-match the format. Length, character set, and structure tell you which transformation produced it.
Learn more
Rules of thumb for identification:
- Base64: charset
A-Za-z0-9+/, length is a multiple of 4 (zero or one or two trailing=chars to pad). If you see=at the end, it's almost certainly base64. - Hex: charset
0-9a-f(or all uppercase), even length, no other characters.706963is hex;cGljis base64. - Charcode array: literally a bracketed list of integers, e.g.
[112,105,99,111]. Looks like data, not text. - ROT13 / Caesar: same length as the original, only letters affected, looks like garbled English.
- Reversed (
rev): same length, recognizable words run backwards (FTCocip). - Binary (0/1 chars): only
0and1, length divisible by 8 (or 7 for ASCII without parity).
Ambiguity: base64 vs hex. A short string like
cafeis both valid hex and valid base64. The trick: try both decoders and gate on whether the output is printable ASCII / starts with a known plaintext prefix likepicoCTF{. Whichever produces a readable result is the right one.See the CTF Encodings guide for the full identification ladder and CyberChef recipes.
- Base64: charset
- Step 2Reverse the transformations in orderApply each transformation's inverse in *exactly* the opposite order. If the encoder was
flag | A | B | C, the decoder isencoded | C_inv | B_inv | A_inv.bash# Example pipeline reversal:bash# Encoded as: base64 -> rev -> tr 'a-z' 'A-Z'bash# Reverse : tr 'A-Z' 'a-z' -> rev -> base64 -dbashecho 'OBFUSCATED_STRING' | tr 'A-Z' 'a-z' | rev | base64 -dbashbash# Individual reversals:bashecho 'STRING' | revbashecho 'STRING' | base64 -dbashecho 'STRING' | xxd -r -p # -r = reverse mode (hex->bin), -p = plain hex (no addrs/ASCII)bashecho 'STRING' | tr 'A-Za-z' 'N-ZA-Mn-za-m' # ROT13 (self-inverse)Learn more
Worked example: wrong order produces garbage. Suppose the flag is
picoCTF{hi}and the encoder isbase64 | rev. Encoding:$ echo -n 'picoCTF{hi}' | base64 cGljb0NURntoaX0= $ echo -n 'cGljb0NURntoaX0=' | rev =0Xahotn{RUNc0bjlGcRight order (
revthenbase64 -d):$ echo -n '=0Xahotn{RUNc0bjlGc' | rev | base64 -d picoCTF{hi}Wrong order (
base64 -dfirst):$ echo -n '=0Xahotn{RUNc0bjlGc' | base64 -d base64: invalid input # the leading '=' breaks the decoder outrightxxd -r -pflags inline.-r= reverse (hex back to binary).-p= plain hex: no offset addresses, no ASCII column, just contiguous hex digits. Without-p,xxdexpects its own dump format with offsets and gutter columns, and a clean hex string will fail to parse.See the CTF Encodings guide for the full inverse table and a CyberChef workflow for stacking these in a UI.
- Step 3Read the flagAfter applying all inverse transformations, the result should start with
picoCTF{...}.
Flag
picoCTF{und0_th3_tr4nsf0rm_...}
Apply each transformation in reverse order - common Linux text tools like rev, tr, base64, and xxd are involved.