MacOS Keychains Dumped


Description

Detects command-line attempts to access or dump macOS Keychain data using native utilities or direct file access. This includes credential dumping via the security utility (e.g. dump-keychain -d), bulk certificate export using security find-certificate, and direct file copying of Keychain database files using utilities such as cat. Keychain files are located in ~/Library/Keychains/, /Library/Keychains/, and /Network/Library/Keychains/. This technique is commonly associated with post-exploitation credential harvesting, where an attacker with local access seeks to escalate privileges or move laterally by obtaining stored credentials for applications, Wi-Fi networks, system services, and certificates.

Query · spl

| tstats `security_content_summariesonly`
  count min(_time) as firstTime
        max(_time) as lastTime
        values(Processes.parent_process) AS parent_process
        values(Processes.parent_process_exec) AS parent_process_exec
        values(Processes.parent_process_id) AS parent_process_id
        values(Processes.parent_process_name) AS parent_process_name
        values(Processes.parent_process_path) AS parent_process_path

FROM datamodel=Endpoint.Processes WHERE
(
    Processes.process_path="/usr/bin/security"
    AND
    (
        (
            Processes.process="*dump-keychain*"
            Processes.process="*-d*"
        )
        OR
        (
            Processes.process="*find-certificate*"
            Processes.process="*-p*"
        )
    )
)
OR
Processes.process="*keychaindump*"
OR
(
    Processes.process_name IN (
        "cat",
        "cp",
        "dd",
        "mv"
    )
    Processes.process="*Library/Keychains/*"
    Processes.process="*.keychain*"
)
by Processes.action Processes.dest Processes.process Processes.process_hash
Processes.process_id Processes.process_name Processes.process_path
Processes.user Processes.vendor_product

| `drop_dm_object_name(Processes)`
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `macos_keychains_dumped_filter`

Implementation guide

This detection uses osquery and endpoint security on MacOS. Follow the link in references, which describes how to setup process auditing in MacOS with endpoint security and osquery. Also the TA-OSquery must be deployed across your indexers and universal forwarders in order to have the osquery data populate the data models.

Known false positives

  • Administrators accessing keychain files for troubleshooting or endpoint management.

Analyst notes

Known false positives: Administrators accessing keychain files for troubleshooting or endpoint management.

Raw source MacOS Keychains Dumped · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: MacOS Keychains Dumped
id: dcb45a09-5e6f-441e-b2f8-cbbf923e36d9
version: 4
creation_date: '2026-04-14'
modification_date: '2026-05-13'
author: Raven Tait, Jamie Windley, Splunk
status: production
type: TTP
description: |-
    Detects command-line attempts to access or dump macOS Keychain data using native utilities or direct file access.
    This includes credential dumping via the `security` utility (e.g. `dump-keychain -d`), bulk certificate export using `security find-certificate`, and direct file copying of Keychain database files using utilities such as `cat`.
    Keychain files are located in `~/Library/Keychains/`, `/Library/Keychains/`, and `/Network/Library/Keychains/`.
    This technique is commonly associated with post-exploitation credential harvesting, where an attacker with local access seeks to escalate privileges or move laterally by obtaining stored credentials for applications, Wi-Fi networks, system services, and certificates.
data_source:
    - Osquery Results
search: |-
    | tstats `security_content_summariesonly`
      count min(_time) as firstTime
            max(_time) as lastTime
            values(Processes.parent_process) AS parent_process
            values(Processes.parent_process_exec) AS parent_process_exec
            values(Processes.parent_process_id) AS parent_process_id
            values(Processes.parent_process_name) AS parent_process_name
            values(Processes.parent_process_path) AS parent_process_path

    FROM datamodel=Endpoint.Processes WHERE
    (
        Processes.process_path="/usr/bin/security"
        AND
        (
            (
                Processes.process="*dump-keychain*"
                Processes.process="*-d*"
            )
            OR
            (
                Processes.process="*find-certificate*"
                Processes.process="*-p*"
            )
        )
    )
    OR
    Processes.process="*keychaindump*"
    OR
    (
        Processes.process_name IN (
            "cat",
            "cp",
            "dd",
            "mv"
        )
        Processes.process="*Library/Keychains/*"
        Processes.process="*.keychain*"
    )
    by Processes.action Processes.dest Processes.process Processes.process_hash
    Processes.process_id Processes.process_name Processes.process_path
    Processes.user Processes.vendor_product

    | `drop_dm_object_name(Processes)`
    | `security_content_ctime(firstTime)`
    | `security_content_ctime(lastTime)`
    | `macos_keychains_dumped_filter`
how_to_implement: |-
    This detection uses osquery and endpoint security on MacOS. Follow the link in references, which describes how to setup process auditing in MacOS with endpoint security and osquery.
    Also the [TA-OSquery](https://splunkbase.splunk.com/app/8574) must be deployed across your indexers and universal forwarders in order to have the osquery data populate the data models.
known_false_positives: |-
    Administrators accessing keychain files for troubleshooting or endpoint management.
references:
    - https://osquery.readthedocs.io/en/stable/deployment/process-auditing/
    - https://gist.github.com/hfeeki/88c12f01d00534e09a84
    - https://ss64.com/mac/security-keychain-settings.html
    - https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1555.001/T1555.001.md
drilldown_searches:
    - name: View the detection results for - "$user$" and "$dest$"
      search: '%original_detection_search% | search  user = "$user$" dest = "$dest$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$user$" and "$dest$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$", "$dest$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
finding:
    title: Keychains dumped on $dest$ by $user$ via $process$
    entity:
        field: user
        type: user
        score: 50
intermediate_findings:
    entities:
        - field: dest
          type: system
          score: 50
          message: Keychains dumped on $dest$ by $user$ via $process$
analytic_story:
    - MacOS Privilege Escalation
asset_type: Endpoint
mitre_attack_id:
    - T1555.001
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: endpoint
security_domain: endpoint
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1555.001/osquery_keychains/osquery.log
          source: osquery
          sourcetype: osquery:results
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.