Skip to content

Commit

Permalink
[Detection Rules] Adding Documents for v8.8.15 Pre-Built Detection Ru…
Browse files Browse the repository at this point in the history
…les (#4320)

* Update latest docs

* Fixing broken links

* Updating message

---------

Co-authored-by: eric-forte-elastic <[email protected]>
  • Loading branch information
protectionsmachine and eric-forte-elastic authored Nov 28, 2023
1 parent 441f684 commit 93dac5a
Show file tree
Hide file tree
Showing 144 changed files with 5,765 additions and 184 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[[prebuilt-rule-8-8-15-access-of-stored-browser-credentials]]
=== Access of Stored Browser Credentials

Identifies the execution of a process with arguments pointing to known browser files that store passwords and cookies. Adversaries may acquire credentials from web browsers by reading files specific to the target browser.

*Rule type*: eql

*Rule indices*:

* logs-endpoint.events.*

*Severity*: high

*Risk score*: 73

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://securelist.com/calisto-trojan-for-macos/86543/

*Tags*:

* Domain: Endpoint
* OS: macOS
* Use Case: Threat Detection
* Tactic: Credential Access
* Data Source: Elastic Defend

*Version*: 106

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Rule query


[source, js]
----------------------------------
process where host.os.type == "macos" and event.type in ("start", "process_started") and
process.args :
(
"/Users/*/Library/Application Support/Google/Chrome/Default/Login Data",
"/Users/*/Library/Application Support/Google/Chrome/Default/Cookies",
"/Users/*/Library/Application Support/Google/Chrome/Profile*/Cookies",
"/Users/*/Library/Cookies*",
"/Users/*/Library/Application Support/Firefox/Profiles/*.default/cookies.sqlite",
"/Users/*/Library/Application Support/Firefox/Profiles/*.default/key*.db",
"/Users/*/Library/Application Support/Firefox/Profiles/*.default/logins.json",
"Login Data",
"Cookies.binarycookies",
"key4.db",
"key3.db",
"logins.json",
"cookies.sqlite"
) and
not (process.name : "wordexp-helper" and process.parent.name : ("elastic-agent", "elastic-endpoint"))
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Credential Access
** ID: TA0006
** Reference URL: https://attack.mitre.org/tactics/TA0006/
* Technique:
** Name: Steal Web Session Cookie
** ID: T1539
** Reference URL: https://attack.mitre.org/techniques/T1539/
* Technique:
** Name: Credentials from Password Stores
** ID: T1555
** Reference URL: https://attack.mitre.org/techniques/T1555/
* Sub-technique:
** Name: Credentials from Web Browsers
** ID: T1555.003
** Reference URL: https://attack.mitre.org/techniques/T1555/003/
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[[prebuilt-rule-8-8-15-access-to-keychain-credentials-directories]]
=== Access to Keychain Credentials Directories

Adversaries may collect the keychain storage data from a system to acquire credentials. Keychains are the built-in way for macOS to keep track of users' passwords and credentials for many services and features such as WiFi passwords, websites, secure notes and certificates.

*Rule type*: eql

*Rule indices*:

* logs-endpoint.events.*

*Severity*: high

*Risk score*: 73

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://objective-see.com/blog/blog_0x25.html
* https://securelist.com/calisto-trojan-for-macos/86543/

*Tags*:

* Domain: Endpoint
* OS: macOS
* Use Case: Threat Detection
* Tactic: Credential Access
* Data Source: Elastic Defend

*Version*: 106

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Rule query


[source, js]
----------------------------------
process where host.os.type == "macos" and event.type in ("start", "process_started") and
process.args :
(
"/Users/*/Library/Keychains/*",
"/Library/Keychains/*",
"/Network/Library/Keychains/*",
"System.keychain",
"login.keychain-db",
"login.keychain"
) and
not process.args : ("find-certificate",
"add-trusted-cert",
"set-keychain-settings",
"delete-certificate",
"/Users/*/Library/Keychains/openvpn.keychain-db",
"show-keychain-info",
"lock-keychain",
"set-key-partition-list",
"import",
"find-identity") and
not process.parent.executable :
(
"/Applications/OpenVPN Connect/OpenVPN Connect.app/Contents/MacOS/OpenVPN Connect",
"/Applications/Microsoft Defender.app/Contents/MacOS/wdavdaemon_enterprise.app/Contents/MacOS/wdavdaemon_enterprise",
"/opt/jc/bin/jumpcloud-agent"
) and
not process.executable : "/opt/jc/bin/jumpcloud-agent"
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Credential Access
** ID: TA0006
** Reference URL: https://attack.mitre.org/tactics/TA0006/
* Technique:
** Name: Credentials from Password Stores
** ID: T1555
** Reference URL: https://attack.mitre.org/techniques/T1555/
* Sub-technique:
** Name: Keychain
** ID: T1555.001
** Reference URL: https://attack.mitre.org/techniques/T1555/001/
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
[[prebuilt-rule-8-8-15-account-configured-with-never-expiring-password]]
=== Account Configured with Never-Expiring Password

Detects the creation and modification of an account with the "Don't Expire Password" option Enabled. Attackers can abuse this misconfiguration to persist in the domain and maintain long-term access using compromised accounts with this property.

*Rule type*: query

*Rule indices*:

* winlogbeat-*
* logs-system.*
* logs-windows.*

*Severity*: medium

*Risk score*: 47

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://www.cert.ssi.gouv.fr/uploads/guide-ad.html#dont_expire
* http://web.archive.org/web/20230329171952/https://blog.menasec.net/2019/02/threat-hunting-26-persistent-password.html

*Tags*:

* Domain: Endpoint
* OS: Windows
* Use Case: Threat Detection
* Tactic: Persistence
* Data Source: Active Directory
* Resources: Investigation Guide
* Use Case: Active Directory Monitoring

*Version*: 108

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Investigation guide


[source, markdown]
----------------------------------
## Triage and analysis
### Investigating Account Configured with Never-Expiring Password
Active Directory provides a setting that prevents users' passwords from expiring. Enabling this setting is bad practice and can expose environments to vulnerabilities that weaken security posture, especially when these accounts are privileged.
The setting is usually configured so a user account can act as a service account. Attackers can abuse these accounts to persist in the domain and maintain long-term access using compromised accounts with a never-expiring password set.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/source host during the past 48 hours.
- Inspect the account for suspicious or abnormal behaviors in the alert timeframe.
### False positive analysis
- This activity should not happen legitimately. The security team should address any potential benign true positive (B-TP), as this configuration can put the user and the domain at risk.
- Using user accounts as service accounts is a bad security practice and should not be allowed in the domain. The security team should map and monitor potential benign true positives (B-TPs), especially if the account is privileged. For cases in which user accounts cannot be avoided, Microsoft provides the Group Managed Service Accounts (gMSA) feature, which ensures that the account password is robust and changed regularly and automatically.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Review the privileges assigned to the user to ensure that the least privilege principle is being followed.
- Reset the password of the account and update its password settings.
- Search for other occurrences on the domain.
- Using the [Active Directory PowerShell module](https://docs.microsoft.com/en-us/powershell/module/activedirectory/get-aduser):
- `get-aduser -filter { passwordNeverExpires -eq $true -and enabled -eq $true } | ft`
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
----------------------------------

==== Rule query


[source, js]
----------------------------------
event.action:"modified-user-account" and winlog.api:"wineventlog" and event.code:"4738" and
message:"'Don't Expire Password' - Enabled" and not user.id:"S-1-5-18"
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Persistence
** ID: TA0003
** Reference URL: https://attack.mitre.org/tactics/TA0003/
* Technique:
** Name: Account Manipulation
** ID: T1098
** Reference URL: https://attack.mitre.org/techniques/T1098/
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[[prebuilt-rule-8-8-15-apple-script-execution-followed-by-network-connection]]
=== Apple Script Execution followed by Network Connection

Detects execution via the Apple script interpreter (osascript) followed by a network connection from the same process within a short time period. Adversaries may use malicious scripts for execution and command and control.

*Rule type*: eql

*Rule indices*:

* logs-endpoint.events.*

*Severity*: medium

*Risk score*: 47

*Runs every*: 5m

*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)

*Maximum alerts per execution*: 100

*References*:

* https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/index.html
* https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml

*Tags*:

* Domain: Endpoint
* OS: macOS
* Use Case: Threat Detection
* Tactic: Command and Control
* Tactic: Execution
* Data Source: Elastic Defend

*Version*: 105

*Rule authors*:

* Elastic

*Rule license*: Elastic License v2


==== Rule query


[source, js]
----------------------------------
sequence by host.id, process.entity_id with maxspan=30s
[process where host.os.type == "macos" and event.type == "start" and process.name == "osascript"]
[network where host.os.type == "macos" and event.type != "end" and process.name == "osascript" and destination.ip != "::1" and
not cidrmatch(destination.ip,
"10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24", "192.0.0.0/29", "192.0.0.8/32",
"192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32", "192.0.2.0/24", "192.31.196.0/24",
"192.52.193.0/24", "192.168.0.0/16", "192.88.99.0/24", "224.0.0.0/4", "100.64.0.0/10", "192.175.48.0/24",
"198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1", "FE80::/10", "FF00::/8")]
----------------------------------

*Framework*: MITRE ATT&CK^TM^

* Tactic:
** Name: Execution
** ID: TA0002
** Reference URL: https://attack.mitre.org/tactics/TA0002/
* Technique:
** Name: Command and Scripting Interpreter
** ID: T1059
** Reference URL: https://attack.mitre.org/techniques/T1059/
* Sub-technique:
** Name: AppleScript
** ID: T1059.002
** Reference URL: https://attack.mitre.org/techniques/T1059/002/
* Tactic:
** Name: Command and Control
** ID: TA0011
** Reference URL: https://attack.mitre.org/tactics/TA0011/
* Technique:
** Name: Ingress Tool Transfer
** ID: T1105
** Reference URL: https://attack.mitre.org/techniques/T1105/
Loading

0 comments on commit 93dac5a

Please sign in to comment.