Repository navigation
Indicators
Indicators highlight events worth looking at. Each indicator is a predicate on one event's record, or a sequence of several events, with a name, a description, a severity, an ATT&CK tactic and an SF Symbol. The Security Extension runs them on every event it captures, for Mac Monitor and for every macmonitor stream. Each record lists what it matched under indicators.
- Event tables: a dot, the indicator's symbol, the event's label in its color, or any mix. Edit an indicator to choose.
- Event Facts: the Indicators button in the toolbar lists what the event matched, and what its correlated events and its process group matched.
- Event Facts > Correlation: cards for the indicators matched among the events of the process an exec created.
- Event Facts > Groups: cards for the indicators matched among a process group's or session's execs.
- Filters > Indicators > Any indicator: shows only the events of every indicator that's on.
-
Command line:
sudo macmonitor stream --indicator 'Property list modified'streams only the events that matched one.
Pack 3, which ships with 3.3, has 48. Tactics follow ATT&CK v19, which splits Defense Evasion into Stealth and Defense Impairment. A few of their predicates include:
| Indicator | Predicate |
|---|---|
| Quarantine attribute removed | event.deleteextattr != nil AND event.deleteextattr.extattr ENDSWITH "apple.quarantine" |
| Reflective loading (T1620) | (event.create != nil OR event.write != nil OR event.mmap != nil) AND target_path CONTAINS "/NSCreateObjectFileImageFromMemory-" |
| New executable |
event.exec != nil AND event.exec.executable_age_ms >= 0 AND event.exec.executable_age_ms < 1000: the binary was created less than a second before it ran |
| Mach-O written | event.close != nil AND event.close.mach_o_type IN {"MH_EXECUTE", "MH_DYLIB", "MH_BUNDLE"} |
Settings > Indicators and sudo macmonitor indicators show NAME show each one in full.
- Settings > Indicators lists them by tactic. You can edit any indicator, turn it off, or use Restore Defaults... to bring Mac Monitor's own back.
-
Add Indicator: write the predicate as you would in the predicate editor. A preview shows what it matches among the events on screen.
- Choose Representative Event starts the predicate from a recorded event's key facts, one clause per line, for you to trim.
-
Import and Export share indicators as JSON.
sudo macmonitor indicatorsdoes the same from a terminal. - The set belongs to the Mac, not to each user. Indicators you made in 3.0 are offered for import once, in Settings > Indicators.
- A predicate has to name its event type, as
event.exec != nildoes, and compare keys the record has. It can't useSUBQUERY,MATCHES,ALLorBETWEEN, andLIKEtakes*only. Settings andmacmonitorsay why when one can't run. - Some marks are still built in and aren't listed in Settings, such as the signing seal, Root user and File Quarantine-aware.
An indicator on one event, Mach-O written. Save it as a .json file and bring it in with Import; with no id, Mac Monitor gives it a new one:
{
"name": "Mach-O written",
"description": "Wrote a Mach-O executable, dynamic library or bundle, whatever its name.",
"severity": "medium",
"tactic": "commandAndControl",
"technique": "T1105",
"symbol": "arrow.down.doc",
"color": "orange",
"tableMarks": ["dot"],
"predicate": "event.close != nil AND event.close.mach_o_type IN {\"MH_EXECUTE\", \"MH_DYLIB\", \"MH_BUNDLE\"}"
}An indicator can read what XProtect's rules found in a written file or a script, a network flow, and where the program an exec runs was downloaded from.
event.close != nil AND event.close.yara_scan.rules.@count > event.close.yara_scan.report_only.@count
event.new_flow != nil AND event.new_flow.remote_hostname == nil AND event.new_flow.remote_address_scope == "public"
event.exec != nil AND ANY event.exec.where_froms BEGINSWITH "http://"
-
yara_scan, on a close, a rename and an exec:status,xprotect_version, and the arraysrules,namesandreport_only. -
event.new_flowandevent.flow_closed:remote_hostname,remote_endpoint.address,remote_endpoint.port,remote_address_scope,local_endpoint.address,local_endpoint.port,url,first_party_site,direction, andsource_app, the app a delegated socket acts for, with keys such assource_app.signing_id.event.flow_closedalso hasbytes_inbound_countandbytes_outbound_count. - A flow's record has no
es_event_type, so its predicate names it withevent.new_flow != nilorevent.flow_closed != nil. - A close, rename or exec has
yara_scanonly while Settings > General > Enrichment > Scan written files with XProtect's rules is on, or a stream has--yara-scan. Flows are recorded while Record network flows is on, or a stream names them orall. -
event.exec.where_froms: the URLs the program the exec runs was downloaded from, forANY. They're read from the script it runs, or its executable, or the bundle either one is the main executable of. -
.@countcounts an array of the record, as a number:event.exec != nil AND event.exec.args.@count > 20. It compares with a number, or with another field that's a number, such as another array's.@count. - Under
indicators, each indicator'smatchedlists the values that made it match. ForANYthat's the string that decided it, with!=as well, and for.@countthe array's size. - Scans, flows and
where_fromsare in the record, so the predicate search andmacmonitor stream --predicateread them too. - An indicator that reads them, or counts with
.@count, needs Mac Monitor 3.3 or later.
An indicator can read the ancestors of an event's process, on any event type it names. The Security Extension tracks them while a trace runs.
event.exec != nil AND lineage.origin.signing_id == "com.apple.Terminal"
event.close != nil AND ANY lineage.paths ENDSWITH "/zsh"
event.exec != nil AND launched_by.parent.signing_id == "com.apple.Safari"
event.close != nil AND lineage.process.command_line CONTAINS " -o /tmp/"
-
lineagefollows the processes that forked the event's process.launched_byfollows its launched-by parents, as the process tree shows them, where an XPC service's parent is its host app and not launchd. -
One ancestor:
parent,grandparentandorigin, the first ancestor below launchd. Each hasexecutable.path,command_line,signing_id,team_idandcodesigning_type. -
Every ancestor, nearest first, for
ANY:paths,command_lines,signing_ids,team_idsandcodesigning_types. A process is given at most 8 ancestors: its nearest, and the first below launchd. -
lineage.process.command_line: the command line of the event's own process. On an exec, that's the program that called exec. The program it starts hasevent.exec.command_line. - On an exec, the fields read the ancestors of the program it starts.
- A field of an ancestor the process doesn't have is
nil. - Only an indicator reads these fields. They aren't in the record, so the predicate search and
macmonitor stream --predicaterefuse them. Exec and fork records list the ancestors asancestor_keys. - An indicator that reads them needs Mac Monitor 3.2 or later, and one that reads
lineage.process.command_line3.3 or later.
A predicate can compare one field of an event with another field of the same event:
event.exec != nil AND event.exec.target.team_id != process.team_id
-
Two strings:
==,!=,BEGINSWITHandENDSWITH, with[c]and[d]as with a constant. -
Two numbers, a Boolean counting as one:
==,!=,<,<=,>and>=. - Both sides have to be the same kind.
CONTAINS,LIKEandINcompare with constants only, and an array is compared with a constant throughANY. - Two missing values are equal. A missing value differs from every present one, so
!=is true when only one side has a value: add!= nilfor a side that has to be there.BEGINSWITHandENDSWITHare false with either side missing.
A sequence is one indicator whose evidence is several events. Each step is a predicate on one event's record, and the steps must match within a time window, tied together by values their events share. Only the event that completes the chain is marked; the earlier steps' events aren't.
-
Steps: 2 to 8, each with a
name(a lowercase letter, then lowercase letters, digits and underscores) and apredicate, written as a rule on one event is. -
within: the most seconds from the first step's event to the last's, from 1 to 86,400 (a day). -
order:orderedneeds the steps in the order they're listed, by event time, and needs every step.unorderedtakes them in any order. -
by: up to 8 key paths every step's event must share, such asprocess.audit_token.pidandprocess.audit_token.pidversion, which together name one process. An unordered sequence needsby. -
join: for an ordered sequence whose key changes from step to step, a step can require that one of its fields equal a field of an earlier step's event, such as the file a download wrote and then ran. Up to 8 per step. An ordered sequence ties each later step withbyor ajoin. -
atLeast: how many steps must match, from 2 to all of them. It defaults to all, and an ordered sequence must use all.
A written Mach-O made executable within 5 seconds, ready to import:
{
"kind": "sequence",
"name": "Written Mach-O made executable",
"description": "Wrote a Mach-O executable, then made it executable within 5 seconds.",
"severity": "medium",
"tactic": "execution",
"symbol": "arrow.down.doc",
"color": "orange",
"sequence": {
"order": "ordered",
"within": 5,
"by": [],
"steps": [
{ "name": "write",
"predicate": "event.close != nil AND event.close.modified == YES AND event.close.mach_o_type == \"MH_EXECUTE\"" },
{ "name": "executable",
"predicate": "event.setmode != nil AND ANY event.setmode.mode_added == \"executable\"",
"join": [ { "field": "target_path", "step": "write", "stepField": "target_path" } ] }
]
}
}One process writing at least 3 of 4 kinds of file within 2 minutes, ready to import:
{
"kind": "sequence",
"name": "Several kinds of file written",
"description": "One process wrote at least 3 of PDFs, text files, SSH keys and Swift source within 2 minutes.",
"severity": "low",
"tactic": "collection",
"symbol": "doc.on.doc",
"color": "yellow",
"sequence": {
"order": "unordered",
"within": 120,
"by": ["process.audit_token.pid", "process.audit_token.pidversion"],
"atLeast": 3,
"steps": [
{ "name": "pdf", "predicate": "event.close != nil AND target_path ENDSWITH \".pdf\"" },
{ "name": "text", "predicate": "event.close != nil AND target_path ENDSWITH \".txt\"" },
{ "name": "key", "predicate": "event.close != nil AND target_path ENDSWITH \"id_ed25519\"" },
{ "name": "source", "predicate": "event.close != nil AND target_path ENDSWITH \".swift\"" }
]
}
}- Write a sequence in an indicator file and bring it in with Import or
sudo macmonitor indicators import. Settings and Event Facts show its order, window, keys and each step with its joins, but the editor can't change them. - Mac Monitor refuses a sequence it can't run and says why, such as a step that joins a step after it or a key path the telemetry schema doesn't have.
- A sequence needs Mac Monitor 3.2 or later.