지니언 EDR 로그에서 UAC 우회와 토큰 가장으로 권한을 올린 뒤 보안 제품을 조회하고 드라이버·도구를 반입하는 BYOVD 보안 프로세스 강제 종료 준비 흐름을 탐지합니다.
Overview
Query
1table duration=30m EDR_GENIAN
2| search (_schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove"))
3 or (_schema == "genian-edr-process" and in(event_subtype, "ProcessStart", "RequestProcessCreate"))
4 or (_schema == "genian-edr-reg" and event_subtype == "RegSetValue")
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 rkey = lower(nvl(reg_key_path, "")), vname = lower(nvl(reg_value_name, "")), rval = lower(nvl(reg_value, ""))
14| eval grp = case(
15 _schema == "genian-edr-reg" and event_subtype == "RegSetValue" and (match(rkey, "(?:^hkey_users\\\\[^\\\\]+_classes|\\\\software\\\\classes)\\\\(?:ms-settings|mscfile|folder|exefile|launcher\\.systemsettings|appx[0-9a-z]{20,})\\\\shell\\\\open\\\\command$") and ((in(vname, "", "(default)") and len(trim(rval)) > 0) or vname == "delegateexecute") and not(in(proc, "explorer.exe", "systemsettings.exe", "svchost.exe")) and not(match(rval, "^\\{[0-9a-f-]{36}\\}$"))), "uacbypass",
16 _schema == "genian-edr-process" and event_subtype == "RequestProcessCreate" and ((in(proc, "python.exe", "pythonw.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "rundll32.exe") or match(ipath, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\")) and match(cmd_l, "(?:^|\\\\|\")(?:cmd|powershell|pwsh)(?:\\.exe)?\"?\\s")), "token",
17 _schema == "genian-edr-reg" and event_subtype == "RegSetValue" and (match(rkey, "^hkey_local_machine\\\\system\\\\(?:currentcontrolset|controlset\\d{3})\\\\services\\\\[^\\\\]+$") and vname == "imagepath" and match(rval, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\[^\"]*\\.sys\"?$") and not(match(rval, "c:\\\\programdata\\\\microsoft\\\\windows defender\\\\(?:platform|definition updates)\\\\"))), "drvsvc",
18 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "wmic.exe" and match(cmd_l, "securitycenter2|antivirusproduct|antispywareproduct|firewallproduct")) or (in(proc, "powershell.exe", "pwsh.exe") and (match(ps_text, "securitycenter2|antivirusproduct|get-mpcomputerstatus") or 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)")))), "secsw",
19 _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",
20 _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",
21 _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",
22 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "whoami.exe", "quser.exe") or (proc == "query.exe" and match(cmd_l, "\\bquery(?:\\.exe)?\"?\\s+(?:user|session)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "windowsidentity\\]::getcurrent\\(\\)[\\s\\S]*isinrole|isinrole\\([\\s\\S]*administrator")) or (in(proc, "wmic.exe", "powershell.exe", "pwsh.exe") and match(ps_text, "\\b(?:win32_logonsession|win32_loggedonuser)\\b"))), "admincheck",
23 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "attrib.exe" and match(cmd_l, "(?:^|\\s)\\+[hs]\\b")) or (proc == "cmd.exe" and match(cmd_l, "\\b(?:mkdir|md)\\s+\"?c:\\\\windows\\\\temp\\\\[^\\\\\\s\"&]+") and match(cmd_l, "\\becho\\b[^&|]*>\\s*\"?c:\\\\windows\\\\temp\\\\"))), "workdir",
24 _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")
25| search isnotnull(grp)
26| eval tech = case(grp == "uacbypass", "T1548.002", grp == "token", "T1134.001", grp == "drvsvc", "T1574.009", grp == "secsw", "T1518.001", grp == "exec", "T1204", grp == "drop", "T1105", grp == "proclist", "T1057", grp == "admincheck", "T1033", grp == "workdir", "T1564.005", grp == "encrypt", "T1486")
27| eval anchor_g = if(in(grp, "uacbypass", "token", "drvsvc", "secsw"), grp, null), has_token_v = if(grp == "token", 1, 0)
28| stats dc(grp) as grp_cnt, dc(anchor_g) as anchor_cnt, max(has_token_v) as has_token, values(grp) as groups, values(tech) as techs, min(_time) as first_seen, max(_time) as last_seen by hostname, host_ip
29| search has_token == 1 and anchor_cnt >= 2 and grp_cnt >= 5
30| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs),
31 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)를 집계합니다. 토큰 가장 셸 생성 요청이 반드시 있고, 자동 상승 UAC 우회 레지스트리 변조·사용자 쓰기 위치 드라이버 서비스 등록·보안 제품 조회 중 1개 이상이 함께 있으며(필수 행위군 2개 이상), 서로 다른 행위군이 5개 이상이면 탐지합니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.
Threat analysis
취약한 서명 드라이버를 반입해 커널 권한으로 보안 제품 프로세스를 종료하는 BYOVD 공격은 랜섬웨어 실행 직전 단계에서 자주 나타납니다. ms-settings·mscfile 등 자동 상승 프로그램의 셸 명령 키 변조와 토큰 가장은 관리자·SYSTEM 권한을 얻는 과정이고, 보안 제품 조회는 종료 대상을 고르는 과정입니다. 이러한 행위가 확인되면 보안 제품이 무력화될 수 있으므로 즉시 대응합니다.
False positives
관리 도구나 설치 프로그램이 토큰을 복제해 다른 권한으로 프로세스를 생성하거나, 자산 관리 스크립트가 설치된 보안 제품을 조회하는 경우가 있습니다. 필수 행위군과 행위군 5개가 함께 요구되어 단독으로는 탐지되지 않으나, 반복 탐지되는 정상 도구가 있으면 해당 프로세스 경로를 예외 조건으로 추가합니다.
Response actions
해당 단말에서 변조된 셸 명령 레지스트리 키와 등록된 드라이버 서비스(경로·서명)를 확인하고, 보안 제품 에이전트가 정상 동작 중인지 점검합니다. 반입된 드라이버 해시를 취약 드라이버 목록과 대조합니다. 정탐으로 확인되면 단말을 격리하고 드라이버 서비스와 변조된 키를 제거한 뒤, 같은 드라이버가 반입된 다른 단말을 조회합니다.