Skip to content

Commit 4ef7245

Browse files
[Tuning] MacOS DR Tuning PR (#4546)
* [Tuning] MacOS DR Tuning PR * tunings * tuning * Update rules/macos/execution_scripting_osascript_exec_followed_by_netcon.toml * Update rules/macos/execution_installer_package_spawned_network_event.toml * Update rules/macos/execution_script_via_automator_workflows.toml * Update rules/macos/credential_access_systemkey_dumping.toml * Update rules/macos/credential_access_mitm_localhost_webproxy.toml * Update rules/macos/credential_access_promt_for_pwd_via_osascript.toml * Update rules/macos/defense_evasion_apple_softupdates_modification.toml * Update rules/macos/lateral_movement_credential_access_kerberos_bifrostconsole.toml * Update rules/macos/lateral_movement_remote_ssh_login_enabled.toml * Update rules/macos/persistence_finder_sync_plugin_pluginkit.toml * fix --------- Co-authored-by: shashank-elastic <[email protected]>
1 parent c58d59e commit 4ef7245

File tree

55 files changed

+318
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+318
-415
lines changed

rules/macos/credential_access_credentials_keychains.toml

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/08/14"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/04/21"
66

77
[rule]
88
author = ["Elastic"]
@@ -15,7 +15,7 @@ from = "now-9m"
1515
index = ["logs-endpoint.events.process*"]
1616
language = "eql"
1717
license = "Elastic License v2"
18-
name = "Access to Keychain Credentials Directories"
18+
name = "Keychain CommandLine Interaction via Unsigned or Untrusted Process"
1919
references = [
2020
"https://objective-see.com/blog/blog_0x25.html",
2121
"https://securelist.com/calisto-trojan-for-macos/86543/",
@@ -60,47 +60,18 @@ timestamp_override = "event.ingested"
6060
type = "eql"
6161

6262
query = '''
63-
process where host.os.type == "macos" and event.type in ("start", "process_started") and
64-
process.args :
65-
(
66-
"/Users/*/Library/Keychains/*",
67-
"/Library/Keychains/*",
68-
"/Network/Library/Keychains/*",
69-
"System.keychain",
70-
"login.keychain-db",
71-
"login.keychain"
72-
) and
73-
not process.args : ("find-certificate",
74-
"add-trusted-cert",
75-
"set-keychain-settings",
76-
"delete-certificate",
77-
"/Users/*/Library/Keychains/openvpn.keychain-db",
78-
"show-keychain-info",
79-
"lock-keychain",
80-
"set-key-partition-list",
81-
"import",
82-
"find-identity") and
83-
not process.parent.executable :
84-
(
85-
"/Applications/OpenVPN Connect/OpenVPN Connect.app/Contents/MacOS/OpenVPN Connect",
86-
"/Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon_enterprise.app/Contents/MacOS/wdavdaemon_enterprise",
87-
"/opt/jc/bin/jumpcloud-agent"
88-
) and
89-
not process.executable : ("/opt/jc/bin/jumpcloud-agent", "/usr/bin/basename") and
90-
not process.Ext.effective_parent.executable : ("/opt/rapid7/ir_agent/ir_agent",
91-
"/Library/Elastic/Endpoint/elastic-endpoint.app/Contents/MacOS/elastic-endpoint",
92-
"/Applications/QualysCloudAgent.app/Contents/MacOS/qualys-cloud-agent",
93-
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
94-
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService",
95-
"/usr/local/jamf/bin/jamf",
96-
"/Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon")
63+
process where host.os.type == "macos" and event.type in ("start", "process_started") and event.action == "exec" and
64+
process.args like ("/Users/*/Library/Keychains/*", "/Library/Keychains/*", "login.keychain-db", "login.keychain") and
65+
((process.code_signature.trusted == false or process.code_signature.exists == false) or
66+
(process.name in ("bash", "sh", "zsh", "osascript", "cat", "echo", "cp") and
67+
(process.parent.code_signature.trusted == false or process.parent.code_signature.exists == false)))
9768
'''
9869
note = """## Triage and analysis
9970
10071
> **Disclaimer**:
10172
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
10273
103-
### Investigating Access to Keychain Credentials Directories
74+
### Investigating Keychain CommandLine Interaction via Unsigned or Untrusted Process
10475
10576
macOS keychains securely store user credentials, such as passwords and certificates, essential for system and application authentication. Adversaries may target these directories to extract sensitive information, potentially compromising user accounts and system integrity. The detection rule identifies suspicious access attempts by monitoring process activities related to keychain directories, excluding known legitimate processes and actions, thus highlighting potential unauthorized access attempts.
10677

rules/macos/credential_access_dumping_hashes_bi_cmds.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/01/25"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -13,7 +13,7 @@ lateral movement.
1313
"""
1414
from = "now-9m"
1515
index = ["logs-endpoint.events.*"]
16-
language = "kuery"
16+
language = "eql"
1717
license = "Elastic License v2"
1818
name = "Dumping Account Hashes via Built-In Commands"
1919
references = [
@@ -57,11 +57,11 @@ tags = [
5757
"Resources: Investigation Guide",
5858
]
5959
timestamp_override = "event.ingested"
60-
type = "query"
60+
type = "eql"
6161

6262
query = '''
63-
event.category:process and host.os.type:macos and event.type:start and
64-
process.name:(defaults or mkpassdb) and process.args:(ShadowHashData or "-dump")
63+
process where host.os.type == "macos" and event.type in ("start", "process_started") and
64+
process.name in ("defaults", "mkpassdb") and process.args like~ ("ShadowHashData", "-dump")
6565
'''
6666
note = """## Triage and analysis
6767

rules/macos/credential_access_dumping_keychain_security.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/01/04"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -57,7 +57,8 @@ timestamp_override = "event.ingested"
5757
type = "eql"
5858

5959
query = '''
60-
process where host.os.type == "macos" and event.type in ("start", "process_started") and process.args : "dump-keychain" and process.args : "-d"
60+
process where host.os.type == "macos" and event.type in ("start", "process_started") and
61+
process.args like~ "dump-keychain" and process.args == "-d"
6162
'''
6263
note = """## Triage and analysis
6364

rules/macos/credential_access_kerberosdump_kcc.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/08/14"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -12,7 +12,7 @@ may attempt to dump credential material in the form of tickets that can be lever
1212
"""
1313
from = "now-9m"
1414
index = ["logs-endpoint.events.*"]
15-
language = "kuery"
15+
language = "eql"
1616
license = "Elastic License v2"
1717
name = "Kerberos Cached Credentials Dumping"
1818
references = [
@@ -56,12 +56,12 @@ tags = [
5656
"Resources: Investigation Guide",
5757
]
5858
timestamp_override = "event.ingested"
59-
type = "query"
59+
type = "eql"
6060

6161
query = '''
62-
event.category:process and host.os.type:macos and event.type:(start or process_started) and
63-
process.name:kcc and
64-
process.args:copy_cred_cache
62+
process where host.os.type == "macos" and event.type in ("start", "process_started") and
63+
process.name == "kcc" and
64+
process.args like~ "copy_cred_cache"
6565
'''
6666
note = """## Triage and analysis
6767

rules/macos/credential_access_keychain_pwd_retrieval_security_cmd.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/01/06"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -64,10 +64,10 @@ type = "eql"
6464

6565
query = '''
6666
process where host.os.type == "macos" and event.action == "exec" and
67-
process.name : "security" and
68-
process.args : ("-wa", "-ga") and process.args : ("find-generic-password", "find-internet-password") and
67+
process.name == "security" and
68+
process.args like ("-wa", "-ga") and process.args like~ ("find-generic-password", "find-internet-password") and
6969
process.command_line : ("*Chrome*", "*Chromium*", "*Opera*", "*Safari*", "*Brave*", "*Microsoft Edge*", "*Firefox*") and
70-
not process.parent.executable : "/Applications/Keeper Password Manager.app/Contents/Frameworks/Keeper Password Manager Helper*/Contents/MacOS/Keeper Password Manager Helper*"
70+
not process.parent.executable like "/Applications/Keeper Password Manager.app/Contents/Frameworks/Keeper Password Manager Helper*/Contents/MacOS/Keeper Password Manager Helper*"
7171
'''
7272
note = """## Triage and analysis
7373

rules/macos/credential_access_mitm_localhost_webproxy.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/01/05"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -13,7 +13,7 @@ hijack web browser traffic for credential access via traffic sniffing or redirec
1313
false_positives = ["Legitimate WebProxy Settings Modification"]
1414
from = "now-9m"
1515
index = ["logs-endpoint.events.*"]
16-
language = "kuery"
16+
language = "eql"
1717
license = "Elastic License v2"
1818
name = "WebProxy Settings Modification"
1919
references = [
@@ -57,15 +57,12 @@ tags = [
5757
"Resources: Investigation Guide",
5858
]
5959
timestamp_override = "event.ingested"
60-
type = "query"
60+
type = "eql"
6161

6262
query = '''
63-
event.category:process and host.os.type:macos and event.type:start and
64-
process.name : networksetup and process.args : (("-setwebproxy" or "-setsecurewebproxy" or "-setautoproxyurl") and not (Bluetooth or off)) and
65-
not process.parent.executable : ("/Library/PrivilegedHelperTools/com.80pct.FreedomHelper" or
66-
"/Applications/Fiddler Everywhere.app/Contents/Resources/app/out/WebServer/Fiddler.WebUi" or
67-
"/usr/libexec/xpcproxy") and
68-
not process.Ext.effective_parent.executable : ("/Applications/Proxyman.app/Contents/MacOS/Proxyman" or "/Applications/Incoggo.app/Contents/MacOS/Incoggo.app")
63+
process where host.os.type == "macos" and event.type in ("start", "process_started") and event.action == "exec" and
64+
process.name == "networksetup" and process.args like~ ("-setwebproxy", "-setsecurewebproxy", "-setautoproxyurl") and
65+
(process.parent.name like~ ("osascript", "bash", "sh", "zsh", "Terminal", "Python*") or (process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false))
6966
'''
7067
note = """## Triage and analysis
7168

rules/macos/credential_access_promt_for_pwd_via_osascript.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/11/16"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/04/21"
66

77
[rule]
88
author = ["Elastic"]
@@ -14,7 +14,7 @@ from = "now-9m"
1414
index = ["logs-endpoint.events.process*"]
1515
language = "eql"
1616
license = "Elastic License v2"
17-
name = "Prompt for Credentials with OSASCRIPT"
17+
name = "Prompt for Credentials with Osascript"
1818
references = [
1919
"https://github.com/EmpireProject/EmPyre/blob/master/lib/modules/collection/osx/prompt.py",
2020
"https://ss64.com/osx/osascript.html",
@@ -60,12 +60,14 @@ type = "eql"
6060

6161
query = '''
6262
process where event.action == "exec" and host.os.type == "macos" and
63-
process.name : "osascript" and process.args : "-e" and process.command_line : ("*osascript*display*dialog*password*", "*osascript*display*dialog*passphrase*") and
64-
not (process.parent.executable : "/usr/bin/sudo" and process.command_line : "*Encryption Key Escrow*") and
65-
not (process.command_line : "*-e with timeout of 3600 seconds*" and user.id == "0" and process.parent.executable : "/bin/bash") and
66-
not process.Ext.effective_parent.executable : ("/usr/local/jamf/*",
63+
process.name == "osascript" and process.args == "-e" and process.command_line like~ ("*osascript*display*dialog*password*", "*osascript*display*dialog*passphrase*", "*pass*display*dialog*") and
64+
not (process.parent.executable == "/usr/bin/sudo" and process.command_line like~ "*Encryption Key Escrow*") and
65+
not (process.command_line like~ "*-e with timeout of 3600 seconds*" and user.id like "0" and process.parent.executable == "/bin/bash") and
66+
not process.Ext.effective_parent.executable like~
67+
("/usr/local/jamf/*",
68+
"/Library/Intune/Microsoft Intune Agent.app/Contents/MacOS/IntuneMdmDaemon",
69+
"/Library/Application Support/Mosyle/MosyleMDM.app/Contents/MacOS/MosyleMDM",
6770
"/Applications/Karabiner-Elements.app/Contents/MacOS/Karabiner-Elements",
68-
"/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal",
6971
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon",
7072
"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfManagementService.app/Contents/MacOS/JamfManagementService")
7173
'''

rules/macos/credential_access_suspicious_web_browser_sensitive_file_access.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/01/04"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -57,15 +57,15 @@ type = "eql"
5757

5858
query = '''
5959
file where event.action == "open" and host.os.type == "macos" and process.executable != null and
60-
file.name : ("cookies.sqlite",
61-
"key?.db",
62-
"logins.json",
63-
"Cookies",
64-
"Cookies.binarycookies",
65-
"Login Data") and
66-
((process.code_signature.trusted == false or process.code_signature.exists == false) or process.name : "osascript") and
67-
not process.code_signature.signing_id : "org.mozilla.firefox" and
68-
not Effective_process.executable : "/Library/Elastic/Endpoint/elastic-endpoint.app/Contents/MacOS/elastic-endpoint"
60+
file.name like~ ("cookies.sqlite",
61+
"key?.db",
62+
"logins.json",
63+
"Cookies",
64+
"Cookies.binarycookies",
65+
"Login Data") and
66+
((process.code_signature.trusted == false or process.code_signature.exists == false) or process.name == "osascript") and
67+
not process.code_signature.signing_id == "org.mozilla.firefox" and
68+
not Effective_process.executable like "/Library/Elastic/Endpoint/elastic-endpoint.app/Contents/MacOS/elastic-endpoint"
6969
'''
7070
note = """## Triage and analysis
7171

rules/macos/credential_access_systemkey_dumping.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/01/07"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -13,7 +13,7 @@ keychain storage data from a system to acquire credentials.
1313
"""
1414
from = "now-9m"
1515
index = ["logs-endpoint.events.*"]
16-
language = "kuery"
16+
language = "eql"
1717
license = "Elastic License v2"
1818
name = "SystemKey Access via Command Line"
1919
references = ["https://github.com/AlessandroZ/LaZagne/blob/master/Mac/lazagne/softwares/system/chainbreaker.py"]
@@ -54,12 +54,12 @@ tags = [
5454
"Resources: Investigation Guide",
5555
]
5656
timestamp_override = "event.ingested"
57-
type = "query"
57+
type = "eql"
5858

5959
query = '''
60-
event.category:process and host.os.type:macos and event.type:(start or process_started) and
61-
process.args:("/private/var/db/SystemKey" or "/var/db/SystemKey") and
62-
not process.Ext.effective_parent.executable : "/Library/Elastic/Endpoint/elastic-endpoint.app/Contents/MacOS/elastic-endpoint"
60+
process where host.os.type == "macos" and event.type in ("start", "process_started") and
61+
process.args in ("/private/var/db/SystemKey", "/var/db/SystemKey") and
62+
not process.Ext.effective_parent.executable like "/Library/Elastic/Endpoint/elastic-endpoint.app/Contents/MacOS/elastic-endpoint"
6363
'''
6464
note = """## Triage and analysis
6565

rules/macos/defense_evasion_apple_softupdates_modification.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2021/01/15"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/15"
5+
updated_date = "2025/03/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -13,7 +13,7 @@ an attempt to disable security updates.
1313
false_positives = ["Authorized SoftwareUpdate Settings Changes"]
1414
from = "now-9m"
1515
index = ["logs-endpoint.events.*"]
16-
language = "kuery"
16+
language = "eql"
1717
license = "Elastic License v2"
1818
name = "SoftwareUpdate Preferences Modification"
1919
references = ["https://blog.checkpoint.com/2017/07/13/osxdok-refuses-go-away-money/"]
@@ -54,12 +54,12 @@ tags = [
5454
"Resources: Investigation Guide",
5555
]
5656
timestamp_override = "event.ingested"
57-
type = "query"
57+
type = "eql"
5858

5959
query = '''
60-
event.category:process and host.os.type:macos and event.type:(start or process_started) and
61-
process.name:defaults and
62-
process.args:(write and "-bool" and (com.apple.SoftwareUpdate or /Library/Preferences/com.apple.SoftwareUpdate.plist) and not (TRUE or true))
60+
process where host.os.type == "macos" and event.type in ("start", "process_started") and
61+
process.name == "defaults" and
62+
process.args like "write" and process.args like "-bool" and process.args like~ ("com.apple.SoftwareUpdate", "/Library/Preferences/com.apple.SoftwareUpdate.plist") and not process.args like ("TRUE", "true")
6363
'''
6464
note = """## Triage and analysis
6565

0 commit comments

Comments
 (0)