Genian EDR

Download 0
Last updated Nov 17, 2026

지니언 EDR - 리눅스 서버 스크립트(웹셸) 파일 다수 배치·웹셸 업로드와 명령 전달·웹셸 코드 기록·임시 업로드 서버 실행 복합 행위 - 웹셸 배치·탐지 회피 시험 의심

지니언 EDR 로그에서 리눅스 서버에 서버 스크립트(웹셸) 파일이 다수 배치되거나 웹셸 업로드·명령 전달·웹셸 코드 기록이 반복되는 웹셸 배치·탐지 회피 시험을 탐지합니다.

Overview

Priority High
Type Batch
Schedule Every month/Every day/Every hour/Every 10 mins */10 * * * *
Message 지니언 EDR - 웹셸 배치형 복합 행위: $host_ip
Output field order hostname, host_ip, grp_cnt, anchor_cnt, ws_files, up_cmds, code_cmds, groups, techs, first_seen, last_seen
MITRE Techniques T1071.001· T1505.003· T1059.006· T1608.001· T1105· T1204.002· T1070.004
MITRE tactics TA0042 Resource Development· TA0002 Execution· TA0003 Persistence· TA0005 Defense Evasion· TA0011 Command and Control
Origin User proposal letsgo

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 event_subtype == "ProcessStart") 4| search len(trim(hostname)) > 0 5| eval psrc = if(len(trim(image_path)) > 0, trim(image_path), trim(image)) 6| eval proc = lower(substr(psrc, lastindexof(psrc, "\\") + 1)), ipath = lower(psrc), cmd_l = lower(nvl(cmd_line, "")), 7 i_dir = if(lastindexof(psrc, "\\") >= 0, lower(substr(psrc, 0, lastindexof(psrc, "\\"))), ""), 8 par = lower(nvl(substr(parent_image, lastindexof(parent_image, "\\") + 1), "")), hostname = lower(trim(hostname)) 9| 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) 10| 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) 11| eval fpath = lower(nvl(file_path, "")), f_dir = if(lastindexof(file_path, "\\") >= 0, lower(substr(file_path, 0, lastindexof(file_path, "\\"))), "") 12| eval grp = case( 13 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "/(?:curl|wget)$") and (match(cmd_l, "\\bcmd\\.exe\\b") or match(cmd_l, "\\bpro=cmd\\b") or (match(cmd_l, "\\s-f\\s+\\S*=@") and match(cmd_l, "\\.(?:aspx|asp|php|jsp|jspx)\\b")))), "wsupload", 14 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and ((match(cmd_l, "<\\?(?:php|=)") and match(cmd_l, "(?:eval|assert|system|passthru|shell_exec|popen|proc_open|base64_decode)\\s*\\(|\\$_(?:get|post|request|cookie)\\s*\\[")) or match(cmd_l, "runtime\\.getruntime\\(\\)\\.exec\\([^)]*request\\.getparameter"))), "wscode", 15 _schema == "genian-edr-file" and in(event_subtype, "FileCreate", "FileMove") and ((match(fpath, "^/(?:tmp|var/tmp|dev/shm|var/www|srv/www|srv/http|usr/share/nginx|var/lib/tomcat[0-9]*/webapps|opt/[^/]+/webapps)/(?:[^/]+/)*[^/]+\\.(?:php[0-9]?|phtml|phar|jsp|jspx|aspx?|ashx|cgi)$") or match(fpath, "^/(?:tmp|var/tmp|dev/shm)/[^/]*web_?shell[^/]*$")) and not(match(lower(psrc), "^/usr/bin/(?:dpkg|apt|apt-get|rpm|yum|dnf|snap|composer|git)$|^/usr/lib/snapd/"))), "wsfile", 16 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and (match(ipath, "/[^/]*web_?shell[^/]*$") or match(cmd_l, "/[^\\s/]*(?:web_?shell|cmdshell|b374k|weevely)[^\\s/]*\\.(?:php[0-9]?|phtml|jsp|jspx|aspx?)\\b"))), "wsname", 17 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and match(cmd_l, "python[0-9.]*\\s+(?:-u\\s+)?/(?:tmp|var/tmp|dev/shm)/\\S+\\.py\\b")), "pysrv", 18 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and (match(cmd_l, "python[0-9.]*\\s+-m\\s+(?:http\\.server|simplehttpserver)\\b") or match(cmd_l, "\\bphp\\s+-s\\s+\\S+:\\d+") or match(cmd_l, "busybox\\s+httpd\\b")) and not(match(ipath, "/(?:grep|egrep|pgrep|pkill|ps)$"))), "stagesrv", 19 _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", 20 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "^/(?:tmp|var/tmp|dev/shm)/")), "lx_tmpexec", 21 _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", 22 _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") 23| search isnotnull(grp) 24| eval tech = case(grp == "wsupload", "T1071.001", grp == "wscode", "T1505.003", grp == "wsfile", "T1505.003", grp == "wsname", "T1505.003", grp == "pysrv", "T1059.006", grp == "stagesrv", "T1608.001", grp == "lx_tmpdrop", "T1105", grp == "lx_tmpexec", "T1204.002", grp == "lx_dl", "T1105", grp == "lx_wipe", "T1070.004") 25| eval anchor_g = if(in(grp, "wsupload", "wscode", "wsfile", "wsname"), grp, null), ws_files_v = if(grp == "wsfile", fpath, null), up_cmds_v = if(grp == "wsupload", cmd_l, null), code_cmds_v = if(grp == "wscode", cmd_l, null) 26| stats dc(grp) as grp_cnt, dc(anchor_g) as anchor_cnt, dc(ws_files_v) as ws_files, dc(up_cmds_v) as up_cmds, dc(code_cmds_v) as code_cmds, values(grp) as groups, values(tech) as techs, min(_time) as first_seen, max(_time) as last_seen by hostname, host_ip 27| search anchor_cnt >= 2 or ws_files >= 3 or up_cmds >= 5 or code_cmds >= 5 28| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs), 29 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)를 집계합니다. 웹셸 행위 4종(서버 스크립트·웹셸 이름 파일 생성, 웹셸 이름 파일 취급·실행, 명령줄 웹셸 코드, curl·wget 웹셸 업로드·명령 전달) 중 2종 이상이 있으면 탐지합니다(필수 행위군). 서로 다른 서버 스크립트 파일이 3개 이상 생성되는 경우(ws_files)에도 탐지합니다. 서로 다른 웹셸 업로드·명령 전달 명령(up_cmds)이 5개 이상이거나 서로 다른 웹셸 코드 명령(code_cmds)이 5개 이상인 경우에도 탐지합니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.

