H4CK0R Network Security ยท Recon ยท Education

๐Ÿ“ก 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

SourceWhere it livesWhat it catches
AuthenticationLinux /var/log/auth.log (Debian) or /var/log/secure (RHEL); Windows Security log โ€” 4624 logon, 4625 failed logon, 4672 special privileges assigned, 4720 account createdPassword spraying, credential stuffing, first use of stolen credentials, new admin accounts
Process creationWindows 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 toolingLiving-off-the-land execution, script interpreters spawned by unusual parents, tooling dropped and run
Network connectionsFirewall logs, NetFlow/IPFIX, cloud VPC flow logs, Zeek conn.log, Sysmon event 3Beaconing, lateral movement, exfiltration volume, connections to newly registered infrastructure
DNS queriesResolver query logs, Sysmon event 22Command-and-control lookups, domain-generation algorithms, tunnelling and exfiltration over DNS
Web accessnginx / Apache access logs, load balancer and CDN logs, WAF eventsScanning, path traversal and injection attempts, webshell access, credential brute force
Cloud control planeAWS CloudTrail, Azure activity and Entra ID sign-in logs, Google Cloud Audit LogsAPI 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"
#FieldValue above
1Client address203.0.113.42
2identd (effectively always -)-
3Authenticated user, if any-
4Timestamp with UTC offset[26/Jul/2026:14:03:11 +0000]
5Request line โ€” method, path, protocolGET /.git/config HTTP/1.1
6Response status200
7Bytes sent512
8Referrer-
9User agentcurl/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).

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:

Detection engineering

Three families, with different economics:

ApproachExampleStrengthWeakness
SignatureA hash, a YARA rule for a known payload, an IDS rule for a specific URIPrecise, explainable, near-zero false positivesTrivially evaded by a one-byte change; only finds what is already known
AnomalyFirst-ever login from a new country; a host suddenly uploading many times its usual volumeCan catch genuinely novel activityNeeds a clean baseline; noisy in environments that legitimately change
BehaviourAn office application spawning a script interpreter; a web server process spawning a shellTargets what the attacker must do, not what they happen to useRequires 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:

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:

LevelIndicatorCost to the attacker of changing it
1 (base)Hash valuesTrivial โ€” recompile, append a byte
2IP addressesEasy โ€” rent another host
3Domain namesSimple โ€” register another domain
4Network / host artefactsAnnoying โ€” a distinctive user agent, URI pattern or filename must be re-engineered
5ToolsChallenging โ€” the capability must be rebuilt or re-acquired
6 (apex)TTPsTough โ€” 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.

Key takeaways
  • 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.