Latest alertCVE-2018-11776 in Apache Struts Confirmed Exploited in the WildRead
Search all news in the platform

Detection rule

Potential Recon Activity Via Nltest.EXE

MediumTest-data validatedSigmaHQ (community)T1016T1482

Overview

Detects nltest commands that can be used for information discovery

Rule id
5cc90652-4cbd-4241-aa3b-4b462fa5a248
ATT&CK techniques
T1016 System Network Configuration Discovery, T1482 Domain Trust Discovery
Severity
Medium
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
The Gentlemen, Akira, safepay, Play

Validation

  1. ExperimentalSyntax checked only. Not yet tested on events.
  2. Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
  3. SIEM-validatedRun in a real SIEM, with a recorded result.

2 of 2 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) · 5cc90652-4cbd-4241-aa3b-4b462fa5a248

Download
title: Potential Recon Activity Via Nltest.EXE
id: 5cc90652-4cbd-4241-aa3b-4b462fa5a248
related:
    - id: 410ad193-a728-4107-bc79-4419789fcbf8
      type: similar
    - id: 903076ff-f442-475a-b667-4f246bcc203b
      type: similar
    - id: 77815820-246c-47b8-9741-e0def3f57308
      type: obsolete
status: test
description: Detects nltest commands that can be used for information discovery
references:
    - https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc731935(v=ws.11)
    - https://thedfirreport.com/2021/08/16/trickbot-leads-up-to-fake-1password-installation/
    - https://thedfirreport.com/2020/10/18/ryuk-in-5-hours/
    - https://book.hacktricks.xyz/windows/basic-cmd-for-pentesters
    - https://www.nccgroup.com/research/back-in-black-unlocking-a-lockbit-30-ransomware-attack/
    - https://eqllib.readthedocs.io/en/latest/analytics/03e231a6-74bc-467a-acb1-e5676b0fb55e.html
    - https://redcanary.com/blog/how-one-hospital-thwarted-a-ryuk-ransomware-outbreak/
    - https://github.com/redcanaryco/atomic-red-team/blob/5360c9d9ffa3b25f6495f7a16e267b719eba2c37/atomics/T1482/T1482.md#atomic-test-2---windows---discover-domain-trusts-with-nltest
author: Craig Young, oscd.community, Georg Lauenstein
date: 2021-07-24
modified: 2023-12-15
tags:
    - attack.discovery
    - attack.t1016
    - attack.t1482
logsource:
    category: process_creation
    product: windows
detection:
    selection_nltest:
        - Image|endswith: '\nltest.exe'
        - OriginalFileName: 'nltestrk.exe'
    selection_recon:
        - CommandLine|contains|all:
              - 'server'
              - 'query'
        - CommandLine|contains:
              - '/user'
              - 'all_trusts' # Flag for /domain_trusts
              - 'dclist:'
              - 'dnsgetdc:'
              - 'domain_trusts'
              - 'dsgetdc:'
              - 'parentdomain'
              - 'trusted_domains'
    condition: all of selection_*
falsepositives:
    - Legitimate administration use but user and host must be investigated
level: medium

QRadar 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 '%\nltest.exe' OR LOWER("Process Name") LIKE '%\nltest.exe') OR Filename='nltestrk.exe') AND ((LOWER(Command) LIKE '%server%' AND LOWER(Command) LIKE '%query%') OR (LOWER(Command) LIKE '%/user%' OR LOWER(Command) LIKE '%all_trusts%' OR LOWER(Command) LIKE '%dclist:%' OR LOWER(Command) LIKE '%dnsgetdc:%' OR LOWER(Command) LIKE '%domain_trusts%' OR LOWER(Command) LIKE '%dsgetdc:%' OR LOWER(Command) LIKE '%parentdomain%' OR LOWER(Command) LIKE '%trusted_domains%'))

QRadar CRE

Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.

