SOC Prime Bias: 중간

03 2월 2026 20:06

맬웨어의 반격

Author Photo
Ruslan Mikhalov SOC Prime에서 위협 연구 책임자 linkedin icon 팔로우
맬웨어의 반격
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

요약

이 보고서는 은폐된 배치 스크립트, PowerShell 기반 로더, Donut으로 생성된 셸코드를 결합하여 자격 증명 도용 기능을 갖춘 지속적이고 메모리 상주형 RAT를 설치하는 다단계 Windows 침입 체인을 설명합니다. 로더는 은폐를 위해 설계된 .NET 임플란트를 배포하며, 강력한 분석 회피 범위, 프로세스 주입, 대화형 원격 제어 기능을 포함합니다. 도난당한 데이터는 Discord 웹훅과 Telegram 봇을 통해 전송되며, 메모리 내 실행과 최소한의 디스크 상 발자국에 중점을 둔 모듈형 설계를 강화합니다.

조사

분석을 통해 사용자별 실행 등록 값에서 숨겨진 배치 파일을 통해 지속성이 확인되었습니다. %APPDATA%. 배치 스크립트는 임베디드된 Base64 블롭을 포함하고 있으며, 이 블롭을 추출하여 PowerShell 단계를 디코딩합니다. 이 로더는 Donut 셸코드 페이로드를 해독하여 svchost.exe and explorer.exe에 주입하며, Windows API 예를 들어 CreateRemoteThread 를 사용하여 메모리 내 임플란트를 실행합니다. 디코드된 단계는 Pulsar RAT 기능 및 전용 도난 모듈을 포함한 강하게 난독화된 .NET 어셈블리로 해석됩니다. 연구자들은 분석 또는 주입 모니터링을 감지할 수 있는 비 VM 및 디버그 방지 검사를 관찰했으며, 태스크 매니저를 비활성화하거나 UAC 관련 동작을 조작하여 로컬 방어를 약화시키려는 시도를 하는 명령 핸들러도 확인되었습니다.

완화 대책

사용자가 쓰기 가능한 AppData 경로에서 숨겨진 배치 파일의 생성을 차단하고 사용자별 실행 키에 추가된 알 수 없는 항목을 조사합니다. PowerShell 명령 줄에서 Base64 디코딩 패턴과 원격 메모리 주입 활동의 징후를 모니터링합니다. Donut 셸코드 특성을 인식하고 메모리 내 .NET 어셈블리를 탐지하며 Discord 및 Telegram으로의 C2 트래픽을 신호하는 엔드포인트 도구를 사용합니다. 어플리케이션 허용 목록을 시행하고 웹훅 엔드포인트 및 메시지 기반 C2에 대한 아웃바운드 접근을 제한하는 이그레스 제어를 적용합니다.

응답

감지되면, 엔드포인트를 격리하고 주입된 svchost.exe and explorer.exe 의 인스턴스를 중단하고 숨겨진 배치 파일과 관련된 지속성 실행 키를 제거합니다. 메모리 아티팩트를 보존하기 위해 메모리 이미지를 캡처하고 .NET 페이로드를 추출 및 분석하며, 일치하는 행동 및 지표를 찾기 위해 환경을 조사합니다. 노출된 자격 증명을 재설정하고 추가 유출을 방지하기 위해 손상된 Discord/Telegram 웹훅 토큰을 취소합니다.

키워드: Windows 멀웨어, PowerShell 로더, 숨겨진 배치 파일, AppData, 실행 키, Donut 셸코드, CreateRemoteThread, 프로세스 주입, 메모리 상 .NET, Pulsar RAT, 자격 증명 도난, Discord 웹훅, Telegram 봇, 비 VM, 디버그 방지.