Threat analysis

웹셸은 웹 서버에 업로드된 스크립트 파일 하나로 원격 명령 실행을 가능하게 하는 지속성 수단입니다. 공격자는 GET·POST·eval 등 방식이 다른 웹셸 여러 종을 업로드해 보안 제품이 탐지하지 못하는 것을 확인한 뒤 그 웹셸을 남깁니다. 다수의 서버 스크립트 파일이 짧은 시간에 생성되면 이러한 시험이 진행 중인 것으로 판단합니다.

False positives

웹 애플리케이션 배포 과정에서 서버 스크립트 파일이 다수 생성되는 경우 파일 수 조건이 충족될 수 있습니다. 배포 도구가 생성하는 경로와 생성 주체 프로세스를 기준으로 예외 조건을 추가하여 조정합니다.

Response actions

생성된 서버 스크립트 파일을 확보하여 웹셸 여부를 확인하고, 웹 서버 접근 로그에서 해당 파일에 대한 요청과 출발지 주소를 조회합니다. 업로드 서버로 쓰인 임시 HTTP 서버 프로세스를 종료합니다. 정탐으로 확인되면 웹셸을 제거하고 출발지 주소를 차단하며, 웹 서버 프로세스가 실행한 명령 이력을 조사합니다.

No comments yet.