Rule name
OffSet7: Potential Recon Activity Via Nltest.EXE
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:Potential Recon Activity Via Nltest EXE:selection_nltest (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 Name ends with: \nltest.exe
    • Filename is equal to (case-insensitive): nltestrk.exe
  • BB:OffSet7:Potential Recon Activity Via Nltest EXE:selection_recon (match)
    Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.
    • Command contains: server, query
    • Command contains: /user, all_trusts, dclist:, dnsgetdc:, domain_trusts, dsgetdc:, parentdomain, trusted_domains

Main rule, option A (building blocks)

  1. 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
  2. when an event matches the condition built from these building blocks: (ALL of [BB:OffSet7:Potential Recon Activity Via Nltest EXE:selection_nltest, BB:OffSet7:Potential Recon Activity Via Nltest EXE:selection_recon])

Main rule, option B (AQL filter test)

  1. when the event matches this AQL filter query: devicetype=12 AND ((LOWER("Process Path") LIKE '%\nltest.exe' OR LOWER("Process Name") LIKE '%\nltest.exe') OR Filename='nltestrk.exe') AND ((LOWER(Command) LIKE '%server%' AND LOWER(Command) LIKE '%query%') OR (LOWER(Command) LIKE '%/user%' OR LOWER(Command) LIKE '%all_trusts%' OR LOWER(Command) LIKE '%dclist:%' OR LOWER(Command) LIKE '%dnsgetdc:%' OR LOWER(Command) LIKE '%domain_trusts%' OR LOWER(Command) LIKE '%dsgetdc:%' OR LOWER(Command) LIKE '%parentdomain%' OR LOWER(Command) LIKE '%trusted_domains%'))

Rule response

  • Severity 5, 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="*\\nltest.exe" OR OriginalFileName="nltestrk.exe") ((CommandLine="*server*" CommandLine="*query*") OR CommandLine IN ("*/user*", "*all_trusts*", "*dclist:*", "*dnsgetdc:*", "*domain_trusts*", "*dsgetdc:*", "*parentdomain*", "*trusted_domains*"))

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

[Potential Recon Activity Via Nltest.EXE]
description = Detects nltest commands that can be used for information discovery
search = (Image="*\\nltest.exe" OR OriginalFileName="nltestrk.exe") ((CommandLine="*server*" CommandLine="*query*") OR CommandLine IN ("*/user*", "*all_trusts*", "*dclist:*", "*dnsgetdc:*", "*domain_trusts*", "*dsgetdc:*", "*parentdomain*", "*trusted_domains*"))

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 "\\nltest.exe" or TargetProcessFileOriginalName =~ "nltestrk.exe") and ((TargetProcessCommandLine contains "server" and TargetProcessCommandLine contains "query") or (TargetProcessCommandLine contains "/user" or TargetProcessCommandLine contains "all_trusts" or TargetProcessCommandLine contains "dclist:" or TargetProcessCommandLine contains "dnsgetdc:" or TargetProcessCommandLine contains "domain_trusts" or TargetProcessCommandLine contains "dsgetdc:" or TargetProcessCommandLine contains "parentdomain" or TargetProcessCommandLine contains "trusted_domains"))

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 "\\nltest.exe" or ProcessVersionInfoOriginalFileName =~ "nltestrk.exe") and ((ProcessCommandLine contains "server" and ProcessCommandLine contains "query") or (ProcessCommandLine contains "/user" or ProcessCommandLine contains "all_trusts" or ProcessCommandLine contains "dclist:" or ProcessCommandLine contains "dnsgetdc:" or ProcessCommandLine contains "domain_trusts" or ProcessCommandLine contains "dsgetdc:" or ProcessCommandLine contains "parentdomain" or ProcessCommandLine contains "trusted_domains"))

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:*\\nltest.exe OR process.pe.original_file_name:nltestrk.exe) AND ((process.command_line:*server* AND process.command_line:*query*) OR (process.command_line:(*\/user* OR *all_trusts* OR *dclist\:* OR *dnsgetdc\:* OR *domain_trusts* OR *dsgetdc\:* OR *parentdomain* OR *trusted_domains*)))

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:"*\\nltest.exe" or process.pe.original_file_name:"nltestrk.exe") and ((process.command_line:"*server*" and process.command_line:"*query*") or (process.command_line like~ ("*/user*", "*all_trusts*", "*dclist:*", "*dnsgetdc:*", "*domain_trusts*", "*dsgetdc:*", "*parentdomain*", "*trusted_domains*")))

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, "\\nltest.exe") or process.pe.original_file_name=="nltestrk.exe") and (process.command_line like "*server*" and process.command_line like "*query*" or process.command_line like "*/user*" or process.command_line like "*all_trusts*" or process.command_line like "*dclist:*" or process.command_line like "*dnsgetdc:*" or process.command_line like "*domain_trusts*" or process.command_line like "*dsgetdc:*" or process.command_line like "*parentdomain*" or process.command_line like "*trusted_domains*")

Required telemetry

Log source
product: windows · category: process_creation
Fields used
CommandLine Image OriginalFileName

False positives

  • Legitimate administration use but user and host must be investigated

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

Author and attribution

Author
Craig Young, oscd.community, Georg Lauenstein
Source
SigmaHQ · rules/windows/process_creation/proc_creation_win_nltest_recon.yml
Upstream commit
9688134317a2
Licence
Detection Rule License (DRL) 1.1

Version history

  1. Version 1Imported from SigmaHQ
  2. OffSet7 build · SigmaHQ 9688134317a2

Related rules