graph TB %% Class Definitions classDef action fill:#99ccff classDef file fill:#ccffcc classDef process fill:#ffeb99 classDef malware fill:#ff9999 classDef operator fill:#ff9900 %% Nodes – Files and Registry logon_script_file[“<b>파일</b>: 0a1a98b5f9fc7c62.bat<br/><b>위치</b>: %APPDATA%\\Microsoft\\…”] class logon_script_file file run_key[“<b>레지스트리</b>: HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\bada287ebf”] class run_key file %% Nodes – Techniques (Actions) persistence_run[“<b>기법</b> – T1037.001 부팅 또는 로그온 초기화 스크립트<br/><b>설명</b>: %APPDATA%에 숨겨진 배치 파일을 배치하고 Run 키에 등록하여 지속성을 확보함.”] class persistence_run action powershell_interpreter[“<b>기법</b> – T1059.001 명령 및 스크립트 인터프리터: PowerShell<br/><b>설명</b>: 실행 정책을 우회하여 디코딩된 PowerShell 스크립트를 실행함.”] class powershell_interpreter action obfuscation[“<b>기법</b> – T1027 난독화된 파일 또는 정보<br/><b>설명</b>: XOR로 암호화된 바이트 배열과 전달 후 컴파일 로직을 사용함.”] class obfuscation action deobfuscate[“<b>기법</b> – T1140 파일 또는 정보 디난독화/디코딩<br/><b>설명</b>: Base64 및 XOR 디코딩을 통해 셸코드를 생성함.”] class deobfuscate action reflective_loading[“<b>기법</b> – T1620 반사적 코드 로딩<br/><b>설명</b>: 대상 프로세스에 메모리를 할당하고 셸코드를 기록함.”] class reflective_loading action process_injection[“<b>기법</b> – T1055.002 프로세스 인젝션: 포터블 실행 파일 인젝션<br/><b>설명</b>: CreateRemoteThread를 사용하여 svchost.exe 및 explorer.exe에 셸코드를 주입함.”] class process_injection action sandbox_evasion[“<b>기법</b> – T1497 가상화/샌드박스 회피<br/><b>설명</b>: 실행 전에 가상 머신 및 샌드박스 환경을 확인함.”] class sandbox_evasion action indirect_cmd[“<b>기법</b> – T1202 간접 명령 실행<br/><b>설명</b>: C2를 통해 작업 관리자 및 사용자 계정 컨트롤을 활성화 또는 비활성화함.”] class indirect_cmd action uac_bypass[“<b>기법</b> – T1548.002 권한 상승 제어 메커니즘 악용: 사용자 계정 컨트롤 우회<br/><b>설명</b>: UAC 및 보안 사용자 인터페이스를 비활성화함.”] class uac_bypass action scheduled_task[“<b>기법</b> – T1053 예약 작업/잡<br/><b>설명</b>: 로그온 시 페이로드를 실행하기 위해 schtasks.exe 작업을 생성함.”] class scheduled_task action autostart[“<b>기법</b> – T1547 부팅 또는 로그온 자동 실행<br/><b>설명</b>: Run 키와 예약 작업을 통한 이중 지속성 확보.”] class autostart action cred_from_browser[“<b>기법</b> – T1555.003 웹 브라우저에서 자격 증명 획득<br/><b>설명</b>: 저장된 자격 증명을 수집함.”] class cred_from_browser action alternate_auth[“<b>기법</b> – T1550.004 대체 인증 자료 사용: 웹 세션 쿠키<br/><b>설명</b>: 세션 쿠키 및 토큰을 추출함.”] class alternate_auth action archive_data[“<b>기법</b> – T1560.002 수집된 데이터 아카이브: 라이브러리를 통한 아카이브<br/><b>설명</b>: 수집된 자격 증명을 메모리에서 ZIP으로 압축함.”] class archive_data action compression[“<b>기법</b> – T1027.015 압축<br/><b>설명</b>: 유출 전에 데이터를 ZIP 형식으로 압축함.”] class compression action exfil_webhook[“<b>기법</b> – T1567.004 웹훅을 통한 데이터 유출<br/><b>설명</b>: ZIP 아카이브를 Discord 웹훅 및 Telegram 봇으로 전송함.”] class exfil_webhook action web_service[“<b>기법</b> – T1102.003 웹 서비스: 단방향 통신<br/><b>설명</b>: Discord 및 Telegram을 통한 HTTPS 통신을 사용함.”] class web_service action compile_after_delivery[“<b>기법</b> – T1027.004 전달 후 컴파일<br/><b>설명</b>: 인젝션을 위해 런타임에 C# 상호 운용 코드를 컴파일함.”] class compile_after_delivery action stripped_payload[“<b>기법</b> – T1027.008 스트립된 페이로드<br/><b>설명</b>: 메타데이터가 제거된 최종 .NET 어셈블리.”] class stripped_payload action embedded_payload[“<b>기법</b> – T1027.009 임베디드 페이로드<br/><b>설명</b>: Donut 셸코드에 .NET 페이로드를 포함함.”] class embedded_payload action %% Nodes – Files Produced ps_script_file[“<b>파일</b>: ps_7b948266.ps1<br/><b>내용</b>: Base64 페이로드를 디코딩하고 실행함.”] class ps_script_file file donut_shellcode[“<b>파일</b>: decoded.bin<br/><b>유형</b>: Donut으로 생성된 셸코드”] class donut_shellcode file %% Nodes – Processes svchost_process[“<b>프로세스</b>: svchost.exe”] class svchost_process process explorer_process[“<b>프로세스</b>: explorer.exe”] class explorer_process process %% Nodes – Malware credential_stealer[“<b>멀웨어</b>: .NET 스틸러<br/><b>설명</b>: 브라우저에서 비밀번호, 쿠키 및 토큰을 추출함.”] class credential_stealer malware %% Connections – Attack Flow logon_script_file –>|등록됨| run_key run_key –>|활성화| persistence_run persistence_run –>|실행| powershell_interpreter powershell_interpreter –>|실행| ps_script_file ps_script_file –>|포함| obfuscation obfuscation –>|요구| deobfuscate deobfuscate –>|생성| donut_shellcode donut_shellcode –>|로드됨| reflective_loading reflective_loading –>|기록| svchost_process svchost_process –>|인젝션 via| process_injection process_injection –>|대상| explorer_process process_injection –>|사용| compile_after_delivery process_injection –>|사용| embedded_payload explorer_process –>|실행| credential_stealer credential_stealer –>|추출| cred_from_browser credential_stealer –>|추출| alternate_auth cred_from_browser –>|수집된 데이터| archive_data archive_data –>|압축| compression compression –>|전송 via| exfil_webhook exfil_webhook –>|사용| web_service sandbox_evasion –>|사전 검사| powershell_interpreter indirect_cmd –>|제어| uac_bypass scheduled_task –>|대체 지속성| autostart autostart –>|보장| persistence_run

