What Is Malware? Viruses, Trojans, Worms and Ransomware

Malware is software written to do something its victim did not want. The classic categories describe how it spreads: a virus attaches to a file and needs you to run it, a worm spreads by itself across a network, and a trojan pretends to be something useful. Modern malware is usually several of these at once, which is why defenders increasingly describe it by behaviour instead, using MITRE ATT&CK technique numbers.

Oct 11, 2026 - 07:29
Updated: 
107k

Cyber Threats, Scams & Online Safety in Cybersecurity & Ethical Hacking · Explainer

What Is Malware: Viruses, Trojans and Worms Explained

Quick answer: Malware is software written to do something its victim did not want. The classic categories describe how it spreads: a virus attaches to a file and needs you to run it, a worm spreads by itself across a network, and a trojan pretends to be something useful. Modern malware is usually several of these at once, which is why defenders increasingly describe it by behaviour instead, using MITRE ATT&CK technique numbers. Both views are useful and they answer different questions.

Key takeaways

  • The virus, worm and trojan distinction is about propagation, not about damage.
  • Real samples combine categories. A single toolkit can arrive as a trojan, spread as a worm and deploy ransomware.
  • Detection works on behaviour. Ransomware is ATT&CK T1486, keylogging is T1056.001, and those numbers are searchable.
  • Disabling security tools is T1562.001 and one of the most reliable signs of a real infection.
  • Rebuild rather than clean on any machine that matters. Removal finds what it recognises.

Topics covered in this guide: what malware is, the difference between a virus, worm and trojan, the other categories, how infection happens, what ransomware does differently, how to describe malware the way defenders do, recognising infection, defences that work, what to do when a machine is infected, why rebuilding is better, and where malware analysis fits.

Table of Contents

What Is Malware?

Malware is software written to act against the interests of the person running it: stealing data, holding files to ransom, using the machine's resources, or giving somebody else control.

The definition is about intent rather than technique. The same capability can be a legitimate feature or malware depending on who installed it and whether they had the right to: remote administration tools and monitoring software appear in both categories, which is why detection is harder than it sounds.

What Is the Difference Between a Virus, Worm and Trojan?

All three are about how it arrives and spreads, not about what it does once it is there. This is the distinction most explanations blur.

How it spreadsNeeds the user to act?Attaches to a host file?
VirusAttaches to a file or program; spreads when that is run or sharedYesYes
WormCopies itself across a network, usually by exploiting a vulnerabilityNoNo
TrojanDoes not spread itself; the user installs it believing it is something elseYesNo

The row that matters operationally is the worm. Because it needs no human action, a worm's speed is limited only by the network, which is why worm outbreaks are measured in minutes and why patching schedules exist.

The row most people encounter is the trojan, because it does not require a vulnerability at all. It requires a decision, and decisions can be influenced far more cheaply than software can be exploited.

What Are the Other Main Categories?

These describe purpose rather than propagation, which is why a single sample is usually several of them at once.

  • Ransomware encrypts files and demands payment. Covered separately below.
  • Spyware and infostealers collect data: credentials, browser profiles, saved cards, session cookies.
  • Keyloggers record what is typed. Our guide to keyloggers covers them in detail.
  • Rootkits hide the presence of other components, often from the kernel.
  • Backdoors and remote access trojans give ongoing control.
  • Botnet clients enrol the machine into a network run by somebody else.
  • Cryptominers use the machine's processing power, which is theft that looks like slowness.
  • Loaders and droppers, whose only job is to install the next stage. These are the most common first component and the least discussed.

Treat the list as a set of capabilities rather than species. A modern intrusion typically involves a loader that fetches an infostealer, which harvests credentials, which are then used to deploy ransomware days later.

