Welcome to Malware Analysis
A malware analyst answers one question: what does this suspicious program actually do? Answer it well and defenders can detect the threat, block it, and clean up after it.
How we study a sample, safely
We use static analysis: inspecting a file without ever running it. Tools
like strings, file and xxd read the raw bytes and surface clues such as
text, URLs, hostnames and error messages. Everything you need in this lab is
sitting in the files as text, so you never have to execute anything.
Rule number one: never run malware you do not fully understand, and never on your own machine. The few professionals who do need to watch a sample execute only ever do it inside dedicated, disposable, network-isolated sandboxes built for exactly that. We will not run anything here.
Why we chase network indicators
Most modern malware "phones home" to a Command and Control (C2) server to
receive orders or to exfiltrate stolen data. The address of that server, its
FQDN (Fully Qualified Domain Name, like api.ipify.org), is one of the most
useful Indicators of Compromise (IOCs) there is. Hand it to a firewall and
the malware is cut off from its operator.
A quick glossary you will use:
- FQDN: the complete hostname of a server, for example
cdn.badguy.net. - Port 80 / HTTP: ordinary, unencrypted web traffic.
- Port 443 / HTTPS: the same, wrapped in TLS encryption.
- Ingress / Egress: data coming in to a system / data going out of it.
Your toolbox
strings <file>prints the readable text hidden inside a binary. Authors often leave hostnames and URLs in plain sight. Pipe it togrepto filter, for examplestrings /shared/malware/file1 | grep -i http.curl <url>andwget <url>make web requests straight from the terminal.
The safe trick that makes this lab work
This environment has no real internet. So when you point curl or wget
at a hostname you pulled out of the malware, DNS cannot resolve it and you get
back something like:
curl: (6) Could not resolve host: cdn.badguy.net
That is not a failure. It is the proof that you found the real address the malware uses, and because nothing resolves, you never actually contact a live malicious server. You get the win and stay completely safe.
One warning: binaries sometimes split, pad or lightly scramble their text, so a hostname can show up broken across lines or mixed with junk. Look carefully and piece it back together.
Ready? Start by finding the plain HTTP server.