๐ก Logging, Detection & MITRE ATT&CK
Logging, Detection and MITRE ATT&CK
Prevention fails. That is not pessimism, it is planning: patches lag, people click, credentials leak, and a determined attacker only has to be right once. Detection is the control that decides whether an intrusion is an incident you closed in an hour or a breach you learn about from somebody else. Detection is built on logs, and logs are worth exactly as much as their coverage, integrity and timestamps.
What to log, and what each source actually catches
| Source | Where it lives | What it catches |
|---|---|---|
| Authentication | Linux /var/log/auth.log (Debian) or /var/log/secure (RHEL); Windows Security log โ 4624 logon, 4625 failed logon, 4672 special privileges assigned, 4720 account created | Password spraying, credential stuffing, first use of stolen credentials, new admin accounts |
| Process creation | Windows event 4688 (enable "Include command line in process creation events" or the command line is missing); Sysmon event 1; Linux auditd execve rules or eBPF tooling | Living-off-the-land execution, script interpreters spawned by unusual parents, tooling dropped and run |
| Network connections | Firewall logs, NetFlow/IPFIX, cloud VPC flow logs, Zeek conn.log, Sysmon event 3 | Beaconing, lateral movement, exfiltration volume, connections to newly registered infrastructure |
| DNS queries | Resolver query logs, Sysmon event 22 | Command-and-control lookups, domain-generation algorithms, tunnelling and exfiltration over DNS |
| Web access | nginx / Apache access logs, load balancer and CDN logs, WAF events | Scanning, path traversal and injection attempts, webshell access, credential brute force |
| Cloud control plane | AWS CloudTrail, Azure activity and Entra ID sign-in logs, Google Cloud Audit Logs | API key abuse, IAM changes, new access keys, storage made public, logging disabled |
DNS deserves a specific note. It is the cheapest high-value telemetry most networks are not collecting, and it is quietly being taken away: if endpoints resolve through DNS-over-HTTPS to a public resolver, the internal query log goes blank. If you want DNS visibility, force clients to internal resolvers and control egress to external ones.
An example of why the format matters โ a single line from an Apache/nginx combined log:
203.0.113.42 - - [26/Jul/2026:14:03:11 +0000] "GET /.git/config HTTP/1.1" 200 512 "-" "curl/8.5.0"
| # | Field | Value above |
|---|---|---|
| 1 | Client address | 203.0.113.42 |
| 2 | identd (effectively always -) | - |
| 3 | Authenticated user, if any | - |
| 4 | Timestamp with UTC offset | [26/Jul/2026:14:03:11 +0000] |
| 5 | Request line โ method, path, protocol | GET /.git/config HTTP/1.1 |
| 6 | Response status | 200 |
| 7 | Bytes sent | 512 |
| 8 | Referrer | - |
| 9 | User agent | curl/8.5.0 |
The interesting part is the pairing of field 5 with field 6: /.git/config answered with 200. A 404 is a scanner being ignored; a 200 is a source-code repository being downloaded. Detection lives in that difference โ and so does triage, because the same rule that alerts on the 200 should stay quiet on the 404. Parse a log sample โ
Integrity, central collection, and the attacker's first move
Logs stored only on the host that produced them protect you until the moment they matter. An attacker with root or SYSTEM edits or truncates them โ ATT&CK calls this T1070 Indicator Removal, with sub-techniques for clearing Windows event logs (T1070.001), clearing Linux and macOS logs (T1070.002), and clearing command history (T1070.003).
- Ship logs off-host immediately, over TLS, to a collector in a different trust zone. Cloud audit logs should land in a separate account or project.
- Write-once storage where you can: object-lock buckets, append-only retention. The collector account should not have delete rights on its own archive.
- Alert on the absence of logs. A host that stops sending is either broken or compromised; both need a human. Windows Security event 1102 (the audit log was cleared) should page somebody, always.
- Protect the SIEM's credentials as tier-0. An attacker who can log into the log platform can delete the evidence and read your detection rules.
Time synchronisation is not a nice-to-have
An investigation is the reconstruction of an ordered sequence across many machines. If one host's clock is eleven minutes fast, its events sort into the wrong place and the causal chain โ phishing email, process spawn, outbound connection, data staged, data leaves โ silently falls apart. Rules:
- Run NTP on everything (chrony, ntpd or
systemd-timesyncd) against a consistent source, and monitor drift:chronyc trackingshows the offset. - Log in UTC. Set servers to UTC (
timedatectl set-timezone UTC) and let humans do local time in the UI. Daylight-saving transitions produce ambiguous or missing local timestamps once a year, each way. - Prefer RFC 3339 / ISO 8601 timestamps with an explicit offset:
2026-07-26T14:03:11Z. A bare14:03:11is not evidence of anything. - Keep both the event time and the ingestion time. A wide gap between them is itself a signal โ of a queue backing up, or of logs being replayed or suppressed.
Detection engineering
Three families, with different economics:
| Approach | Example | Strength | Weakness |
|---|---|---|---|
| Signature | A hash, a YARA rule for a known payload, an IDS rule for a specific URI | Precise, explainable, near-zero false positives | Trivially evaded by a one-byte change; only finds what is already known |
| Anomaly | First-ever login from a new country; a host suddenly uploading many times its usual volume | Can catch genuinely novel activity | Needs a clean baseline; noisy in environments that legitimately change |
| Behaviour | An office application spawning a script interpreter; a web server process spawning a shell | Targets what the attacker must do, not what they happen to use | Requires rich telemetry and per-environment tuning |
Every rule trades false positives against false negatives, and the practical constraint is human. A rule that fires dozens of times a day for nothing gets muted, and a muted rule is a false negative with extra steps. Judge a detection by whether an analyst can act on it: what does the alert say, what does the responder check first, what does "not malicious" look like? If you cannot answer, the rule is not finished.
Detection-as-code treats rules like software: written in a portable format, reviewed in pull requests, versioned in git, tested against recorded telemetry, and deployed by CI. Sigma is the common vendor-neutral format:
title: Windows Security Event Log Cleared
status: experimental
description: The Security audit log was cleared, which is rare outside planned maintenance.
references:
- https://attack.mitre.org/techniques/T1070/001/
logsource:
product: windows
service: security
detection:
selection:
EventID: 1102
condition: selection
falsepositives:
- Deliberate log rotation or clearing by an administrator during maintenance
level: high
tags:
- attack.t1070.001
Because the rule is text, it can be diffed, reviewed by someone who was not on shift, and converted to whichever query language the SIEM speaks.
MITRE ATT&CK, used properly
ATT&CK is a curated knowledge base of adversary behaviour observed in real intrusions. Its structure is worth getting right, because most misuse comes from misreading it:
- Tactics are the columns of the matrix โ the adversary's objective at that moment, the why. Examples: TA0043 Reconnaissance, TA0001 Initial Access, TA0002 Execution, TA0003 Persistence, TA0004 Privilege Escalation, TA0005 Defense Evasion, TA0006 Credential Access, TA0007 Discovery, TA0008 Lateral Movement, TA0009 Collection, TA0011 Command and Control, TA0010 Exfiltration, TA0040 Impact.
- Techniques are the how: T1566 Phishing, T1190 Exploit Public-Facing Application, T1078 Valid Accounts, T1059 Command and Scripting Interpreter, T1071 Application Layer Protocol, T1003 OS Credential Dumping, T1021 Remote Services, T1486 Data Encrypted for Impact.
- Sub-techniques refine them: T1566.001 Spearphishing Attachment, T1059.001 PowerShell, T1059.004 Unix Shell, T1071.004 DNS (command and control tunnelled through DNS), T1021.004 SSH, T1003.001 LSASS Memory.
- Procedures are the specific implementations a named group or piece of software used โ the level at which detections are usually written.
A technique is not a detection. "We cover T1059" is meaningless; "we alert on script interpreters spawned by browser and office processes, on the hosts where Sysmon is deployed โ and we know exactly which hosts those are" is a coverage statement. That distinction is the whole value of coverage mapping: colour a matrix layer by what you can actually detect, weighted by telemetry availability, and the gaps become a prioritised backlog rather than a feeling. Do not chase 100% โ many techniques do not apply to your platforms, and completeness on paper is a poor substitute for depth where your real threats operate.
Purple teaming closes the loop. The offensive side executes one specific technique in a controlled way; the defensive side checks whether the telemetry existed, whether the rule fired, how long it took, and what the analyst saw. Each of those four can fail independently. Open-source frameworks such as Atomic Red Team and MITRE CALDERA exist to script the execution half repeatably. The output is not a pass/fail grade โ it is a list of specific, fixable gaps.
Indicators, and the Pyramid of Pain
An indicator of compromise is an artefact showing an intrusion happened or is happening: a file hash, an IP address, a domain, a URL, a registry key, a mutex. An indicator of attack is a behaviour that signals an attack in progress regardless of the tooling used โ a service account authenticating interactively at 03:00, credential dumping, mass file encryption. IOCs are for hunting historically and blocking cheaply; IOAs are for catching an operator you have never seen before.
David Bianco's Pyramid of Pain (2013) ranks indicator types by how much it hurts the adversary when you deny them, from trivial at the base to painful at the apex:
| Level | Indicator | Cost to the attacker of changing it |
|---|---|---|
| 1 (base) | Hash values | Trivial โ recompile, append a byte |
| 2 | IP addresses | Easy โ rent another host |
| 3 | Domain names | Simple โ register another domain |
| 4 | Network / host artefacts | Annoying โ a distinctive user agent, URI pattern or filename must be re-engineered |
| 5 | Tools | Challenging โ the capability must be rebuilt or re-acquired |
| 6 (apex) | TTPs | Tough โ the adversary must change how they operate |
The practical reading: a feed of hashes and IPs is cheap and expires almost immediately, so automate it and expect little. Detections written against behaviour survive infrastructure changes and are what actually forces an adversary to retool. Spend your engineering time near the top of the pyramid.
Working the ground floor: extract indicators from a report or log โ, defang or refang them for safe sharing โ, score a vulnerability with CVSS โ, and keep an eye on the live CVE feed โ for what is newly published.
- Authentication, process creation, network, DNS, web and cloud control-plane logs cover most of what matters. DNS is the most commonly missing high-value source.
- Logs that live only on the host they describe are not evidence. Ship them off-host, make them append-only, and alert when a source goes silent.
- UTC everywhere, NTP everywhere, RFC 3339 timestamps. Bad clocks destroy investigations quietly.
- A detection nobody can action is a false negative with extra steps. Write rules as code, review them, and tune for the analyst.
- ATT&CK tactics are goals, techniques are methods, sub-techniques are variants. Use it for honest coverage mapping and purple-team gap-finding, not decoration.
- Hashes and IPs cost an attacker nothing to change; TTP-level detections are what force them to retool.