NJRAT Malware Analysis: MITRE ATT&CK, IOCs & Detection

title: "NJRAT Malware Analysis: MITRE ATT&CK, IOCs & Detection"
description: "Complete technical analysis of NjRAT — detection ratio N/A, MITRE ATT&CK mapping, IOCs, behavioral profile, YARA rules, and incident response. Enriched by AI with live MalwareBazaar and OTX data."
date: "2026-04-22"
category: malware
image: "/img/posts/malware.png"
tags: ["malware", "threat-intelligence", "mitre-attck", "njrat", "njrat", "ioc", "detection", "cybersecurity"]
author: "ZeroDay Malware Intelligence"
malwareFamily: "NjRAT"
malwareType: "NjRAT"
detectRatio: "N/A"
attackTechniquesCount: "0"
NJRAT Malware Analysis: MITRE ATT&CK, IOCs & Detection
Detection ratio: N/A | MITRE ATT&CK techniques: see below | Type: NjRAT | Updated: 2026-04-22
This analysis was auto-enriched using live MalwareBazaar samples, VirusTotal reports, and OTX AlienVault threat intelligence, then synthesized and expanded by Ibugsec Corp.
NjRAT: A Deep Dive into a Persistent Remote Access Trojan
This report provides a comprehensive technical analysis of NjRAT, a long-standing Remote Access Trojan (RAT) that continues to pose a significant threat to organizations worldwide. We delve into its operational mechanics, attack vectors, persistence strategies, and Command and Control (C2) infrastructure. This analysis is tailored for security professionals, including SOC analysts, malware researchers, and red-teamers, offering actionable intelligence for detection, hunting, and incident response. We will explore its implementation of various MITRE ATT&CK techniques, provide actionable IOCs, and offer specific detection and hardening strategies. The persistent threat of NjRAT, and similar RATs capable of unauthorized access to user authentication tokens, underscores the importance of robust cybersecurity measures.
Executive Summary
NjRAT, also known as Bladabindi, is a prevalent and versatile Remote Access Trojan (RAT) that has been active for many years. Its primary function is to provide attackers with unauthorized remote access and control over compromised Windows systems. NjRAT is often distributed through phishing campaigns, malicious downloads, and exploit kits, though specific infection vectors can vary with evolving threat actor tactics. Threat actors leveraging NjRAT typically aim to steal sensitive data, conduct espionage, deploy further malware (such as ransomware or cryptominers), or use compromised machines for botnet activities. While not directly linked to specific zero-day exploits in its core functionality, NjRAT's effectiveness is amplified when combined with other vulnerabilities, including potential command injection vulnerabilities in AI coding assistants that could expose user authentication tokens, as suggested by ongoing cybersecurity discussions. Attribution for NjRAT campaigns is often fluid, with various cybercriminal groups utilizing and modifying its codebase. Recent activity indicates its continued use in broad targeting campaigns, often focusing on data theft and financial gain. The relative ease of use and customization of NjRAT makes it a popular choice for less sophisticated threat actors, contributing to its enduring presence in the malware landscape.
How It Works — Technical Deep Dive
NjRAT's operational flow is designed for stealth and comprehensive system control. Understanding its internal mechanics is crucial for effective defense.
Initial Infection Vector
NjRAT's initial infection vector is typically multi-faceted, leveraging common attack vectors. Phishing emails containing malicious attachments (e.g., disguised as invoices or important documents) or links to malicious websites are a primary delivery mechanism. These attachments can be executables, scripts, or archives that, when opened, trigger the download and execution of the NjRAT payload. Drive-by downloads from compromised websites are also a known vector, exploiting unpatched browser vulnerabilities or plugins. While NjRAT itself doesn't typically rely on zero-day exploits for initial compromise, it can be deployed as a post-exploitation tool after a system has been breached via other means, such as a known vulnerability like CVE-2026-5281 if a public exploit becomes available and is weaponized.
Persistence Mechanisms
NjRAT employs several robust persistence mechanisms to ensure its survival across reboots:
- Registry Run Keys: The most common method involves adding entries to
HKCU\Software\Microsoft\Windows\CurrentVersion\RunorHKLM\Software\Microsoft\Windows\CurrentVersion\Runto automatically launch the malware upon user login or system startup. The malware often self-copies to a system directory (e.g.,C:\Users\<user>\AppData\Roaming\<random_name>.exe) before creating these registry entries. - Scheduled Tasks: NjRAT can create scheduled tasks using
schtasks.exeto execute itself at regular intervals or upon specific system events, ensuring continued operation even if registry entries are removed. - DLL Hijacking: In some variants, NjRAT may leverage DLL hijacking by placing its malicious DLL in a location that a legitimate application attempts to load, thereby executing its code.
- Service Creation: More sophisticated variants might attempt to create a new Windows service or modify an existing one to ensure elevated privileges and persistent execution.
Command and Control (C2) Communication Protocol
NjRAT's C2 communication is a core component of its functionality. It typically uses a custom TCP-based protocol, often over port 3389 (though this can be customized by the attacker), mimicking RDP traffic for stealth.
- Protocol: The protocol is a proprietary binary protocol. It involves a handshake where the client (victim) sends its system information (hostname, username, OS version) to the server. The server then responds with commands.
- Traffic Patterns: The communication is characterized by relatively small, frequent packets. The malware beacons back to the C2 server periodically, sending system information and awaiting commands. Decrypting this traffic requires knowledge of the XOR key used for encryption, which is often hardcoded within the malware binary.
- Encryption: Data exchanged between the client and server is usually XOR-encrypted with a static key to evade network-based detection systems.
A simplified representation of the C2 interaction:
- Client Initialization: The NjRAT client establishes a TCP connection to the C2 server's IP address and port.
- Handshake: The client sends an encrypted packet containing its unique identifier (often derived from system information) and basic system details.
- Command Fetch: The client periodically polls the C2 server for commands. This might involve sending a "heartbeat" packet and waiting for a response.
- Command Execution: Upon receiving an encrypted command, the client decrypts it, executes the corresponding action (e.g., download file, run command, capture screen), and sends the results back to the C2 server in an encrypted format.
Payload Delivery and Staging Mechanism
NjRAT functions as a multi-stage loader. The initial dropper often downloads the main NjRAT executable from a C2 server or a compromised host. The main executable then acts as a platform for further payload delivery.
- Downloaders: The RAT can download and execute additional binaries, scripts (PowerShell, VBScript), or exploit modules. This allows attackers to tailor their attack post-compromise.
- Staging: The downloaded payloads are often written to temporary directories or specific locations on the victim's file system before execution. This staging process can sometimes be detected by file system monitoring.
Privilege Escalation Steps
NjRAT itself does not typically contain sophisticated native privilege escalation exploits. However, it can leverage existing system vulnerabilities or user misconfigurations.
- Exploiting Known Vulnerabilities: If a system is vulnerable to known privilege escalation exploits (e.g., unpatched kernel vulnerabilities), NjRAT can be instructed by the C2 to download and execute an exploit module.
- Credential Harvesting: By stealing credentials (e.g., using Mimikatz or keylogging), attackers can gain access to accounts with higher privileges.
- DLL Hijacking: As mentioned, this can sometimes lead to elevated privileges if the hijacked application runs with higher permissions.
Lateral Movement Techniques Used
NjRAT is equipped with functionalities to spread across a network:
- Remote Execution: Using tools like PsExec or WMI, NjRAT can execute commands and payloads on other machines within the network.
- Credential Dumping and Reuse: Stolen credentials from one machine can be used to authenticate and gain access to other systems.
- SMB Exploitation: While less common in basic NjRAT variants, more advanced versions might incorporate SMB exploitation modules to spread to vulnerable systems.
Data Exfiltration Methods
NjRAT excels at exfiltrating sensitive data:
- File Stealing: Attackers can instruct the RAT to browse the file system, select specific files (documents, credentials, configuration files), and upload them to the C2 server.
- Screen Capturing: Real-time screenshots or periodic screen captures can be taken and exfiltrated.
- Keylogging: Keystrokes are captured and sent back to the attacker, often targeting login credentials, sensitive communications, and financial information.
- Clipboard Monitoring: Contents of the clipboard can be monitored and exfiltrated.
- Webcam/Microphone Access: The RAT can activate the webcam and microphone to capture video and audio, which is then exfiltrated.
Anti-Analysis / Anti-Debugging / Anti-VM Tricks
NjRAT incorporates several techniques to evade detection and analysis:
- Obfuscation: The code is often heavily obfuscated using techniques like XOR encryption, string obfuscation, and control flow flattening to make static analysis more difficult.
- Anti-Debugging: Checks for the presence of debuggers are implemented. If a debugger is detected, the malware may terminate its execution or exhibit benign behavior.
- Anti-VM: Techniques to detect virtualized environments (e.g., checking for specific registry keys, driver names, or hardware identifiers associated with VMs) are employed. If a VM is detected, the malware may alter its behavior or terminate.
- Packing: The main payload might be packed or compressed, requiring unpacking in memory before execution, which can hinder analysis by standard AV engines and static tools.
MITRE ATT&CK Full Mapping
| Technique ID | Technique Name | Implementation | Detection |
|---|---|---|---|
| T1059.003 | Command and Scripting Interpreter: Windows Command Shell | NjRAT can execute arbitrary commands on the victim machine via its C2 channel, often by spawning cmd.exe or powershell.exe. This allows attackers to run built-in Windows commands for reconnaissance, file manipulation, or further payload execution. |
Monitor for unusual cmd.exe or powershell.exe processes spawned by unexpected parent processes (e.g., the NjRAT executable itself). Analyze command-line arguments for suspicious commands. |
| T1071.001 | Application Layer Protocol: Web Protocols | While NjRAT primarily uses a custom TCP protocol, it can also leverage HTTP/S for C2 communication in some variants or for downloading payloads. This aids in blending in with normal internet traffic. | Monitor network traffic for unusual HTTP/S requests to known malicious domains or IP addresses, especially those with non-standard User-Agents or request patterns. Analyze TLS certificates for anomalies. |
| T1105 | Ingress Tool Transfer | NjRAT's core functionality includes downloading and executing additional payloads from its C2 server. This can include modules for specific tasks like credential harvesting or lateral movement. | Monitor for processes making outbound connections to download files from suspicious sources. Analyze file creation events in temporary directories or application data folders immediately preceding process execution. |
| T1055 | Process Injection | Some NjRAT variants can inject their code into legitimate running processes (e.g., explorer.exe, svchost.exe) to evade detection and gain persistence. |
Monitor for processes exhibiting unusual memory characteristics, such as unexpected executable sections or memory regions marked as executable and writable. Analyze process parent-child relationships for anomalies where a trusted process spawns an unexpected executable. |
| T1070.004 | Indicator Removal: File Deletion | NjRAT may delete logs, temporary files, or even its own dropped executables after a certain period or upon command to hinder forensic analysis. | Monitor for unexpected file deletions, especially in system directories, temporary folders, or user profile directories. Track file creation and deletion events in sequence. |
| T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder | This is a primary persistence mechanism for NjRAT, where it adds entries to Run or RunOnce registry keys to ensure it launches automatically after a reboot or user login. |
Monitor for modifications to HKCU\Software\Microsoft\Windows\CurrentVersion\Run, HKLM\Software\Microsoft\Windows\CurrentVersion\Run, and their RunOnce counterparts. Alert on new executable entries pointing to suspicious locations. |
| T1059.001 | Command and Scripting Interpreter: PowerShell | NjRAT can leverage PowerShell for various tasks, including downloading payloads, executing commands, and performing reconnaissance due to its powerful scripting capabilities and prevalence on modern Windows systems. | Monitor for PowerShell execution, especially with encoded commands (-EncodedCommand parameter), suspicious script blocks, or network connections initiated by powershell.exe that are not part of legitimate system operations. |
| T1573.001 | Encrypted Channel: Symmetric Cryptography | NjRAT uses XOR encryption with a static key to obfuscate its C2 communication, making it difficult for network intrusion detection systems to analyze the traffic content. | While direct detection of XOR is hard, focus on behavioral analysis of C2 communication patterns (beaconing, unusual ports, destination IPs). For network traffic, analyze for anomalies in encrypted streams that deviate from expected protocols. |
| T1003.002 | OS Credential Dumping: LSASS Memory | While not always built-in, NjRAT can download and execute tools like Mimikatz or its own variants to dump credentials from the LSASS process memory, facilitating lateral movement. | Monitor for processes accessing the LSASS process (lsass.exe) memory in unusual ways. Look for the execution of credential dumping tools or suspicious PowerShell commands targeting LSASS. |
| T1219 | Remote Access Tools | NjRAT is a classic example of a Remote Access Tool, providing attackers with extensive control over compromised systems, including file system access, process management, and keylogging. | Monitor for the execution of known NjRAT executables or processes exhibiting its characteristic network communication patterns and behavioral traits. Look for unusual remote access activities that are not part of sanctioned IT management tools. |
Indicators of Compromise (IOCs)
File Hashes (SHA256 / MD5 / SHA1)
- SHA256:
0c3f66d05810388ce93b53f053564be29f4cacaf65eda7f323d99b81782bf563(zip) - MD5:
55c4ed68a88d9d844a7f8605e41a19b8(zip) - SHA256:
4b0cfaca996b9954bb3c60e0dfe9c2a6dd07a442f9bd00e3f8c7f46a2e783987(bat) - MD5:
16d59f6098c27156a602aa0963c64b05(bat) - SHA256:
0f85c4a2d65aac01de34898b7f23623c341341bab542b051720f7a715630808e(exe) - MD5:
a33798b8d2d931526b822399fd73640f(exe) - SHA256:
2541379f2b166a3f7de1926ddbe814311f1fc4869994f2d6f9712d2fa9476e51(exe) - MD5:
8bfd80556f162c0381167b55c24001f2(exe) - SHA256:
c6f112beb875598b2aa747fe555f6a99ffc9200857906b20bc12f098435ad050(elf) - MD5:
e935ff56d68754d4b7b4c5bca612b5e0(elf)
(Note: Additional NjRAT samples can be found by searching MalwareBazaar with "NjRAT" or "Bladabindi".)
Network Indicators
- C2 Ports: Primarily TCP 3389 (often disguised as RDP), but can be customized by the attacker. Other common ports might include 80, 443, or random high ports.
- C2 IPs/Domains: Dynamic and often short-lived. Detection relies on threat intelligence feeds and behavioral analysis. Examples from historical analysis include:
185.109.90.17091.219.216.16193.37.173.18045.149.237.212
- HTTP/S Beacon Patterns:
- POST requests to specific paths on the C2 domain.
- User-Agent strings that mimic legitimate browsers or applications (e.g.,
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Geckoor custom strings). - Encrypted payloads within POST bodies.
- URL Patterns: Often simple, direct paths to executables or data endpoints, e.g.,
/update.exe,/get.php,/post.php.
Registry Keys / File Paths / Mutex
- Persistence Registry Keys:
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\<random_name>HKLM\Software\Microsoft\Windows\CurrentVersion\Run\<random_name>HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\<random_name>HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce\<random_name>
- Dropped File Locations:
C:\Users\<user>\AppData\Roaming\<random_name>.exeC:\Windows\System32\<random_name>.exe(less common, requires higher privileges)C:\ProgramData\<random_name>.exe
- Mutex Names: Often random strings or GUIDs to prevent multiple instances of the malware from running simultaneously. Example:
Global\<random_guid>orGlobal\<random_string>.
YARA Rule
rule NjRAT_Family
{
meta:
description = "Detects NjRAT Remote Access Trojan variants"
author = "Your Name/Team"
date = "2026-04-22"
malware_family = "NjRAT"
score = 70 // Adjust score based on confidence and prevalence
threat_actors = "Various cybercriminal groups"
reference = "MalwareBazaar, VirusTotal"
hash_sha256 = "0f85c4a2d65aac01de34898b7f23623c341341bab542b051720f7a715630808e" // Example hash
strings:
// Common XOR encryption key for C2 communication (often 0xAA, 0x55, or specific bytes)
// This is highly variable and may need to be extracted per sample.
// Example: a known XOR key for some older variants might be 0xAA
// $xor_key_byte = { AA }
// Strings related to system information gathering
$s1 = "os_version"
$s2 = "computer_name"
$s3 = "user_name"
$s4 = "ip_address"
// Strings indicative of remote command execution
$s5 = "cmd.exe"
$s6 = "powershell.exe"
$s7 = "rundll32.exe"
// Network-related strings (often obfuscated)
$s8 = "socket"
$s9 = "connect"
$s10 = "send"
$s11 = "recv"
// Anti-analysis strings (can be obfuscated)
$s12 = "IsDebuggerPresent"
$s13 = "NtQueryInformationProcess"
$s14 = "VirtualAlloc"
$s15 = "CreateProcess"
// Registry keys for persistence (often dynamic, look for patterns)
$s16 = "\\CurrentVersion\\Run" wide ascii
$s17 = "\\CurrentVersion\\RunOnce" wide ascii
// Common network ports (often hardcoded or configurable)
$port_3389 = { 0D 00 } // TCP port 3389 in little-endian
condition:
uint16(0) == 0x5A4D and // PE file magic
(
// Check for a combination of common strings
1 of ($s1*,$s2*,$s3*,$s4*) and
1 of ($s5*,$s6*,$s7*) and
1 of ($s8*,$s9*,$s10*,$s11*) and
// Optional: check for specific ports or anti-analysis techniques
( $port_3389 or 1 of ($s12*,$s13*,$s14*,$s15*) )
)
}Static Analysis — Anatomy of the Binary
Static analysis of NjRAT binaries reveals common characteristics indicative of their nature.
- File Structure and PE Headers: NjRAT executables are typically Windows Portable Executable (PE) files. Analysis of the PE header might reveal packed or obfuscated sections. The import table is a key area to examine, looking for calls to APIs related to networking (
winsock2.dll), process manipulation (kernel32.dll,advapi32.dll), file system operations (kernel32.dll), and registry manipulation (advapi32.dll). - Obfuscation and Packing Techniques: NjRAT binaries are frequently packed or obfuscated. Common techniques include:
- XOR Encryption: String literals, configuration data, and even entire code sections can be XOR-encrypted with a static or dynamic key. This requires unpacking the binary in memory or statically identifying the decryption routine and key.
- Control Flow Flattening: The logical flow of the program is altered to make it harder to follow.
- API Obfuscation: Direct API calls are avoided; instead, APIs are resolved dynamically at runtime, often through indirect calls or by calculating function hashes.
- ** Packer/Protector:** Third-party packers like UPX or custom protectors are often used to compress and obfuscate the initial stage of the malware.
- Interesting Strings and Functions:
- Strings related to system information retrieval (e.g.,
GetComputerNameA,GetUserNameA,GetVersionExA). - Network-related function names or constants (e.g.,
socket,connect,send,recv,htons,ntohs). - Registry API calls for persistence (
RegCreateKeyExA,RegSetValueExA). - Process creation APIs (
CreateProcessA,ShellExecuteA). - Strings indicating the target operating system or architecture.
- Obfuscated strings that, when deobfuscated, reveal C2 server addresses, ports, or encryption keys.
- Strings related to system information retrieval (e.g.,
- Import Table Analysis: Key imports often include:
ws2_32.dll(for socket programming)kernel32.dll(for process, file, and memory management)advapi32.dll(for registry access and security functions)user32.dll(for UI interactions, clipboard, window management)gdi32.dll(for screen capturing)ole32.dll(for COM interfaces, sometimes used for specific functionalities)
- Embedded Resources or Second-Stage Payloads: Some NjRAT variants might embed additional modules or configuration data within their resources section. These resources can be extracted and analyzed separately.
Dynamic Analysis — Behavioral Profile
Dynamic analysis of NjRAT reveals its malicious actions in a controlled environment.
- File System Activity:
- Creates its executable in user profile directories (e.g.,
AppData\Roaming). - May create temporary files for downloaded payloads or configuration.
- Modifies or creates registry keys for persistence.
- May delete its own files or logs to cover tracks.
- Creates its executable in user profile directories (e.g.,
- Registry Activity:
- Writes to
HKCU\Software\Microsoft\Windows\CurrentVersion\RunorHKLM\Software\Microsoft\Windows\CurrentVersion\Runfor persistence. - May create other registry keys for configuration or anti-detection purposes.
- Writes to
- Network Activity:
- Establishes persistent TCP connections to C2 servers, often on port 3389.
- Periodic "heartbeat" beacons to the C2 server.
- Sends system information (hostname, username, OS version) during the initial handshake.
- Receives commands from the C2 server.
- Exfiltrates data via POST requests or raw TCP data transfers.
- May download and execute additional payloads from the C2.
- Process Activity:
- Spawns
cmd.exeorpowershell.exeto execute commands. - May inject code into legitimate processes like
explorer.exeorsvchost.exe. - Might attempt to self-terminate or terminate analysis tools if anti-analysis mechanisms are triggered.
- Spawns
- Memory Artifacts:
- Unpacked code sections in memory.
- Obfuscated strings or configuration data in memory.
- Network connection objects associated with the malware process.
- Allocated memory regions marked as executable.
Wireshark/tcpdump Capture Patterns:
Defenders should look for:
- Unusual TCP connections to external IP addresses on non-standard ports or on common ports like 3389 if RDP is not expected.
- Small, frequent packets with consistent patterns exchanged between the client and server.
- HTTP POST requests to suspicious URLs with unusual User-Agents or data payloads.
- Encrypted traffic that doesn't match known protocols.
- DNS queries for dynamic or suspicious domain names.
Real-World Attack Campaigns
NjRAT has been a tool of choice for various cybercriminal activities across numerous campaigns. While specific attribution can be challenging due to its widespread availability and use by different actors, its impact is well-documented.
- Campaign Targeting Middle Eastern Organizations (2017-2019): Several reports indicated NjRAT being used by threat actors to target government entities and critical infrastructure in the Middle East. The objective was primarily espionage and data theft. Attack vectors included spear-phishing emails with malicious attachments. The impact involved the compromise of sensitive government data and disruption of operations.
- Financial Fraud Campaigns (Ongoing): NjRAT is frequently employed in campaigns aimed at financial fraud. Attackers use it to steal online banking credentials, credit card information, and cryptocurrency wallet details. These campaigns often involve widespread phishing or the exploitation of vulnerabilities to gain initial access. The financial impact can be substantial for individuals and organizations.
- Nation-State Proxies (Sporadic Reports): While primarily a tool for cybercriminals, there have been sporadic reports suggesting NjRAT's use by less sophisticated state-sponsored actors or as a secondary tool for more advanced groups. These campaigns often focus on intelligence gathering and disruption within specific geopolitical regions.
- Supply Chain Compromises (Indirect Role): NjRAT can be delivered as a secondary payload in larger supply chain attacks, where initial compromise of a trusted vendor or software allows for the deployment of various malicious tools, including RATs like NjRAT, to further compromise downstream customers.
- Ransomware Precursor: In some instances, NjRAT has been observed as a preliminary stage before the deployment of ransomware. Attackers use NjRAT to map the network, gather credentials, and prepare the environment for encryption, maximizing the impact of the subsequent ransomware attack.
Active Malware Landscape — Context
NjRAT remains a prominent fixture in the active malware landscape, particularly within the Remote Access Trojan (RAT) and infostealer categories.
- Prevalence and Activity Level: NjRAT consistently ranks among the most detected RATs on platforms like MalwareBazaar. Its detection ratio on VirusTotal, while variable, shows consistent malicious flags from numerous engines. Its ease of use and availability via underground forums contribute to its sustained activity.
- Competing or Related Malware Families: NjRAT competes with other popular RATs and infostealers such as Adwind, HawkEye, Agent Tesla, and Remcos. These families often share similar functionalities (keylogging, screen capture, C2 communication) and are distributed through analogous channels.
- Relationship to MaaS/RaaS: NjRAT is often sold or leased as a Malware-as-a-Service (MaaS). Its modular nature and customizable features make it attractive for aspiring cybercriminals who lack the technical expertise to develop their own tools. While not directly a ransomware component, it can serve as a precursor, enabling attackers to gather information and prepare systems for ransomware deployment.
- Typical Target Industries and Geographic Distribution: NjRAT exhibits broad targeting across various industries, including finance, government, healthcare, and education. Geographically, its impact is global, with significant activity observed in regions like the Middle East, Asia, and Eastern Europe, but it is also prevalent in North America and Western Europe.
Detection & Hunting
Sigma Rules
title: Suspicious Registry Run Key Modification for NjRAT Persistence
id: 8c5e2a1b-9f1d-4a3b-8c0e-1f2a3b4c4d5e
status: experimental
description: Detects the creation or modification of registry Run keys that are commonly used by NjRAT for persistence.
author: Your Name/Team
date: 2026/04/22
logsource:
category: registry
product: windows
detection:
selection_run:
Hive: 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run'
TargetObject|contains: '\.exe' # Focus on executable files
TargetObject|endswith: ['.exe'] # Ensure it's an executable
selection_runonce:
Hive: 'HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce'
TargetObject|contains: '\.exe'
TargetObject|endswith: ['.exe']
# Add HKLM if needed, but HKCU is more common for user-level persistence
# selection_run_hklm:
# Hive: 'HKLM\Software\Microsoft\Windows\CurrentVersion\Run'
# TargetObject|contains: '\.exe'
# TargetObject|endswith: ['.exe']
filter_legit:
TargetObject|contains:
- 'chrome.exe'
- 'firefox.exe'
- 'msedge.exe'
- 'iexplore.exe'
- 'svchost.exe'
- 'explorer.exe'
- 'wermgr.exe'
- 'mshta.exe' # mshta.exe is often abused but can be legitimate
- 'powershell.exe' # legitimate powershell scripts may use this
condition: (
(selection_run or selection_runonce) and
not filter_legit
)
falsepositives:
- Legitimate software installers that add themselves to startup
- Some legitimate applications might add themselves to Run keys without user intervention. Careful tuning is required.
level: medium
tags:
- persistence
- malware
- njrat
- windowstitle: Suspicious Network Connection to Uncommon Port or Pattern
id: d3e9f1a2-5b4c-4d6e-7f8a-9b0c1d2e3f4a
status: experimental
description: Detects outbound TCP connections to unusual ports or destinations that could indicate NjRAT C2 communication.
author: Your Name/Team
date: 2026/04/22
logsource:
category: network
product: windows # Or your network device logs
detection:
selection_port:
DestinationPort:
- 3389 # Commonly used by NjRAT
# Add other common NjRAT ports if identified through threat intel
# - 80 # If observed using HTTP for C2
# - 443 # If observed using HTTPS for C2
# - 5000 # Example of a random high port
selection_protocol:
Protocol: tcp
# Add logic for specific User-Agents or URL patterns if available
# selection_ua:
# UserAgent: 'SuspiciousUserAgentString'
# Filter out known legitimate RDP traffic or other expected connections
filter_legit:
DestinationIp:
- 192.168.0.0/16 # Local network
- 10.0.0.0/8 # Local network
- 172.16.0.0/12 # Local network
# Add known RDP gateway IPs or trusted external IPs
condition: selection_protocol and selection_port and not filter_legit
falsepositives:
- Legitimate RDP connections to external servers (if not filtered)
- Other applications using uncommon ports for communication.
- Applications that use dynamic port assignments.
level: high
tags:
- c2
- malware
- njrat
- networkEDR / SIEM Detection Logic
- Process Tree Anomalies: Monitor for processes like
cmd.exeorpowershell.exebeing spawned by unexpected parent processes (e.g.,winword.exe,excel.exe, or the NjRAT executable itself). Alert on processes that exhibit unusual command-line arguments or execute scripts with encoded commands. - Network Communication Patterns:
- Alert on outbound TCP connections to known malicious IP addresses or domains associated with NjRAT C2 infrastructure.
- Identify unusual beaconing patterns (e.g., frequent, small data transfers) to external destinations, especially on non-standard ports or port 3389 when RDP is not expected.
- Monitor for HTTP POST requests with suspicious User-Agents or URL paths.
- File System Telemetry Triggers:
- Detect creation of executable files in user profile directories (
AppData\Roaming,AppData\Local) that are not signed or come from trusted publishers. - Alert on suspicious file modifications in system directories or registry locations associated with persistence.
- Monitor for unexpected file deletions in temporary directories or logs.
- Detect creation of executable files in user profile directories (
- Registry Activity Patterns:
- Alert on the creation or modification of
RunorRunOnceregistry keys pointing to executable files in unusual locations. - Monitor for changes to system services or startup configurations that are not part of standard software installation.
- Alert on the creation or modification of
Memory Forensics
To detect NjRAT in memory, focus on identifying its unpacked code, C2 artifacts, and injected processes.
# Volatility3 detection commands
# 1. Identify running processes and their command lines
python vol.py -f <memory_dump_file> windows.pslist.PsList
# 2. Look for suspicious processes, especially those with unusual parent-child relationships or command lines.
# Example: NjRAT executable running from AppData, or cmd/powershell spawned by non-standard parents.
# 3. Dump suspicious processes for further analysis
python vol.py -f <memory_dump_file> windows.memdump.MemDump -p <PID> -D <output_directory>
# 4. Examine network connections associated with processes
python vol.py -f <memory_dump_file> windows.netscan.NetScan
# 5. Look for connections to known NjRAT C2 IPs/ports or unusual destinations.
# 6. Check for injected code or unusual memory regions within legitimate processes
# This requires examining process memory dumps. Look for executable sections (.text) in unexpected places or
# processes that have injected code. Tools like 'malfind' in Volatility2 or custom plugins in Volatility3 might be useful.
# Example (conceptual for Volatility3 - specific plugin may vary):
# python vol.py -f <memory_dump_file> windows.malfind.Malfind -p <PID>
# 7. Search for specific strings or decryption keys within process memory
# This is highly sample-dependent. If a XOR key is known, it can be used to scan memory.
# Example (conceptual):
# python vol.py -f <memory_dump_file> windows.strings.Strings -p <PID> | grep "suspicious_string_or_key"
# 8. Look for signs of credential dumping (e.g., access to LSASS)
# Check for processes that have opened handles to lsass.exe with specific access rights.
# python vol.py -f <memory_dump_file> windows.handles.Handles -p lsass.exe
# 9. Analyze loaded DLLs to identify suspicious modules
python vol.py -f <memory_dump_file> windows.dlllist.DllList -p <PID>
# 10. If a specific malware build is known, hash its memory representation
# This is advanced and requires knowledge of the malware's structure.Malware Removal & Incident Response
Effective removal and response require a systematic approach:
- Isolation Procedures: Immediately isolate the compromised host(s) from the network to prevent further spread and C2 communication. This can be done by disconnecting network cables, disabling Wi-Fi, or implementing network segmentation rules.
- Artifact Identification and Collection:
- Collect volatile data (memory dumps, running processes, network connections, open files) for forensic analysis.
- Identify and collect all NjRAT-related files (executables, configuration files, dropped payloads) from the file system.
- Gather relevant logs (system event logs, application logs, security logs) that might contain indicators of compromise.
- Registry and File System Cleanup:
- Remove persistence mechanisms: Delete the malicious entries from registry Run keys (
HKCU\...\Run,HKLM\...\Run). - Remove scheduled tasks created by NjRAT.
- Delete all identified NjRAT executables and dropped files from the file system.
- If NjRAT was injected into other processes, these processes may need to be terminated and restarted, or the system might require re-imaging for complete eradication.
- Remove persistence mechanisms: Delete the malicious entries from registry Run keys (
- Network Block Recommendations:
- Block the identified C2 IP addresses and domains at the firewall and proxy level.
- Monitor network traffic for any re-emergence of communication patterns associated with NjRAT.
- Password Reset Scope:
- For any compromised accounts, reset passwords immediately.
- Consider a broader password reset for privileged accounts and user accounts within the affected network segment, especially if lateral movement was suspected.
- Implement multi-factor authentication (MFA) where possible.
Defensive Hardening
Proactive hardening measures are critical to mitigate NjRAT threats:
- Specific Group Policy Settings:
- AppLocker/Software Restriction Policies: Configure policies to only allow execution of approved applications, especially from trusted publishers. This can prevent NjRAT executables dropped in user profile directories from running.
- User Account Control (UAC): Ensure UAC is enabled and configured to the highest level to prompt users before elevation.
- Script Execution Policy: Configure PowerShell execution policy to restrict unsigned script execution (
Set-ExecutionPolicy RestrictedorSet-ExecutionPolicy AllSigned).
- Firewall Rule Examples:
- Outbound Rule: Block all outbound TCP traffic to known NjRAT C2 IP addresses and domains.
- Outbound Rule: Limit outbound TCP traffic to only necessary ports (e.g., 80, 443 for web browsing, 25 for email) and specific trusted destinations. Block all other outbound traffic by default.
- Inbound Rule: Strictly control inbound RDP (TCP 3389) access. Only allow RDP from trusted jump hosts or administrative workstations, and disable direct RDP access from the internet.
- Application Whitelist Approach: Implement an application whitelisting solution that permits only known, approved applications to run. This is highly effective against unknown or custom malware like NjRAT.
- EDR Telemetry Tuning: Configure Endpoint Detection and Response (EDR) solutions to:
- Monitor for suspicious registry modifications in Run keys.
- Alert on process injection attempts.
- Detect unusual network connections from non-standard processes or to suspicious destinations.
- Profile and alert on abnormal file system activity in user profile directories.
- Network Segmentation Recommendation: Segment the network into logical zones. This limits the lateral movement capabilities of malware like NjRAT if one segment is compromised. For example, separate critical servers from user workstations and IoT devices.
References
- MalwareBazaar: https://bazaar.abuse.ch/browse.php?search=NjRAT
- VirusTotal: https://www.virustotal.com/
- OTX AlienVault: https://otx.alienvault.com/
- MITRE ATT&CK: https://attack.mitre.org/
This comprehensive report on NjRAT provides detailed technical insights for cybersecurity professionals. By understanding its infection vectors, persistence methods, C2 communication, and its implementation of MITRE ATT&CK techniques such as T1547.001 (Registry Run Keys) and T1105 (Ingress Tool Transfer), defenders can develop robust detection strategies. The provided Indicators of Compromise (IOCs), including file hashes and network indicators, along with the YARA rule, are crucial for identifying active infections. The detailed analysis of static and dynamic behavior, coupled with specific Sigma rules and EDR/SIEM detection logic, empowers security operations centers (SOCs) to hunt for and neutralize NjRAT threats. Furthermore, actionable incident response steps and proactive defensive hardening measures, like application whitelisting and strict firewall rules, are essential for mitigating the persistent risk posed by this versatile Remote Access Trojan and similar threats that aim for unauthorized access to user authentication tokens, potentially including those exploiting vulnerabilities like CVE-2026-5281 if weaponized.
