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
- Execution detections are about combinations and context: who, where, when, how many, what next.
- A rule on one way of running code misses another way; a second sensor covers the gap.
- Exclusions are holes; name an owner and a review date.
- Score visibility and detection separately, and tie each score to evidence.
Sources
- MITRE ATT&CK: Execution (TA0002)
- MITRE ATT&CK: Command and Scripting Interpreter, Unix Shell (T1059.004)
- MITRE ATT&CK: Scheduled Task/Job, Systemd Timers (T1053.006)
- Linux man page: auditctl(8)
- DeTT&CT README (Rabobank CDC, GitHub)
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.
- Catch shell script execution (T1059.004), and see what a rule on the shell can and cannot see (Purple Execution 1 of 3): You write a rule on the shell programs and a rule on files run from a temporary folder, measure the noise and see which of four tests each catches.
- Catch systemd timer execution (T1053.006), including the one that leaves no file (Purple Execution 2 of 3): You save a baseline of timers and unit files, catch a file-based timer with a rule and a transient timer by comparing the list.
- Tell attack-like execution from normal admin work, and tune the rules (Purple Execution 3 of 3): You run a staged administrator session next to the tests, compare three rule versions on false positives and misses and write the runbook.
- Measure your detection coverage against ATT&CK with DeTT&CT: You record the telemetry you collect, score visibility and detection per technique, and produce ATT&CK Navigator layers.
Also try, in the simulators
- The Pyramid of Pain: choosing what to detect (Detection Lab lesson): A lesson on choosing what to detect so the rule is expensive for an adversary to step around, the judgment behind tuning.
- Find the accounting updater starting a command shell (Detection Lab task): You write the rule that finds a trusted updater starting a command shell it never normally needs, execution seen from the defender's side.
Knowledge check
- 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.
- 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.
- 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.
- 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
- Adversary emulation and purple teaming
- Catch shell script execution (T1059.004), and see what a rule on the shell can and cannot see (Purple Execution 1 of 3)
- Catch systemd timer execution (T1053.006), including the one that leaves no file (Purple Execution 2 of 3)
- Tell attack-like execution from normal admin work, and tune the rules (Purple Execution 3 of 3)
- Measure your detection coverage against ATT&CK with DeTT&CT
- All classes
- Free cyber labs