How Does Infection Actually Happen?

  • Phishing with an attachment or link, still the most common route for the initial foothold. Our guide to protecting against email phishing covers it.
  • Exploiting an unpatched internet-facing service, which needs no human involvement at all.
  • Pirated or cracked software, where protections have usually been disabled by the user first.
  • Malicious advertising and compromised websites.
  • Removable media, still effective in segregated environments precisely because they are segregated.
  • Supply chain, through a legitimate update or a compromised dependency, which defeats user caution entirely.

Two of these, unpatched services and supply chain, are not addressed by user awareness at all. That is worth stating, because awareness training is often presented as the whole answer.

What Does Ransomware Do Differently?

It does not need to stay hidden. Every other category is trying not to be noticed, and ransomware announces itself, which changes the defensive problem.

MITRE ATT&CK catalogues the final act as T1486, Data Encrypted for Impact. The important operational point is that T1486 is the end of the intrusion, not the start. Before the encryption there is usually access, reconnaissance, credential theft, lateral movement, data theft for extortion, and deliberate destruction of backups.

Three consequences:

  • By the time you see the ransom note, the attacker has been present for a while. Treat it as a compromise of the whole environment, not a file problem.
  • Backups are a target. Attackers look for them specifically. A backup reachable from the network with the same credentials is not a backup.
  • Paying does not undo the data theft, which has usually already happened.

How Defenders Describe Malware Now

This is the section the published article lacked, and it is what connects everything above to how detection actually works.

Categories are a poor basis for defence, because a sample can change category between versions while doing the same things. So defenders describe behaviour, using the technique numbers in MITRE ATT&CK.

What it doesATT&CK technique
Encrypts files for extortionT1486 Data Encrypted for Impact
Records keystrokesT1056.001 Input Capture: Keylogging
Installs a service to survive rebootT1543 Create or Modify System Process
Turns off antivirus or loggingT1562.001 Impair Defenses
Runs its code in the first placeTA0002 Execution

The practical value is that these are searchable and shared. "We saw T1486" communicates precisely to any defender, and it maps to detections you can write. "We found a virus" does not.

It also changes what you look for. A detection built on behaviour catches a new sample doing an old thing, which is what most new malware is.

How Do You Recognise a Possible Infection?

Not by slowness, which is usually a storage or thermal problem. The reliable signs are the ones that indicate someone establishing control:

  • Security software disabled, or an antivirus exclusion you did not add. This is T1562.001 and it is the strongest single indicator.
  • New accounts, scheduled tasks or services you did not create.
  • Sustained network connections from a process you cannot account for.
  • Account activity at a service you did not perform.
  • Files renamed with an unfamiliar extension, which is the unambiguous one.

Our guide to signs your computer has been hacked gives the command to check each of these on Windows, Linux and macOS.

What Defences Actually Work?

In rough order of effect:

  1. Patch promptly, especially anything reachable from the internet. This closes the routes that need no human error.
  2. Remove administrative rights from everyday accounts, which blocks most persistence and most rootkits.
  3. Phishing-resistant MFA, so stolen credentials are not enough.
  4. Behaviour-based endpoint detection rather than signatures alone.
  5. Tested, offline or versioned backups. The only reliable answer to ransomware.
  6. Application control where feasible, which is the strongest preventive measure and the hardest to operate.
  7. Segmentation, so a worm or an attacker reaches less. Our guide to access control lists covers the mechanics.

NIST publishes handling guidance in SP 800-83 and incident handling more broadly in SP 800-61, and both are worth reading before writing an internal procedure rather than after.

What Should You Do If a Machine Is Infected?

  1. Isolate it from the network, and leave it powered on. Memory holds evidence, and in ransomware cases sometimes keys.
  2. Change credentials from a different machine, and revoke sessions.
  3. Preserve evidence before cleaning anything, because you cannot recover it afterwards.
  4. Determine the scope. One infected machine on a network of shared credentials is rarely one infected machine.
  5. Report it. In India, CERT-In requires listed incidents to be reported "within 6 hours of noticing such incidents or being brought to notice about such incidents", and if money moved, call 1930 and file on the portal within 24 hours.
  6. Rebuild rather than clean, for the reason below.

