지니언 EDR 로그에서 Kerberoasting, 도메인 트러스트 조회, AD 개체 조회가 계정 정찰과 함께 한 단말에서 나타나는 Akira 랜섬웨어 내부 장악 준비를 탐지합니다.
개요
쿼리
1table duration=30m EDR_GENIAN
2| search (_schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove"))
3 or (_schema == "genian-edr-network" and event_subtype == "NetworkConnect")
4 or (_schema == "genian-edr-process" and event_subtype == "ProcessStart")
5| search len(trim(hostname)) > 0
6| eval psrc = if(len(trim(image_path)) > 0, trim(image_path), trim(image))
7| eval proc = lower(substr(psrc, lastindexof(psrc, "\\") + 1)), ipath = lower(psrc), cmd_l = lower(nvl(cmd_line, "")),
8 i_dir = if(lastindexof(psrc, "\\") >= 0, lower(substr(psrc, 0, lastindexof(psrc, "\\"))), ""),
9 par = lower(nvl(substr(parent_image, lastindexof(parent_image, "\\") + 1), "")), hostname = lower(trim(hostname))
10| eval b64 = if(in(proc, "powershell.exe", "pwsh.exe"), valueof(groups(cmd_line, "(?i)(?:^|\\s)\"?-(?:e|ec|en|enc|enco|encod|encode|encoded|encodedc|encodedco|encodedcom|encodedcomm|encodedcomma|encodedcomman|encodedcommand)\"?\\s+\"?([a-z0-9+/]{20,}={0,2})\"?(?:\\s|$)"), 0), null)
11| eval ps_text = if(in(proc, "powershell.exe", "pwsh.exe"), lower(concat(cmd_line, " ", nvl(decode(frombase64(substr(b64, 0, len(b64) - mod(len(b64), 4))), "UTF-16LE"), ""))), cmd_l)
12| eval fpath = lower(nvl(file_path, "")), f_dir = if(lastindexof(file_path, "\\") >= 0, lower(substr(file_path, 0, lastindexof(file_path, "\\"))), "")
13| eval grp = case(
14 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (proc == "rubeus.exe" or match(cmd_l, "\\b(?:kerberoast(?:ing)?|asreproast(?:ing)?)\\b") or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "invoke-kerberoast|invoke-rubeus|kerberosrequestorsecuritytoken|\\b(?:kerberoast(?:ing)?|asreproast(?:ing)?)\\b"))), "kerberoast",
15 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "nltest.exe" and match(cmd_l, "[/-](?:domain_trusts|trusted_domains|all_trusts)\\b")) or (proc == "dsquery.exe" and match(cmd_l, "trusteddomain")) or (proc == "adfind.exe" and match(cmd_l, "trustdmp|trusteddomain")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-adtrust\\b|get-domaintrust\\b|getalltrustrelationships|nltest(?:\\.exe)?\\s+[/-](?:domain_trusts|trusted_domains|all_trusts)\\b"))), "trust",
16 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "nltest.exe" and match(cmd_l, "[/-](?:dclist|parentdomain|dnsgetdc)\\b")) or proc == "adfind.exe" or (in(proc, "powershell.exe", "pwsh.exe", "cmd.exe") and match(ps_text, "adfind(?:\\.exe)?\"?\\s+-")) or (proc == "dsquery.exe" and match(cmd_l, "dsquery(?:\\.exe)?\"?\\s+(?:computer|server)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-adcomputer\\b|get-addomaincontroller\\b|get-netcomputer\\b|get-domaincomputer\\b"))), "addisc",
17 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\bnet1?(?:\\.exe)?\"?\\s+(?:user|users|accounts)\\b") and not(match(cmd_l, "/(?:add|del|delete|do|dom|doma|domai|domain)\\b"))) or (proc == "wmic.exe" and match(cmd_l, "\\buseraccount\\b[\\s\\S]*\\b(?:get|list)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-localuser\\b|get-aduser\\b|win32_useraccount\\b"))), "acct",
18 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\bnet1?(?:\\.exe)?\"?\\s+localgroup\\b")) or (proc == "wmic.exe" and match(cmd_l, "\\bgroup\\b[\\s\\S]*\\b(?:get|list)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-localgroup(?:member)?\\b|add-localgroupmember\\b|win32_group\\b"))), "localgroup",
19 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\s(?:group|groups|user|users)\\b[^/]*\\s/do(?:m|ma|mai|main)?\\b") and not(match(cmd_l, "/(?:add|del|delete)\\b"))) or (proc == "dsquery.exe" and match(cmd_l, "dsquery(?:\\.exe)?\"?\\s+group\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-adgroup(?:member)?\\b|get-domaingroup\\b|\\bnet(?:\\.exe)?\\s+(?:user|users|group|groups)\\b[^\\r\\n|;]*\\s/do(?:m|ma|mai|main)?\\b"))), "domgroup",
20 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "ipconfig.exe", "nbtstat.exe", "getmac.exe") or (proc == "route.exe" and match(cmd_l, "\\bprint\\b")) or (proc == "arp.exe" and match(cmd_l, "\\s-[ag]\\b")) or (proc == "netsh.exe" and match(cmd_l, "\\b(?:interface\\s+(?:ip|ipv4)?\\s*show|wlan\\s+show|(?:advfirewall\\s+(?:firewall\\s+)?|firewall\\s+)show|ip\\s+show\\s+config)\\b")) or (proc == "wmic.exe" and match(cmd_l, "\\b(?:nicconfig|nic|win32_networkadapterconfiguration|win32_ip4routetable)\\b[\\s\\S]*\\b(?:get|list)\\b")) or (proc == "nltest.exe" and match(cmd_l, "[/-]dsgetdc\\b"))), "netconf",
21 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "systeminfo.exe", "hostname.exe") or (proc == "wmic.exe" and match(cmd_l, "\\b(?:os|computersystem|bios|qfe|csproduct|path\\s+win32_(?:operatingsystem|bios|baseboard|computersystemproduct))\\b[\\s\\S]*\\b(?:get|list)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "getnativesysteminfo|getsysteminfo\\b|get-computerinfo|win32_operatingsystem|\\.partofdomain\\b|dllimport[\\s\\S]*\\b(?:getlogicaldrivestringsw?|getdrivetypew?|getlogicaldrives)\\b"))), "sysinfo",
22 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "tasklist.exe", "qprocess.exe") and not(contains(cmd_line, "/?"))) or (proc == "query.exe" and match(cmd_l, "\\bquery(?:\\.exe)?\"?\\s+process\\b")) or (proc == "wmic.exe" and match(cmd_l, "\\bprocess\\b[\\s\\S]*\\b(?:get|list)\\b") and not(match(cmd_l, "\\bcall\\b"))) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-process|\\bgps\\b") and match(ps_text, "(?:msmpeng|mssense|sentinelagent|csfalconservice|cylancesvc|mcshield|bdservicehost|savservice|sophos|ekrn|avp\\.exe|ntrtscan|tmbmsrv|cbdefense|repmgr|xagt|elastic-endpoint|vsserv|ccsvchst|avastsvc|v3svc|ayagent)[\\s\\S]*(?:msmpeng|mssense|sentinelagent|csfalconservice|cylancesvc|mcshield|bdservicehost|savservice|sophos|ekrn|avp\\.exe|ntrtscan|tmbmsrv|cbdefense|repmgr|xagt|elastic-endpoint|vsserv|ccsvchst|avastsvc|v3svc|ayagent)"))), "proclist",
23 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\bnet1?(?:\\.exe)?\"?\\s+user\\s+\\S+[\\s\\S]*\\s/add\\b") and not(match(cmd_l, "/do(?:m|ma|mai|main)?\\b"))) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "new-localuser\\b|\\[adsi\\][\\s\\S]*winnt://[\\s\\S]*create\\(\\s*['\"]user"))), "localacct",
24 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "powershell.exe", "pwsh.exe", "cmd.exe") and (match(ps_text, "\\b(?:copy|copy-item|cp|cpi|move|move-item|xcopy)\\s[^\\r\\n]*c:\\\\windows\\\\system32\\\\[\\s\\S]*(?:get-filehash|certutil[^\\r\\n]*-hashfile)") or match(ps_text, "\\b(?:copy|copy-item|cp|cpi|xcopy)\\s[^\\r\\n]*(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\[\\s\\S]*(?:get-filehash|certutil[^\\r\\n]*-hashfile)[\\s\\S]*(?:get-filehash|certutil[^\\r\\n]*-hashfile)[\\s\\S]*-eq\\b"))), "evasioncheck",
25 _schema == "genian-edr-file" and event_subtype == "FileCreate" and ((match(fpath, "\\.(?:exe|dll|sys|scr|cpl|bat|cmd|ps1|vbs|vbe|js|jse|wsf|hta)$") or (nvl(file_type, "") == "PE" and not(match(fpath, "\\.[a-z0-9]{2,4}$")))) and (indexof(fpath, "c:\\users\\public\\") == 0 or indexof(fpath, "c:\\perflogs\\") == 0 or in(f_dir, "c:\\programdata", "c:\\windows\\temp")) and not(match(fpath, "\\\\__psscriptpolicytest_[^\\\\]+\\.ps1$")) and not(in(proc, "msiexec.exe", "trustedinstaller.exe", "tiworker.exe", "mpsigstub.exe", "mpcmdrun.exe", "msmpeng.exe", "dismhost.exe", "system"))), "drop",
26 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "\\.(?:exe|scr|com|pif)$") and (indexof(ipath, "c:\\users\\public\\") == 0 or indexof(ipath, "c:\\perflogs\\") == 0 or in(i_dir, "c:\\programdata", "c:\\windows\\temp"))), "exec",
27 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "remove-item|\\bdel\\b|\\bri\\b|\\brm\\b") and match(ps_text, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\windows\\\\temp|c:\\\\programdata)\\\\[^\\r\\n\"']*\\.(?:exe|dll|sys|ps1|bat|cmd|vbs|js|jse|hta|cs|bin|zip|7z|rar)\\b")) or (proc == "cmd.exe" and match(cmd_l, "\\b(?:del|erase)\\b[^&|]*(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\windows\\\\temp|c:\\\\programdata|%temp%|\\\\appdata\\\\local\\\\temp)\\\\[^&|\"]*\\.(?:exe|dll|sys|ps1|bat|cmd|vbs|js|jse|hta|bin)\\b")) or in(proc, "sdelete.exe", "sdelete64.exe")), "wipe",
28 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "rundll32.exe" and match(cmd_l, "comsvcs(?:\\.dll)?[\\s\\S]*minidump|#\\+?24\\b")) or (in(proc, "procdump.exe", "procdump64.exe", "procdump64a.exe") and match(cmd_l, "\\s-m[ap]\\b[\\s\\S]*lsass|lsass[\\s\\S]*\\s-m[ap]\\b")) or in(proc, "mimikatz.exe", "nanodump.exe", "pypykatz.exe") or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "invoke-mimikatz|sekurlsa::|lsadump::|comsvcs(?:\\.dll)?[\\s\\S]*minidump|minidumpwritedump|out-minidump"))), "lsass",
29 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "(?:new-pssession|enter-pssession)\\b[\\s\\S]*-computername\\b|invoke-command\\b[\\s\\S]*-(?:computername|session)\\b")) or (proc == "winrs.exe" and match(cmd_l, "[-/]r(?:emote)?:"))), "winrm",
30 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "vssadmin.exe" and match(cmd_l, "\\bdelete\\s+shadows\\b|\\bresize\\s+shadowstorage\\b")) or (proc == "wmic.exe" and match(cmd_l, "shadowcopy[\\s\\S]*\\bdelete\\b")) or (proc == "bcdedit.exe" and match(cmd_l, "recoveryenabled\\s+no|bootstatuspolicy\\s+ignoreallfailures")) or (proc == "wbadmin.exe" and match(cmd_l, "\\bdelete\\s+(?:catalog|systemstatebackup|backup)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "win32_shadowcopy[\\s\\S]*(?:\\.delete\\(\\)|remove-(?:cim|wmi)(?:instance|object))|remove-(?:cim|wmi)(?:instance|object)[\\s\\S]*win32_shadowcopy|vssadmin[^\\r\\n]*delete\\s+shadows"))), "shadow",
31 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and (match(fpath, "\\.(?:conti|vanhelsing|vanlocker|locked|lockbit|encrypted|crypted|ryk|babyk|akira|royal|basta|hive|clop|medusa|rhysida|8base|phobos|makop|djvu)$") or match(fpath, "\\\\(?:how[_-]?to[_-]?(?:decrypt|restore|recover)|restore[_-]?(?:my[_-]?)?files|decrypt[_-]?(?:my[_-]?)?files|readme[_-]?(?:for[_-]?)?decrypt|_readme_|ransom)[^\\\\]*\\.(?:txt|html?|hta)$")), "encrypt",
32 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "lazagne.exe", "secretsdump.exe", "pwdump.exe", "fgdump.exe", "gsecdump.exe", "wce.exe") or match(cmd_l, "\\blazagne(?:\\.exe|\\.py)?\"?\\s+(?:all|browsers|windows|sysadmin|wifi|mails|chats|databases|memory)\\b") or (proc == "reg.exe" and match(cmd_l, "\\b(?:save|export)\\s+\"?(?:hklm|hkey_local_machine)\\\\(?:sam|security|system)\"?\\s")) or (proc == "ntdsutil.exe" and match(cmd_l, "\\bifm\\b|ac(?:tivate)?\\s+i(?:nstance)?\\s+ntds"))), "credump",
33 _schema == "genian-edr-network" and event_subtype == "NetworkConnect" and ((in(proc, "powershell.exe", "pwsh.exe", "cmd.exe", "ftp.exe", "tftp.exe", "curl.exe", "rundll32.exe", "regsvr32.exe", "mshta.exe", "wscript.exe", "cscript.exe") or match(lower(psrc), "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\")) and in(int(remote_port), 20, 21, 69, 989, 990) and isnotnull(remote_ip) and not(match(remote_ip, "^(?:10\\.|127\\.|192\\.168\\.|172\\.(?:1[6-9]|2\\d|3[01])\\.|169\\.254\\.)"))), "ftpc2",
34 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "esentutl.exe" and match(cmd_l, "[/-]y\\b") and match(cmd_l, "webcache|login data|cookies|web data|\\\\user data\\\\|\\\\profiles\\\\")) or (in(proc, "cmd.exe", "powershell.exe", "pwsh.exe", "robocopy.exe", "xcopy.exe") and match(ps_text, "\\b(?:copy|copy-item|cp|cpi|xcopy|robocopy|esentutl)\\b[^\\r\\n]*(?:\\\\user data\\\\[^\\r\\n]*(?:login data|cookies|web data|local state)|key4\\.db|logins\\.json|webcachev01\\.dat)"))), "browser")
35| search isnotnull(grp)
36| eval tech = case(grp == "kerberoast", "T1558.003", grp == "trust", "T1482", grp == "addisc", "T1018", grp == "acct", "T1087", grp == "localgroup", "T1069.001", grp == "domgroup", "T1069.002", grp == "netconf", "T1016", grp == "sysinfo", "T1082", grp == "proclist", "T1057", grp == "localacct", "T1136.001", grp == "evasioncheck", "T1497", grp == "drop", "T1105", grp == "exec", "T1204", grp == "wipe", "T1070.004", grp == "lsass", "T1003.001", grp == "winrm", "T1021.006", grp == "shadow", "T1490", grp == "encrypt", "T1486", grp == "credump", "T1003", grp == "ftpc2", "T1071.002", grp == "browser", "T1555.003")
37| eval anchor_g = if(in(grp, "kerberoast", "trust", "addisc"), grp, null), disc_g = if(in(grp, "acct", "localgroup", "domgroup", "netconf", "sysinfo", "proclist"), grp, null)
38| stats dc(grp) as grp_cnt, dc(anchor_g) as anchor_cnt, dc(disc_g) as disc_cnt, values(grp) as groups, values(tech) as techs, min(_time) as first_seen, max(_time) as last_seen by hostname, host_ip
39| search anchor_cnt >= 2 and disc_cnt >= 2 and grp_cnt >= 6
40| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs),
41 first_seen = string(first_seen, "yyyy-MM-dd HH:mm:ss"), last_seen = string(last_seen, "yyyy-MM-dd HH:mm:ss")
10분마다 직전 30분의 지니언 EDR 프로세스·파일·네트워크 로그를 조회하여, 각 이벤트를 조건에 따라 행위군(grp)으로 분류하고 해당하는 MITRE 기법 번호(tech)를 붙입니다. 이후 hostname·host_ip별로 서로 다른 행위군 수(grp_cnt)와 필수 행위군 수(anchor_cnt)를 집계합니다. Kerberoasting·도메인 트러스트 조회·도메인 컨트롤러와 AD 개체 조회 중 2개 이상이 있고(필수 행위군), 계정·로컬 그룹·도메인 그룹·네트워크 설정·시스템 정보·프로세스 정찰 행위군이 2개 이상(disc_cnt)이며, 서로 다른 행위군이 6개 이상이면 탐지합니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.
위협 분석
nltest·AdFind로 도메인 컨트롤러와 트러스트, AD 개체를 조회하는 것은 도메인 전체를 장악하기 위한 경로를 찾는 과정입니다. Kerberoasting은 서비스 계정의 티켓을 요청해 오프라인에서 암호를 푸는 기법으로, 성공하면 높은 권한의 서비스 계정이 탈취됩니다. 랜섬웨어 조직은 이 단계를 거쳐 도메인 관리자 권한으로 암호화를 배포하므로 초기에 차단해야 합니다.
오탐 유형
AD 관리자가 nltest나 AD 조회 도구로 도메인 구성을 점검하는 경우 필수 행위군 일부가 관찰될 수 있습니다. AD 관리 단말에서 반복 탐지되면 hostname 기준으로 예외 조건을 추가하되, Kerberoasting 행위가 포함된 탐지는 예외로 두지 않습니다.
대응 방안
Kerberoasting이 확인되면 도메인 컨트롤러 로그에서 같은 시각의 서비스 티켓 요청을 조회하고, 대상 서비스 계정의 암호를 변경합니다. Windows Temp에 반입된 도구를 확보하고 실행 계정을 확인합니다. 정탐으로 확인되면 단말을 격리하고 해당 계정의 다른 단말 로그온 이력을 조회합니다.