Sub topic 5
Malware types: viruses, worms, trojans, ransomware, and spyware
This chapter assumes you can use Windows Settings and Task Manager, and that you know what an IP address and a network share are. It also assumes you have read the earlier chapters on the CIA triad and access control. Malware is software built to harm a system, steal data, or give an attacker control. The A+ exam asks you to name a malware type from a short symptom description, so this chapter focuses on what separates each type.
How to classify malware
Two questions sort most malware:
- How does it get onto the machine and spread? A virus attaches to a host file, a worm spreads over a network by itself, and a trojan relies on the user installing it.
- What does it do once it runs? This is the payload. Examples are encrypting files, logging keystrokes, or joining a botnet.
The first question describes the delivery method and the second describes the effect. Many exam mistakes come from mixing the two. A ransomware sample can arrive as a trojan, and a worm can carry a ransomware payload.
The core types
Virus
A virus is code that attaches itself to a legitimate file or boot sector. It runs only when a person opens the infected file. It then copies itself into other files. Typical carriers are executables and Office documents with macros. Slow performance, changed file sizes, and programs that crash are classic signs.
Worm
A worm is standalone malware that replicates itself across a network without any user action. It exploits an unpatched vulnerability or a weak network service. Worms consume bandwidth and can saturate a network. The exam clue is that many machines get infected quickly with no one clicking anything. Patching and a host firewall are the main defenses.
Trojan
A trojan disguises itself as something useful, such as a free utility, a cracked game, or a fake invoice. It does not self-replicate. The user is tricked into running it. A remote access trojan (RAT) gives the attacker control of the machine. Trojans are the most common delivery vehicle for other payloads.
Ransomware
Ransomware encrypts files, or locks the whole system, and demands payment for the key. It attacks availability in the CIA triad. Modern variants also steal data first and threaten to publish it. Recovery depends on clean, offline, tested backups. Paying does not guarantee decryption.
Spyware
Spyware collects information without the user's knowledge, such as browsing habits, credentials, or screen contents. Adware is a related type that shows unwanted ads and may redirect the browser's home page or search engine. A keylogger is a form of spyware that records keystrokes. Spyware attacks confidentiality.
Other types the exam includes
| Type | Key trait | Typical symptom |
|---|---|---|
| Rootkit | Hides itself and other malware by modifying the OS at a low level | Antivirus cannot find it. Removal often needs offline scanning or a reinstall |
| Botnet | Infected "zombie" machines controlled by a command-and-control server | Unexplained outbound traffic. Used for DDoS and spam |
| Cryptominer | Uses your hardware to mine cryptocurrency | High CPU or GPU use, heat, loud fans |
| Logic bomb | Triggers when a condition is met, such as a date or a deleted account | Damage at a specific moment |
| Fileless malware | Runs in memory and abuses built-in tools like PowerShell | Little or nothing on disk to scan |
| Boot sector virus | Infects the startup code of a drive | Problems before Windows loads |
Telling the types apart
Match the clue in the question to the type:
- "Spread to hundreds of computers overnight with no user action" points to a worm.
- "User ran a downloaded 'PDF viewer' and the attacker then had remote control" points to a trojan, specifically a RAT.
- "Files renamed with a strange extension and a note demanding Bitcoin" points to ransomware.
- "Antivirus reports clean, but the system still behaves oddly and a scan from a rescue disk finds a hidden driver" points to a rootkit.
- "Browser home page keeps changing and pop-ups appear" points to adware or spyware.
Typical symptoms and first checks
Common signs of infection are:
- Slow performance or high resource use
- Unexpected pop-ups or browser redirects
- Disabled security tools
- Renamed or inaccessible files
- Antivirus alerts you did not trigger
- Contacts receiving odd messages from your account
Start with Task Manager to look for unknown processes with high CPU use. Then check startup items and installed programs. Finally run a scan. On Windows, Microsoft Defender Antivirus can be driven from an elevated PowerShell session:
# Confirm real-time protection and signature age
Get-MpComputerStatus | Select-Object RealTimeProtectionEnabled, AntivirusSignatureLastUpdated
# Refresh definitions, then run a quick scan
Update-MpSignature
Start-MpScan -ScanType QuickScan
# List threats Defender has detected
Get-MpThreatDetectionIf you suspect a rootkit, use Start-MpScan -ScanType FullScan or run Microsoft Defender Offline, which scans before Windows fully loads. The full removal sequence is covered in a later chapter. It begins with identifying symptoms and quarantining the machine.
Prevention
No single control stops every type, so layer them:
- Keep the OS and applications patched. This stops worms that exploit known flaws.
- Run antivirus with current signatures and real-time protection. Keep the host firewall on.
- Use standard accounts for daily work so that malware inherits fewer rights, as described in the least privilege chapter.
- Disable macros from untrusted documents and block unneeded autorun behavior.
- Train users to question attachments, links, and software from unknown sources.
- Keep offline or immutable backups and test restores. This is the main defense against ransomware.
Common errors
- Treating a "clean" scan as proof of a clean machine. Rootkits and fileless malware can evade a scan run inside the infected OS.
- Leaving an infected computer on the network. Isolate it first to stop a worm or ransomware from spreading.
- Restoring backups before removing the malware, which reinfects the restored data.
- Using the words virus and malware interchangeably. A virus is one kind of malware.
Exercise
A workstation shows a text file on the desktop demanding payment, and every document now has the extension .locked. Name the malware type, name the CIA property it mainly attacks, and give the first action you should take on the network.
Show answer
It is ransomware. It mainly attacks availability, because the data becomes unusable. The first action is to disconnect the workstation from the network, by unplugging the cable or disabling Wi-Fi, so the infection cannot spread to shares and other machines. Restoring from a clean backup comes only after the malware is removed.
Exercise
Within an hour, 40 computers on a flat network become slow and saturate the link. No user opened any file. Which type is most likely, and which preventive control addresses the usual cause?
Show answer
A worm is most likely, because it spreads on its own across the network. Patching the exploited vulnerability, together with host firewalls that block the vulnerable service, addresses the usual cause.