Detection rules › Elastic

Sensitive File Access - System Admin Utilities

Time window
5m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies an unusual process accessing common third party system utilities sensitive files and registries. Adversaries may search local file systems and remote file shares for files containing insecurely stored credentials.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies an unusual process accessing common third party system utilities sensitive files and registries. Adversaries
may search local file systems and remote file shares for files containing insecurely stored credentials.
"""
id = "949c72ee-a283-4673-afe0-7fa72bddc2f6"
license = "Elastic License v2"
name = "Sensitive File Access - System Admin Utilities"
os_list = ["windows"]
reference = ["https://github.com/GhostPack/Seatbelt", "https://github.com/AlessandroZ/LaZagne"]
version = "1.0.30"

query = '''
sequence by process.entity_id with maxspan=5m
   [process where event.action == "start" and
    user.id like ("S-1-5-21*", "S-1-12-*") and process.executable : "?:\\*" and
    not process.executable :
          (
            /* third party programs common install path - requires local admin */
            "?:\\Program Files\\*",
            "?:\\Program Files (x86)\\*",
            /*
              dllhost.exe (IFileOperation like view/changing security permission of a file/folder).
              explorer.exe for directory and file discovery.
              SearchProtocolHost.exe is for file searches and indexing.
             */
            "?:\\Windows\\explorer.exe",
            "?:\\Windows\\System32\\dllhost.exe",
            "?:\\Windows\\System32\\SearchProtocolHost.exe",
            "?:\\Windows\\regedit.exe",
            "?:\\Windows\\system32\\reg.exe",
            "?:\\Windows\\System32\\userinit.exe",
            "?:\\Windows\\System32\\notepad.exe",
            "?:\\Windows\\System32\\Robocopy.exe",
            "?:\\Windows\\System32\\cmd.exe",
            /* Windows Defender */
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe",
            "?:\\Windows\\_ScriptingFramework\\Modul\\Engine.exe",

            /* lot of legit access from mounted sysadmin file shares */
            "\\Device\\Mup\\*.exe") and
    not (process.code_signature.subject_name :
                      ("Martin Prikryl",
                       "OpenVPN Technologies, Inc.",
                       "TeamViewer Germany GmbH",
                       "Open Source Developer, Dominik Reichl",
                       "Tim Kosse",
                       "TEFINCOM S.A.",
                       "nordvpn s.a.") and
          process.code_signature.trusted == true)
   ]
   [any where event.category in ("registry", "file") and
    event.action in ("query", "open") and
    (
     file.path : ("?:\\Users\\*\\AppData\\Roaming\\KeePass\\KeePass.config.xml",
                  "?:\\Users\\*\\AppData\\*\\NordVPN\\NordVPN.exe*\\user.config",
                  "?:\\Users\\*\\AppData\\*\\FileZilla\\recentservers.xml",
                  "?:\\Users\\*\\AppData\\*\\FileZilla\\sitemanager.xml") or
     registry.path : ("HKEY_USERS\\S-1-5-21*\\software\\Martin Prikryl\\WinSCP *\\Sessions\\*\\Password*",
                      "HKEY_USERS\\S-1-5-21*\\SOFTWARE\\WOW6432Node\\TeamViewer\\ProxyPassword",
                      "HKEY_USERS\\S-1-5-21*\\Software\\OpenVPN-GUI\\Configs\\*auth-data*",
                      "HKEY_USERS\\S-1-12-1-*\\software\\Martin Prikryl\\WinSCP *\\Sessions\\*\\Password*",
                      "HKEY_USERS\\S-1-12-1-*\\SOFTWARE\\WOW6432Node\\TeamViewer\\ProxyPassword",
                      "HKEY_USERS\\S-1-12-1-*\\Software\\OpenVPN-GUI\\Configs\\*auth-data*")
     ) and
      /* unsigned KeePass */
     not (process.name : "KeePass.exe" and file.name : "KeePass.config.xml")]
'''

min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"



[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
    user.id like ("S-1-5-21*", "S-1-12-*") and process.executable : "?:\\*" and
    not process.executable :
          (
            "?:\\Program Files\\*",
            "?:\\Program Files (x86)\\*",
            /*
              dllhost.exe (IFileOperation like view/changing security permission of a file/folder).
              explorer.exe for directory and file discovery.
              SearchProtocolHost.exe is for file searches and indexing.
             */
            "?:\\Windows\\explorer.exe",
            "?:\\Windows\\System32\\dllhost.exe",
            "?:\\Windows\\System32\\SearchProtocolHost.exe",
            "?:\\Windows\\regedit.exe",
            "?:\\Windows\\system32\\reg.exe",
            "?:\\Windows\\System32\\userinit.exe",
            "?:\\Windows\\System32\\notepad.exe",
            "?:\\Windows\\System32\\Robocopy.exe",
            "?:\\Windows\\System32\\cmd.exe",
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MsMpEng.exe",
            "?:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\*\\MpCopyAccelerator.exe",
            "?:\\Windows\\_ScriptingFramework\\Modul\\Engine.exe",
            "\\Device\\Mup\\*.exe") and
    not (process.code_signature.subject_name :
                      ("Martin Prikryl",
                       "OpenVPN Technologies, Inc.",
                       "TeamViewer Germany GmbH",
                       "Open Source Developer, Dominik Reichl",
                       "Tim Kosse",
                       "TEFINCOM S.A.",
                       "nordvpn s.a.") and
          process.code_signature.trusted == true)
   ]

Stage 2: any

[any where event.category in ("registry", "file") and
    event.action in ("query", "open") and
    (
     file.path : ("?:\\Users\\*\\AppData\\Roaming\\KeePass\\KeePass.config.xml",
                  "?:\\Users\\*\\AppData\\*\\NordVPN\\NordVPN.exe*\\user.config",
                  "?:\\Users\\*\\AppData\\*\\FileZilla\\recentservers.xml",
                  "?:\\Users\\*\\AppData\\*\\FileZilla\\sitemanager.xml") or
     registry.path : ("HKEY_USERS\\S-1-5-21*\\software\\Martin Prikryl\\WinSCP *\\Sessions\\*\\Password*",
                      "HKEY_USERS\\S-1-5-21*\\SOFTWARE\\WOW6432Node\\TeamViewer\\ProxyPassword",
                      "HKEY_USERS\\S-1-5-21*\\Software\\OpenVPN-GUI\\Configs\\*auth-data*",
                      "HKEY_USERS\\S-1-12-1-*\\software\\Martin Prikryl\\WinSCP *\\Sessions\\*\\Password*",
                      "HKEY_USERS\\S-1-12-1-*\\SOFTWARE\\WOW6432Node\\TeamViewer\\ProxyPassword",
                      "HKEY_USERS\\S-1-12-1-*\\Software\\OpenVPN-GUI\\Configs\\*auth-data*")
     ) and
     not (process.name : "KeePass.exe" and file.name : "KeePass.config.xml")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqMartin Prikryl, OpenVPN Technologies, Inc., TeamViewer Germany GmbH, Open Source Developer, Dominik Reichl, Tim Kosse, TEFINCOM S.A., nordvpn s.a.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executablewildcard?:\Program Files\*, ?:\Program Files (x86)\*, ?:\Windows\explorer.exe, ?:\Windows\System32\dllhost.exe, ?:\Windows\System32\SearchProtocolHost.exe, ?:\Windows\regedit.exe, ?:\Windows\system32\reg.exe, ?:\Windows\System32\userinit.exe, ?:\Windows\System32\notepad.exe, ?:\Windows\System32\Robocopy.exe, ?:\Windows\System32\cmd.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MsMpEng.exe, ?:\ProgramData\Microsoft\Windows Defender\Platform\*\MpCopyAccelerator.exe, ?:\Windows\_ScriptingFramework\Modul\Engine.exe, \Device\Mup\*.exeexcludes:process.executable
file.nameeqKeePass.config.xmlexcludes:file.name field:"file.name" value:"KeePass.config.xml"
process.nameeqKeePass.exeexcludes:process.name field:"process.name" value:"KeePass.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionin
  • open corpus 52 (elastic 51, sigma 1)
  • query corpus 6 (elastic 6)
field:"EventType" kind:in
event.categoryin
  • file corpus 43 (elastic 43)
  • registry corpus 14 (elastic 14)
field:"event.category" kind:in
file.pathwildcard
  • ?:\Users\*\AppData\*\FileZilla\recentservers.xml corpus 2 (elastic 2)
  • ?:\Users\*\AppData\*\FileZilla\sitemanager.xml corpus 2 (elastic 2)
  • ?:\Users\*\AppData\*\NordVPN\NordVPN.exe*\user.config corpus 2 (elastic 2)
  • ?:\Users\*\AppData\Roaming\KeePass\KeePass.config.xml
field:"TargetFilename" kind:wildcard
process.executablewildcard
  • ?:\* corpus 18 (elastic 18)
field:"Image" kind:wildcard value:"?:\*"
registry.pathwildcard
  • HKEY_USERS\S-1-12-1-*\SOFTWARE\WOW6432Node\TeamViewer\ProxyPassword
  • HKEY_USERS\S-1-12-1-*\Software\OpenVPN-GUI\Configs\*auth-data*
  • HKEY_USERS\S-1-12-1-*\software\Martin Prikryl\WinSCP *\Sessions\*\Password*
  • HKEY_USERS\S-1-5-21*\SOFTWARE\WOW6432Node\TeamViewer\ProxyPassword corpus 2 (elastic 2)
  • HKEY_USERS\S-1-5-21*\Software\OpenVPN-GUI\Configs\*auth-data* corpus 2 (elastic 2)
  • HKEY_USERS\S-1-5-21*\software\Martin Prikryl\WinSCP *\Sessions\*\Password*
field:"TargetObject" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 46 (elastic 46)
  • S-1-5-21* corpus 47 (elastic 47)
field:"user.id" kind:wildcard