Detection rules › Sigma

DNS Server Discovery Via LDAP Query

Status
test
Severity
low
Log source
category dns_query, product windows
Author
frack113
Source
github.com/SigmaHQ/sigma

Detects DNS server discovery via LDAP query requests from uncommon applications

Known false positives

  • Likely

MITRE ATT&CK coverage

TacticTechniques
Discovery

Telemetry coverage

ProviderRecord / event type
SysmonEvent ID 22: DNSEvent (DNS query)

Rule body

title: DNS Server Discovery Via LDAP Query
id: a21bcd7e-38ec-49ad-b69a-9ea17e69509e
status: test
description: Detects DNS server discovery via LDAP query requests from uncommon applications
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/980f3f83fd81f37c1ca9c02dccfd1c3d9f9d0841/atomics/T1016/T1016.md#atomic-test-9---dns-server-discovery-using-nslookup
    - https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-adts/7fcdce70-5205-44d6-9c3a-260e616a2f04
author: frack113
date: 2022-08-20
modified: 2023-09-18
tags:
    - attack.discovery
    - attack.t1482
logsource:
    product: windows
    category: dns_query
detection:
    selection:
        QueryName|startswith: '_ldap.'
    filter_main_generic:
        Image|contains:
            - ':\Program Files\'
            - ':\Program Files (x86)\'
            - ':\Windows\'
    filter_main_defender:
        Image|contains: ':\ProgramData\Microsoft\Windows Defender\Platform\'
        Image|endswith: '\MsMpEng.exe'
    filter_main_unknown:
        Image: '<unknown process>'
    filter_optional_azure:
        Image|startswith: 'C:\WindowsAzure\GuestAgent'
    filter_main_null:
        Image: null
    filter_optional_browsers:
        # Note: This list is for browsers installed in the user context. To avoid basic evasions based on image name. Best to baseline this list with the browsers you use internally and add their full paths.
        Image|endswith:
            - '\chrome.exe'
            - '\firefox.exe'
            - '\opera.exe'
    condition: selection and not 1 of filter_main_* and not 1 of filter_optional_*
falsepositives:
    - Likely
# Note: Incrase the level once a baseline is established
level: low

Stages and Predicates

Stage 0: condition

selection and not 1 of filter_main_* and not 1 of filter_optional_*

Stage 1: selection

selection:
    QueryName|startswith: '_ldap.'

Stage 2: not filter_main_*

filter_main_generic:
    Image|contains:
        - ':\Program Files\'
        - ':\Program Files (x86)\'
        - ':\Windows\'
filter_main_defender:
    Image|contains: ':\ProgramData\Microsoft\Windows Defender\Platform\'
    Image|endswith: '\MsMpEng.exe'
filter_main_unknown:
    Image: '<unknown process>'
filter_main_null:
    Image: null

Stage 3: not filter_optional_*

filter_optional_azure:
    Image|startswith: 'C:\WindowsAzure\GuestAgent'
filter_optional_browsers:
    Image|endswith:
        - '\chrome.exe'
        - '\firefox.exe'
        - '\opera.exe'

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
Imageends_with\MsMpEng.exeexcludes:Image field:"Image" value:"\MsMpEng.exe"
Imagematch:\ProgramData\Microsoft\Windows Defender\Platform\excludes:Image field:"Image" value:":\ProgramData\Microsoft\Windows Defender\Platform\"
Imageeq<unknown process>excludes:Image field:"Image" value:"<unknown process>"
Imageis_null(no value, null check)excludes:Image
Imagematch:\Program Files (x86)\excludes:Image field:"Image" value:":\Program Files (x86)\"
Imagematch:\Program Files\excludes:Image field:"Image" value:":\Program Files\"
Imagematch:\Windows\excludes:Image field:"Image" value:":\Windows\"
Imageends_with\chrome.exeexcludes:Image field:"Image" value:"\chrome.exe"
Imageends_with\firefox.exeexcludes:Image field:"Image" value:"\firefox.exe"
Imageends_with\opera.exeexcludes:Image field:"Image" value:"\opera.exe"
Imagestarts_withC:\WindowsAzure\GuestAgentexcludes:Image field:"Image" value:"C:\WindowsAzure\GuestAgent"

Indicators

These rows show field, operator, and value matches.