SOC Prime Bias: Medium

27 4월 2026 18:22

Rebex 기반 텔레그램 RAT 베트남 타겟팅

Author Photo
Ruslan Mikhalov SOC Prime에서 위협 연구 책임자 linkedin icon 팔로우
Rebex 기반 텔레그램 RAT 베트남 타겟팅
shield icon

Detection stack

  • AIDR
  • Alert
  • ETL
  • Query

요약

악성 CHM 파일이 ZIP 아카이브 내에 포함되어 배포되며, 이는 임베디드 페이로드를 해독하는 C++ DLL과 함께 악성 Python 런타임을 드롭합니다. 해당 페이로드는 Winlogon 셸 하이재킹, 예약 작업, 그리고 MSBuild를 악용하여 지속성을 수립한 후, .NET 기반 Telegram RAT를 실행합니다. 이 악성코드는 하드코딩된 토큰을 사용하여 Telegram 봇과 통신하며 명령 실행, 토큰 교체, 파일 다운로드를 지원합니다. 베트남의 피해자를 표적으로 한 캠페인이 관찰되었으며, 현재 VirusTotal에서 탐지되지 않고 있습니다.

조사

CHM 파일 분석 결과, 아카이브를 디컴파일하고 PYTHONHOME을 정리한 후, 컴파일된 바이트코드 파일과 함께 이름이 변경된 Python 실행 파일을 실행하는 스크립트가 밝혀졌습니다. 그 후 바이트코드는 암호화된 DOCX 블롭을 해독하는 DLL을 로드하고, 추가 구성 요소를 추출하여 임시 위치에 저장했습니다. DLL은 레지스트리 항목을 생성하고 Doubt라는 이름의 작업을 예약하며 MSBuild XML 파일을 실행하여 두 번째 DLL을 로드하고, 최종적으로 .NET Telegram RAT를 배포했습니다. RAT는 명령-제어를 위해 하드코딩된 Telegram 봇 자격 증명에 의존했습니다.

완화

방어자는 신뢰할 수 없는 출처의 CHM 파일 실행을 차단하고 hh.exe, msbuild.exe및 서명되지 않거나 의심스러운 스크립트에 대한 PowerShell 사용을 제한해야 합니다. 모니터링은 Winlogon Shell 레지스트리 수정, 비정상적인 예약 작업 생성, 새로 드롭된 DLL의 임시 디렉토리 내 위치에 주목해야 합니다. 조직은 또한 프록시 제어를 통해 Telegram API 트래픽을 검사하고 사용자에게 최소 권한 접근을 적용해야 합니다.

대응 조치

보안 팀은 영향을 받은 호스트를 식별하고 격리하여, 휘발성 증거를 수집하고 악성 DLL 및 스크립트를 추출하여 분석해야 합니다. Winlogon Shell 값과 예약된 작업을 제거하고, 삭제된 파일을 삭제하며 변경된 레지스트리 설정을 신뢰할 수 있는 상태로 복원해야 합니다. 공개된 Telegram 봇 토큰은 즉각적으로 회전하고, 방어자는 추가 명령-제어 활동을 지속적으로 모니터링해야 합니다. 데이터 유출 여부를 파악하기 위한 전체 포렌식 조사를 권장합니다.

