SOC Prime Bias: 심각

09 4월 2026 18:14

새로운 백서: BPFDoor 변종이 눈에 띄지 않게 숨는 방법

Author Photo
SOC Prime Team linkedin icon 팔로우
새로운 백서: BPFDoor 변종이 눈에 띄지 않게 숨는 방법
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

요약

Rapid7 Labs는 통신 환경에서 은밀한 백도어 접근을 유지하기 위해 커널 레벨의 Berkeley Packet Filters를 악용하는 일곱 가지 새로운 BPFDoor 변종을 식별했습니다. 새로운 계열인 httpShell과 icmpShell은 상태 없는 ICMP 및 HTTP 터널링을 ‘마법’ 패킷 형식과 숨겨진 IP 필드를 사용하여 최소한의 관찰가능한 발자국으로 지휘 통제를 수립합니다. 이 보고서는 프로세스 위장, 파일 기술자 정리, 타임스템핑, 암호화된 ICMP 통신 등을 통해 임플란트가 거의 보이지 않도록 하려는 방법을 설명합니다.

조사

연구원들은 거의 300개의 샘플을 분석하여 새로운 BPF 바이트코드 특성, 신규 ‘마법의 바이트’ 마커, 및 hpasmlited와 cmathreshd와 같은 변종 특유의 프로세스 이름을 추출했습니다. Docker에서의 실험실 검증은 ICMP 기반의 PTY 터널링, RC4 암호화 페이로드 교환, -1 플래그가 패킷의 원본 주소로 트래픽을 반환하는 라우팅 동작을 재현했습니다. 그 팀은 또한 NTP-over-SSL 서비스를 가장하여 스테이징 및 제어 트래픽을 혼합하는 지원 인프라를 발견했습니다.

완화

커널에 인접한 악용을 드러내는 텔레메트리에 우선순위를 두십시오: AF_PACKET 소켓 생성 모니터링, BPF 필터 첨부 탐지, 및 icmpShell 변종에 관련된 프로토콜 이상 징후, ICMP 시퀀스 1234 및 잘못된 ICMP 코드 1을 사냥하십시오. 실행 파일 경로가 없는 의심스러운 데몬, 위조된 서비스 이름, 또는 정당한 시스템 프로세스와 일치하지 않는 실행 시 특성에 대한 경고를 발령하십시오. Rapid7은 rapid7_bpfdoor_check.sh 평가 스크립트를 실행하고 새롭게 문서화된 마법 바이트 서명을 이용해 YARA/Suricata 탐지를 업데이트할 것을 권고합니다.

대응

지표가 발견되면 시스템을 격리하고, 의심되는 임플란트 프로세스를 중지하고 연관된 도메인 및 IP 범위를 차단하십시오. 메모리 및 디스크 아티팩트를 캡처하여 BPF 상태 및 실행 시간 증거를 보존한 후 rapid7_bpfdoor_check.sh를 사용하여 활성 BPF 필터 및 관련된 0바이트 뮤텍스 아티팩트를 식별하십시오. 마지막으로 공개된 서명으로 탐지를 갱신하고 동일한 패킷 마커, 프로세스 이름 및 필터 첨부 동작의 재발을 계속 모니터하십시오.

