Enumerating Domain Trusts via NLTEST.EXE

Identifies the use of nltest.exe for domain trust discovery purposes. Adversaries may use this command-line utility to enumerate domain trusts and gain insight into trust relationships, as well as the state of Domain Controller (DC) replication in a Microsoft Windows NT Domain.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2022/05/31"
  3integration = ["endpoint", "windows", "system", "m365_defender", "crowdstrike"]
  4maturity = "production"
  5updated_date = "2024/10/31"
  6min_stack_version = "8.14.0"
  7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies the use of nltest.exe for domain trust discovery purposes. Adversaries may use this command-line utility to
 13enumerate domain trusts and gain insight into trust relationships, as well as the state of Domain Controller (DC)
 14replication in a Microsoft Windows NT Domain.
 15"""
 16false_positives = [
 17    """
 18    Domain administrators may use this command-line utility for legitimate information gathering purposes, but it is not
 19    common for environments with Windows Server 2012 and newer.
 20    """,
 21]
 22from = "now-9m"
 23index = [
 24    "winlogbeat-*",
 25    "logs-endpoint.events.process-*",
 26    "logs-windows.forwarded*",
 27    "logs-windows.sysmon_operational-*",
 28    "endgame-*",
 29    "logs-system.security*",
 30    "logs-m365_defender.event-*",
 31    "logs-crowdstrike.fdr*",
 32]
 33language = "eql"
 34license = "Elastic License v2"
 35name = "Enumerating Domain Trusts via NLTEST.EXE"
 36note = """## Triage and analysis
 37
 38### Investigating Enumerating Domain Trusts via NLTEST.EXE
 39
 40Active Directory (AD) domain trusts define relationships between domains within a Windows AD environment. In this setup, a "trusting" domain permits users from a "trusted" domain to access resources. These trust relationships can be configurable as one-way, two-way, transitive, or non-transitive, enabling controlled access and resource sharing across domains.
 41
 42This rule identifies the usage of the `nltest.exe` utility to enumerate domain trusts. Attackers can use this information to enable the next actions in a target environment, such as lateral movement.
 43
 44#### Possible investigation steps
 45
 46- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 47- Identify the user account that performed the action and whether it should perform this kind of action.
 48- Investigate other alerts associated with the user/host during the past 48 hours.
 49
 50### False positive analysis
 51
 52- Discovery activities are not inherently malicious if they occur in isolation and are done within the user business context (e.g., an administrator in this context). As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
 53
 54### Related rules
 55
 56- Enumerating Domain Trusts via DSQUERY.EXE - 06a7a03c-c735-47a6-a313-51c354aef6c3
 57
 58### Response and remediation
 59
 60- Initiate the incident response process based on the outcome of the triage.
 61- Isolate the involved hosts to prevent further post-compromise behavior.
 62- Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
 63- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 64- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 65- 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).
 66"""
 67references = [
 68    "https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc731935(v=ws.11)",
 69    "https://redcanary.com/blog/how-one-hospital-thwarted-a-ryuk-ransomware-outbreak/",
 70]
 71risk_score = 21
 72rule_id = "84da2554-e12a-11ec-b896-f661ea17fbcd"
 73severity = "low"
 74tags = [
 75    "Domain: Endpoint",
 76    "OS: Windows",
 77    "Use Case: Threat Detection",
 78    "Tactic: Discovery",
 79    "Data Source: Elastic Endgame",
 80    "Resources: Investigation Guide",
 81    "Data Source: Elastic Defend",
 82    "Data Source: System",
 83    "Data Source: Microsoft Defender for Endpoint",
 84    "Data Source: Sysmon",
 85    "Data Source: Crowdstrike",
 86]
 87timestamp_override = "event.ingested"
 88type = "eql"
 89
 90query = '''
 91process where host.os.type == "windows" and event.type == "start" and
 92    process.name : "nltest.exe" and process.args : (
 93        "/DCLIST:*", "/DCNAME:*", "/DSGET*",
 94        "/LSAQUERYFTI:*", "/PARENTDOMAIN",
 95        "/DOMAIN_TRUSTS", "/BDC_QUERY:*"
 96        ) and 
 97not process.parent.name : "PDQInventoryScanner.exe" and 
 98not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20")
 99'''
100
101
102[[rule.threat]]
103framework = "MITRE ATT&CK"
104[[rule.threat.technique]]
105id = "T1018"
106name = "Remote System Discovery"
107reference = "https://attack.mitre.org/techniques/T1018/"
108
109[[rule.threat.technique]]
110id = "T1482"
111name = "Domain Trust Discovery"
112reference = "https://attack.mitre.org/techniques/T1482/"
113
114
115[rule.threat.tactic]
116id = "TA0007"
117name = "Discovery"
118reference = "https://attack.mitre.org/tactics/TA0007/"

Triage and analysis

Investigating Enumerating Domain Trusts via NLTEST.EXE

Active Directory (AD) domain trusts define relationships between domains within a Windows AD environment. In this setup, a "trusting" domain permits users from a "trusted" domain to access resources. These trust relationships can be configurable as one-way, two-way, transitive, or non-transitive, enabling controlled access and resource sharing across domains.

This rule identifies the usage of the nltest.exe utility to enumerate domain trusts. Attackers can use this information to enable the next actions in a target environment, such as lateral movement.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Investigate other alerts associated with the user/host during the past 48 hours.

False positive analysis

  • Discovery activities are not inherently malicious if they occur in isolation and are done within the user business context (e.g., an administrator in this context). As long as the analyst did not identify suspicious activity related to the user or host, such alerts can be dismissed.
  • Enumerating Domain Trusts via DSQUERY.EXE - 06a7a03c-c735-47a6-a313-51c354aef6c3

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • 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).

References

Related rules

to-top