The same CERT-In directions require logs of all ICT systems to be kept "for a rolling period of 180 days", which is what makes step 4 possible at all.

Why Is Rebuilding Usually Better Than Cleaning?

Because removal finds what it recognises, and malware that achieved administrative access can hide from software running on the same machine. A rootkit's purpose is exactly that.

There is also the composition point from earlier: modern infections are multi-stage, so removing the component that alerted leaves the loader that installed it. Cleaning answers "did I remove the thing I found?" and rebuilding answers "is this machine known-good?", which is the question that matters.

Rebuild from known-good media, restore data rather than applications, and change credentials afterwards from a clean device.

How Does Malware Analysis Fit In?

Malware analysis answers what a specific sample does, which matters when you need to know what was taken, what else to look for, and whether your detections would catch it next time.

It splits into static analysis, examining the file without running it, and dynamic analysis, running it in an isolated environment and watching. Both produce indicators and, more usefully, a list of ATT&CK techniques that becomes detection logic.

For most organisations this is a capability they consume rather than build, through threat intelligence and their endpoint vendor. For an individual learning the field it is an excellent specialism, and the entry requirement is the fundamentals rather than the tooling: operating system internals, file formats and assembly. Our guides to digital forensics investigation and cyber security projects for beginners cover the adjacent ground, including how to build an isolated lab before you run anything.

Talk to a WebAsha training advisor about batches, syllabus and current fees.

References

Frequently Asked Questions

Software written to act against the interests of the person running it, whether by stealing data, holding files to ransom, using the machine’s resources or giving somebody else control. The definition is about intent rather than technique.

All three describe how it spreads. A virus attaches to a file and spreads when that file is run or shared, a worm copies itself across a network with no human action, and a trojan does not spread itself because the user installs it believing it is something else.

They are dangerous differently. A worm needs no human action so its speed is limited only by the network, which is why outbreaks are measured in minutes. A trojan needs no vulnerability at all, only a decision, and decisions are cheaper to influence.

Rarely. A single toolkit typically arrives as a trojan, may spread like a worm, installs an infostealer and later deploys ransomware. Treat the categories as capabilities rather than species.

Because a sample can change category between versions while doing the same things. Behaviour is what detection is built on, and technique numbers such as T1486 for ransomware are precise, searchable and shared between defenders.

It does not need to stay hidden. ATT&CK catalogues the encryption as T1486, Data Encrypted for Impact, and that is the end of the intrusion rather than the start: access, credential theft, lateral movement, data theft and backup destruction usually came first.

Usually a while. Treat it as a compromise of the whole environment rather than a file problem, because the encryption is the final step after reconnaissance, credential theft and deliberate destruction of backups.

It does not undo the data theft, which has usually already happened before the encryption. Decrypting files does not retrieve what was copied out, and the compromise of the environment still has to be addressed.

Security software disabled, or an antivirus exclusion you did not add. That is ATT&CK T1562.001, and there is no innocent reason for it. Slowness, by contrast, is usually a storage or thermal problem.

Patching anything internet-facing promptly, removing administrative rights from everyday accounts, phishing-resistant MFA, behaviour-based endpoint detection, tested offline backups, application control where feasible, and network segmentation.

Rebuild, if the machine matters. Removal finds what it recognises, and malware with administrative access can hide from software on the same system. Infections are also multi-stage, so removing the component that alerted leaves the loader that installed it.

No. Isolate it from the network and leave it running. Memory holds evidence and sometimes encryption keys, both of which powering off destroys permanently.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Anjali

I am passionate about technology, invention and big challenging tasks on my to- do list. In terms of the work I am doing also at Bunnyshell, I am most passionate about the technologies that we are using., I'm devoted to delivering content that not only informs but also inspires. Whether you need in- depth analysis pieces, educational attendants, or study- provoking opinion pieces, I draft content that resonates with tech suckers and professionals likewise.