Unit 1: Detection lifecycle and ATT&CK coverage · Lesson 3 of 7 · 15 min

Look up techniques in ATT&CK's own data

Query the MITRE ATT&CK v20 STIX bundle with jq to read techniques, tactics and sub-techniques offline.

mission

You are
You are mapping Kestrel's rules to ATT&CK.
Situation
The website is a view of a data file. MITRE publishes ATT&CK as a STIX 2.1 bundle, and ~/attack/enterprise-attack.json is the v20.0 release.
Goal
Read the bundle with jq so you can answer ATT&CK questions from the terminal.
Hand in
The tactic for T1003.001 and the number of current techniques.

STIX is a JSON format for threat intelligence. The bundle is one object with an objects array. Each object has a type: attack-pattern is a technique, x-mitre-tactic is a tactic, and relationship links two objects. Techniques keep their ID, such as T1003.001, in external_references[0].external_id.

01

Check what you have

The licence file carries MITRE's copyright notice, which you must keep with any copy.

analyst@soc-de01
du -h attack/*
4.0K	attack/LICENSE.txt
53M	attack/enterprise-attack.json
jq -r '.objects[] | select(.type=="x-mitre-collection") | "\(.name) \(.x_mitre_version)"' attack/enterprise-attack.json
Enterprise ATT&CK 20.0

you should see A 53 MB file holding Enterprise ATT&CK 20.0.

du
Shows how much disk space files and folders use. Built into Linux and macOS.
jq
Picks fields out of JSON and reshapes it. Install with sudo apt install jq, or brew install jq on a Mac.
02

Count objects by type

jq -r '.objects[].type' prints one type per object. sort | uniq -c | sort -rn counts them, biggest first.

analyst@soc-de01
jq -r '.objects[].type' attack/enterprise-attack.json | sort | uniq -c | sort -rn
  21819 relationship
   1770 x-mitre-analytic
    867 attack-pattern
    750 malware
    705 x-mitre-detection-strategy
    268 course-of-action
    193 intrusion-set
    109 x-mitre-data-component
     95 tool
     57 campaign
     38 x-mitre-data-source
     15 x-mitre-tactic
      1 x-mitre-matrix
      1 x-mitre-collection
      1 marking-definition
      1 identity

you should see Relationships dominate. 867 attack patterns, 705 detection strategies and 1,770 analytics.

sort
Sorts lines of text. Built into Linux and macOS.
uniq
Collapses repeated neighbouring lines. With -c it counts them. Built into Linux and macOS.
03

Count current techniques

Revoked and deprecated techniques stay in the file so old references still resolve. Filter them out before you count.

analyst@soc-de01
jq '[.objects[] | select(.type=="attack-pattern" and (.revoked|not) and (.x_mitre_deprecated|not))] | length' attack/enterprise-attack.json
706

you should see 706 techniques and sub-techniques are current.

04

List the tactics

Tactics are the columns of the matrix: the attacker's goal.

analyst@soc-de01
jq -r '.objects[] | select(.type=="x-mitre-tactic") | .x_mitre_shortname' attack/enterprise-attack.json | sort
collection
command-and-control
credential-access
defense-impairment
discovery
execution
exfiltration
impact
initial-access
lateral-movement
persistence
privilege-escalation
reconnaissance
resource-development
stealth

you should see Fifteen tactics. Defense Evasion is gone: v20 has Stealth and Defense Impairment instead.

05

Look up one technique

analyst@soc-de01
jq -r '.objects[] | select(.type=="attack-pattern" and .external_references[0].external_id=="T1003.001") | .name, (.kill_chain_phases[].phase_name), (.x_mitre_platforms | join(","))' attack/enterprise-attack.json
LSASS Memory
credential-access
Windows

you should see LSASS Memory, under credential access, on Windows.

06

List the sub-techniques of T1218

System binary proxy execution has many sub-techniques. Two of Kestrel's requests are on this list.

analyst@soc-de01
jq -r '.objects[] | select(.type=="attack-pattern" and (.revoked|not)) | .external_references[0].external_id + " " + .name' attack/enterprise-attack.json | grep '^T1218\.' | sort
T1218.001 Compiled HTML File
T1218.002 Control Panel
T1218.003 CMSTP
T1218.004 InstallUtil
T1218.005 Mshta
T1218.007 Msiexec
T1218.008 Odbcconf
T1218.009 Regsvcs/Regasm
T1218.010 Regsvr32
T1218.011 Rundll32
T1218.012 Verclsid
T1218.013 Mavinject
T1218.014 MMC
T1218.015 Electron Applications

you should see Fourteen current sub-techniques, including Mshta (T1218.005) and Rundll32 (T1218.011).

grep
Prints the lines of text that match a pattern. Built into Linux and macOS.

jq patterns for ATT&CK

CommandWhat it does
.objects[] | select(.type=="attack-pattern")Every technique
.external_references[0].external_idThe T number
(.revoked|not) and (.x_mitre_deprecated|not)Only current objects
.kill_chain_phases[].phase_nameThe tactics a technique belongs to

What a defender takes away

  1. 1ATT&CK is data. Keep a pinned copy of the bundle next to your rules.
  2. 2Filter out revoked and deprecated objects before counting.
  3. 3Tactics are goals, techniques are methods, sub-techniques are specific variants.

Questions

0 of 2 solved

Answer each one from what you find on your lab machine.

  1. Show hint

    Filter out revoked and deprecated attack-pattern objects.

  2. Show hint

    Read `.kill_chain_phases[].phase_name`.