"graph TBn%% Class definitionsnclassDef action fill:#99ccffnclassDef tool fill:#ffcc99nclassDef malware fill:#ff9999nclassDef process fill:#ccccffnclassDef registry fill:#ffddaann%% Nodesninitial_access_phishing["<b>Action</b> – <b>T1566.001 Spearphishing Attachment</b><br/>Email with malicious CHM disguised as Word document sent to victim."]nclass initial_access_phishing actionnnfile_chm["<b>Malware</b> – <b>File</b>: CV – Vu PLPC KT nam 2026.chm<br/>Disguised with doubleu2011extension to appear as .doc."]nclass file_chm malwarenndefense_masquerade["<b>Action</b> – <b>T1036.008 Masquerading</b><br/>CHM file masquerades as Word document using double extension."]nclass defense_masquerade actionnndefense_obfuscation["<b>Action</b> – <b>T1027.006 Obfuscated Files or Information</b><br/>HTML smuggling hides malicious code inside CHM."]nclass defense_obfuscation actionnnexecution_user["<b>Action</b> – <b>T1204.002 User Execution</b><br/>Victim opens CHM, HTML/JS runs OBJECT tag launching cmd.exe."]nclass execution_user actionnnprocess_cmd["<b>Process</b> – cmd.exe<br/>Launched by CHM via OBJECT tag."]nclass process_cmd processnnexecution_msbuild["<b>Action</b> – <b>T1127.001 Trusted Developer Utilities Proxy Execution</b><br/>Script drops mechaniSm.xml and calls msbuild.exe to load malicious .NET DLL."]nclass execution_msbuild actionnntool_msbuild["<b>Tool</b> – msbuild.exe<br/>Used to load ioy24euj.dll."]nclass tool_msbuild toolnnfile_dll["<b>Malware</b> – <b>DLL</b>: ioy24euj.dll<br/>Contains .NET code for persistence and payload delivery."]nclass file_dll malwarennpersistence_autostart["<b>Action</b> – <b>T1547.014 Active Setup</b><br/>DLL modifies HKCUSoftwareMicrosoftWindows NTCurrentVersionWinlogonShell to point to renamed msbuild wrapper."]nclass persistence_autostart actionnnregistry_mod["<b>Registry</b> – HKCUSoftwareMicrosoftWindows NTCurrentVersionWinlogonShell<br/>Set to custom msbuild wrapper for autou2011run."]nclass registry_mod registrynnpersistence_event["<b>Action</b> – <b>T1546.009 AppCert DLLs</b><br/>DLL loaded via ctypes.CDLL and later executed to decrypt further payloads."]nclass persistence_event actionnndll_load["<b>Process</b> – ctypes.CDLL load<br/>Loads the malicious DLL into process space."]nclass dll_load processnnprivilege_injection["<b>Action</b> – <b>T1055.001 Process Injection</b><br/>DLL injects code into cmd.exe to run payloads."]nclass privilege_injection actionnnprocess_injection["<b>Process</b> – DLL injection into cmd.exe<br/>Enables execution of further malicious routines."]nclass process_injection processnncommand_and_control["<b>Action</b> – <b>T1573 Encrypted Channel</b><br/>.NET RAT communicates with Telegram bot using XORu2011encrypted and base64 encoded messages."]nclass command_and_control actionnnc2_telegram["<b>Tool</b> – Telegram bot<br/>Receives commands and exfiltrates data via encrypted channel."]nclass c2_telegram toolnnimpact_shutdown["<b>Action</b> – <b>T1529 System Shutdown/Reboot</b><br/>Scheduled task u201cDoubtu201d created to shut down system every Friday at midnight."]nclass impact_shutdown actionnnscheduled_task["<b>Process</b> – Scheduled Task u201cDoubtu201d<br/>Triggers system shutdown on schedule."]nclass scheduled_task processnn%% Connectionsninitial_access_phishing –>|delivers| file_chmnfile_chm –>|uses| defense_masqueradenfile_chm –>|uses| defense_obfuscationnfile_chm –>|triggers| execution_usernexecution_user –>|launches| process_cmdnprocess_cmd –>|enables| execution_msbuildnexecution_msbuild –>|uses| tool_msbuildntool_msbuild –>|loads| file_dllnfile_dll –>|enables| persistence_autostartnpersistence_autostart –>|modifies| registry_modnfile_dll –>|enables| persistence_eventnpersistence_event –>|loads via| dll_loadndll_load –>|performs| privilege_injectionnprivilege_injection –>|injects into| process_injectionnprocess_injection –>|facilitates| command_and_controlncommand_and_control –>|uses| c2_telegramncommand_and_control –>|leads to| impact_shutdownnimpact_shutdown –>|creates| scheduled_taskn"

공격 흐름

시뮬레이션 실행

전제 조건: Telemetry 및 Baseline Pre-flight 체크가 통과해야 합니다.

