지니언 EDR 로그에서 Windows의 SSH 키 기반 측면 이동·관리자 계정 생성·로그 삭제 또는 리눅스의 파일리스 실행·SUID 바이너리 교체·커널 권한 상승이 한 호스트에서 겹치는 Qilin 랜섬웨어 측면 이동을 탐지합니다.
Overview
Query
1table duration=30m EDR_GENIAN
2| search (_schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileDelete", "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 ((proc == "ssh-keygen.exe" and match(cmd_l, "\\s-f\\s+\"?(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\")) or (proc == "icacls.exe" and match(cmd_l, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\[^\\s\"]*(?:ssh|_key\\b|id_rsa|id_ed25519|id_ecdsa)") and match(cmd_l, "/inheritance:r|/grant:r"))), "sshkey",
17 _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",
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+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",
19 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "wevtutil.exe" and match(cmd_l, "\\s(?:cl|clear-log)\\s")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "clear-eventlog\\b|remove-eventlog\\b|\\.clearlog\\(|wevtutil(?:\\.exe)?\\s+(?:cl|clear-log)\\s"))), "logclear",
20 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and not(match(ipath, "runc")) and (match(ipath, "^/proc/(?:self|[0-9]+)/fd/[0-9]+$") or indexof(ipath, "memfd:") == 0 or match(cmd_l, "memfd_create|(?:^|\\s)/proc/(?:self|[0-9]+)/fd/[0-9]+(?:\\s|$)"))), "lx_memfd",
21 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and match(ipath, "/chmod$") and match(cmd_l, "\\s(?:[0-7]?[2467][0-7]{3}|[ugoa]*\\+[rwxt]*s[rwxt]*)\\s")), "lx_suid",
22 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and (indexof(fpath, "/") == 0 and not(match(lower(psrc), "^/usr/bin/(?:dpkg|dpkg-deb|apt|apt-get|rpm|yum|dnf|snap|update-alternatives)$|^/usr/lib/snapd/|^/usr/libexec/packagekitd$|^/usr/sbin/(?:ldconfig|update-alternatives)")) and match(concat(fpath, " ", lower(nvl(file_path2, ""))), "(?:^|\\s)/(?:usr/)?s?bin/[^/\\s]+(?:\\s|$)")), "lx_sysbin",
23 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and match(ipath, "/(?:cp|mv|install|dd|tee|ln)$") and match(cmd_l, "(?:\\s|of=)/(?:etc/(?:passwd|shadow|gshadow|sudoers)|(?:usr/)?s?bin/(?:su|sudo|passwd|pkexec))[ \\t]*(?:$|\\n)")), "lx_sysbin",
24 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and (match(cmd_l, "\\bxfrm\\s+state\\s+add\\b[^\\n]*(?:espinudp|espintcp|digest_null)") or match(cmd_l, "-j\\s+tee\\s+--gateway\\s+127\\.") or match(cmd_l, "\\bsu\\s+(?:-\\s+)?firefart\\b"))), "lx_lpe",
25 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and not(match(ipath, "/sshd$")) and match(cmd_l, "authorized_keys") and ((match(ipath, "/(?:touch|sed|perl)$") and match(cmd_l, "^(?:touch\\s|sed\\s+-i|perl\\s+-[a-z]*i)[^\\n]*/\\.ssh/authorized_keys2?\\b")) or match(cmd_l, ">>?\\s*\\S*authorized_keys2?\\b|\\btee\\b[^\\n]*authorized_keys|\\b(?:cp|mv|install|ln|cat|dd)\\b[^\\n]*\\sauthorized_keys2?\\b|\\b(?:cp|mv|install|ln|dd)\\b[^\\n]*/authorized_keys2?\\b|ssh-copy-id"))), "lx_authkey",
26 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and (match(concat(fpath, " ", lower(nvl(file_path2, ""))), "/\\.ssh/authorized_keys2?(?:\\s|$)") and not(match(lower(psrc), "/sshd$|^/usr/bin/(?:dpkg|apt|apt-get|snap)$|^/usr/lib/snapd/|/cloud-init$"))), "lx_authkey",
27 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and ((match(ipath, "/(?:useradd|adduser|newusers)$") and not(match(cmd_l, "--system\\b|\\s-r(?:\\s|$)|\\s(?:-s|--shell)\\s+\\S*/(?:nologin|false)\\b"))) or (match(ipath, "/usermod$") and match(cmd_l, "\\s-[a-z]*g\\s+\\S*\\b(?:sudo|wheel|root|adm)\\b")) or (match(ipath, "/gpasswd$") and match(cmd_l, "\\s-a\\s+\\S+\\s+(?:sudo|wheel|root|adm)\\b")))), "lx_acct",
28 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and match(ipath, "/(?:cat|head|tail|less|more|strings|xxd|od|base64|grep|awk|sed|cut|cp|tar|dd)$") and match(cmd_l, "(?:\\s|if=)/etc/g?shadow-?(?:\\s|$)")), "lx_shadow",
29 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "^/(?:tmp|var/tmp|dev/shm)/")), "lx_tmpexec",
30 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and (match(concat(fpath, " ", lower(nvl(file_path2, ""))), "(?:^|\\s)/(?:tmp|var/tmp|dev/shm)/[^\\s]+") and file_type == "EXEC" and not(match(lower(psrc), "^/usr/bin/(?:dpkg|apt|apt-get|snap)$|^/usr/lib/snapd/"))), "lx_tmpdrop",
31 _schema == "genian-edr-network" and event_subtype == "NetworkConnect" and (lower(psrc) == "/usr/sbin/sshd" and direction == "IN" and match(string(remote_ip), "^(?:10\\.|192\\.168\\.|172\\.(?:1[6-9]|2[0-9]|3[01])\\.)")), "lx_sshin",
32 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and (match(cmd_l, "(?:curl|wget)\\b[^\\n|]*\\|\\s*(?:sudo\\s+)?(?:ba|da|z)?sh\\b") or match(cmd_l, "/dev/(?:tcp|udp)/[0-9a-z]") or match(cmd_l, "python[0-9.]*\\s+-c\\s[^\\n]*(?:urllib|requests|socket)[^\\n]*(?:subprocess|os\\.system|exec\\(|memfd|pty\\.spawn)"))), "lx_oneliner",
33 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "/(?:curl|wget)$") and match(cmd_l, "(?:\\s-o|--output(?:-document)?)[= ]?\\s*\\S?/(?:tmp|var/tmp|dev/shm)/|\\|\\s*(?:sudo\\s+)?(?:ba|da|z)?sh\\b")), "lx_dl",
34 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and (match(concat(fpath, " ", lower(nvl(file_path2, ""))), "(?:^|\\s)(?:/(?:etc|usr/lib|lib)/systemd/(?:system|user)/|/home/[^/\\s]+/\\.config/systemd/user/|/root/\\.config/systemd/user/)[^/\\s]+\\.(?:service|timer|socket|path)(?:\\s|$)") and not(match(lower(psrc), "^/usr/bin/(?:dpkg|apt|apt-get|rpm|yum|dnf|snap|systemctl|deb-systemd-helper)$|^/usr/lib/snapd/|^/(?:usr/)?lib/systemd/"))), "lx_systemd",
35 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and ((match(ipath, "/(?:rm|shred|unlink|truncate)$") and match(cmd_l, "\\s/(?:usr/)?s?bin/\\.[^/\\s]+|\\s/dev/shm/[^/\\s]+|\\.(?:bash|zsh)_history|/var/log/(?:auth\\.log|secure|wtmp|btmp|lastlog|syslog|messages|audit/)|^shred\\b|/shred\\s")) or match(cmd_l, "\\bhistory\\s+-c\\b|unset\\s+histfile|histfile=/dev/null") or (match(ipath, "/(?:cp|mv)$") and match(cmd_l, "\\.(?:bash|zsh)_history")))), "lx_wipe",
36 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and ((match(ipath, "/base64$") and match(cmd_l, "\\s(?:-d|--decode)\\b")) or (match(ipath, "/xxd$") and match(cmd_l, "\\s-r\\b")) or (match(ipath, "/openssl$") and match(cmd_l, "\\senc\\b[^\\n]*\\s-d\\b")))), "lx_decode",
37 _schema == "genian-edr-file" and event_subtype == "FileCreate" and (match(fpath, "\\\\(?:plink|chisel|ngrok|frpc|frps|ligolo[^\\\\]*|revsocks|gost|bore|rathole|iox)\\.exe$") and not(in(proc, "msiexec.exe", "trustedinstaller.exe", "tiworker.exe")) and not(match(fpath, "\\\\program files(?: \\(x86\\))?\\\\putty\\\\"))), "tunnel",
38 _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",
39 _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",
40 _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",
41 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "add-type[\\s\\S]*dllimport|dllimport[\\s\\S]*add-type")), "nativeapi",
42 _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",
43 _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"))), "user",
44 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "cmd.exe", "powershell.exe", "pwsh.exe", "where.exe", "tree.com", "wmic.exe") and match(ps_text, "\\b(?:cim_datafile|cim_directory|win32_directory)\\b[\\s\\S]*\\bget\\b|\\bdir\\b[^|&\\r\\n]*\\s/s\\b|\\btree(?:\\.com)?\\b[^|&\\r\\n]*\\s/f\\b|\\bwhere(?:\\.exe)?\\s+/r\\s|get-childitem[^|\\r\\n]*-recurse|\\bgci\\b[^|\\r\\n]*-recurse|dllimport[\\s\\S]*\\bfind(?:first|next)filew?\\b")), "filedisc",
45 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "sc.exe" and match(cmd_l, "\\s(?:query|queryex|qc|qdescription|enumdepend)\\b")) or (proc == "tasklist.exe" and match(cmd_l, "\\s/svc\\b")) or ((proc == "net.exe" or (proc == "net1.exe" and par != "net.exe")) and match(cmd_l, "\\bnet1?(?:\\.exe)?\"?\\s+start\\s*$")) or (proc == "wmic.exe" and match(cmd_l, "\\bservice\\b[\\s\\S]*\\b(?:get|list)\\b")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-service\\b|win32_service\\b"))), "svcdisc",
46 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "reg.exe" and match(cmd_l, "\\bquery\\b") and match(cmd_l, "securityproviders\\\\wdigest|control\\\\lsa\\b|winlogon|terminal server|simontatham\\\\putty|martin prikryl|realvnc|tightvnc|control\\\\systemstartoptions|/v\\s+systemstartoptions")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "get-item(?:property)?(?:value)?\\b|\\bgp\\b|\\bgpv\\b|regread|opensubkey") and match(ps_text, "securityproviders\\\\wdigest|control\\\\lsa\\b|winlogon\\b[\\s\\S]*(?:defaultpassword|autoadminlogon)|terminal server\\\\(?:winstations|fdenytsconnections)|simontatham\\\\putty|systemstartoptions"))), "regquery",
47 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "['\"]\\*\\.(?:pem|key|pfx|p12)['\"][\\s,]*['\"]\\*\\.(?:pem|key|pfx|p12|cer|crt)['\"]|(?:get-childitem|gci|dir|ls)\\b[^\\r\\n|]*-(?:filter|include)\\s+['\"]?\\*\\.(?:pfx|p12|pem|key)\\b|cert:\\\\[\\s\\S]*\\.hasprivatekey|export-pfxcertificate")) or (proc == "certutil.exe" and match(cmd_l, "[-/]exportpfx\\b")) or (in(proc, "cmd.exe", "where.exe") and match(cmd_l, "(?:dir|where)\\b[^\\r\\n]*(?:/s|/r)\\b[^\\r\\n]*\\*\\.(?:pfx|p12|pem|key)\\b"))), "privkey",
48 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (in(proc, "gitleaks.exe", "trufflehog.exe", "detect-secrets.exe", "ggshield.exe", "noseyparker.exe") or match(cmd_l, "(?:gitleaks|trufflehog)[^\\s]*(?:\\.exe)?\"?\\s+(?:detect|protect|git|filesystem|dir)\\b") or (proc == "git.exe" and match(cmd_l, "\\scredential\\s+fill\\b")) or (proc == "cmdkey.exe" and match(cmd_l, "/generic:\"?git:") and match(cmd_l, "/pass:")) or (proc == "findstr.exe" and match(cmd_l, "\\s/s") and match(cmd_l, "pass(?:word|wd)?|secret|token|api[_-]?key|credential")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "gitleaks(?:\\.exe)?\"?\\s+detect|\\sdetect\\s+--source\\b[^\\r\\n]*--report-(?:path|format)|git\\s+credential\\s+fill|select-string\\b[^\\r\\n]*-pattern\\s+['\"]?[^'\"\\r\\n]*(?:password|passwd|secret|api[_-]?key|aws_secret)"))), "credfile",
49 _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",
50 _schema == "genian-edr-reg" and event_subtype == "RegSetValue" and (match(rkey, "\\\\software\\\\(?:wow6432node\\\\)?microsoft\\\\windows\\\\currentversion\\\\runonceex\\\\[^\\\\]+\\\\depend$")), "runkey",
51 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and ((proc == "schtasks.exe" and match(cmd_l, "[/-]create\\b") and match(cmd_l, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\|%(?:temp|tmp|appdata|public|programdata)%|/tr\\s+\"?[^/]*(?:powershell|pwsh|mshta|wscript|cscript|rundll32|regsvr32|cmd)(?:\\.exe)?\\b|/ru\\s+\"?(?:system|nt authority)")) or (in(proc, "powershell.exe", "pwsh.exe") and match(ps_text, "(?:^|[^a-z])register-scheduledtask") and match(ps_text, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\|-execute\\s+['\"]?[^'\"\\s]*(?:powershell|pwsh|mshta|wscript|cscript|rundll32|regsvr32|cmd)(?:\\.exe)?\\b|-user(?:id)?\\s+['\"]?(?:system|nt authority)"))), "schtask",
52 _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",
53 _schema == "genian-edr-file" and event_subtype == "FileDelete" and (match(proc, "^(?:msmpeng|mssense|sentinelagent|csfalconservice|cylancesvc|mcshield|bdservicehost|savservice|sophos|ekrn|avp\\.exe|ntrtscan|tmbmsrv|cbdefense|repmgr|xagt|elastic-endpoint|vsserv|ccsvchst|avastsvc|v3svc|ayagent)") and match(fpath, "(?:c:\\\\users\\\\public|c:\\\\perflogs|c:\\\\programdata|c:\\\\windows\\\\temp|\\\\appdata\\\\local\\\\temp|\\\\appdata\\\\roaming|\\\\downloads)\\\\") and match(fpath, "\\.(?:exe|dll|scr|com|pif|cpl|sys|swf|jar|js|jse|vbs|vbe|wsf|hta|ps1|bat|cmd|lnk|docm|xlsm|zip|rar|7z|iso|img|txt)$") and not(match(fpath, "^c:\\\\programdata\\\\microsoft\\\\"))), "avquar",
54 _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",
55 _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)$")), "ransom",
56 _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",
57 _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",
58 _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")
59| search isnotnull(grp)
60| eval tech = case(grp == "sshkey", "T1021.004", grp == "ssh", "T1021.004", grp == "localacct", "T1136.001", grp == "logclear", "T1685.005", grp == "lx_memfd", "T1620", grp == "lx_suid", "T1548.001", grp == "lx_sysbin", "T1554/T1554", grp == "lx_lpe", "T1068", grp == "lx_authkey", "T1098.004/T1098.004", grp == "lx_acct", "T1136.001", grp == "lx_shadow", "T1003.008", grp == "lx_tmpexec", "T1204.002", grp == "lx_tmpdrop", "T1105", grp == "lx_sshin", "T1021.004", grp == "lx_oneliner", "T1059.004", grp == "lx_dl", "T1105", grp == "lx_systemd", "T1543.002", grp == "lx_wipe", "T1070.004", grp == "lx_decode", "T1140", grp == "tunnel", "T1572", grp == "localgroup", "T1069.001", grp == "acct", "T1087", grp == "netconn", "T1049", grp == "nativeapi", "T1106", grp == "sysinfo", "T1082", grp == "user", "T1033", grp == "filedisc", "T1083", grp == "svcdisc", "T1007", grp == "regquery", "T1012", grp == "privkey", "T1552.004", grp == "credfile", "T1552.001", grp == "runkey", "T1547.001/T1547.001", grp == "schtask", "T1053.005", grp == "drop", "T1105", grp == "avquar", "T1587.001", grp == "webc2", "T1071.001", grp == "ransom", "T1486", grp == "shadow", "T1490", grp == "wipe", "T1070.004", grp == "psbypass", "T1059.001")
61| eval anchor_g = if(in(grp, "sshkey", "ssh", "localacct", "logclear", "lx_memfd", "lx_suid", "lx_sysbin", "lx_lpe", "lx_authkey", "lx_acct"), grp, null)
62| stats dc(grp) as grp_cnt, dc(anchor_g) as anchor_cnt, values(grp) as groups, values(tech) as techs, min(_time) as first_seen, max(_time) as last_seen by hostname, host_ip
63| search anchor_cnt >= 3 and grp_cnt >= 6
64| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs),
65 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)를 집계합니다. 필수 행위군이 3개 이상이고 서로 다른 행위군이 6개 이상이면 탐지합니다. Windows의 필수 행위군은 SSH 키 쌍 생성·개인 키 권한 조정, SSH 클라이언트 원격 접속, 로컬 계정 생성, 이벤트 로그 삭제입니다. 리눅스의 필수 행위군은 memfd 파일리스 실행, SUID·SGID 부여, 시스템 실행 파일 교체, 커널 권한 상승 익스플로잇 준비, authorized_keys 키 추가, 로컬 계정 생성입니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.
Threat analysis
Qilin 랜섬웨어는 Windows 단말에서 SSH 키를 만들어 리눅스 서버로 이동한 뒤 서버까지 암호화 대상으로 삼습니다. 리눅스에서 memfd로 파일 없이 익스플로잇을 실행하고 su 바이너리를 SUID로 교체하는 것은 루트 권한을 얻는 과정이며, 이후 /etc/shadow 읽기가 이어지면 서버의 계정 정보가 탈취된 것으로 판단합니다.
False positives
서버 관리자가 SSH 키를 만들어 authorized_keys에 등록하고 계정을 생성하는 작업은 정상 운영에서도 발생합니다. 필수 행위군 3개와 행위군 6개가 요구되지만 서버 구축·이전 작업 시에는 탐지될 수 있으므로, 작업 일정과 대조하고 구성 관리 도구는 실행 주체 기준으로 예외 조건을 추가합니다.
Response actions
Windows 단말에서는 생성된 SSH 키와 접속 대상 서버, 생성된 계정을 확인합니다. 리눅스 서버에서는 authorized_keys 변경 내용과 SUID가 부여된 파일을 확인하고, 교체된 시스템 실행 파일의 무결성을 패키지 검증으로 확인합니다. 정탐으로 확인되면 출발지와 대상 호스트를 함께 격리하고 등록된 키와 계정을 제거하며, 서버 계정의 암호를 변경합니다.