Description
A stripped binary named ret hides a password in plain sight. Retrieve it via static inspection.
Setup
Download the ELF and examine it with strings or a disassembler.
Search for picoCTF inside the binary output.
wget https://artifacts.picoctf.net/c/270/retstrings ret | grep picoSolution
- Step 1Rely on stringsDespite the challenge name, the binary embeds the flag literally. strings ret provides the answer immediately.
Learn more
Static analysis examines a binary without executing it. The simplest static analysis tool is
strings, which extracts sequences of printable characters (minimum length 4 by default) from a binary file. Because C string literals are stored verbatim in the binary's.rodata(read-only data) section, any hard-coded passwords, URLs, error messages, or flags appear directly in thestringsoutput.A stripped binary has had its symbol table and debug information removed (via
stripor a compiler flag like-s). This hides function names, variable names, and source file information, making disassembly harder - but it does not affect string literals stored in the data section. That is whystringsstill works: the flag is a string constant that the linker places in.rodataregardless of whether the binary is stripped.For challenges where the flag is not stored as a plain string, the next steps are: Ghidra (free NSA tool) or IDA for disassembly and decompilation, and ltrace/strace or gdbfor dynamic analysis. The challenge name "reverse" is intentionally misleading here - recognizing when brute-force reversal is unnecessary and strings suffices is itself a skill.
The
stringscommand accepts a-nflag to set the minimum string length (default 4). Increasing this value, e.g.,strings -n 8 binary, filters out noise and focuses on longer strings that are more likely to be meaningful. You can also specify an encoding with-e:-e lfor 16-bit little-endian (common in Windows binaries) and-e bfor 16-bit big-endian. On PE (Windows) executables, thestringscommand from Sysinternals (strings.exe) handles Unicode strings natively.When
stringsdoesn't reveal a flag, the binary may be obfuscating it: XOR-encrypting the string constant and decoding it at runtime, building the string character-by-character on the stack, or deriving it from a hash. These techniques are common in malware to evade static string analysis. The appropriate counter-tool in that case is dynamic analysis: run the binary under gdb and set a breakpoint just before the comparison, then read the decoded value from memory.file and checksec are useful first commands on any unfamiliar binary.
file binaryreports the architecture, bitness (32 vs 64), and whether the binary is stripped.checksec --file=binarylists security mitigations in place: ASLR, stack canaries, NX (No-eXecute), PIE (position-independent executable), and RELRO. This triage determines the difficulty of any dynamic exploitation attempt even if, as in this challenge, no exploitation is required.
Flag
picoCTF{3lf_r...f62bc8}
No reversing tools beyond strings are required for this warm-up.