graph TB classDef technique fill:#ffcc99 classDef action fill:#99ccff classDef tool fill:#cccccc classDef process fill:#c2f0c2 classDef malware fill:#f4c2c2 tech_socket_filters[“<b>기법</b> – T1205.002 소켓 필터 기반 트래픽 신호<br/><b>설명</b>: AF_PACKET 소켓과 BPF 필터로 트래픽 감시”] class tech_socket_filters technique tech_masq_task_service[“<b>기법</b> – T1036.004 서비스 위장<br/><b>설명</b>: 정상 데몬 이름 위장”] class tech_masq_task_service technique tech_overwrite_args[“<b>기법</b> – T1036.011 프로세스 인자 덮어쓰기<br/><b>설명</b>: 인자 문자열 변조”] class tech_overwrite_args technique tech_rename_utils[“<b>기법</b> – T1036.003 유틸리티 위장<br/><b>설명</b>: 도구 이름 변경”] class tech_rename_utils technique tech_obfuscate_strings[“<b>기법</b> – T1027 난독화 파일<br/><b>설명</b>: 스택 기반 문자열 난독화”] class tech_obfuscate_strings technique tech_clear_history[“<b>기법</b> – T1070.003 명령 기록 삭제”] class tech_clear_history technique tech_wipe_timestamps[“<b>기법</b> – T1070.004 파일 삭제”] class tech_wipe_timestamps technique tech_unix_shell[“<b>기법</b> – T1059.004 Unix 셸”] class tech_unix_shell technique tech_break_process[“<b>기법</b> – T1036.009 프로세스 트리 파괴”] class tech_break_process technique tech_http_c2[“<b>기법</b> – T1071.001 HTTP 통신”] class tech_http_c2 technique tech_icmp_tunnel[“<b>기법</b> – T1572 ICMP 터널링”] class tech_icmp_tunnel technique tech_rc4_encryption[“<b>기법</b> – T1573.001 RC4 암호화”] class tech_rc4_encryption technique tech_data_obfuscation[“<b>기법</b> – T1001 데이터 난독화”] class tech_data_obfuscation technique tech_port_knocking[“<b>기법</b> – T1205.001 포트 노킹”] class tech_port_knocking technique tech_proxy[“<b>기법</b> – T1090 프록시”] class tech_proxy technique tech_create_process[“<b>기법</b> – T1543 시스템 프로세스 생성”] class tech_create_process technique tech_socket_filters –>|활성화| tech_masq_task_service tech_masq_task_service –>|지원| tech_overwrite_args tech_overwrite_args –>|지원| tech_rename_utils tech_rename_utils –>|강화| tech_obfuscate_strings tech_obfuscate_strings –>|숨김| tech_clear_history tech_clear_history –>|완료| tech_wipe_timestamps tech_wipe_timestamps –>|준비| tech_unix_shell tech_unix_shell –>|분리| tech_break_process tech_break_process –>|채널| tech_http_c2 tech_break_process –>|채널| tech_icmp_tunnel tech_icmp_tunnel –>|사용| tech_rc4_encryption tech_rc4_encryption –>|추가| tech_data_obfuscation tech_port_knocking –>|활성화| tech_socket_filters tech_socket_filters –>|사용| tech_proxy tech_proxy –>|전송| tech_http_c2 tech_proxy –>|전송| tech_icmp_tunnel tech_create_process –>|지속성| tech_masq_task_service

Attack Flow

Simulation Execution

Prerequisite: The Telemetry & Baseline Pre‑flight Check must have passed.

Attack Narrative & Commands

  1. Create a malicious Bash script in the rarely‑monitored path /var/run/user/0.
  2. Make the script executable and then delete the file while keeping it open, resulting in a deleted inode that the kernel logs as part of the command line when the process continues to run.
  3. Execute the dangling file descriptor, causing the process to run from a deleted inode and generating the exact telemetry the Sigma rule looks for.
  4. Verify that the process command line in audit logs contains the string “deleted inode”, satisfying selection3.
  5. Avoid the excluded masquerading strings (hpasmlited, cmathreshd) to ensure the rule fires.

Regression Test Script

#!/usr/bin/env bash
# -------------------------------------------------
# BPFDoor‑style execution-from‑deleted‑inode test
# -------------------------------------------------

# 1. Prepare a malicious (harmless) payload
PAYLOAD="/var/run/user/0/malicious.sh"
echo -e "#!/usr/bin/env bashnsleep 60" > "$PAYLOAD"
chmod +x "$PAYLOAD"

# 2. Open the file descriptor (keep the file open)
exec 3<"$PAYLOAD"

# 3. Delete the file from the filesystem – inode remains open via FD 3
rm -f "$PAYLOAD"

# 4. Execute the script via its dangling file descriptor.
#    The /proc/self/fd/3 symlink points to the now‑deleted inode.
bash /proc/self/fd/3 &

# 5. Give the process a moment to start and be logged
sleep 5

# 6. Clean up: close the file descriptor
exec 3<&-
echo "Simulation completed – check SIEM for alerts."

Cleanup Commands

#!/usr/bin/env bash
# -------------------------------------------------
# Cleanup after BPFDoor simulation
# -------------------------------------------------

# Kill any lingering sleep processes started by the script
pkill -f "sleep 60"

# Ensure no leftover files in the target directory
rm -f /var/run/user/0/malicious.sh

echo "Cleanup finished."

End of Report