이유: 이 섹션은 탐지 규칙을 트리거할 수 있도록 설계된 상대 기술(TTP)의 정확한 실행을 상세히 설명합니다. 명령 및 서술은 식별된 TTP를 직접 반영하며 탐지 로직에서 기대하는 정확한 텔레메트리를 생성하는 데 중점을 두고 있습니다.

  • 공격 서사 및 명령

    1. 전달: 공격자는 악성 .chm 파일(명명된 UpdateHelp.chm)을 피해자에게 전달합니다.

    2. 디컴파일: 피해자(또는 악의적인 스크립트)가 hh.exe 을 실행하여 내장된 페이로드를 추출합니다. -decompile 플래그와 함께

      hh.exe -decompile C:TempPayloads C:UsersPublicUpdateHelp.chm

      이 과정은 규칙이 주시하는 프로세스 생성 이벤트 를 생성합니다. (hh.exe + -decompile).

    3. 페이로드 실행 – 이름이 변경된 인터프리터: 추출된 파일 내부에는 이름이 변경된 Python 인터프리터(_pJifgWSwPi.exe)가 있습니다. 공격자는 낮은 프로파일을 유지하기 위해 이를 통해 cmd.exe 를 통해 실행합니다:

      cmd.exe /c "C:TempPayloads_pJifgWSwPi.exe -c "import os; os.system('whoami')""

      이렇게 하면 규칙의 cmd.exe 조건이 만족됩니다.

    4. 계약된 이진 프록시 – Msbuild: Python 페이로드는 악의적인 .proj 파일을 기록한 후 이를 실행하기 위해 msbuild.exe 을 호출하여 지속성 또는 추가 코드 실행을 달성합니다:

      msbuild.exe C:TempPayloadsmalicious.proj /target:Build
  • 회귀 테스트 스크립트

    #=============================================================
    # CHM 기반 공격 시뮬레이션 - 시그마 규칙 트리거
    #=============================================================
    
    # 변수
    $chmPath   = "C:UsersPublicUpdateHelp.chm"
    $outFolder = "C:TempPayloads"
    $renamedPy = "_pJifgWSwPi.exe"
    $projFile  = "malicious.proj"
    
    # 1. 출력 폴더가 존재하는지 확인
    New-Item -ItemType Directory -Force -Path $outFolder | Out-Null
    
    # 2. CHM 파일의 디컴파일 시뮬레이션
    Write-Host "[*] Decompiling CHM..."
    hh.exe -decompile $outFolder $chmPath
    
    # 3. 이름이 변경된 인터프리터를 위한 python.exe 또는 벤치 exe의 사본을 배치
    Copy-Item -Path "$env:SystemRootSystem32WindowsPowerShellv1.0powershell.exe" `
              -Destination "$outFolder$renamedPy" -Force
    
    # 4. cmd.exe를 통해 이름이 변경된 인터프리터 실행
    Write-Host "[*] Launching renamed interpreter via cmd.exe..."
    cmd.exe /c "`"$outFolder$renamedPy`" -c `"Write-Host 'Simulated payload executed'`""
    
    # 5. 메시지를 출력하는 간단한 msbuild 프로젝트 생성
    $projContent = @"
    <Project ToolsVersion='4.0' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
      <Target Name='Build'>
        <Message Text='Msbuild executed malicious project' Importance='High'/>
      </Target>
    </Project>
    "@
    Set-Content -Path "$outFolder$projFile" -Value $projContent -Encoding ASCII
    
    # 6. msbuild.exe로 악의적인 프로젝트 실행
    Write-Host "[*] Executing msbuild.exe..."
    msbuild.exe "$outFolder$projFile" /target:Build
    
    Write-Host "[+] Simulation complete."
  • 정리 명령

    # 실행 중인 모든 남아 있는 프로세스를 중지합니다 (아직 실행 중인 경우)
    Get-Process -Name "_pJifgWSwPi","hh","msbuild","cmd" -ErrorAction SilentlyContinue |
      Stop-Process -Force
    
    # 생성된 파일 및 폴더 제거
    Remove-Item -Recurse -Force -Path "C:TempPayloads"
    # 테스트를 위해 생성된 CHM 파일을 선택적으로 삭제
    Remove-Item -Force -Path "C:UsersPublicUpdateHelp.chm" -ErrorAction SilentlyContinue
    
    Write-Host "[+] 클린업 완료."