Lion Cipher Lab
Watch what a program does without reading its code: files, network and child commands with strace and ltrace
- Foundations
- Beginner
- ~45 min
- Free · no account required
Why it matters
The fastest way to understand an unfamiliar program is often not to read it but to watch it. Whatever a program does that matters to the outside world, it must ask the operating system to do: open a file, make a network connection, start another program. Those requests are called system calls, and a tool that logs them gives you a factual list of the program's behaviour: which files it touched, who it talked to, what it ran. Analysts use exactly this to triage software they do not trust and cannot easily read, and automated analysis sandboxes build on the same idea. This lab teaches the…
What you'll learn
- explaining the difference between a system call and a library call
- running a program under strace and saving the trace to a file with -o
- filtering a trace to files, network or process calls with -e trace=
- following child processes with -f and finding the command a program ran
- reading a connect line to learn the address and port a program contacted
- using -s, -tt, -T and -c to see full strings, timing and a summary
- using ltrace for library calls and knowing when it shows nothing
- stating what a trace cannot tell you
Steps in this lab
- Two kinds of calls, and why watching them works
- Build the mystery program and its config file
- Trace everything and read one line
- Question 1: which files did it touch?
- Question 2: who did it try to talk to?
- Question 3: what other programs did it start?
- Time and summaries: -tt, -T and -c
- Library calls with ltrace, and the static-binary trap
- Check your three answers against the source
- Limits to remember: overhead, one tracer, static binaries
- When NOT to use this, and how a pro does it better
Open the full interactive lab →