Malware Triage, Sandboxes, and Threat Intelligence
Triage suspicious files safely, read static and sandbox evidence, write YARA rules, and turn threat intelligence into detections without drowning in false positives.
By the end, you’ll be able to…
- Handle suspected malware safely and preserve hashes and evidence.
- Perform static triage with file type, strings, hashes, and PE or ELF headers.
- Use sandbox results and YARA rules to form defensible conclusions.
- Map behaviour to MITRE ATT&CK and distinguish indicators from tactics and techniques.
- Share threat intelligence responsibly and manage false positives and expiry.
01Safety and Scope Before Curiosity
A suspicious file is not a toy. Malware can encrypt files, spread across a network, steal credentials, install persistence, and contact remote infrastructure. Treat every unknown sample as potentially dangerous until you have evidence otherwise. Analysis belongs in a dedicated virtual machine with a snapshot, a host-only or controlled network, no shared folders, no clipboard sharing, and no production credentials. If you need internet access for the sample, route it through an isolated simulation or a controlled gateway that you can monitor and tear down.
Document the sample before you touch it. Record where it came from, who collected it, the date and time, the storage location, and a cryptographic hash. Work on a copy and keep the original read-only. If the sample is part of an incident, follow your organisation's evidence and chain-of-custody process. Do not upload confidential files to a public sandbox or a public multi-engine scanner without approval; the sample may contain customer data, internal documents, or credentials. A harmless test file such as EICAR is enough to practise the workflow without handling real malware.
Triage answers a small set of questions. Is the file malicious, suspicious, or benign? What family or behaviour does it resemble? What does it do when executed? Which indicators can defenders use? What is the business impact, and what should be contained first? You will not always get a complete answer. State your confidence, distinguish observation from inference, and recommend the next action. A fast, honest 'suspicious, needs sandbox confirmation, isolate the host' is more useful than a confident guess.
02Static Triage: Hashes, Strings, and Headers
Hashes are the identity card of a file. Compute SHA-256 first because it is the standard for sharing and verification, and compute MD5 or SHA-1 only when a legacy system requires them. On Linux, sha256sum sample.bin prints the digest. On Windows, Get-FileHash -Algorithm SHA256 does the same. Hash the sample when you receive it, after you copy it, and before you archive it. A matching hash proves the bytes are unchanged; it does not prove the file is safe. A hash can also be looked up in VirusTotal without uploading the sample, which is useful when the file is sensitive.
File type is more reliable than the extension. The file command reads magic bytes and identifies PE, ELF, script, archive, or document formats. Extensions lie constantly: invoice.pdf.exe is a Windows executable, and a .jpg can be a script or an archive. strings extracts readable text from a binary. Use strings -n 8 to skip short noise and strings -el for UTF-16 text. Look for URLs, domains, IP addresses, registry keys, mutex names, user-agent strings, error messages, and build paths. These are clues, not proof. Attackers can plant decoy strings, and legitimate software contains many of the same artefacts.
Headers explain how a file is built. For a Windows PE file, objdump -x shows the DOS and PE headers, sections, entry point, imports, and DLL characteristics. For an ELF file, readelf -h -l -S shows the header, program headers, and sections. Packed or obfuscated samples often have high-entropy sections, few imports, unusual section names, and a small stub that unpacks the real payload. Static analysis has limits: a packed sample may reveal almost nothing until it runs. VirusTotal adds multi-engine opinions, community comments, and behaviour reports, but a detection ratio is not a verdict. False positives exist, and a new sample may have no detections at all.
# Lab sample only. Work on a copy in an isolated analysis VM.sha256sum sample.bin | tee sample.sha256file sample.binstrings -n 8 sample.bin | head -50strings -el sample.bin | head -30# PE headers and imports.objdump -x sample.bin | head -100# ELF headers, sections, and program headers.readelf -h -l -S sample.elf | head -100# Scan a directory with a lab YARA rule.yara -r lab-rule.yar samples/# Look up the hash in VirusTotal without uploading the file.# https://www.virustotal.com/gui/file/<sha256>9f2c... sample.bin sample.bin: PE32+ executable (GUI) x86-64, for MS Windows https://updates.example.invalid/gate.php Invoice_2026.pdf.exe Software\Microsoft\Windows\CurrentVersion\Run PE32+ executable (GUI) x86-64, 7 sections
03Dynamic Analysis and Sandboxes
A sandbox runs the sample in an instrumented environment and records what it does. Commercial services such as Any.Run and Joe Sandbox offer interactive or automated analysis; open-source options such as CAPE and Cuckoo can be self-hosted. The report usually includes a process tree, file and registry changes, network connections, dropped files, screenshots, and sometimes a MITRE ATT&CK mapping. Public sandboxes may share your sample with other users, so use a private submission or an on-premises sandbox for sensitive material.
Read the report like an investigator. Start with the process that launched the sample and the children it created. Note where files were dropped, which registry keys or services were changed, and what network destinations were contacted. Look for persistence, credential access, defence evasion, and encryption behaviour. Correlate the sandbox findings with static strings and hashes. A sample that sleeps, checks for a virtual machine, or waits for user interaction may show nothing in a short run. Absence of behaviour is not proof of innocence; it may be evasion, a missing dependency, or a timeout.
YARA turns indicators into a reusable matching rule. A rule has a name, optional metadata, string definitions, and a condition. Use unique strings, not generic words, and combine them so a single coincidence does not trigger a match. Test the rule against a corpus of benign files and known samples. YARA can scan files, directories, and memory, and it is used by malware analysts, incident responders, and detection engineers. It is not an antivirus and it does not execute anything; it answers whether a set of bytes matches a pattern.
rule Lab_Invoice_Loader{ meta: author = "course lab" description = "Synthetic sample used in the malware triage lesson" confidence = "medium" strings: $mz = { 4D 5A } $s1 = "Invoice_2026.pdf.exe" ascii wide $s2 = "updates.example.invalid" ascii nocase $s3 = { 6A 40 68 00 30 00 00 } condition: $mz at 0 and 2 of ($s1, $s2, $s3)}Lab_Invoice_Loader samples/lab-loader.exe Lab_Invoice_Loader samples/lab-loader-copy.exe 2 matches, 0 files scanned without a match in the benign corpus
04Threat Intelligence: From IOCs to TTPs
Threat intelligence is useful when it changes a decision. An indicator of compromise is an observable artefact: a file hash, domain, IP address, URL, mutex, or registry key. A tactic, technique, or procedure is a behaviour: how an adversary gains access, persists, escalates, or exfiltrates. The pyramid of pain puts hashes at the bottom because an attacker can change them trivially, and TTPs at the top because changing behaviour is expensive. IOCs are still valuable for blocking and hunting, but they expire quickly and need context.
STIX and TAXII are standard formats for sharing intelligence. STIX 2.1 represents objects such as indicators, malware, campaigns, relationships, and observed data in JSON. TAXII 2.1 is a transport protocol for exchanging those objects between systems. A shared indicator should include a pattern, a confidence value, a validity window, and handling markings such as TLP. Sharing communities, sector ISACs, national CERTs, and vendors use these standards to move intelligence without everyone inventing a different spreadsheet.
Operationalise intelligence deliberately. A hash can be blocked at the endpoint, a domain at DNS or the proxy, and a behaviour turned into a detection rule. Before blocking, consider collateral damage: an IP may be a shared cloud address, a domain may host many customers, and a hash may match a legitimate installer. Use the indicator's confidence, age, and source. Run retro-hunts against historical logs, enrich alerts with context, and expire indicators when their validity window ends. Measure whether the intelligence produced true positives, false positives, or no action at all. Intelligence that is never used is just reading.
{ "type": "indicator", "spec_version": "2.1", "id": "indicator--11111111-1111-4111-8111-111111111111", "created": "2026-11-01T12:00:00.000Z", "modified": "2026-11-01T12:00:00.000Z", "name": "Lab loader command-and-control domain", "pattern": "[domain-name:value = 'updates.example.invalid']", "pattern_type": "stix", "valid_from": "2026-11-01T12:00:00.000Z", "valid_until": "2026-12-01T12:00:00.000Z", "confidence": 60, "labels": ["malicious-activity"], "object_marking_refs": [ "marking-definition--22222222-2222-4222-8222-222222222222" ]}Indicator loaded with confidence 60 and a 30-day validity window. Review before blocking: shared hosting and sinkhole risk.
The ideas worth keeping.
- Assume a sample is dangerous until proven otherwise and analyse it in an isolated, snapshotted environment.
- Static triage starts with a SHA-256 hash, true file type, strings, and headers; a detection ratio is not a verdict.
- Sandboxes show behaviour but can be evaded; absence of activity is not proof of safety.
- Turn intelligence into precise blocks, detections, and hunts, with confidence, expiry, and false-positive review.
Make it yours.
Type and test your code right here in the interactive workspace. Run your solution, check the output, and compare with the worked guide when ready.
Exercise 1: Write and test a YARA rule
Write a YARA rule for a synthetic lab sample that contains the ASCII string LAB_TRIAGE_2026 and the domain updates.example.invalid, is a Windows PE file, and should not match a benign document. Explain how you would test it.
Explore a worked solution
Start with a rule that requires the MZ signature at offset zero, then match both unique strings. For example: rule Lab_Triage_2026 { strings: $s1 = "LAB_TRIAGE_2026" ascii wide $s2 = "updates.example.invalid" ascii nocase condition: uint16(0) == 0x5A4D and all of them }. Test it with yara -r lab-rule.yar samples/ against the synthetic sample and a benign corpus of documents, installers, and text files. Confirm the sample matches and the benign files do not. If a benign file matches, inspect the strings, add context such as filesize or a PE section check, and retest. Do not broaden the rule until it matches everything; a narrow, explainable rule is better than a noisy one.A good YARA rule combines a file-format condition with specific strings. Testing against benign files is part of writing the rule, not an optional extra.
Exercise 2: Act on a mixed intelligence report
A report gives a SHA-256, a domain, and the technique T1059.001. Your EDR has no hash hits, but DNS logs show two internal hosts queried the domain last month. What do you do, in what order, and what do you avoid?
Explore a worked solution
First validate the report's provenance, date, and confidence. Search historical DNS, proxy, and firewall logs for the domain and the resolved addresses. Query the hash across endpoint telemetry, backups, and email attachments. If the domain is confirmed malicious and not a shared service, block the exact domain at DNS and the proxy and add a detection. Contact the two hosts' owners, isolate them if there is evidence of execution, and collect memory and logs before cleanup. Hunt for the behaviour behind T1059.001, such as suspicious command interpreters and child processes. Do not block an entire cloud provider or a shared domain without checking collateral impact. Record the timeline, the confidence, and the actions taken, and set an expiry for the block.Start with validation and scoping, then contain the confirmed path. Intelligence should drive a precise action, not a broad block that breaks legitimate services.
What stayed with you?
Check the ideas while they’re fresh. Your answers stay in this page and feedback appears as you go.
Keep exploring.
The official references behind this lesson, when you want a second angle or the full details.
One lesson closer.
Reading is a start. Trying it yourself makes the connection.