Description
Can you handle APKs? Download the android apk here.
Setup
Download mobpsycho.apk and unzip it in a separate directory (APK unzip dumps lots of files).
Use strings/grep to hunt for "flag" within res/.
wget https://artifacts.picoctf.net/c_titan/53/mobpsycho.apk && \
mkdir mobpsycho_dir && cd mobpsycho_dir && \
unzip ../mobpsycho.apkSolution
Walk me through itxxd -r -p reverse-hex pattern at the heart of this solve, plus the recognition cues for hex-encoded strings hidden inside other formats.- Step 1Find the flag fileRecursively scan extracted files with find and strings, scoped to res/ for speed. The flag lives at res/color/flag.txt.bash
find res -type f -exec strings {} + | grep flagbashfind . -type f -name 'flag*'Learn more
An APK (Android Package Kit) is simply a ZIP archive containing everything an Android app needs: compiled Dalvik bytecode (
classes.dex), resources, assets, a manifest, and native libraries. Because it is a standard ZIP, any tool that can unzip an archive can explore its contents without needing a real Android device.find ... -exec strings {} +appliesstringsto every regular file under the path and pipes the union intogrep. It's the safer alternative to a top-levelstrings *: that glob skips dotfiles, expands at most one level, and chokes on directories. Scoping tores/avoids dumpingclasses.dexthroughstringsjust to look for a filename you already suspect lives in resources.- The
res/directory holds Android XML resources, drawables, and raw files, a common hiding spot for CTF secrets. - The
assets/directory is another frequent location for embedded files that are not compiled into the DEX. - For deeper analysis, tools like jadx or apktool decompile DEX bytecode back to readable Java/Smali.
- The
- Step 2Decode the hexflag.txt contains hex; pipe it through xxd -r -p (or CyberChef's From Hex) to recover the ASCII flag.bash
xxd -r -p res/color/flag.txtLearn more
Hiding data as hexadecimal is a simple obfuscation technique: each byte of the original string is represented as two hex digits (e.g., the letter 'p' becomes
70). The value is human-unreadable at a glance but trivially reversible.xxd -r -preverses a plain hex dump back to binary. The-rflag means "reverse" (hex to binary) and-pmeans the input is in plain/continuous hex format without address offsets. This combination is the standard Linux one-liner for hex decoding.CyberChef's From Hex recipe performs the same operation visually, making it useful when you want to see intermediate steps or chain multiple decodings (e.g., hex then base64 then ROT13). Real malware samples often layer encodings precisely to slow down analysts.
The decoded output is pure ASCII printable text from
pthrough}: that's the entire flag, copy it as-is. If you see\0or other null bytes inside the output, that's a sign the input hex had odd-length bytes, stray spaces, or trailing whitespace thatxxd -r -pmishandled, not part of the flag itself.
Flag
picoCTF{ax8mC0RU6ve_NX85l4ax8mCl_a3e...}
The decoded hex string inside res/color/flag.txt is the flag.