지니언 EDR 로그에서 Run 키 지속성, AD 컴퓨터 조회, hosts 파일 수집과 브라우저 암호 복구 도구·Rubeus·Mimikatz 실행이 한 단말에서 이어지는 Conti 랜섬웨어 백업 서버 침투를 탐지합니다.
개요
쿼리
1table duration=30m EDR_GENIAN
2| search (_schema == "genian-edr-file" and in(event_subtype, "FileCopy", "FileCreate", "FileMove"))
3 or (_schema == "genian-edr-network" and event_subtype == "NetworkConnect")
4 or (_schema == "genian-edr-process" and event_subtype == "ProcessStart")
5 or (_schema == "genian-edr-reg" and event_subtype == "RegSetValue")
6| search len(trim(hostname)) > 0
7| eval psrc = if(len(trim(image_path)) > 0, trim(image_path), trim(image))
8| eval proc = lower(substr(psrc, lastindexof(psrc, "\\") + 1)), ipath = lower(psrc), cmd_l = lower(nvl(cmd_line, "")),
9 i_dir = if(lastindexof(psrc, "\\") >= 0, lower(substr(psrc, 0, lastindexof(psrc, "\\"))), ""),
10 par = lower(nvl(substr(parent_image, lastindexof(parent_image, "\\") + 1), "")), hostname = lower(trim(hostname))
11| 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)
12| 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)
13| eval fpath = lower(nvl(file_path, "")), f_dir = if(lastindexof(file_path, "\\") >= 0, lower(substr(file_path, 0, lastindexof(file_path, "\\"))), "")
14| eval rkey = lower(nvl(reg_key_path, "")), vname = lower(nvl(reg_value_name, "")), rval = lower(nvl(reg_value, ""))
15| eval grp = case(
16 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(proc, "^(?:cpr|chromepass|webbrowserpassview|browserpasswordview|passwordfox|iepv|operapassview|sharpchrome|sharpchromium|chromekatz|hackbrowserdata|chrome[-_ ]?password[-_ ]?recovery[^\\\\]*)\\.exe$") and match(ipath, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\")), "browsertool",
17 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "powershell.exe", "pwsh.exe", "cmd.exe", "findstr.exe", "more.com") and match(ps_text, "drivers\\\\etc\\\\hosts\\b") and match(ps_text, "get-content|\\bgc\\b|\\bcat\\b|\\btype\\b|select-string|findstr|readalltext|readalllines|test-path|join-path|resolve-path|get-item\\b") and not(match(ps_text, "(?:add-content|set-content|out-file|>>?)\\s*[^\\r\\n|;]*drivers\\\\etc\\\\hosts"))), "hostsfile",
18 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(cmd_l, "\\b(?:sekurlsa|lsadump|kerberos|crypto|privilege|vault|dpapi|misc|token|event|ts)::[a-z]") or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "invoke-mimikatz\\b|sekurlsa::|lsadump::"))), "mimikatz",
19 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileCopy", "FileMove") and (match(fpath, "\\\\(?:wmiexec|psexec|psexec64|smbexec|atexec|dcomexec|wmipersist|ntlmrelayx|getuserspns|getnpusers|winpeas[^\\\\]*|seatbelt|sharphound|rubeus|adfind|bloodhound[^\\\\]*|powerview|powerup|sharpup)\\.(?:py|exe|ps1|zip|7z|rar)$") and not(match(fpath, "^c:\\\\program files"))), "hacktool",
20 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileCopy", "FileMove") and (match(fpath, "\\\\[^\\\\]*(?:lazagne|pwdump\\d*|gsecdump|mimikatz|mimilib|mimidrv|mimispool|wce|fgdump|secretsdump|nanodump|dumpert|safetykatz|sharpkatz|pypykatz|quarkspwdump|cachedump|procdump(?:64)?|handlekatz|lsassy)[^\\\\]*\\.(?:exe|dll|sys|zip|7z|rar|ps1)$") and not(match(fpath, "^c:\\\\program files"))), "credtool",
21 _schema == "genian-edr-reg" and event_subtype == "RegSetValue" and (match(rkey, "\\\\software\\\\(?:wow6432node\\\\)?microsoft\\\\windows\\\\currentversion\\\\(?:run|runonce|runonceex|runservices|runservicesonce|policies\\\\explorer\\\\run)$") and match(rval, "c:\\\\users\\\\public\\\\|c:\\\\perflogs\\\\|\\\\windows\\\\temp\\\\|\\\\appdata\\\\local\\\\temp\\\\|%temp%|%public%|https?://|(?:^|\\\\|\")(?:powershell|pwsh|mshta|wscript|cscript|rundll32|regsvr32)(?:\\.exe)?\"?\\s")), "runkey",
22 _schema == "genian-edr-reg" and event_subtype == "RegSetValue" and (match(rkey, "\\\\software\\\\(?:wow6432node\\\\)?microsoft\\\\windows\\\\currentversion\\\\runonceex\\\\[^\\\\]+\\\\depend$")), "runkey",
23 _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"))), "adcomp",
24 _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",
25 _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",
26 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "copy-item\\b[\\s\\S]*-(?:tosession|fromsession)\\b")), "lateralpush",
27 _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",
28 _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"))), "domacct",
29 _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",
30 _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)"))), "procdisc",
31 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (proc == "netstat.exe" or ((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\bnet1?(?:\\.exe)?\"?\\s+(?:session|sessions|use)\\s*$")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-nettcpconnection\\b|get-netudpendpoint\\b|get-smbsession\\b"))), "netconn",
32 _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",
33 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "plink.exe", "ssh.exe", "kitty.exe", "kitty_portable.exe") or match(cmd_l, "\\s-ssh\\s")) and match(cmd_l, "\\S+@\\S+|\\s-pw\\s")), "ssh",
34 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "(?:invoke-(?:webrequest|restmethod)|\\biwr\\b|\\birm\\b)[\\s\\S]*-method\\s+['\"]?(?:post|put)\\b[\\s\\S]*-(?:infile|body)\\b|(?:invoke-(?:webrequest|restmethod)|\\biwr\\b|\\birm\\b)[\\s\\S]*-(?:infile|body)\\b[\\s\\S]*-method\\s+['\"]?(?:post|put)\\b|\\.upload(?:file|data|string)(?:async)?\\s*\\(")) or (proc == "curl.exe" and match(cmd_l, "(?:^|\\s)(?:-t|--upload-file)\\s+\\S|(?:^|\\s)(?:-f|--form)\\s+['\"]?[^\\s'\"]*=@|(?:^|\\s)(?:--data-binary|-d|--data)\\s+['\"]?@")) or (proc == "bitsadmin.exe" and match(cmd_l, "/transfer\\b[\\s\\S]*/upload\\b"))), "exfil",
35 _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",
36 _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",
37 _schema == "genian-edr-network" and event_subtype == "NetworkConnect" and (in(proc, "powershell.exe", "pwsh.exe", "mshta.exe", "wscript.exe", "cscript.exe", "rundll32.exe", "regsvr32.exe", "certutil.exe", "bitsadmin.exe") and isnotnull(remote_ip) and not(match(remote_ip, "^(?:10\\.|127\\.|192\\.168\\.|172\\.(?:1[6-9]|2\\d|3[01])\\.|169\\.254\\.|0\\.|::1|fe80)"))), "webc2",
38 _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",
39 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "powershell.exe", "pwsh.exe") and match(cmd_line, "(?i)(?:^|\\s)\"?-(?:ep|ex|exe|exec|execu|execut|executi|executio|execution|executionp|executionpo|executionpol|executionpoli|executionpolic|executionpolicy)\"?\\s+\"?bypass\"?(?:\\s|$)") and (isnotnull(b64) or match(cmd_l, "(?:^|\\s)\"?-(?:f|fi|fil|file)\"?\\s+\"?(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\windows\\\\temp|c:\\\\programdata|c:\\\\users\\\\[^\\\\]+\\\\appdata\\\\local\\\\temp)\\\\"))), "psbypass")
40| search isnotnull(grp)
41| eval tech = case(grp == "browsertool", "T1555.003", grp == "hostsfile", "T1016", grp == "mimikatz", "T1003.001", grp == "hacktool", "T1105", grp == "credtool", "T1003", grp == "runkey", "T1547.001/T1547.001", grp == "adcomp", "T1018", grp == "kerberoast", "T1558.003", grp == "winrm", "T1021.006", grp == "lateralpush", "T1570", grp == "trust", "T1482", grp == "domacct", "T1069.002", grp == "sysinfo", "T1082", grp == "procdisc", "T1057", grp == "netconn", "T1049", grp == "netconf", "T1016", grp == "ssh", "T1021.004", grp == "exfil", "T1041", grp == "drop", "T1105", grp == "exec", "T1204", grp == "webc2", "T1071.001", grp == "wipe", "T1070.004", grp == "psbypass", "T1059.001")
42| eval anchor_g = if(in(grp, "browsertool", "hostsfile", "mimikatz", "hacktool", "runkey", "adcomp"), grp, null), disc_g = if(in(grp, "domacct", "sysinfo", "procdisc", "netconn", "netconf"), grp, null)
43| 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
44| search anchor_cnt >= 3 and disc_cnt >= 2 and grp_cnt >= 7
45| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs),
46 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)를 집계합니다. 브라우저 암호 복구 도구 실행·hosts 파일 읽기·Mimikatz 모듈 명령(DCSync·Kerberos 티켓)·공격 도구 반입·Run 키 지속성·AD 컴퓨터 조회 중 3개 이상이 있고(필수 행위군), 도메인 계정·시스템 정보·프로세스·네트워크 연결·네트워크 설정 정찰 행위군이 2개 이상(disc_cnt)이며, 서로 다른 행위군이 7개 이상이면 탐지합니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.
위협 분석
Conti 계열 공격은 암호화 전에 백업 서버를 찾아 백업을 삭제하거나 암호화하여 복구 수단을 없앱니다. AD 컴퓨터 조회와 hosts 파일 수집은 백업 서버의 위치를 찾는 과정이고, DCSync는 도메인 컨트롤러에서 계정 해시를 복제하는 기법입니다. DCSync가 성공했다면 도메인 전체 계정이 노출된 것으로 보고 대응합니다.
오탐 유형
관리자가 AD 컴퓨터 목록을 조회하고 hosts 파일을 확인하는 작업은 정상 운영에서도 발생합니다. 필수 행위군 3개가 요구되어 조회 작업만으로는 탐지 조건을 충족하기 어렵지만, 관리 단말에서 반복 탐지되면 hostname 기준으로 예외 조건을 추가합니다.
대응 방안
Mimikatz 명령줄에서 DCSync 대상 계정을 확인하고, 도메인 컨트롤러에서 해당 시각의 복제 요청 이력을 조회합니다. Run 키에 등록된 값과 반입된 도구를 확보하고, WinRM 접속 대상 서버를 확인합니다. 정탐으로 확인되면 단말을 격리하고 노출된 계정과 krbtgt 계정의 암호를 변경하며, 백업 서버의 접근 이력과 백업 무결성을 점검합니다.