Execution, and telling attack-like activity from admin work

Unit 4 of 5 in Adversary emulation and purple teaming.

You will be able to detect shell and scheduled execution, separate attack-like from administrator activity using five questions, tune a rule without blinding it, and measure coverage across ATT&CK.

Lesson

Execution is where code runs

MITRE describes Execution as techniques that result in adversary-controlled code running on a local or remote system, often paired with techniques from other tactics: its example is an adversary using a remote access tool to run a script that does discovery. Unix shell (T1059.004) is the primary command prompt on Linux, and the page notes that shells can control every aspect of a system and can be used interactively or through scripts, including as part of payloads used for persistence.

Systemd timers (T1053.006) are unit files that control services and can run on a calendar event or after a time span; the page describes them as an alternative to cron. The detection challenge is again that all of this is ordinary system behaviour.

What a rule on the shell can and cannot see

The shell lab runs four documented shell tests, writes a rule on the shell programs and measures how noisy it is, writes a second rule on files executed from a temporary folder, and sees which tests each does and does not catch. One lesson is that a script run in a different way, for example executed directly instead of passed to the shell, can bypass a rule that names the shell. That is not a trick to hide anything; it is a gap in the rule, and the report says so.

ATT&CK's detection strategy for Unix shell execution describes a chain: shell execution initiated by remote sessions or unauthorized users, then suspicious commands, then network discovery or persistence indicators. The focus is the combination.

Timers that leave no file

ATT&CK's detection strategy for systemd timers describes correlating file creation or modification of timer and service unit files in system directories with execution of abnormal child processes launched by systemd. The systemd lab shows the harder case: a transient timer leaves no unit file, so a rule that watches the unit folder cannot see it. You catch it another way, by comparing the list of timers against a saved baseline. That is the same lesson as the snapshot lab: a second sensor sees what the first cannot.

Five questions that separate attack from admin work

The tuning lab stages an administrator's session and the tests side by side and separates them with five questions: who ran it, where from, when, how many times, and what happened next. A rule is then tuned with the login user, the location and an exclusion for a known script, and each version is measured for false positives and misses. The audit documentation's fields make this possible: auid for the original login, and the ability to match on user, directory and other fields.

The exclusion is the dangerous part. An exclusion for a known script is only safe if the script's location and permissions are protected, because an exclusion is a hole of exactly its own shape. The lab asks you to write the runbook entry that says who owns the exclusion and when it will be reviewed.

Coverage: what do we see across ATT&CK?

After a handful of tests the next question is about the whole: which techniques can we actually see? DeTT&CT's README says it aims to help blue teams use ATT&CK to score and compare data log source quality, visibility coverage, detection coverage and threat actor behaviours. The lab separates two scores that are easy to confuse. Visibility asks whether you collect the data to see a technique. Detection asks whether you would alert on it. Visibility is the floor; detection is what is built on it.

A coverage map is only as honest as its scores, so each score should point at evidence, such as the test you ran and the rule that fired. Your purple reports from this unit and the last two are that evidence.

Key points

Sources

Lecture

Logging and detection pipelines: How logs become detections and alerts: the pipeline your rules and tuning live in.

Practice in the labs

Three execution labs with tuning, then a coverage map across everything you have tested.

Also try, in the simulators

Knowledge check

  1. A transient systemd timer leaves no unit file. How can you still catch it? Answer: Compare the list of timers with a saved baseline, a second sensor that does not depend on the file. The file-watching rule cannot see it; listing timers and comparing to a baseline can.
  2. Which five questions separate attack-like from administrator activity in the tuning lab? Answer: Who, where, when, how many and what next. Context separates two uses of the same commands; the rule versions are measured on those features.
  3. Why is an exclusion for a known administrator script risky? Answer: It is a hole in the rule: if the script's location or permissions are not protected, the hole can be used. An exclusion needs an owner and a review date, and the protected location is part of the control.
  4. In DeTT&CT terms, what is the difference between visibility and detection? Answer: Visibility is whether you collect the data to see a technique; detection is whether you would alert on it. Visibility is the floor that detection is built on; scoring them separately shows where the gap is.

Back to the syllabus or see all classes.

Related