Detection rule
Suspicious Process Patterns NTDS.DIT Exfil
Overview
Detects suspicious process patterns used in NTDS.DIT exfiltration
- Rule id
8bc64091-6875-4881-aaf9-7bd25b5dda08- ATT&CK techniques
- T1003.003 OS Credential Dumping: NTDS
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- The Gentlemen, Akira, safepay, Play, nightspire
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- SIEM-validatedRun in a real SIEM, with a recorded result.
3 of 3 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.
Detection logic and queries
Queries are shown exactly as generated. Test them in your environment before you deploy them.
Sigma
Sigma (YAML) · 8bc64091-6875-4881-aaf9-7bd25b5dda08
title: Suspicious Process Patterns NTDS.DIT Exfil
id: 8bc64091-6875-4881-aaf9-7bd25b5dda08
status: test
description: Detects suspicious process patterns used in NTDS.DIT exfiltration
references:
- https://www.ired.team/offensive-security/credential-access-and-credential-dumping/ntds.dit-enumeration
- https://www.n00py.io/2022/03/manipulating-user-passwords-without-mimikatz/
- https://pentestlab.blog/tag/ntds-dit/
- https://github.com/samratashok/nishang/blob/414ee1104526d7057f9adaeee196d91ae447283e/Gather/Copy-VSS.ps1
- https://github.com/zcgonvh/NTDSDumpEx
- https://github.com/rapid7/metasploit-framework/blob/d297adcebb5c1df6fe30b12ca79b161deb71571c/data/post/powershell/NTDSgrab.ps1
- https://blog.talosintelligence.com/recent-cyber-attack/
author: Florian Roth (Nextron Systems)
date: 2022-03-11
modified: 2022-11-10
tags:
- attack.credential-access
- attack.t1003.003
logsource:
product: windows
category: process_creation
detection:
selection_tool:
# https://github.com/zcgonvh/NTDSDumpEx
- Image|endswith:
- '\NTDSDump.exe'
- '\NTDSDumpEx.exe'
- CommandLine|contains|all:
# ntdsdumpex.exe -d ntds.dit -o hash.txt -s system.hiv
- 'ntds.dit'
- 'system.hiv'
- CommandLine|contains: 'NTDSgrab.ps1'
selection_oneliner_1:
# powershell "ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp' q q"
CommandLine|contains|all:
- 'ac i ntds'
- 'create full'
selection_onliner_2:
# cmd.exe /c copy z:\windows\ntds\ntds.dit c:\exfil\ntds.dit
CommandLine|contains|all:
- '/c copy '
- '\windows\ntds\ntds.dit'
selection_onliner_3:
# ntdsutil "activate instance ntds" "ifm" "create full c:\windows\temp\data\" "quit" "quit"
CommandLine|contains|all:
- 'activate instance ntds'
- 'create full'
selection_powershell:
CommandLine|contains|all:
- 'powershell'
- 'ntds.dit'
set1_selection_ntds_dit:
CommandLine|contains: 'ntds.dit'
set1_selection_image_folder:
- ParentImage|contains:
- '\apache'
- '\tomcat'
- '\AppData\'
- '\Temp\'
- '\Public\'
- '\PerfLogs\'
- Image|contains:
- '\apache'
- '\tomcat'
- '\AppData\'
- '\Temp\'
- '\Public\'
- '\PerfLogs\'
condition: 1 of selection* or all of set1*
falsepositives:
- Unknown
level: high
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_susp_ntds/info.ymlQRadar AQL
IBM QRadar AQL (hunting query)Hunting query
Hunting search for the Log Activity tab or the API. It is not a QRadar rule.
AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).
SELECT * FROM events WHERE devicetype=12 AND (((((LOWER("Process Path") LIKE '%\ntdsdump.exe' OR LOWER("Process Path") LIKE '%\ntdsdumpex.exe') OR (LOWER("Process Name") LIKE '%\ntdsdump.exe' OR LOWER("Process Name") LIKE '%\ntdsdumpex.exe')) OR (LOWER(Command) LIKE '%ntds.dit%' AND LOWER(Command) LIKE '%system.hiv%') OR LOWER(Command) LIKE '%ntdsgrab.ps1%') OR (LOWER(Command) LIKE '%ac i ntds%' AND LOWER(Command) LIKE '%create full%') OR (LOWER(Command) LIKE '%/c copy %' AND LOWER(Command) LIKE '%\windows\ntds\ntds.dit%') OR (LOWER(Command) LIKE '%activate instance ntds%' AND LOWER(Command) LIKE '%create full%') OR (LOWER(Command) LIKE '%powershell%' AND LOWER(Command) LIKE '%ntds.dit%')) OR (LOWER(Command) LIKE '%ntds.dit%' AND ((LOWER("Parent Process Path") LIKE '%\apache%' OR LOWER("Parent Process Path") LIKE '%\tomcat%' OR LOWER("Parent Process Path") LIKE '%\appdata\%' OR LOWER("Parent Process Path") LIKE '%\temp\%' OR LOWER("Parent Process Path") LIKE '%\public\%' OR LOWER("Parent Process Path") LIKE '%\perflogs\%') OR ((LOWER("Process Path") LIKE '%\apache%' OR LOWER("Process Path") LIKE '%\tomcat%' OR LOWER("Process Path") LIKE '%\appdata\%' OR LOWER("Process Path") LIKE '%\temp\%' OR LOWER("Process Path") LIKE '%\public\%' OR LOWER("Process Path") LIKE '%\perflogs\%') OR (LOWER("Process Name") LIKE '%\apache%' OR LOWER("Process Name") LIKE '%\tomcat%' OR LOWER("Process Name") LIKE '%\appdata\%' OR LOWER("Process Name") LIKE '%\temp\%' OR LOWER("Process Name") LIKE '%\public\%' OR LOWER("Process Name") LIKE '%\perflogs\%')))))QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: Suspicious Process Patterns NTDS.DIT Exfil- Rule type
- Event rule (Local)
- Log source types
- Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
Building blocks
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_tool(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Process Path / Process Nameends with:\NTDSDump.exe,\NTDSDumpEx.exeCommandcontains:ntds.dit,system.hivCommandcontains:NTDSgrab.ps1
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_oneliner_1(match)All test lines must match (AND).Commandcontains:ac i ntds,create full
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_onliner_2(match)All test lines must match (AND).Commandcontains:/c copy,\windows\ntds\ntds.dit
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_onliner_3(match)All test lines must match (AND).Commandcontains:activate instance ntds,create full
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_powershell(match)All test lines must match (AND).Commandcontains:powershell,ntds.dit
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:set1_selection_ntds_dit(match)All test lines must match (AND).Commandcontains:ntds.dit
BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:set1_selection_image_folder(match)Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.Parent Process Pathcontains:\apache,\tomcat,\AppData\,\Temp\,\Public\,\PerfLogs\Process Path / Process Namecontains:\apache,\tomcat,\AppData\,\Temp\,\Public\,\PerfLogs\
Main rule, option A (building blocks)
- when the event(s) were detected by one or more of these log source types:
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1 - when an event matches the condition built from these building blocks:
(ANY of [BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_tool, BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_oneliner_1, BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_onliner_2, BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_onliner_3, BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:selection_powershell]) OR (ALL of [BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:set1_selection_ntds_dit, BB:OffSet7:Suspicious Process Patterns NTDS DIT Exfil:set1_selection_image_folder])
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND (((((LOWER("Process Path") LIKE '%\ntdsdump.exe' OR LOWER("Process Path") LIKE '%\ntdsdumpex.exe') OR (LOWER("Process Name") LIKE '%\ntdsdump.exe' OR LOWER("Process Name") LIKE '%\ntdsdumpex.exe')) OR (LOWER(Command) LIKE '%ntds.dit%' AND LOWER(Command) LIKE '%system.hiv%') OR LOWER(Command) LIKE '%ntdsgrab.ps1%') OR (LOWER(Command) LIKE '%ac i ntds%' AND LOWER(Command) LIKE '%create full%') OR (LOWER(Command) LIKE '%/c copy %' AND LOWER(Command) LIKE '%\windows\ntds\ntds.dit%') OR (LOWER(Command) LIKE '%activate instance ntds%' AND LOWER(Command) LIKE '%create full%') OR (LOWER(Command) LIKE '%powershell%' AND LOWER(Command) LIKE '%ntds.dit%')) OR (LOWER(Command) LIKE '%ntds.dit%' AND ((LOWER("Parent Process Path") LIKE '%\apache%' OR LOWER("Parent Process Path") LIKE '%\tomcat%' OR LOWER("Parent Process Path") LIKE '%\appdata\%' OR LOWER("Parent Process Path") LIKE '%\temp\%' OR LOWER("Parent Process Path") LIKE '%\public\%' OR LOWER("Parent Process Path") LIKE '%\perflogs\%') OR ((LOWER("Process Path") LIKE '%\apache%' OR LOWER("Process Path") LIKE '%\tomcat%' OR LOWER("Process Path") LIKE '%\appdata\%' OR LOWER("Process Path") LIKE '%\temp\%' OR LOWER("Process Path") LIKE '%\public\%' OR LOWER("Process Path") LIKE '%\perflogs\%') OR (LOWER("Process Name") LIKE '%\apache%' OR LOWER("Process Name") LIKE '%\tomcat%' OR LOWER("Process Name") LIKE '%\appdata\%' OR LOWER("Process Name") LIKE '%\temp\%' OR LOWER("Process Name") LIKE '%\public\%' OR LOWER("Process Name") LIKE '%\perflogs\%')))))
Rule response
- Severity 7, credibility 6, relevance 7
- Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
- Respond no more than once per 30 minutes per Log Source (tune per environment)
Limitations
- QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.
Splunk
Splunk SPLSearch
Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.
Image IN ("*\\NTDSDump.exe", "*\\NTDSDumpEx.exe") OR (CommandLine="*ntds.dit*" CommandLine="*system.hiv*") OR CommandLine="*NTDSgrab.ps1*" OR (CommandLine="*ac i ntds*" CommandLine="*create full*") OR (CommandLine="*/c copy *" CommandLine="*\\windows\\ntds\\ntds.dit*") OR (CommandLine="*activate instance ntds*" CommandLine="*create full*") OR (CommandLine="*powershell*" CommandLine="*ntds.dit*") OR (CommandLine="*ntds.dit*" (ParentImage IN ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*") OR Image IN ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*")))Splunk savedsearches.conf stanzaScheduled search template
Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.
[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now
[Suspicious Process Patterns NTDS.DIT Exfil]
description = Detects suspicious process patterns used in NTDS.DIT exfiltration
search = Image IN ("*\\NTDSDump.exe", "*\\NTDSDumpEx.exe") OR (CommandLine="*ntds.dit*" CommandLine="*system.hiv*") OR CommandLine="*NTDSgrab.ps1*" OR (CommandLine="*ac i ntds*" CommandLine="*create full*") OR (CommandLine="*/c copy *" CommandLine="*\\windows\\ntds\\ntds.dit*") OR (CommandLine="*activate instance ntds*" CommandLine="*create full*") OR (CommandLine="*powershell*" CommandLine="*ntds.dit*") OR (CommandLine="*ntds.dit*" (ParentImage IN ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*") OR Image IN ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*")))Microsoft Sentinel
Microsoft Sentinel KQL (ASIM)Hunting query
Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.
imProcessCreate
| where (((TargetProcessName endswith "\\NTDSDump.exe" or TargetProcessName endswith "\\NTDSDumpEx.exe") or (TargetProcessCommandLine contains "ntds.dit" and TargetProcessCommandLine contains "system.hiv") or TargetProcessCommandLine contains "NTDSgrab.ps1") or (TargetProcessCommandLine contains "ac i ntds" and TargetProcessCommandLine contains "create full") or (TargetProcessCommandLine contains "/c copy " and TargetProcessCommandLine contains "\\windows\\ntds\\ntds.dit") or (TargetProcessCommandLine contains "activate instance ntds" and TargetProcessCommandLine contains "create full") or (TargetProcessCommandLine contains "powershell" and TargetProcessCommandLine contains "ntds.dit")) or (TargetProcessCommandLine contains "ntds.dit" and (((ParentProcessName contains "\\apache" or ParentProcessName contains "\\tomcat" or ParentProcessName contains "\\AppData\\" or ParentProcessName contains "\\Temp\\" or ParentProcessName contains "\\Public\\" or ParentProcessName contains "\\PerfLogs\\") or (ActingProcessName contains "\\apache" or ActingProcessName contains "\\tomcat" or ActingProcessName contains "\\AppData\\" or ActingProcessName contains "\\Temp\\" or ActingProcessName contains "\\Public\\" or ActingProcessName contains "\\PerfLogs\\")) or (TargetProcessName contains "\\apache" or TargetProcessName contains "\\tomcat" or TargetProcessName contains "\\AppData\\" or TargetProcessName contains "\\Temp\\" or TargetProcessName contains "\\Public\\" or TargetProcessName contains "\\PerfLogs\\")))Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (((FolderPath endswith "\\NTDSDump.exe" or FolderPath endswith "\\NTDSDumpEx.exe") or (ProcessCommandLine contains "ntds.dit" and ProcessCommandLine contains "system.hiv") or ProcessCommandLine contains "NTDSgrab.ps1") or (ProcessCommandLine contains "ac i ntds" and ProcessCommandLine contains "create full") or (ProcessCommandLine contains "/c copy " and ProcessCommandLine contains "\\windows\\ntds\\ntds.dit") or (ProcessCommandLine contains "activate instance ntds" and ProcessCommandLine contains "create full") or (ProcessCommandLine contains "powershell" and ProcessCommandLine contains "ntds.dit")) or (ProcessCommandLine contains "ntds.dit" and ((InitiatingProcessFolderPath contains "\\apache" or InitiatingProcessFolderPath contains "\\tomcat" or InitiatingProcessFolderPath contains "\\AppData\\" or InitiatingProcessFolderPath contains "\\Temp\\" or InitiatingProcessFolderPath contains "\\Public\\" or InitiatingProcessFolderPath contains "\\PerfLogs\\") or (FolderPath contains "\\apache" or FolderPath contains "\\tomcat" or FolderPath contains "\\AppData\\" or FolderPath contains "\\Temp\\" or FolderPath contains "\\Public\\" or FolderPath contains "\\PerfLogs\\")))Elastic
Elastic Lucene (ECS)Hunting query
Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.
(((process.executable:(*\\NTDSDump.exe OR *\\NTDSDumpEx.exe)) OR (process.command_line:*ntds.dit* AND process.command_line:*system.hiv*) OR process.command_line:*NTDSgrab.ps1*) OR (process.command_line:*ac\ i\ ntds* AND process.command_line:*create\ full*) OR (process.command_line:*\/c\ copy\ * AND process.command_line:*\\windows\\ntds\\ntds.dit*) OR (process.command_line:*activate\ instance\ ntds* AND process.command_line:*create\ full*) OR (process.command_line:*powershell* AND process.command_line:*ntds.dit*)) OR (process.command_line:*ntds.dit* AND ((process.parent.executable:(*\\apache* OR *\\tomcat* OR *\\AppData\\* OR *\\Temp\\* OR *\\Public\\* OR *\\PerfLogs\\*)) OR (process.executable:(*\\apache* OR *\\tomcat* OR *\\AppData\\* OR *\\Temp\\* OR *\\Public\\* OR *\\PerfLogs\\*))))Elastic EQL (ECS)Hunting query
EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.
any where (((process.executable like~ ("*\\NTDSDump.exe", "*\\NTDSDumpEx.exe")) or (process.command_line:"*ntds.dit*" and process.command_line:"*system.hiv*") or process.command_line:"*NTDSgrab.ps1*") or (process.command_line:"*ac i ntds*" and process.command_line:"*create full*") or (process.command_line:"*/c copy *" and process.command_line:"*\\windows\\ntds\\ntds.dit*") or (process.command_line:"*activate instance ntds*" and process.command_line:"*create full*") or (process.command_line:"*powershell*" and process.command_line:"*ntds.dit*")) or (process.command_line:"*ntds.dit*" and ((process.parent.executable like~ ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*")) or (process.executable like~ ("*\\apache*", "*\\tomcat*", "*\\AppData\\*", "*\\Temp\\*", "*\\Public\\*", "*\\PerfLogs\\*"))))Elastic ES|QL (ECS)Hunting query
ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.
from * metadata _id, _index, _version | where ends_with(process.executable, "\\NTDSDump.exe") or ends_with(process.executable, "\\NTDSDumpEx.exe") or process.command_line like "*ntds.dit*" and process.command_line like "*system.hiv*" or process.command_line like "*NTDSgrab.ps1*" or process.command_line like "*ac i ntds*" and process.command_line like "*create full*" or process.command_line like "*/c copy *" and process.command_line like "*\\\\windows\\\\ntds\\\\ntds.dit*" or process.command_line like "*activate instance ntds*" and process.command_line like "*create full*" or process.command_line like "*powershell*" and process.command_line like "*ntds.dit*" or process.command_line like "*ntds.dit*" and (process.parent.executable like "*\\\\apache*" or process.parent.executable like "*\\\\tomcat*" or process.parent.executable like "*\\\\AppData\\\\*" or process.parent.executable like "*\\\\Temp\\\\*" or process.parent.executable like "*\\\\Public\\\\*" or process.parent.executable like "*\\\\PerfLogs\\\\*" or process.executable like "*\\\\apache*" or process.executable like "*\\\\tomcat*" or process.executable like "*\\\\AppData\\\\*" or process.executable like "*\\\\Temp\\\\*" or process.executable like "*\\\\Public\\\\*" or process.executable like "*\\\\PerfLogs\\\\*")Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineImageParentImage
False positives
- Unknown
Investigation and response
No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.
References
- https://www.ired.team/offensive-security/credential-access-and-credential-dumping/ntds.dit-enumeration
- https://www.n00py.io/2022/03/manipulating-user-passwords-without-mimikatz/
- https://pentestlab.blog/tag/ntds-dit/
- https://github.com/samratashok/nishang/blob/414ee1104526d7057f9adaeee196d91ae447283e/Gather/Copy-VSS.ps1
- https://github.com/zcgonvh/NTDSDumpEx
- https://github.com/rapid7/metasploit-framework/blob/d297adcebb5c1df6fe30b12ca79b161deb71571c/data/post/powershell/NTDSgrab.ps1
- https://blog.talosintelligence.com/recent-cyber-attack/
Author and attribution
- Author
- Florian Roth (Nextron Systems)
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_susp_ntds.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2