Before opening Ghidra on a crackme, try running it under ltrace. Many beginner reversing challenges compare your input against the correct password with strcmp or memcmp — and ltrace prints both arguments of that call as it happens.
ltrace: library calls
$ ltrace ./crackme
puts("Enter the password:") = 20
fgets("hello\n", 64, 0x7f...) = 0x7ffc...
strcmp("hello", "s3cr3t_p4ss") = -11
puts("Wrong!") = 7
The second argument to strcmp is the password. ltrace hooks calls into shared libraries like libc, so it works on any dynamically linked binary. Useful flags:
-s 200— print strings up to 200 characters instead of truncating them-e strcmp+memcmp— only show the calls you care about-i— show the instruction pointer at each call, to find it later in a disassembler
strace: system calls
$ strace ./mystery
openat(AT_FDCWD, "/tmp/.hidden_key", O_RDONLY) = -1 ENOENT (No such file or directory)
write(1, "Key file missing\n", 17) = 17
strace shows every interaction between the program and the kernel: files opened, data read and written, network connections, child processes. It answers questions like "what file is it looking for?" or "where does it connect?" Add -f to follow child processes and -e trace=openat,read to filter.
When they don't work
- Statically linked binaries have no library calls to hook — ltrace shows nothing. strace still works.
- Inlined or custom comparisons (a loop comparing byte by byte) never call
strcmp. Time for a debugger. - Anti-debugging checks using
ptracemay detect strace and exit early; strace shows theptracecall, which tells you what to patch.
Where they fit
ltrace and strace are the quickest form of dynamic analysis: no setup, no breakpoints, just run and read. Use them first; if they don't reveal the answer, move to GDB for stepping through the code or Ghidra to read it. As always, only run untrusted challenge binaries in a VM or container.