공격 흐름

Simulation Execution

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

Rationale: This section details the precise execution of the adversary technique (TTP) designed to trigger the detection rule. The commands and narrative MUST directly reflect the TTPs identified and aim to generate the exact telemetry expected by the detection logic. Abstract or unrelated examples will lead to misdiagnosis.

  • Attack Narrative & Commands:

    1. Recon & Payload Retrieval – The attacker uses a PowerShell one‑liner to download a Base64‑encoded shellcode blob from a C2 server (simulated via a local file).
    2. Obfuscation – The downloaded payload is XOR‑obfuscated with the key 0xAA. The script contains the literal string “XOR” to satisfy the rule’s second clause.
    3. Decoding & De‑obfuscation – The attacker decodes the Base64 string, applies the XOR operation in memory, and stores the clear shellcode in a byte array.
    4. Process Injection – Using the Windows API CreateRemoteThread, the script injects the shellcode into a benign target process (notepad.exe). The command line explicitly includes the text “CreateRemoteThread”.
    5. Execution – The remote thread runs, achieving code execution on the host.
  • Regression Test Script:

    # ------------------------------------------------------------
    # Simulated PowerShell memory‑injection campaign
    # ------------------------------------------------------------
    # 1. Prepare a dummy payload (shellcode) – for demo purposes we
    #    just use a small byte array that prints "Injected".
    $shellcode = [Byte[]] (0x90,0x90,0x90,0x90)   # NOP sled placeholder
    
    # 2. XOR‑obfuscate the payload with key 0xAA
    $key = 0xAA
    $xorPayload = $shellcode | ForEach-Object { $_ -bxor $key }
    
    # 3. Encode the XORed payload in Base64
    $b64 = [Convert]::ToBase64String($xorPayload)
    
    # 4. Build the PowerShell command that will run the injection
    $injectCmd = @"
    `$bytes = [Convert]::FromBase64String('$b64')
    # XOR de‑obfuscation (literal 'XOR' present for detection)
    `$decoded = `$bytes | ForEach-Object { `$_ -bxor $key }
    # Launch notepad as injection target
    `$proc = Start-Process notepad -PassThru
    # Allocate memory in remote process
    `$addr = [System.Runtime.InteropServices.Marshal]::AllocHGlobal(`$decoded.Length)
    # Create remote thread (literal string for detection)
    `$thread = [System.Threading.Thread]::Start( { 
    } )
    "@
    
    # 5. Encode the whole injection command (includes marker ::6bbd64163c24f552::)
    $marker = '::6bbd64163c24f552::'
    $fullCmd = $marker + $injectCmd
    $encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($fullCmd))
    
    # 6. Execute the malicious PowerShell via -EncodedCommand
    powershell.exe -EncodedCommand $encoded
  • Cleanup Commands:

    # Terminate any notepad instances started during the test
    Get-Process notepad -ErrorAction SilentlyContinue | Stop-Process -Force
    
    # Remove any temporary files / modules if created (none in this demo)
    Write-Host "Cleanup complete."