SOC Prime Bias: 중간

03 Feb 2026 17:06 UTC

맬웨어의 반격

Author Photo
Ruslan Mikhalov Chief of Threat Research at 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, 디버그 방지.

공격 흐름

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."