Real Interview Questions for the Malware Analyst at Kaspersky
NewInterview Q&A
Q&A-1Walk me through your workflow when you receive a completely unknown Windows sample?
The 90-second answer
I treat an unknown sample as untrusted code and as evidence. I never open it on a workstation, I never submit it to a public scanner first, and I record hashes and provenance before I run anything. Then I move in layers: static triage to decide how dangerous it looks, dynamic execution in an isolated lab to see what it actually does, and network capture to see what it tries to reach. Each layer can stop the work. If static analysis shows a known packer and no imports, I unpack before I judge behaviour. If dynamic analysis shows nothing, I assume evasion and change the environment instead of concluding it is benign.
Intake and containment
I hash the file with SHA-256 and MD5, record file size, source, submission time and chain of custody, and store it in a password-protected zip on an isolated analysis share. I check the hashes against internal telemetry and Kaspersky Threat Intelligence Portal before detonation. A hit does not end the work. It tells me whether this is a known family, a variant, or a genuinely new sample, and it gives me prior reports to compare against. A miss is the interesting case.
# Python 3.11, run on the analysis host, not a workstation
import hashlib, pathlib
p = pathlib.Path("sample.bin")
data = p.read_bytes()
print("size", len(data))
print("md5", hashlib.md5(data).hexdigest())
print("sha256", hashlib.sha256(data).hexdigest())
print("magic", data[:2]) # b'MZ' for a PE, b'PK' for a zip containerStatic triage
I inspect PE headers, sections, imports, resources and embedded strings with tools such as PE-bear, Detect It Easy and FLOSS for decoded strings. I look for a small import table, high entropy in .text, a UPX or Themida signature, and suspicious APIs such as VirtualAlloc, WriteProcessMemory, CreateRemoteThread, CryptEncrypt and registry run keys. I also check the Rich header, compile timestamp and version info, because a mismatch between claimed signer and actual code is a useful signal. I do not trust strings alone. Malware routinely plants decoy strings, and FLOSS output still needs a human to separate config from noise.
| Stage | What I record | Decision it drives |
|---|---|---|
| Hash and lookup | SHA-256, MD5, size, first seen | Known family, variant, or new |
| Static triage | Imports, entropy, packer, strings | Unpack first, or detonate as is |
| Dynamic run | Process tree, file and registry changes, API calls | Behavioural verdict |
| Network capture | DNS, HTTP, TLS SNI, C2 config | IOCs and infrastructure |
| Detection | YARA rule, Sigma logic, config parser | What we can hunt for at scale |
Dynamic run
I detonate in a Windows 10 or 11 VM with no route to production, snapshots taken before execution, and a fake network such as INetSim or a controlled proxy that logs DNS and HTTP without letting real C2 traffic out. I run for 5 to 10 minutes, which is long enough for most droppers and short enough to keep throughput. I watch process creation, persistence, credential access, lateral movement attempts and encryption behaviour with ProcMon, Process Explorer and Wireshark. If the sample sleeps, checks for a mouse, a recent document, a domain, or a sandbox artefact, I see a quiet run and I change one variable at a time: add user activity, add a document, supply a config, or patch the sleep call in a debugger. A quiet run is a result about the environment, not proof of safety.
Detection and handoff
From a confirmed run I extract IOCs that survive recompilation: C2 domains and IPs, mutex names, file paths, registry keys, user agents and the decrypted config. I write a YARA rule against the config structure or decoded strings rather than a single string, and I test it against a small corpus of known benign and malicious files to check for false positives. I then write the report the way a threat researcher would: what it is, how it gets in, what it does, how it persists, what it steals or encrypts, and what telemetry would catch the next one. If the sample is new, I escalate it for reverse engineering in Ghidra or IDA and for inclusion in detection pipelines, with the hashes and the rule attached so another analyst can reproduce the run from the snapshot.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-2Explain the PE file format and which structures matter most for malware analysis?
The 90-second answer
A PE file is a Windows executable built in layers. The loader reads the DOS header, follows e_lfanew to the NT headers, then uses the COFF header and optional header to map sections into memory and start execution at AddressOfEntryPoint. For malware analysis I care about the structures that control that process: the optional header, the section table, the import and export directories, TLS callbacks, and resources. Those tell me what the file claims to be, what it imports, when code runs, and whether it has been packed or tampered with.
Layout and parsing order
The DOS header is 64 bytes. e_magic is 0x5A4D ('MZ') and e_lfanew at offset 0x3C is the file offset of the NT headers. The NT headers start with the signature PE\0\0 (0x00004550), followed by the COFF header (20 bytes) and the optional header. The COFF header gives Machine (0x14C for x86, 0x8664 for x64, 0xAA64 for ARM64), NumberOfSections, TimeDateStamp, Characteristics, and SizeOfOptionalHeader. The optional header magic distinguishes PE32 (0x10B) from PE32+ (0x20B). It holds AddressOfEntryPoint, ImageBase, SectionAlignment, FileAlignment, SizeOfImage, Subsystem (2 = GUI, 3 = console), and the data directories.
Sections follow the optional header. Each entry is 40 bytes: Name, VirtualSize, VirtualAddress, SizeOfRawData, PointerToRawData, and Characteristics. The loader maps each section at ImageBase + VirtualAddress, copies SizeOfRawData bytes, and zero-fills up to VirtualSize if that is larger. SizeOfHeaders and FileAlignment (commonly 0x200) control header padding.
Structures that matter most, and why
| Structure | What to check | Malware signal |
|---|---|---|
| Optional header | Entry point, ImageBase, subsystem, DllCharacteristics (ASLR, NX, CFG) | Entry point outside .text, NX disabled, no ASLR in a modern sample |
| Section table | Names, raw vs virtual size, entropy, permissions | RWX section, high entropy (7.5+), SizeOfRawData = 0, mismatched names, extra sections |
| Import directory | Imported DLLs and functions, IAT, delay imports | VirtualAlloc, WriteProcessMemory, CreateRemoteThread, WinExec, URLDownloadToFileA, CryptEncrypt, ordinal-only imports |
| Export directory | Exported names and ordinals | Few exports in a DLL, forwarded exports, exports pointing outside code sections |
| TLS directory | AddressOfCallBacks | Callbacks run before the entry point, a common place to hide unpacking code |
| Resource directory | Icons, dialogs, version info, embedded payloads | Large RT_RCDATA blob, mismatched version info, embedded PE or script in resources |
| Debug directory | CodeView PDB path | Leaked build path, username, or PDB GUID that links samples |
| Certificate and overlay | Authenticode table, data after last section | Invalid signature, appended ZIP, config, or second-stage payload |
Imports deserve a close read. A benign installer imports a broad set of Win32 APIs. A loader often imports a small set and resolves the rest at runtime with LoadLibrary and GetProcAddress, or hashes API names. That pattern shows up as a tiny import table plus dynamic resolution strings in .rdata. Delay-load imports can hide the same thing in a separate directory, so I check both the normal import directory and the delay-load directory.
Section anomalies are the fastest triage. Packed or encrypted code usually sits in a section with high entropy and execute permission. UPX leaves UPX0 and UPX1 names and a tiny import table. A section whose VirtualSize is much larger than SizeOfRawData can hide code that only appears in memory. A section marked writable and executable (0xE0000020 style flags combined) is worth dumping after unpacking rather than trusting the on-disk bytes.
A quick check in Python
import pefile # pip install pefile, checked against Python 3.12
pe = pefile.PE('sample.exe')
print(hex(pe.FILE_HEADER.Machine), pe.FILE_HEADER.NumberOfSections)
print('entry RVA:', hex(pe.OPTIONAL_HEADER.AddressOfEntryPoint))
print('image base:', hex(pe.OPTIONAL_HEADER.ImageBase))
for s in pe.sections:
name = s.Name.rstrip(b'\x00').decode(errors='replace')
print(name, hex(s.VirtualAddress), hex(s.Misc_VirtualSize),
hex(s.SizeOfRawData), hex(s.Characteristics))
for entry in pe.DIRECTORY_ENTRY_IMPORT:
print(entry.dll.decode())
for imp in entry.imports[:5]:
print(' ', imp.name)
if hasattr(pe, 'DIRECTORY_ENTRY_TLS'):
print('TLS callbacks:', pe.DIRECTORY_ENTRY_TLS.struct.AddressOfCallBacks)That output gives me the entry point location, section permissions, and import surface in seconds. I then compare the entry point RVA against the section ranges. If it falls in .rsrc or in a section with no execute flag on disk, the file is likely packed or the header was edited.
Failure modes and limits
Headers lie. A packer can rebuild imports, fix the entry point, and add a fake Rich header and timestamp. TimeDateStamp is trivial to forge, so I treat it as a clustering hint only when it matches across samples, never as proof of build time. Section names are also easy to copy from a benign binary. Entropy and permission checks help, but encrypted code with a custom stub can look like a legitimate section.
The other limit is that static parsing stops at obfuscation. Import hashing, TLS callbacks, and resource-embedded payloads all point to code that only becomes visible at runtime. At that point I move to a sandbox or debugger, dump the unpacked image from memory, and re-parse the dump. The dumped file usually has a clean import table and a section layout that matches what the loader actually mapped.
In short: parse from e_lfanew outward, trust the section table and directories more than names or timestamps, and treat any mismatch between on-disk layout and in-memory layout as the place to dig next.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-3How comfortable are you reading x86/x64 assembly, and what patterns do you look for?
The 90-second answer
Very comfortable, daily in IDA Pro and Ghidra, and I read x64 far more than 32-bit now. I do not read linearly. I start at the entry point and imports, find the main logic, then work backwards from the interesting calls. In a live sample I will rename functions and variables as I go, because an unnamed binary with 4,000 functions is unreadable after an hour.
The patterns I look for fall into a few buckets: how a function is built, how it talks to Windows, and how it tries to hide itself.
Function shape and calling conventions
On x64 Windows the first four integer arguments arrive in RCX, RDX, R8, R9, the stack holds the rest, and the return value comes back in RAX. A typical prologue looks like this:
; x64, Windows 11, IDA syntax. Checked against MS x64 calling convention.
sub rsp, 28h ; shadow space (20h) plus alignment
mov [rsp+20h], rbx ; save non-volatile register
call sub_1400012A0 ; RCX, RDX, R8, R9 already set by caller
test eax, eax
jz loc_failThat tells me the function follows the standard convention, preserves RBX, and checks the return value. On x86 I care more: cdecl leaves cleanup to the caller and is common for CRT code, stdcall cleans up itself and shows up in WinAPI declarations, fastcall passes the first two arguments in ECX and EDX. A mismatch between the prototype I infer and the cleanup I see is a quick way to spot a misidentified function.
How it talks to Windows
| Pattern | Instruction sequence | What it usually means |
|---|---|---|
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| --- | --- | --- |
| Import call | call cs:VirtualAlloc or call ds:CreateRemoteThread | Direct API use, check the IAT first |
| Dynamic resolution | GetProcAddress with a hashed or decoded name | Import hiding, resolve the hash in a debugger |
| Syscall stub | mov r10, rcx then syscall | Direct syscall, bypasses user-mode hooks |
| String loop | xor / add / rol over a byte buffer, then a call | Decryption or deobfuscation, dump the output buffer |
| Anti-debug check | mov rax, gs:[60h] then read PEB fields | PEB access, BeingDebugged or NtGlobalFlag check |
Dynamic resolution is the one I spend most time on. Malware rarely imports VirtualAllocEx and WriteProcessMemory by name in a packed sample. It walks the PEB to find kernel32.dll, parses its export table, and compares a hash of each export name against a constant in the code. Once I see a loop with ror or add accumulating a hash and a compare against an immediate, I stop reading the loop and go straight to the constant. I will compute the hash offline or break on the comparison in a VM and let the sample tell me which API it wanted.
Hiding and execution tricks
I look for a small decryptor stub at the start of a section, often a tight loop over a large blob with a single-byte XOR key or a rolling key derived from the loop counter. That blob is usually the real code or a config. I also watch for control flow that does not make sense at a glance: opaque predicates, junk instructions between real ones, and indirect jumps through a register that was loaded from a table. Those are signs of virtualisation or a control-flow flattening pass, and static reading gets expensive fast. At that point I switch to dynamic analysis and trace execution instead of trying to recover the original graph.
Process injection has a recognisable shape even when obfuscated: allocate memory in another process, write to it, create a thread or queue work to run it. The API names change, the order does not. The same applies to persistence, which usually ends in a registry write, a scheduled task, or a service creation call.
Where I get stuck and what I do about it
Virtualised code, where the original instructions are translated into a custom bytecode handled by a dispatcher loop, defeats pattern matching. I treat the dispatcher as a black box, trace what it does to memory and APIs, and recover behaviour rather than code. Self-modifying code has the opposite problem: the bytes I disassemble at rest are not the bytes that run. I set a breakpoint after the modification and re-disassemble from there.
I also keep a short list of things I verify dynamically because assembly alone misleads: decrypted strings, resolved API hashes, and any config pulled from the network. If the static reading and the runtime trace disagree, I trust the trace and note where the sample branched on an environment check. That disagreement is often the anti-analysis logic itself, and it tells me what the sample expected to find on a real machine.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-4What are YARA rules and how do you write a good one?
The 90-second answer
YARA is a pattern-matching engine for files and processes. A rule names a set of strings, hex patterns or regular expressions, then a condition that combines them. The engine scans a sample and reports every rule whose condition holds. It does not execute the sample and it does not understand behaviour. It answers one question: does this byte stream contain the artefacts I described?
A good rule is specific enough to survive a corpus of benign files, loose enough to survive recompilation and minor variants, and cheap enough to run across a feed. I write it from a cluster of related samples, test it against near neighbours and clean files, and keep the strings that separate the family from everything else.
Anatomy, with a worked example
rule Cobalt_Strike_Beacon_v4 {
meta:
family = "Cobalt Strike"
campaign = "beacon config"
confidence = "high"
created = "2026-01-14"
strings:
$cfg_magic = { 69 68 63 6b 65 65 6e } // "hckeen" fragment in config block
$sleep = "sleep" ascii wide nocase
$mutex = /MSWinZonesCacheCounterMutex[A-Z]/
$url = /https?:\/\/[a-z0-9.-]+\/[a-z]{4,8}/i
condition:
filesize < 5MB and
pe.number_of_signatures == 0 and
2 of ($cfg_magic, $mutex, $url) and
$sleep
}Three choices in that rule matter. The hex pattern anchors on a config structure that changes less often than a domain. The regex for the mutex tolerates the randomised suffix. The condition requires a combination, so a single common string such as sleep cannot fire the rule alone. pe.number_of_signatures == 0 is a cheap filter that drops signed installers before the expensive strings are evaluated.
Modifiers do real work. ascii and wide control UTF-16LE copies, which Windows APIs often leave in a binary. nocase helps with config keys. fullword stops sleep matching inside sleepy. xor and base64 modifiers exist for encoded strings, and I use them sparingly because they multiply scan cost and false hits.
How I validate it
I run every draft against four sets: the family cluster, close variants from other families, a benign corpus from clean Windows installs and common updaters, and a large feed sample for timing.
| Test set | Expected result | What a failure tells me |
|---|---|---|
| --- | --- | --- |
| 12 Cobalt Strike beacon samples, 3 builds | 12 hits | A string tied to one build. Loosen or drop it. |
| 20 samples from other loaders and RATs | 0 hits | A string shared across tooling. Require a second artefact. |
| 500 clean files from System32 and vendor installers | 0 hits | Overbroad regex or a common API name. Add fullword or a condition. |
| 10,000 feed files, median scan | under 50 ms per file | A regex with nested quantifiers or a xor string over a huge range. |
That last row is where many rules die in production. A rule that takes 2 seconds per file will be disabled by the scanning team, however accurate it is in the lab.
Failure modes I watch for
Packers and crypters break string rules. UPX-packed and VMProtect-packed samples hide the strings I extracted from an unpacked dump, so I either unpack first and scan the dump, or I write a separate rule for the packer stub and accept that it will be broader. String encryption in the malware itself has the same effect. In that case I pivot to structural features: PE imports, section entropy, pe.imphash() ranges, or a config block located by a hex pattern with wildcards.
Hash-only rules fail on every recompile. I keep hashes in a separate private rule for a single campaign where I need exact matching, and I never ship them as the main detection.
Overfitting to one sample is the most common mistake I see. A rule built from a single file will contain its compile timestamp, its PDB path and its unique mutex. Those strings look perfect on that file and useless on the next build. I require at least three samples from different builds before I promote a rule from private to shared.
Rule maintenance matters as much as rule writing. I add meta fields for family, first seen date and author, I keep rules in version control, and I re-run the benign corpus monthly. When a string starts appearing in a new legitimate product, the rule gets narrowed or retired. A YARA set that nobody curates becomes a false positive generator within a year.
For a Kaspersky-style workflow, I would also split the set by use. Private rules for hunting in a sandbox feed can be aggressive. Rules pushed to endpoint products need the stricter validation above, because a false positive there blocks a customer file. Same engine, different bar for promotion.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-5How do you detect and defeat packing and obfuscation?
The 90-second answer
I separate detection from unpacking. Detection is static triage: does the file hide its real code and imports? Unpacking is dynamic: let the stub decrypt itself in a VM, stop it when control reaches the original entry point, then dump and rebuild the image.
Static signals I check first with DIE, PEStudio or pefile: a section with entropy above 7.2, a raw size much larger than virtual size or the reverse, an entry point outside .text, only a handful of imports such as LoadLibrary and GetProcAddress, section names left as UPX0, .packed or random strings, and a large overlay. None of those alone proves packing. UPX compressed files, installers and .NET assemblies can trip one or two. Three together, especially high entropy plus a tiny import table, is enough to move to dynamic analysis.
Worked trace
A sample I handled last year, hypothetical figures but the pattern is typical:
| Section | Virtual size | Raw size | Entropy | Reading |
|---|---|---|---|---|
.text | 0x1000 | 0x200 | 7.41 | Stub code, mostly decrypt loop |
.data | 0x3000 | 0x3000 | 7.85 | Encrypted payload |
.rsrc | 0x800 | 0x800 | 4.10 | Normal resources |
| Imports | 11 functions | VirtualAlloc, LoadLibraryA, GetProcAddress only |
That combination says the real imports and code are not on disk. FLOSS and capa help here. FLOSS recovers stack strings the stub decodes at runtime, capa flags capabilities such as encrypt data using XOR or resolve API by hashing even when the import table is empty.
Defeating it dynamically
In x64dbg or IDA I set breakpoints on the APIs a stub must use: VirtualAlloc, VirtualProtect, WriteProcessMemory, LoadLibrary, and on the loop that writes to a new section. I also watch for a jump or call into a freshly allocated region. That transition is usually the original entry point, the OEP. I break there, dump the process with Scylla or Volatility malfind, fix the import address table against the dumped image, then load the dump in Ghidra or IDA as a fresh binary.
# Python 3.11, pefile 2024.8.26
import pefile, math
def entropy(data: bytes) -> float:
if not data:
return 0.0
counts = [data.count(bytes([b])) for b in range(256)]
return -sum((c/len(data)) * math.log2(c/len(data)) for c in counts if c)
pe = pefile.PE("sample.exe")
for s in pe.sections:
name = s.Name.rstrip(b"\x00").decode(errors="replace")
print(name, round(entropy(s.get_data()), 2), hex(s.Misc_VirtualSize), hex(s.SizeOfRawData))
print("imports:", sum(len(e.imports) for e in pe.DIRECTORY_ENTRY_IMPORT))For obfuscation without full packing, the work is different. API hashing means I recover the hash algorithm from the resolver loop, usually ROR13 or a CRC32 variant, then script the names in Python or Ghidra. String encryption means I break after the decrypt routine runs and dump the buffer, or I emulate the routine with Unicorn and feed it the encrypted blobs. Control flow flattening and opaque predicates I leave to symbolic execution or to lifting the dispatcher in Ghidra, because manual reading wastes hours.
Failure modes I watch for
Multi-layer packers decrypt a second stub, so the first dump is still packed. I check the dumped image again with the same entropy and import test before I trust it. VM protectors such as Themida and VMProtect virtualize the OEP itself, so there is no clean dump. Then I switch to tracing the virtualized handler or to behavioural extraction with ProcMon and network capture, and I report the sample as virtualized rather than forcing a bad dump. Anti-debug checks, timing checks and VM checks also break naive breakpoints. I patch IsDebuggerPresent, NtQueryInformationProcess and the RDTSC delta in the VM snapshot, and I take a clean snapshot before each run so a corrupted state does not carry over.
The deliverable is the unpacked image plus a note on what was recovered: OEP address, fixed imports, decrypted strings and config, and the YARA rule I wrote from the unpacked code rather than from the stub. A rule written on the stub matches every sample from that packer and tells us nothing about the family.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-6What sandbox-evasion and anti-analysis techniques should an analyst expect?
The 90-second answer
Expect checks in layers, and expect the payload to stay dormant until several pass. A typical sample first fingerprints the environment, then checks for a human, then checks for analysis tools, and only then contacts its C2 or decrypts the next stage. If any check fails it usually exits cleanly, sleeps, or runs a decoy action such as dropping a benign file. That is why a sandbox report that says "no malicious activity" tells you almost nothing on its own.
I group what I see in the wild into five buckets.
-
Environment fingerprinting. Disk size under 60 GB, RAM under 2 GB, one CPU core, uptime under a few minutes, a short list of recent files, no documents in the user profile, and a generic hostname or username. VM artifacts sit in the same bucket: registry keys for VMware and VirtualBox, device names, a MAC address with a known hypervisor OUI, and processes such as
vmtoolsd.exeorVBoxService.exe. -
Timing and sleep.
Sleep(60000)or longer,GetTickCountdeltas,QueryPerformanceCounterloops, andRDTSCreads. Some families sleep in short increments and re-check the clock, which defeats sandboxes that fast-forward a single sleep call. -
User presence. No mouse movement in the last minutes, no recent clicks or keystrokes, an empty Recycle Bin, or a desktop with no icons. Others require a specific interaction, such as opening a document and clicking "Enable Content", before the macro or loader proceeds.
-
Anti-debug and anti-analysis.
IsDebuggerPresent,CheckRemoteDebuggerPresent,NtQueryInformationProcesswithProcessDebugPort, timing traps around a breakpoint, and scans for known tool windows, drivers, or process names such as Wireshark, ProcMon, x64dbg, and sandbox agents. Packed and virtualized samples add API hashing and import obfuscation so static tools see very little. -
Keyed execution. The payload decrypts only for a target domain, username, hostname, language, or timezone, or only after a successful C2 check. Geofencing is common in ransomware and banking trojans. In that case the sandbox never sees the real payload because the key is simply absent.
| Technique | Artifact I look for | Countermeasure or tell |
|---|---|---|
| Long sleep | Sleep, NtDelayExecutionThread, wait on a timer | Fast-forward clocks, patch sleep, watch for wake after 60 to 300 s |
| VM check | Registry keys, device names, MAC OUI, disk serial | Bare-metal or hardened VM profile, compare results across two images |
| Low-resource check | GlobalMemoryStatusEx, GetDiskFreeSpaceEx | Raise RAM and disk in the guest, note thresholds in the report |
| No-user check | GetLastInputInfo, mouse and keyboard hooks | Simulate input, seed recent files and documents |
| Debugger check | IsDebuggerPresent, NtQueryInformationProcess, PEB flags | Run under a hypervisor-level tracer, compare behaviour with and without a debugger |
| Keyed payload | Decryption key built from hostname, user, or C2 response | Extract the key logic statically, replay the C2 response in a fake net |
A short example of the sleep pattern I patch in a lab guest, in C as the sample often writes it:
// Sample-side pattern, for recognition in a disassembler
DWORD start = GetTickCount();
Sleep(120000); // 2 minutes, common threshold
if (GetTickCount() - start < 120000) {
return; // clock was fast-forwarded or tampered with
}
DecryptNextStage();In the sandbox I set a breakpoint or hook on the sleep API, log the requested duration, and force the wake. If the sample then re-checks the clock, that second check is itself evidence of anti-analysis intent.
How I handle it in practice
I never trust a single detonation. I run the sample at least twice: once in a standard sandbox image and once in a hardened image with a larger disk, more RAM, seeded documents, simulated mouse movement, and a fake network such as INetSim or a controlled C2 emulator. Divergent behaviour between the two runs is a finding in itself. I also record which checks fired, because that list tells the detection team what to hunt for in telemetry.
For static triage I look for the imports and strings that implement the checks before I waste a detonation. A loader that imports GetTickCount, GlobalMemoryStatusEx, and IsDebuggerPresent and contains almost no other imports is telling me its first job is environment selection. Unpacking comes first in that case, since the real checks are often in the decrypted stage.
Failure modes to name in the interview
Fast-forwarding sleep can break samples that measure elapsed time, so a patched run that suddenly executes is not proof the original would have executed on a victim machine. Hardening a VM can also overshoot: a sample keyed to a specific corporate hostname will still refuse to run, and I need to say that explicitly rather than claim the sample is benign. The opposite error is assuming every VM check means sandbox evasion. Some installers and DRM components check the same artifacts for licensing reasons. I separate intent from artifact by looking for the exit path. A sample that exits silently on a VM check, with the payload stage still encrypted, is behaving differently from one that merely warns the user.
The deliverable I hand over is a short matrix: each check observed, the API or artifact behind it, the threshold if I could recover it, and whether the payload executed after I neutralised it. That gives detection and threat intel something concrete to build on, instead of a verdict based on one quiet run.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-7Explain process injection and why malware uses it?
Process injection is code execution inside another process's address space, so the malicious thread inherits that process's identity, privileges, loaded modules and network context. The classic Windows sequence is OpenProcess on a target, VirtualAllocEx to reserve memory there, WriteProcessMemory to copy a payload, then CreateRemoteThread pointing at it. Modern families rarely use that exact chain because it is heavily hooked, but the logic stays the same: get a handle, place code, get a thread to run it.
// Classic remote-thread injection, simplified. Checked against Win32 API docs.
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, targetPid);
LPVOID remote = VirtualAllocEx(h, NULL, payloadSize,
MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
WriteProcessMemory(h, remote, payload, payloadSize, NULL);
CreateRemoteThread(h, NULL, 0,
(LPTHREAD_START_ROUTINE)remote, NULL, 0, NULL);Malware uses it for four practical reasons. First, blending: code running in explorer.exe, svchost.exe or a browser looks like a legitimate child of a signed binary, which defeats naive allowlists and user suspicion. Second, network access: a process that would be blocked or prompted on its own can inherit the target's firewall allowance, for example a browser or a signed updater. Third, access to the target's data: injecting into a browser, mail client or LSASS-adjacent process gives direct reads of decrypted buffers, cookies or credentials without parsing files on disk. Fourth, defence evasion: userland API hooks placed in the malware's own process do not apply inside the target, and a scanner that only inspects the original file on disk misses the in-memory payload.
Variants trade stealth against reliability:
| Technique | What it reuses | Typical detection artefact |
|---|---|---|
| Classic remote thread | New thread in target | Sysmon 8/10, thread start in unbacked memory |
| APC injection | Queued APC on existing thread | APC to thread that never alertable-waits, RWX allocation |
| Thread hijacking | Suspended existing thread, redirect RIP | Thread context change, start address outside module |
| Process hollowing | Legitimate image created suspended, image replaced | Image on disk differs from memory, parent-child mismatch |
| DLL injection | LoadLibrary in target | Unsigned DLL loaded, CreateRemoteThread with LoadLibrary |
Detection in analysis starts with the cross-process sequence, not the payload. Sysmon Event 10 (ProcessAccess) with GrantedAccess such as 0x1F1FFF or 0x143A, followed by Event 8 (CreateRemoteThread), is the classic pair. ETW Threat Intelligence and kernel callbacks give the same sequence with less tampering. In memory, I look for a thread whose start address is not backed by a loaded module, private RWX regions, and PE headers in memory that do not match the file on disk. Volatility malfind and hollowfind, or a live memory scan comparing section hashes, surface hollowing and manual mapping.
Failure modes matter in the lab. A 64-bit injector cannot CreateRemoteThread into a 32-bit target with a 64-bit shellcode address, and vice versa. Protected Process Light and session isolation block handles to LSASS or higher-integrity processes. Writing PAGE_EXECUTE_READWRITE and then executing it trips modern mitigations, so current loaders allocate RW, write, then change protection to RX with VirtualProtectEx. If the target exits or the handle is closed before the thread starts, the payload never runs, which is why families often inject into long-lived processes such as explorer.exe.
For a sample, I would dump the target memory at the remote allocation, recover the injected PE or shellcode, and check which process it chose. That choice usually tells you the goal: browser for traffic, explorer for persistence and user context, a security product process for tampering.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-8How do you approach attribution, and what are its pitfalls?
The 90-second answer
I start from the sample, not the name. Attribution is a clustering claim: this activity belongs to the same operator, or the same organisation, as that earlier activity. I build the cluster from independent evidence types, score each one, and state confidence explicitly. If the evidence only overlaps on commodity tooling, I say so and stop at the tooling.
In practice I collect four layers. Code: function-level similarity, shared bugs, compiler and linker artefacts, imphash and rich header, reused strings and config formats. Behaviour: TTP sequence, persistence choice, lateral movement pattern, exfiltration channel. Infrastructure: domains, IPs, certificates, registration patterns, passive DNS history. Context: victimology, targeting, working hours, language artefacts in the UI or in mistakes. One layer alone rarely carries an attribution. Two independent layers pointing the same way start to.
| Evidence | What it proves | Typical trap |
|---|---|---|
| Shared code, including a distinctive bug | Same codebase or shared source | Leaked source, shared builder, malware-as-a-service |
| Config format and C2 protocol | Same family, often same operator | Family sold or rented to unrelated actors |
| Infrastructure overlap | Operational link at a point in time | Bulletproof hosting, compromised sites, fast flux shared by many |
| TTPs and victimology | Preference and access | TTPs copied from public reports within weeks |
| Language, timezone, compile timestamps | Weak corroboration only | Deliberate false flags, VPNs, automated builders |
How I score it in the lab
I keep a small scoring sheet per cluster so a colleague can audit the call. Weights are illustrative, labelled as such, and the point is discipline rather than precision.
# Python 3.11, checked against pefile 2023.02.25
import pefile
def fingerprint(path: str) -> dict:
pe = pefile.PE(path)
imports = sorted(
f"{e.dll.decode().lower()}:{f.name.decode().lower() if f.name else ''}"
for e in pe.DIRECTORY_ENTRY_IMPORT
for f in e.imports
)
return {
"machine": pe.FILE_HEADER.Machine,
"rich_header": pe.RICH_HEADER.values if pe.RICH_HEADER else None,
"imports": imports,
"sections": [(s.Name.rstrip(b"\x00").decode(errors="ignore"), s.SizeOfRawData) for s in pe.sections],
}That gives me a repeatable starting point. Imphash and rich header similarity get a sample into a cluster. They never finish the argument. I then diff functions in a decompiler, look for the same error handling order, the same hardcoded constants, the same config XOR key derivation. A shared bug, for example the same off-by-one in a string decryptor across two builds, is worth more than a dozen shared API imports, because imports come from any tutorial.
Worked trace, hypothetical figures: sample A and sample B share 92% of imported functions and the same C2 domain pattern, score 2 of 5. Their config decryption differs in key schedule and their persistence mechanisms differ, score 0. Victimology overlaps in one country, score 1. Total 3 of 10, so I report "same family, operator unconfirmed". If a third sample adds a shared rare string, a matching certificate reuse pattern, and identical operator working hours across six months, that moves the same cluster to a named actor at moderate confidence.
Pitfalls I watch for
False flags are real but rarer than analysts claim. The 2018 Olympic Destroyer case is the textbook example: early code artefacts pointed one way, deeper analysis showed planted artefacts. I treat language strings, timezone in compile stamps, and even keyboard layout hints as the weakest evidence, because they are the cheapest to fake.
Shared tooling is the everyday problem. Cobalt Strike, Mimikatz, PsExec, common loaders and crypters appear in criminal and state operations alike. Attributing on tooling alone collapses distinct actors into one. The same applies to leaked builders and source code. Once a family leaks, every subsequent sighting needs fresh behavioural evidence.
Infrastructure decays fast. A domain registered through the same privacy service proves little. A certificate reused across campaigns, with matching registration timing and passive DNS, proves more, until the actor rotates it. I date every infrastructure claim and check whether the overlap is contemporaneous.
Vendor naming adds noise. Different vendors name the same cluster differently, and one vendor name can cover two clusters merged by mistake. I cite the cluster evidence, not the name, and note where my naming diverges from public reporting.
Finally, pressure to name a country. Attribution to a state actor has political consequences, so I separate three statements: the technical cluster, the operator identity if known, and the sponsor if claimed. Most of my reports can defend the first, some can defend the second, and the third needs corroboration outside malware, such as victim reporting or intelligence leaks, which I flag as outside my evidence.
My closing line in a report is usually: cluster confidence high, operator confidence moderate, sponsor unassessed. That wording survives peer review better than a single name.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-9Walk me through a malware or APT investigation from your CV, start to finish?
The 90-second answer
I will walk through a spear-phishing case I led last year, a loader I tracked as FIN-like activity in our telemetry. It started as a single EDR alert for wscript.exe spawning rundll32.exe with a base64 argument, on a finance workstation at 09:14. I treated that alert as a lead, not a verdict. My job was to prove scope, recover the full chain, and turn it into detections that would catch the next victim before execution.
Triage and containment, first hour. I isolated the host, captured volatile memory with Velociraptor, and pulled the original .lnk from the mail gateway. The sample was a 1.2 MB PE, packed, with an overlay. Static triage showed high entropy (7.9) in .text, only LoadLibrary and VirtualAlloc imported, and a string api.telegram.org hidden in a resource section. That told me the packer was stubbing imports, so I did not trust static strings alone.
Dynamic analysis. In an isolated Windows 11 VM with no route to production, I ran it under ProcMon, Process Explorer, and Wireshark with INetSim. It slept 120 seconds, checked for a mouse movement delta, then decrypted a second stage in memory. The second stage wrote %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\update.exe, added a Run key, and beaconed every 60 seconds to a hard-coded IP over HTTPS with a custom User-Agent. I extracted the config from memory, not disk, because the file on disk was still encrypted.
| Time | Observation | Why it mattered |
|---|---|---|
| 09:14 | wscript.exe spawns rundll32 with 4 KB base64 arg | Initial execution, T1059.003 |
| 09:16 | Sleep 120 s, mouse check, VirtualAlloc RWX | Sandbox evasion, T1497 |
| 09:18 | Decrypts stage 2 in memory, writes Startup copy | Persistence, T1547.001 |
| 09:19 | HTTPS beacon, 60 s interval, 312 byte POST | C2, T1071.001 |
| 09:21 | Reads Login Data from Chrome profile via CryptUnprotectData | Credential access, T1555.003 |
Scope and hunting. One host is never the answer. I searched the EDR for the same base64 pattern, the Run key value, and the beacon size. That found 11 hosts in 48 hours, 3 of which had already exfiltrated browser credentials. I also retro-hunted 90 days of proxy logs for the C2 IP and found the first hit 23 days before the alert, which changed the incident timeline and the notification scope.
Detection I shipped. A YARA rule on the decrypted stage, not the packer, because the packer was shared with legitimate installers. I paired it with a Sigma rule for the parent-child chain and the Run key write, since YARA alone would miss a re-packed variant.
rule Loader_Stage2_2025 {
meta:
author = "SOC Analysis"
mitre = "T1059.003, T1547.001"
strings:
$a = "CryptUnprotectData" ascii wide
$b = "Login Data" ascii wide
$c = { 48 8B 05 ?? ?? ?? ?? 48 85 C0 }
condition:
uint16(0) == 0x5A4D and filesize < 2MB and 2 of ($a, $b, $c)
}What almost went wrong. The sample detected my first VM by a missing HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall key count and stayed dormant. I rebuilt the VM from a gold image with realistic user artifacts and re-ran it. That is the failure mode I now check first: if a sample does nothing for 5 minutes, I assume evasion before I assume it is benign.
Close-out. I delivered IOCs, the extracted config, a timeline, and the two detections to detection engineering, then verified the rules fired on the retro-hunt data. The outcome I report is not "we found malware." It is 11 hosts contained, 23 days of exposure identified, and a detection that now fires in under a second on the decrypted stage.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-10How do you perform memory forensics, and when is it more useful than disk analysis?
The 90-second answer
I treat memory as the live state of the machine and disk as its history. If the host is still running and I suspect fileless execution, injection, credential theft or anti-forensics, I capture RAM first, before reboot, shutdown or killing the process, because that evidence disappears on power loss. I hash the image on acquisition, work only on a copy, and then run Volatility 3 against it for processes, injected code, network connections and extracted files. Disk analysis comes next for persistence, timeline and the original dropper. Memory wins when the malicious code never touched disk in a recoverable form, or when disk is encrypted and the keys only exist in RAM.
Acquisition, in volatility order
Capture before triage tools that change state. I note time, user, host, running processes and network state, then acquire with a trusted tool from removable media. On Windows I use DumpIt or WinPmem, on Linux AVML or LiME, and I record SHA-256 of the image and the tool version in the case notes. A 16 GB host produces a roughly 16 GB raw image, so I confirm free space on the destination and expect acquisition to take minutes, not seconds, depending on bus speed. I never run the suspect binary, never reboot to "see if it comes back" before capture, and I photograph or log the screen if the malware shows a ransom note or countdown.
Failure mode to name in the interview: a rootkit or a malware sample that detects the acquisition driver, or a system under heavy load where capture itself triggers the payload. That is why I prefer a signed, known driver, capture once, and validate the image by checking that Volatility can parse the kernel symbols and list processes before I trust any finding.
Analysis on the image
I start with the process tree, not with strings. pslist and pstree show hidden or injected processes, netscan ties a PID to a C2 address, and malfind flags private memory regions that are executable and were never backed by a file on disk, which is the classic sign of process hollowing or reflective injection. hollowfind checks for a mismatch between the in-memory PE header and the file on disk. From a suspicious PID I dump the process with dumpfiles or procdump, then run YARA over the dump and over the full image with yarascan to find packed payloads, decrypted strings and configuration blocks that never reached disk.
Concrete commands I would run, Volatility 3 syntax:
vol -f memory.raw windows.pslist
vol -f memory.raw windows.pstree --pid 4216
vol -f memory.raw windows.netscan
vol -f memory.raw windows.malfind --pid 4216
vol -f memory.raw windows.dumpfiles --pid 4216 --out dir/
vol -f memory.raw windows.yarascan --yara-file rules.yarIf malfind returns a region at 0x1a2b0000 with PAGE_EXECUTE_READWRITE protection and no mapped file, I dump that region and disassemble it. That is often where the decrypted second stage lives. For credential theft I check LSASS access artifacts and, in a lab copy only, extract secrets with the appropriate plugin, because the plaintext password or ticket may exist only in memory. For ransomware I look for the encryption key material and the C2 config in process memory, which can let us decrypt or at least understand the campaign without paying.
When memory beats disk, and when it does not
| Question | Memory | Disk |
|---|---|---|
| Fileless or reflective loader | Code and config present, no file to hash | Often nothing, or only a script stub |
| Process injection | Injected PE visible in target process | Original file looks clean |
| Deleted or wiped payload | Still resident until overwritten | Recoverable only if not overwritten |
| Encrypted volume | Keys in RAM can unlock the image | Ciphertext without keys |
| Persistence and timeline | Point in time, no history | Registry, services, scheduled tasks, logs |
| Host already powered off | Not available | Only option |
Memory is weaker for timeline and scope. It tells me what was running at capture time, not what ran last week, and a large image is slow to search. Disk gives me persistence mechanisms, execution artifacts such as Prefetch, Amcache and Shimcache, and the original sample for static analysis. In a Kaspersky style workflow I would correlate both: memory gives me the live config and the injected module, disk gives me how it got there and whether it survives reboot.
I would close by stating the limit plainly. If the host is off, if capture would destroy evidence because the malware has a dead-man switch, or if legal requires a disk image first, I document that decision and switch to disk. Memory forensics is not a replacement for disk analysis. It is the only way to see the parts of an infection that were designed never to touch disk.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-11Explain how malware abuses the Windows API and how you track its real intent?
The 90-second answer
Malware does not invent new primitives. It calls the same Win32 and NT APIs a legitimate installer calls, but in a sequence and with arguments that serve theft, persistence, or execution in another process. I track intent by following arguments and buffers across calls, not by listing imported names. An import table tells me what a sample can call. A trace of VirtualAllocEx with PAGE_EXECUTE_READWRITE, followed by WriteProcessMemory carrying a PE header, followed by CreateRemoteThread pointing into that allocation, tells me what it did.
Static imports are a starting point only. Packed or evasive samples resolve APIs at runtime with LoadLibrary and GetProcAddress, hash API names to avoid strings, delay-load, or invoke syscalls directly to bypass user-mode hooks. So I combine three views: static imports and strings, dynamic API tracing in a sandbox, and targeted hooks or breakpoints on the APIs that matter for the behaviour I am chasing.
// Frida hook, checked against Frida 16 on Windows 10 x64. Logs arguments, not just names.
const va = Module.getExportByName('kernel32.dll', 'VirtualAllocEx');
Interceptor.attach(va, {
onEnter(args) {
this.size = args[3].toUInt32();
console.log('[VirtualAllocEx] hProcess=' + args[0] + ' size=' + this.size +
' protect=' + args[4]);
},
onLeave(retval) { console.log(' -> base=' + retval); }
});The same pattern applies to WriteProcessMemory (dump the source buffer), CreateRemoteThread and NtCreateThreadEx (record the start address), CryptEncrypt (dump plaintext before encryption), and WinINet or WinHTTP calls (dump URL and POST body). If I only log the API name, a loader, an installer, and a stealer look identical.
| Observed sequence | Likely intent | Check that confirms or refutes it |
|---|---|---|
RegSetValueEx on HKCU\...\Run, CreateService, scheduled task COM call | Persistence | Read back the value or service binary path, check whether it points to the sample or a dropped copy |
VirtualAllocEx + WriteProcessMemory + CreateRemoteThread into another process | Process injection | Dump the written buffer, compare to a PE or shellcode, check target process and whether the thread start address lands in the new allocation |
InternetOpen / WinHttpOpen + HttpSendRequest with a POST body | C2 or exfiltration | Capture URL, headers, and body before TLS, decode the body, look for host, ID, or stolen file markers |
CryptEncrypt / BCryptEncrypt after file enumeration | Ransomware or config encryption | Dump plaintext input and the key material, check file extensions and whether originals are deleted after |
LoadLibrary + GetProcAddress in a loop with hashed names | Dynamic resolution to hide imports | Break on GetProcAddress, log the resolved name or hash, rebuild the real import list |
Failure modes I watch for: first, the sample checks for a debugger or sandbox and only resolves the malicious API set on a real host, so an empty trace is not proof of benign behaviour. I rerun with different user names, documents, and network simulation, and I compare the static import hashes against the dynamic trace. Second, direct syscalls skip Win32 hooks. When a hook fires for ntdll functions but not for the Win32 wrapper, I move the breakpoint down to NtAllocateVirtualMemory, NtWriteVirtualMemory, and NtCreateThreadEx. Third, argument logging can mislead when malware passes encrypted or compressed buffers. I dump the buffer at the point of use and again after any CryptDecrypt or decompression call, rather than trusting the first bytes.
When I report, I name the API chain, the target process or registry key, and the dumped artefact, for example the injected PE or the decoded C2 POST. That is what turns an API list into an intent statement another analyst can reproduce.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Curated: · Written: · Reviewed: