지니안 EDR

다운로드 0
업데이트 2026. 11. 17.

지니언 EDR - 리눅스 동적 링커 하이재킹·임시 경로 ELF 반입·sshpass 측면 이동·C2 유출·정찰 스크립트 복합 행위 - Ebury 침투 체인 의심

지니언 EDR의 리눅스 호스트 로그에서 동적 링커 하이재킹, 임시 경로 ELF 반입, sshpass 측면 이동, C2 유출이 한 호스트에서 겹치는 Ebury형 침투 체인을 탐지합니다.

개요

중요도 상
유형 배치 탐지
실행 주기 매달/매일/매시/10분간격 */10 * * * *
메시지 지니언 EDR - Ebury형 복합 행위: $host_ip
출력 필드 순서 hostname, host_ip, grp_cnt, anchor_cnt, groups, techs, first_seen, last_seen
MITRE 기술 T1574.006· T1105· T1021.004· T1041· T1082· T1204.002· T1059.004· T1543.002· T1140· T1070.004
MITRE 전술 TA0002 Execution· TA0003 Persistence· TA0005 Defense Evasion· TA0007 Discovery· TA0008 Lateral Movement· TA0011 Command and Control· TA0010 Exfiltration
출처 사용자 제안 letsgo

쿼리

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 (indexof(ipath, "/") == 0 and (match(cmd_l, "(?:^|\\s)ld_preload=\\S*/(?:tmp|var/tmp|dev/shm)/\\S*\\.so") or match(cmd_l, "(?:>>?|\\btee\\b|\\bcp\\b|\\bmv\\b|\\binstall\\b|\\bln\\b|\\bdd\\b)[^\\n]*/etc/ld\\.so\\.preload\\b"))), "lx_dlhijack", 15 _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", 16 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and (match(ipath, "/sshpass$") or (match(ipath, "/ssh$") and match(cmd_l, "stricthostkeychecking=no|userknownhostsfile=/dev/null") and match(cmd_l, "@(?:10\\.|192\\.168\\.|172\\.(?:1[6-9]|2[0-9]|3[01])\\.)")))), "lx_ssh", 17 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "/(?:curl|wget)$") and (match(cmd_l, "(?:\\s-t\\s|--upload-file\\b|--data-binary\\b|\\s-d\\s+@|\\s--data\\s+@)") or match(cmd_l, "x-amz-(?:algorithm|credential|signature)\\b") or (match(cmd_l, "https?://[^\\s/]+:[0-9]{4,5}/") and not(match(cmd_l, ":443/|:80/|:8080/"))))), "lx_exfil", 18 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (indexof(ipath, "/") == 0 and match(ipath, "/(?:ba|da|z|k)?sh$") and match(cmd_l, "(?:^|\\s)(?:ba|da|z|k)?sh\\s+/(?:tmp|var/tmp|dev/shm)/[a-z0-9_]+\\.sh\\b") and not(match(cmd_l, "/tmp/[0-9]+\\.[a-z0-9]+\\.sh|apt-key|gpghome|/gpg\\.[0-9]"))), "lx_disc", 19 _schema == "genian-edr-process" and event_subtype == "ProcessStart" and (match(ipath, "^/(?:tmp|var/tmp|dev/shm)/")), "lx_tmpexec", 20 _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", 21 _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", 22 _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", 23 _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", 24 _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", 25 _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") 26| search isnotnull(grp) 27| eval tech = case(grp == "lx_dlhijack", "T1574.006", grp == "lx_tmpdrop", "T1105", grp == "lx_ssh", "T1021.004", grp == "lx_exfil", "T1041", grp == "lx_disc", "T1082", grp == "lx_tmpexec", "T1204.002", grp == "lx_dl", "T1105", grp == "lx_oneliner", "T1059.004", grp == "lx_sshin", "T1021.004", grp == "lx_systemd", "T1543.002", grp == "lx_decode", "T1140", grp == "lx_wipe", "T1070.004") 28| eval anchor_g = if(in(grp, "lx_dlhijack", "lx_tmpdrop", "lx_ssh", "lx_exfil"), grp, null) 29| 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 30| search anchor_cnt >= 2 and grp_cnt >= 3 31| eval groups = strjoin(", ", groups), techs = strjoin(", ", techs), 32 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)를 집계합니다. 동적 링커 하이재킹(LD_PRELOAD·/etc/ld.so.preload 변조)·임시 경로 ELF 생성·sshpass 또는 호스트 키 검증 생략 아웃바운드 SSH·curl과 wget을 이용한 외부 업로드 중 2개 이상이 있고(필수 행위군), 서로 다른 행위군이 3개 이상이면 탐지합니다. 탐지 결과에는 관찰된 행위군 목록(groups)과 기법 목록(techs), 첫 발생 시각(first_seen)과 마지막 발생 시각(last_seen)을 함께 제공합니다.

위협 분석

Ebury는 악성 공유 라이브러리로 동적 링커를 가로채 OpenSSH에 백도어를 설치하고 SSH 자격 증명을 탈취하는 리눅스 악성코드입니다. 감염된 서버는 탈취한 자격 증명으로 다른 서버에 접속해 감염을 확산하므로, 호스트 키 검증을 비활성화한 자동 인증 SSH 접속이 함께 관찰되면 확산이 진행 중인 것으로 판단합니다.

오탐 유형

배포 자동화 스크립트가 sshpass로 여러 서버에 접속하거나 성능 분석 도구가 LD_PRELOAD를 사용하는 경우 필수 행위군이 관찰될 수 있습니다. 확인된 자동화 스크립트와 도구는 실행 경로와 접속 대상 기준으로 예외 조건을 추가하여 조정합니다.

대응 방안

/etc/ld.so.preload 내용과 임시 경로에 생성된 공유 라이브러리·ELF 파일을 확보하고, 시스템 라이브러리의 무결성을 패키지 검증으로 확인합니다. SSH 접속 대상 서버와 외부 업로드 목적지를 확인합니다. 정탐으로 확인되면 호스트를 격리하고 해당 서버를 거친 모든 SSH 계정의 암호와 키를 교체합니다.

아직 댓글이 없습니다.