Rebex 기반 텔레그램 RAT 베트남 타겟팅
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 TB %% Class Definitions classDef technique fill:#99ccff classDef tool fill:#ffcc99 classDef process fill:#ffeb99 classDef operator fill:#ff9900 %% Nodes initial_access[“<b>기법</b> – <b>T1204.001 사용자 실행: 악성 링크</b><br/><b>설명</b>: 사용자가 악성 링크를 클릭하여 실행됨.”] class initial_access technique delivery_html_smuggling[“<b>기법</b> – <b>T1027.006 HTML 스머글링</b><br/><b>설명</b>: HTML 내부에 숨겨진 JavaScript로 페이로드 전달.”] class delivery_html_smuggling technique delivery_compile_after[“<b>기법</b> – <b>T1027.004 전달 후 컴파일</b><br/><b>설명</b>: 호스트에서 나중에 페이로드 구성.”] class delivery_compile_after technique delivery_embedded_payloads[“<b>기법</b> – <b>T1027.009 내장 페이로드</b><br/><b>설명</b>: JavaScript 내부에 숨겨진 페이로드.”] class delivery_embedded_payloads technique delivery_deobfuscate[“<b>기법</b> – <b>T1140 디코딩/복호화</b><br/><b>설명</b>: 브라우저에서 Base64 디코딩.”] class delivery_deobfuscate technique persistence_run_key[“<b>기법</b> – <b>T1127.002 신뢰 도구 프록시 실행</b>”] class persistence_run_key technique persistence_appcert[“<b>기법</b> – <b>T1546.009 AppCert DLL 실행</b>”] class persistence_appcert technique recon_hardware[“<b>기법</b> – 하드웨어 정보 수집”] class recon_hardware technique recon_firmware[“<b>기법</b> – 펌웨어 정보 수집”] class recon_firmware technique c2_web_protocols[“<b>기법</b> – 웹 프로토콜 C2”] class c2_web_protocols technique c2_bidirectional[“<b>기법</b> – 양방향 통신”] class c2_bidirectional technique c2_oneway[“<b>기법</b> – 단방향 통신”] class c2_oneway technique c2_encrypted[“<b>기법</b> – 암호화된 채널”] class c2_encrypted technique c2_data_encoding[“<b>기법</b> – 데이터 인코딩”] class c2_data_encoding technique c2_config_repo[“<b>기법</b> – 설정 저장소”] class c2_config_repo technique asset_drain[“<b>기법</b> – 토큰 승인”] class asset_drain technique %% Tools / Processes tool_malicious_link[“<b>도구</b>: 피싱 링크”] class tool_malicious_link tool tool_js_payload[“<b>도구</b>: 난독화 JS”] class tool_js_payload tool process_installer[“<b>프로세스</b>: Windows 설치 프로그램”] class process_installer process tool_node_exe[“<b>도구</b>: node.exe”] class tool_node_exe tool tool_web3modal[“<b>도구</b>: Web3Modal UI”] class tool_web3modal tool %% Connections unchanged initial_access –>|leads_to| delivery_html_smuggling delivery_html_smuggling –>|uses| tool_malicious_link delivery_html_smuggling –>|uses| tool_js_payload delivery_html_smuggling –>|enables| delivery_compile_after delivery_compile_after –>|enables| delivery_embedded_payloads delivery_embedded_payloads –>|triggers| delivery_deobfuscate delivery_deobfuscate –>|creates| process_installer process_installer –>|drops| persistence_run_key process_installer –>|may_use| persistence_appcert persistence_run_key –>|executes| tool_node_exe persistence_appcert –>|loads| tool_node_exe tool_node_exe –>|collects| recon_hardware tool_node_exe –>|collects| recon_firmware recon_hardware –>|feeds| c2_web_protocols recon_firmware –>|feeds| c2_web_protocols c2_web_protocols –>|supports| c2_bidirectional c2_web_protocols –>|supports| c2_oneway c2_bidirectional –>|uses| c2_encrypted c2_oneway –>|uses| c2_encrypted c2_encrypted –>|encodes| c2_data_encoding c2_data_encoding –>|stores_config_in| c2_config_repo c2_config_repo –>|provides| asset_drain asset_drain –>|uses| tool_web3modal
공격 흐름
탐지
지속성 가능성 지점 [ASEPs – 소프트웨어/NTUSER Hive] (레지스트리 이벤트 통해)
보기
시스템 중지 또는 재부팅을 강제하기 위한 종료 (cmdline 통해)
보기
LOLBAS HH – HTML 도움말 실행 프로그램의 의심스러운 인자 (cmdline 통해)
보기
자동 실행 위치의 의심스러운 바이너리/스크립트 (파일 이벤트 통해)
보기
Microsoft 컴파일 HTML 도움말(.chm) 확장명으로 파일 쓰기를 통한 실행 가능성 (파일 이벤트 통해)
보기
명령 및 제어 채널로 텔레그램 악용 가능성 (dns_query 통해)
보기
베트남을 타겟으로 한 Rebex 기반 Telegram RAT 탐지용 IOC (HashSha256)
보기
CHM 파일 실행으로 인해 발생하는 악의적 활동 [Windows 프로세스 생성]
보기
시뮬레이션 실행
전제 조건: Telemetry 및 Baseline Pre-flight 체크가 통과해야 합니다.
이유: 이 섹션은 탐지 규칙을 트리거할 수 있도록 설계된 상대 기술(TTP)의 정확한 실행을 상세히 설명합니다. 명령 및 서술은 식별된 TTP를 직접 반영하며 탐지 로직에서 기대하는 정확한 텔레메트리를 생성하는 데 중점을 두고 있습니다.
-
공격 서사 및 명령
-
전달: 공격자는 악성
.chm파일(명명된UpdateHelp.chm)을 피해자에게 전달합니다. -
디컴파일: 피해자(또는 악의적인 스크립트)가
hh.exe을 실행하여 내장된 페이로드를 추출합니다.-decompile플래그와 함께hh.exe -decompile C:TempPayloads C:UsersPublicUpdateHelp.chm이 과정은 규칙이 주시하는 프로세스 생성 이벤트 를 생성합니다. (
hh.exe+-decompile). -
페이로드 실행 – 이름이 변경된 인터프리터: 추출된 파일 내부에는 이름이 변경된 Python 인터프리터(
_pJifgWSwPi.exe)가 있습니다. 공격자는 낮은 프로파일을 유지하기 위해 이를 통해cmd.exe를 통해 실행합니다:cmd.exe /c "C:TempPayloads_pJifgWSwPi.exe -c "import os; os.system('whoami')""이렇게 하면 규칙의
cmd.exe조건이 만족됩니다. -
계약된 이진 프록시 – 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 "[+] 클린업 완료."