A suspicious file lands in the SOC’s queue. It came as an attachment to a finance employee, an endpoint agent quarantined it, and nobody yet knows what it does. The organisation needs answers to practical questions: is it malicious, what would it have done, what should we search for elsewhere? Malware analysis is how those answers are produced, and it comes in two broad styles that are almost always used together.

Static analysis examines the file without executing it. Dynamic analysis runs it in a controlled environment and records what it does. A widely used textbook, Practical Malware Analysis by Michael Sikorski and Andrew Honig, splits each into basic and advanced levels, which is a helpful way to think about effort.

Basic static analysis: reading the label on the box

The first minutes are spent on cheap, safe checks.

Hashes. Compute the SHA-256 and look it up in threat intelligence and multi-engine scanning services. If it is already known, much of the work may be done. Be careful about uploading files to public services: a document might contain the organisation’s own confidential data, and uploading tells the world, possibly including the attacker, that you have found it. Searching by hash avoids both problems.

True file type. The extension can lie; the first bytes of the file usually do not. A file named as a PDF that begins with the “MZ” signature is a Windows executable. A document that is actually an archive containing scripts tells its own story.

Strings. Extracting readable text from the binary can reveal URLs, IP addresses, file paths, registry locations, error messages, and occasionally the author’s own debug notes. Their absence is informative too.

Imports and structure. A Windows executable lists the system functions it intends to call. A program importing functions to allocate memory in other processes and create threads inside them hints at process injection. Imports for cryptography and file enumeration together hint at ransomware. These are clues, not verdicts; legitimate software uses the same functions.

Packing. Many malware samples are packed: the real code is compressed or encrypted inside a small stub that unpacks it at run time. Signs include very few readable strings, very few imports, and sections with high entropy. Entropy measures randomness on a scale up to 8 bits per byte; compressed or encrypted data sits close to 8, whereas ordinary code is noticeably lower. Packing is not proof of malice, since some commercial software is packed to protect intellectual property, but it explains why static analysis may show little.

Basic dynamic analysis: letting it run in a cage

When static analysis runs out, the analyst executes the sample inside an isolated virtual machine and watches. The environment matters more than the tools:

  • The VM has no route to the corporate network, and a snapshot is taken so it can be reset afterwards.
  • Internet access is either cut, routed through a controlled gateway, or simulated by tools that answer DNS and web requests with fake responses so the malware reveals what it tries to contact.
  • Monitoring captures process creation, file writes, registry changes and network traffic.

In our finance attachment example, the run might show the document launching a scripting engine, which downloads a file to a temporary folder, runs it, and creates a scheduled task. The new process then tries to resolve two domains and send small HTTPS requests every 60 seconds. In ten minutes of observation, the analyst has persistence details, network indicators and a behaviour chain that can be turned into detections.

Automated sandboxes perform this step at scale, which is why email gateways can “detonate” attachments before delivery. But automated runs are short and generic, and malware increasingly checks whether it is in a sandbox before misbehaving.

The advanced levels

Advanced static analysis means reverse engineering: loading the program into a disassembler or decompiler such as Ghidra (released free by the US NSA in 2019) or IDA, and reading the logic. This is how analysts extract a ransomware family’s encryption scheme, decode configuration data like a hidden list of command servers, or find a kill switch.

Advanced dynamic analysis means running the sample under a debugger, pausing at chosen points and inspecting memory. A common use is letting a packed sample unpack itself in memory, then saving the unpacked code for static analysis. The two styles feed each other continuously.

Comparing the two

StaticDynamic
SafetyVery safe; nothing executesNeeds careful isolation
CoverageCan see code paths that never ranSees only what happened in that run
Defeated byPacking, obfuscationSandbox detection, time delays, missing triggers
Speed for a first answerFast for known samplesFast for behaviour and indicators
DepthReverse engineering can reveal everything, slowlyDebugging reveals runtime secrets

Knowing when to stop

Most SOCs do not need to fully reverse every sample. The goal is usually operational: enough understanding to contain the incident, find other infected machines and write detections. A reasonable rule is to go only as deep as the next decision requires. If basic dynamic analysis already shows the domains to block and the persistence to remove, deeper work can wait unless the sample is new, targeted or likely to recur. Deep analysis is reserved for novel families, targeted attacks and cases where the full capability matters, such as confirming whether data theft code was present.

Whatever the depth, good analysis ends in outputs others can use: hashes, network indicators, behavioural descriptions mapped to ATT&CK techniques, and a plain-language summary of impact for the people making decisions.

Written by the RP Strativa Team. The sample behaviour described is illustrative.

Leave a Reply

Trending