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"]
  4maturity = "production"
  5updated_date = "2024/05/21"
  6
  7[rule]
  8author = ["Elastic"]
  9description = """
 10Identifies the use of nltest.exe for domain trust discovery purposes. Adversaries may use this command-line utility to
 11enumerate domain trusts and gain insight into trust relationships, as well as the state of Domain Controller (DC)
 12replication in a Microsoft Windows NT Domain.
 13"""
 14false_positives = [
 15    """
 16    Domain administrators may use this command-line utility for legitimate information gathering purposes, but it is not
 17    common for environments with Windows Server 2012 and newer.
 18    """,
 19]
 20from = "now-9m"
 21index = [
 22    "winlogbeat-*",
 23    "logs-endpoint.events.process-*",
 24    "logs-windows.*",
 25    "endgame-*",
 26    "logs-system.security*",
 27]
 28language = "eql"
 29license = "Elastic License v2"
 30name = "Enumerating Domain Trusts via NLTEST.EXE"
 31note = """## Triage and analysis
 32
 33### Investigating Enumerating Domain Trusts via NLTEST.EXE
 34
 35Active 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.
 36
 37This 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.
 38
 39#### Possible investigation steps
 40
 41- 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.
 42- Identify the user account that performed the action and whether it should perform this kind of action.
 43- Investigate other alerts associated with the user/host during the past 48 hours.
 44
 45### False positive analysis
 46
 47- 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.
 48
 49### Related rules
 50
 51- Enumerating Domain Trusts via DSQUERY.EXE - 06a7a03c-c735-47a6-a313-51c354aef6c3
 52
 53### Response and remediation
 54
 55- Initiate the incident response process based on the outcome of the triage.
 56- Isolate the involved hosts to prevent further post-compromise behavior.
 57- Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
 58- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 59- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 60- 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).
 61"""
 62references = [
 63    "https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc731935(v=ws.11)",
 64    "https://redcanary.com/blog/how-one-hospital-thwarted-a-ryuk-ransomware-outbreak/",
 65]
 66risk_score = 21
 67rule_id = "84da2554-e12a-11ec-b896-f661ea17fbcd"
 68severity = "low"
 69tags = [
 70    "Domain: Endpoint",
 71    "OS: Windows",
 72    "Use Case: Threat Detection",
 73    "Tactic: Discovery",
 74    "Data Source: Elastic Endgame",
 75    "Resources: Investigation Guide",
 76    "Data Source: Elastic Defend",
 77]
 78timestamp_override = "event.ingested"
 79type = "eql"
 80
 81query = '''
 82process where host.os.type == "windows" and event.type == "start" and
 83    process.name : "nltest.exe" and process.args : (
 84        "/DCLIST:*", "/DCNAME:*", "/DSGET*",
 85        "/LSAQUERYFTI:*", "/PARENTDOMAIN",
 86        "/DOMAIN_TRUSTS", "/BDC_QUERY:*"
 87        ) and 
 88not process.parent.name : "PDQInventoryScanner.exe" and 
 89not user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20")
 90'''
 91
 92
 93[[rule.threat]]
 94framework = "MITRE ATT&CK"
 95[[rule.threat.technique]]
 96id = "T1018"
 97name = "Remote System Discovery"
 98reference = "https://attack.mitre.org/techniques/T1018/"
 99
100[[rule.threat.technique]]
101id = "T1482"
102name = "Domain Trust Discovery"
103reference = "https://attack.mitre.org/techniques/T1482/"
104
105
106[rule.threat.tactic]
107id = "TA0007"
108name = "Discovery"
109reference = "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