A remote access trojan, usually called a RAT, is a type of malware designed to give an attacker persistent, covert control over a victim’s computer or mobile device. Unlike a virus that simply corrupts files or ransomware that locks you out, a RAT operates quietly in the background, letting someone on the other side of the internet browse your files, watch your screen, record your keystrokes, and even activate your webcam without any visible sign that something is wrong. RATs have been around since the late 1990s, and while the underlying concept has not changed much, the sophistication of delivery, evasion, and automation has escalated dramatically.
How RATs Get Onto Your Machine
The most common way a RAT reaches your system is through social engineering. You receive an email with an attachment that looks like an invoice, a resume, or a shipping notification. The file might be a Word document with an embedded macro, a PDF with a hidden exploit, or a plain executable disguised with a double extension like report.pdf.exe. Opening it runs the installer silently. Phishing emails remain the dominant delivery method because they scale easily and exploit human trust rather than technical vulnerabilities.
Drive-by downloads are another route. You visit a compromised or malicious website, and a browser or plugin vulnerability is exploited to drop the RAT payload without you clicking anything beyond the initial link. This method has become less common as browsers have improved their sandboxing and auto-update mechanisms, but it still works when people run outdated software.
Some RATs arrive bundled with pirated software, game cracks, or free utilities downloaded from unofficial sites. The user installs what they think is a legitimate program, and the RAT installs alongside it. A more dangerous variant of this approach is supply chain compromise, where the attacker poisons software at its source, so even users who download from official channels get infected. That vector is discussed in more detail below.
What a RAT Can Do Once Installed
A RAT’s defining feature is the breadth of control it gives the attacker. Once the malware establishes a connection back to the operator’s server, the infected machine essentially becomes a remote desktop that the victim never sees. The specific capabilities vary from one RAT family to another, but the general toolkit is remarkably consistent across decades of development.
- File access: The attacker can browse, copy, rename, delete, or upload files on the victim’s system, including documents, saved passwords, cryptocurrency wallets, and database files.
- Screen capture: Many RATs can stream the victim’s screen in real time or take periodic screenshots, letting the attacker see everything the user does.
- Keystroke logging: A built-in keylogger records every key pressed, capturing passwords, messages, and credit card numbers as they are typed.
- Camera and microphone: RATs frequently include the ability to activate the webcam and microphone silently, turning the victim’s own hardware into a surveillance device.
- Shell access: The attacker can open a command prompt or terminal on the victim’s machine and run arbitrary commands, install additional malware, or pivot to other machines on the same network.
- Credential harvesting: Some RATs specifically extract stored credentials from browsers, email clients, and FTP programs.
- Persistence mechanisms: RATs install themselves to survive reboots, often by modifying startup entries, creating scheduled tasks, or injecting into legitimate system processes.
The combination of these capabilities makes RATs a favorite tool for both financially motivated cybercriminals and state-sponsored espionage groups. A single RAT infection can give an attacker everything needed to empty bank accounts, steal intellectual property, or monitor a person’s private life indefinitely.
Command and Control Channels
Every RAT needs a way to communicate with its operator. This communication link, called the command and control (C2) channel, is how the attacker sends instructions and receives stolen data. Early RATs used simple direct TCP connections, often on a fixed port, which made them relatively easy for network administrators to spot and block.
Modern RATs have moved far beyond that. Many now communicate over HTTPS, blending in perfectly with normal web traffic. Some use legitimate cloud services as intermediaries. A RAT might store commands in a Google Drive document, a Telegram channel, a Twitter post, or a Pastebin page, so the malware’s network traffic looks like ordinary use of those platforms. This makes detection extremely difficult because blocking the traffic means blocking the legitimate service for everyone on the network.
Other C2 techniques include DNS tunneling, where data is encoded into DNS queries and responses, and the use of domain generation algorithms (DGAs), which let the RAT automatically generate new domain names to connect to on a schedule. If defenders take down one domain, the RAT simply moves to the next one on the list. Researchers have developed techniques to reverse-engineer these C2 mechanisms by analyzing RAT binaries, but attackers continuously adapt in response.1Lecture Notes in Computer Science. Reconstructing C2 Servers for Remote Access Trojans with Symbolic Execution
How RATs Stay Hidden
Stealth is existentially important to a RAT. The moment the victim realizes something is wrong, they can disconnect from the internet, run a scan, or wipe the machine. A RAT that gets detected quickly is a failed RAT. So developers put enormous effort into evasion.
At the file level, RATs use code obfuscation, packing, and encryption to avoid signature-based antivirus detection. A packer compresses or encrypts the RAT’s code so that each copy looks different to a scanner, even though the underlying behavior is identical. Some RATs are “fileless,” meaning they never write a traditional executable to disk. Instead, they live entirely in memory, injected into a legitimate running process. When the computer restarts, the RAT reloads itself from a small stub hidden in the registry or a scheduled task.
At the network level, encrypting C2 traffic with TLS makes it indistinguishable from legitimate HTTPS browsing without deep packet inspection. Some RATs throttle their communication, sending small amounts of data at irregular intervals to avoid triggering volume-based alerts. Others piggyback on traffic from legitimate applications, timing their transmissions to coincide with periods of normal user activity.
At the system level, RATs may disable or tamper with security software. A common technique is to terminate antivirus processes, modify Windows Defender exclusions, or use rootkit functionality to hide their own files and registry entries from the operating system’s file browser. The more advanced RATs hook into the operating system kernel, making their processes invisible even to security tools running at the user level.
When Trusted Software Becomes the Attack Vector
One of the most insidious delivery methods for RATs is the software supply chain attack. Instead of tricking you into opening a suspicious email attachment, the attacker compromises the developer or distributor of software you already trust. When you download an update from the official source, you get the RAT included.
An empirical study of prominent supply chain attacks cataloged several high-profile cases that illustrate the range of targets. The compromised software included CCleaner (a popular disk management tool used by millions), the XShell SSH client distributed by NetSarang, ASUS’s own firmware update utility (in the ShadowHammer campaign), a widely used media player, and even a Mongolian certificate authority’s software.2Forensic Science International: Digital Investigation. On the prevalence of software supply chain attacks: Empirical study and investigative framework In each case, the attacker inserted malicious code at the source, so the infected software was digitally signed and distributed through official channels. Antivirus tools had no reason to flag it.
The ShadowHammer attack is a particularly striking example. ASUS’s Live Update utility, which ships on millions of laptops, was compromised at ASUS’s own servers. Users who ran the update received a trojanized version signed with ASUS’s legitimate digital certificate. The attackers were reportedly targeting only a small number of specific machines identified by their network adapter MAC addresses, but the infected update was pushed to a much wider population.
Supply chain attacks are especially dangerous because they undermine the basic trust model that security advice relies on. “Only download software from official sources” does not help when the official source has been compromised. Defense against this vector requires the software vendor to secure its own build pipeline, which is outside the end user’s control.
Spotting and Removing a RAT
Detecting a RAT on your system is harder than catching most other malware because RATs are specifically designed to be invisible. Still, there are signs to watch for and steps you can take.
Behavioral clues include your webcam indicator light turning on when you are not using it, unexplained mouse movement or cursor jumps, your system running noticeably slower without an obvious cause, new programs or processes appearing in Task Manager that you do not recognize, and unusually high network activity when you are not actively using the internet. None of these are definitive on their own. A slow computer might just need a restart. But several of them together, especially the webcam light, warrant investigation.
On the software side, keeping your operating system and all applications updated closes the vulnerabilities that RATs exploit for initial access and privilege escalation. Running a reputable antivirus or endpoint detection and response (EDR) tool catches known RAT families by signature and can flag suspicious behaviors like unexpected process injection or unusual outbound connections. EDR tools are more effective than traditional antivirus against modern RATs because they monitor behavior patterns rather than just matching file signatures.
If you believe a RAT is on your machine, the safest approach is to disconnect from the internet immediately to sever the C2 link, then boot from a clean external drive or recovery environment and run a full scan. In serious cases, especially if the RAT had shell access, a complete reinstallation of the operating system is the only way to be sure. RATs with rootkit components can survive partial cleanups.
For organizations, network-level detection is often more effective than endpoint scanning. Monitoring for unusual outbound connections, DNS queries to newly registered domains, or traffic to known C2 infrastructure can catch RATs that evade endpoint tools. Researchers have explored using early-stage network behavioral features to detect RATs before they fully establish their C2 link, focusing on the distinctive handshake patterns that differ from normal application traffic.
Government Use of Trojan-Like Tools
RATs are not exclusively the province of criminals and foreign intelligence services. Law enforcement and domestic intelligence agencies in multiple countries have developed or purchased tools that function almost identically to criminal RATs, deployed under legal authority to surveil suspects. Germany’s Federal Criminal Police Office (the BKA), for instance, has reportedly used trojan software to access smartphone data of suspected individuals before the information was encrypted, effectively intercepting communications that would otherwise be protected by end-to-end encryption.3IGI Global. Lawful Trojan Horse
The commercial spyware market has grown substantially around this demand. Companies sell “lawful intercept” products to governments worldwide, and these products are functionally indistinguishable from criminal RATs in their capabilities. They can extract messages, record calls, track location, activate cameras, and exfiltrate files. The difference is legal authorization and, in theory, targeting limited to specific individuals under judicial oversight.
This creates a genuine tension. The same vulnerabilities that allow a government trojan to function also allow a criminal RAT to function. When a government agency stockpiles an exploit to deploy its surveillance tool, that exploit remains available for criminal actors who independently discover it. And commercial spyware vendors have repeatedly been found selling their products to governments with poor human rights records, where the targets include journalists, activists, and political opponents rather than criminal suspects.
AI-Powered RATs and the Emerging Threat
A recent and genuinely alarming development is the integration of artificial intelligence into RAT functionality. Researchers have demonstrated an “agentic RAT” concept in which a locally deployed small language model (a lightweight AI) runs directly on the compromised machine. The AI interprets reconnaissance data from the host and network, selects its own next actions, recovers from failed steps, and reduces or eliminates the need for a human operator to be actively directing the attack. In testing on commodity hardware with no cloud connection and no human in the loop, the AI-driven RAT completed the full cycle of observation, decision-making, and action, ultimately obtaining verified root-shell access on real vulnerable services.4arXiv. Tiny Enough to Break In: Agentic Remote Access Trojans Powered by Small Language Models
The implications are significant. Traditional RATs require a skilled operator to be online, interpreting what they see on the compromised system and deciding what to do. That human bottleneck limits how many machines an attacker can actively exploit at once. An AI-powered RAT that makes its own decisions could operate autonomously across many compromised hosts simultaneously, adapting to each environment in real time without waiting for instructions. It could also react to detection attempts faster than a human operator, potentially evading security tools by adjusting its behavior on the fly.
The fact that this was demonstrated with a small language model running locally, rather than a large cloud-based model, matters practically. It means the RAT does not need an internet connection to its AI component, which would be detectable. The intelligence runs entirely on the victim’s own hardware, using computational resources the victim is unlikely to notice missing. As these models continue to shrink in size and grow in capability, the barrier to building autonomous malware drops further. The research was published as an academic proof of concept, but the techniques it describes are accessible to anyone with moderate technical skill and a few hundred dollars in hardware.
RATs on Mobile Devices
While RATs originated on desktop operating systems, mobile variants are now common and in some ways more dangerous. Your phone is with you constantly, has a camera and microphone, knows your location, stores your messages, and holds your authentication apps. A RAT on a phone is a comprehensive surveillance device that the target carries voluntarily into every private meeting and conversation.
On Android, RATs can be delivered through sideloaded apps, malicious links, or compromised apps that occasionally slip through Google Play’s review process. Android’s permission model provides some protection, but users routinely grant broad permissions to apps without reading the prompts carefully. Once a RAT has accessibility service permissions, it can read the screen content of other apps, effectively bypassing any app-level encryption.
On iOS, the attack surface is smaller because Apple restricts sideloading and tightly controls the App Store. But zero-click exploits, which require no user interaction at all, have been used to deploy sophisticated RATs on iPhones. These exploits target vulnerabilities in services that process incoming data automatically, like iMessage or FaceTime, and can compromise a device with nothing more than a specially crafted message that the user never needs to open.
Protecting yourself on mobile devices follows familiar principles with a few additions. Keep your operating system updated, because most mobile RAT exploits target known vulnerabilities that patches have already fixed. Avoid sideloading apps from outside official stores. Review app permissions periodically and revoke anything that looks excessive. If your phone exhibits unusual battery drain, data usage, or overheating without an obvious cause, consider it a warning sign worth investigating. For high-risk individuals such as journalists, activists, or executives handling sensitive information, enabling lockdown modes offered by modern operating systems can reduce the available attack surface substantially.

