SOC Prime Bias: High

14 4월 2026 18:38

VIPERTUNNEL 파이썬 백도어: 심층 분석

Author Photo
SOC Prime Team linkedin icon 팔로우
VIPERTUNNEL 파이썬 백도어: 심층 분석
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

요약

이 보고서는 VIPERTUNNEL의 분석을 자세히 설명하며, 이는 지속성을 위해 예약된 작업을 통해 지속성을 유지하고 악성 sitecustomize.py를 활용하여 난독화된 DLL을 로드하는 Python 기반 백도어입니다. 이 DLL은 하드코딩된 C2 서버로 포트 443을 통해 SOCKS5 프록시를 설정하는 다중 스테이지 페이로드를 복호화 및 실행합니다. 이 인프라는 UNC2165 및 EvilCorp와 연결되어 있으며 ShadowCoil 자격 증명 도용기와 난독화 기술을 공유합니다.

조사

연구원들은 Autoruns 출력을 검사하고 예약된 작업 523135538을 식별하여 실행을 C:ProgramDatacp49spythonw.exe와 해당 sitecustomize.py 모듈로 추적했습니다. b5yogiiy3c.dll의 리버스 엔지니어링은 계층화된 난독화, 복호화 루틴, 하드코딩된 자격 증명을 사용하는 SOCKS5 터널을 생성하는 최종 스테이지를 밝혀냈습니다. 인프라 분석은 캠페인에 여러 도메인 및 IP를 연결하고 Pyramid C2 프레임워크의 사용을 강조했습니다.

완화

아규먼트 없이 pythonw.exe 실행 모니터링, 숫자 이름을 가진 예약된 작업 생성, 예상치 못한 위치에서의 sitecustomize.py 존재 여부를 감시하는 엔드포인트 탐지를 배포합니다. 비정상적인 HTTP 401 응답과 함께 포트 443/8000을 차단하여 알려진 C2 도메인으로의 아웃바운드 트래픽을 차단합니다. 승인되지 않은 Python 모듈 로드를 방지하기 위해 엄격한 애플리케이션 제어를 구현합니다.

대응

의심스러운 예약된 작업 생성 및 스크립트 없이 pythonw.exe 실행에 대한 알림을 설정합니다. 영향을 받은 호스트를 격리하고 메모리 덤프를 수집하며 특성 클래스 이름 및 하드코딩된 자격 증명을 탐색합니다. 손상된 자격 증명을 무효화하고 보고서에서 식별된 C2 인프라를 방해합니다.

graph TB %% Class definitions classDef technique fill:#ffcc99 classDef process fill:#c2f0c2 classDef tool fill:#ffeb99 classDef file fill:#d9d9d9 classDef component fill:#cce5ff classDef c2 fill:#f4b084 classDef credential fill:#ffe6e6 %% Technique nodes tech_persistence[“<b>기법</b> – T1053.005 예약 작업 : 지속성<br/><b>설명</b>: 시스템 부팅 또는 스케줄 실행 작업 생성/수정”] class tech_persistence technique tech_obfuscation[“<b>기법</b> – T1027 난독화된 파일/정보<br/><b>설명</b>: 인코딩/압축/암호화로 코드 은폐”] class tech_obfuscation technique tech_deobfuscate[“<b>기법</b> – T1140 디코딩/복호화<br/><b>설명</b>: Base85 등을 디코딩하여 다음 단계 코드 복원”] class tech_deobfuscate technique tech_compile[“<b>기법</b> – T1027.004 실행 후 컴파일<br/><b>설명</b>: compile()/exec()로 메모리 컴파일”] class tech_compile technique tech_reflect[“<b>기법</b> – T1620 리플렉티브 로딩<br/><b>설명</b>: 디스크 없이 메모리 실행”] class tech_reflect technique tech_proxy_ext[“<b>기법</b> – T1090.002 외부 프록시<br/><b>설명</b>: SOCKS5 외부 프록시”] class tech_proxy_ext technique tech_proxy_int[“<b>기법</b> – T1090.001 내부 프록시<br/><b>설명</b>: 내부 프록시 릴레이”] class tech_proxy_int technique tech_tunnel[“<b>기법</b> – T1572 프로토콜 터널링<br/><b>설명</b>: SOCKS5 터널로 캡슐화”] class tech_tunnel technique tech_encrypted[“<b>기법</b> – T1573 암호화 채널<br/><b>설명</b>: ChaCha20/XOR C2 암호화”] class tech_encrypted technique tech_webc2[“<b>기법</b> – T1102 웹 서비스<br/><b>설명</b>: Pyramid HTTPS C2 통신”] class tech_webc2 technique tech_nonstd[“<b>기법</b> – T1571 비표준 포트<br/><b>설명</b>: 443 포트 위장”] class tech_nonstd technique %% Process and tool nodes process_task[“<b>프로세스</b> – 예약 작업 523135538<br/><b>명령</b>: C:\\ProgramData\\cp49s\\pythonw.exe”] class process_task process tool_pythonw[“<b>도구</b> – pythonw.exe<br/><b>역할</b>: 콘솔 없이 Python 실행”] class tool_pythonw tool %% File nodes file_sitecustomize[“<b>파일</b> – sitecustomize.py<br/><b>목적</b>: 자동 import 및 DLL 실행”] class file_sitecustomize file file_dll[“<b>파일</b> – b5yogiiy3c.dll<br/><b>유형</b>: 난독화 Python 페이로드”] class file_dll file %% Component nodes component_wire[“<b>컴포넌트</b> – Wire 클래스<br/><b>기능</b>: SOCKS5 클라이언트”] class component_wire component component_relay[“<b>컴포넌트</b> – Relay 클래스<br/><b>기능</b>: 트래픽 전달”] class component_relay component component_commander[“<b>컴포넌트</b> – Commander 클래스<br/><b>기능</b>: C2 제어”] class component_commander component %% C2 and credential nodes c2_server[“<b>C2 서버</b> – Pyramid 서비스<br/><b>응답</b>: HTTP 401 Basic realm=Proxy”] class c2_server c2 credentials[“<b>자격 증명</b> – AnyUser / AnyPassword<br/><b>용도</b>: 프록시 인증”] class credentials credential %% Connections tech_persistence –>|creates| process_task process_task –>|launches| tool_pythonw tool_pythonw –>|imports| file_sitecustomize file_sitecustomize –>|loads| file_dll file_dll –>|uses| tech_obfuscation file_dll –>|triggers| tech_deobfuscate tech_deobfuscate –>|leads to| tech_compile tech_compile –>|leads to| tech_reflect tech_reflect –>|executes| component_wire component_wire –>|works with| component_relay component_relay –>|controls| component_commander component_commander –>|contacts| c2_server c2_server –>|uses| tech_proxy_ext c2_server –>|uses| tech_proxy_int c2_server –>|tunnels via| tech_tunnel c2_server –>|encrypts channel| tech_encrypted c2_server –>|communicates over| tech_webc2 c2_server –>|uses port| tech_nonstd component_commander –>|auth with| credentials %% Apply classes class tech_persistence,tech_obfuscation,tech_deobfuscate,tech_compile,tech_reflect,tech_proxy_ext,tech_proxy_int,tech_tunnel,tech_encrypted,tech_webc2,tech_nonstd technique class process_task process class tool_pythonw tool class file_sitecustomize,file_dll file class component_wire,component_relay,component_commander component class c2_server c2 class credentials credential

공격 흐름

시뮬레이션 실행

필수 사전 조건: Telemetry & Baseline Pre-flight Check가 통과되어야 합니다.

이유: 이 섹션에서는 탐지 규칙을 트리거하기 위해 설계된 적대기술(TTP)의 정확한 실행을 상세히 설명합니다. 명령어 및 내러티브는 식별된 TTP를 직접 반영하고 탐지 논리가 기대하는 정확한 원격 측정을 생성하는 것을 목표로 해야 합니다.

  • 공격 내러티브 및 명령어:

    적대자는 처음에 악성 sitecustomize.pypythonw.exe와 동일한 디렉터리에 배치합니다. Python은 인터프리터 시작 시 sitecustomize.py 를 자동으로 가져와 공격자가 명령줄에 스크립트 경로를 전달하지 않고 임의의 코드를 실행할 수 있게 합니다. 아규먼트 없이 pythonw.exe 를 실행하여프로세스 생성 이벤트에 빈 CommandLine 필드가 포함되며, 이는 Sigma 규칙의 조건을 만족시킵니다. 페이로드는 지속성을 위한 예약된 작업을 설정하여 인터프리터가 시스템 시작 시 실행되도록 하여 장기적인 입지를 확보합니다.

  • 회귀 테스트 스크립트:

    # -------------------------------------------------
    # 악성 sitecustomize.py 설정
    # -------------------------------------------------
    $payloadPath = 'C:ProgramDatacp49ssitecustomize.py'
    $exePath     = 'C:ProgramDatacp49spythonw.exe'
    
    # 대상 폴더가 존재하는지 확인
    New-Item -ItemType Directory -Path (Split-Path $exePath) -Force | Out-Null
    
    # 테스트를 위해 pythonw.exe의 무해한 복사본 배포 (이미 존재하지 않을 경우)
    # 실제 레드 팀 시나리오에서는 적법한 인터프리터가 될 것입니다
    if (-Not (Test-Path $exePath)) {
        # 시스템 Python 설치에서 복사 (필요에 맞게 경로 조정)
        Copy-Item 'C:Python39pythonw.exe' $exePath
    }
    
    # 악성 sitecustomize.py 생성 (개념 증명을 위한 예약된 작업 생성)
    @"
    import subprocess, sys
    # pythonw.exe를 매 분마다 실행하는 예약 작업 생성 (지속성)
    subprocess.run(['schtasks', '/Create', '/SC', 'MINUTE', '/MO', '1',
                '/TN', 'UpdateTask', '/TR', sys.executable])
    "@ | Set-Content -Path $payloadPath -Encoding UTF8
    
    # -------------------------------------------------
    # 탐지 트리거 (악성 실행)
    # -------------------------------------------------
    Write-Host '[+] 빈 명령줄로 pythonw.exe 실행 중...'
    Start-Process -FilePath $exePath -ArgumentList '' -WindowStyle Hidden
    
    # 예약된 작업이 생성될 때까지 짧은 시간 기다림 (선택 사항)
    Start-Sleep -Seconds 5
    
    Write-Host '[+] 페이로드 실행됨. SIEM에서 경고를 확인하세요.'
    # -------------------------------------------------
    # 스크립트 끝
    # -------------------------------------------------
  • 정리 명령어:

    # 악성 sitecustomize.py 제거
    Remove-Item -Path 'C:ProgramDatacp49ssitecustomize.py' -Force -ErrorAction SilentlyContinue
    
    # 페이로드에 의해 생성된 예약된 작업 삭제
    schtasks /Delete /TN UpdateTask /F
    
    # 복사된 pythonw.exe를 제거 (테스트 복사본일 경우)
    # Remove-Item -Path 'C:ProgramDatacp49spythonw.exe' -Force
    
    Write-Host '[+] 정리 완료.'