Malware, and the tools that find it
Some software is written to do harm: to steal, to spy, to lock files for ransom or to take over a computer for someone else's use. It reaches ordinary computers every day by email, web pages and memory sticks. No background is assumed. A security professional has to tell the kinds apart, because each spreads in its own way, and has to know what each protective tool can and cannot recognise.
By the end of this unit you will be able to:
- Tell apart a virus, a worm and a Trojan horse by how each spreads
- Name what ransomware, spyware, rootkits, logic bombs, backdoors and bots are for
- Tell apart signature, heuristic and behavioural detection of malware
- Tell apart anti-malware, EDR and XDR
- Explain the limits of security tools based on machine learning
The invoice that was not an invoice
An illustrative example
On a Friday an accounts clerk at a plumbing merchant opens a spreadsheet attached to an email headed Overdue invoice. A yellow bar asks her to enable content, and she does. The sheet is blank. She deletes the email.
The anti-malware program on her computer is up to date and reports nothing. On Monday every file on the shared drive has a new, unreadable name, and a note on each screen demands payment.
The anti-malware was installed and up to date. Why might it have seen nothing, and what kind of tool might have noticed?
Virus, worm, Trojan: two questions sort them
Malware, short for malicious software, is software written to harm a system or its data, or to use it without the owner's consent. It mostly arrives on an endpoint: a device at the end of a network connection, such as a laptop, a phone or a server.
The three classic kinds differ in how they spread. Two questions separate them: does it need another file to live in, and does it need a person to do something?
| Kind | What it is | Needs a host file | Needs a person to act |
|---|---|---|---|
| Virus | Code that copies itself into other programs or documents | Yes | Usually: someone opens or runs the infected file |
| Worm | A complete program that copies itself across a network | No | No: it uses a weakness in a network service |
| Trojan horse | A program that looks useful or harmless and hides a malicious purpose | No | Yes: someone is tricked into running it. It does not copy itself |
A worm is the fastest, because it waits for nobody. Most malware today is a blend that uses several of these methods at once.
- Macro virus
- Written in the automation language built into office documents. The prompt to enable content is what lets it run.
- Boot sector virus
- Infects the part of a disk that is read when the computer starts.
- Multipartite virus
- Infects both program files and the boot sector.
- Polymorphic malware
- Changes its outward form, usually its , with each copy, so that no two copies look alike. Metamorphic malware goes further and rewrites its whole code. Some sources use the two names loosely.
- Stealth virus
- Hides from anti-malware by tampering with the operating system, so that a scan is shown the clean file.
- Encrypted virus
- Encrypts its body with a changing key, leaving only a short routine for scanners to find.
Malware named for what it does
| Name | What it does |
|---|---|
| Ransomware | Encrypts the victim's files and demands payment for the key. Many strains steal a copy first and threaten to publish it |
| Spyware | Is installed secretly and gathers information about a person or organisation. A keylogger records every key pressed |
| Rootkit | Alters the system to hide itself and other malware, usually with administrator-level control. It is very hard to detect from inside the infected machine |
| Backdoor | Gives a hidden way into a system that avoids the normal sign-in |
| Logic bomb | Code planted in a legitimate system that sets off a harmful action when a condition is met, such as a date |
| Bot | A compromised computer under remote control. A botnet is a network of bots directed by one controller, used for spam and for flooding targets with traffic |
A logic bomb is typically the work of an insider. The standard example is a programmer whose code deletes records if his own name ever leaves the payroll.
Two more terms describe how malware avoids being seen. Fileless malware runs in the computer's memory and uses the system's own legitimate tools, so there is no malicious file on the disk to scan. A zero-day attack exploits a weakness that was unknown to defenders, so no fix and no signature exists on the day it is used.
How anti-malware recognises malware
Anti-malware, in older texts antivirus, is software that detects, blocks and removes malware. It runs on endpoints and at the gateways where email and web traffic enter.
| Method | How it works | Finds | Misses |
|---|---|---|---|
| Signature | Compares files with stored patterns of known malware | Known malware, quickly and with few false alarms | New, polymorphic and fileless malware |
| Heuristic | Examines a file for suspicious features, using rules of thumb | Variants of known malware and some new malware | Malware that shows no suspicious features until it runs. More false alarms than signatures |
| Behavioural | Watches what a running program does, such as encrypting many files in a minute | Unknown and fileless malware | Nothing until the program has started to act |
| Integrity checking | Keeps of important files and reports any change | Unauthorised changes, including those made by rootkits | It says that a file changed, not why |
Signature detection finds known malware. The other methods are what find the unknown.
Operating it well takes four habits. Signatures are updated at least daily. Files are scanned as they are opened, with full scans on a schedule. A central console shows the state of every device. Users cannot switch it off. Suspect files go to quarantine, a locked folder where they cannot run.
Malware often tries to disable the protection on the machine it infects. A device that stops reporting is treated as a warning sign.
EDR and XDR: recording what happens, then acting
Endpoint protection is the family name for the security software on a device. Two newer members go beyond blocking files.
Endpoint detection and response (EDR) records what happens on each endpoint all the time: programs started, files changed, connections made. A central service analyses the record for suspicious behaviour. Analysts can then investigate and act from a distance, for instance by cutting one laptop off from the network.
Extended detection and response (XDR) applies the same approach to more than endpoints. It joins endpoint records with email, network, sign-in and cloud records in one product, so that one attack seen in four places appears as one incident.
| Tool | Main job | Looks at | Responds by |
|---|---|---|---|
| Anti-malware | Blocks known and suspected malicious files | Files and programs on one device | Quarantining or deleting the file |
| EDR | Records and analyses all activity on endpoints | Every endpoint, over time | Isolating a device, stopping a program, supporting investigation |
| XDR | Correlates endpoints with other sources | Endpoints, email, network, identity and cloud together | Co-ordinated action across those sources |
Machine learning and AI-based tools
Machine learning (ML) is software that learns patterns from examples, called training data, without being given rules. Artificial intelligence (AI) is the wider term for systems that perform tasks normally needing human judgement. Security tools use both to files, to spot unusual behaviour, to rank alerts and to summarise incidents for analysts.
They find what no signature describes, and they cope with volumes no team could read. They also have limits.
- A model is only as good as its training data. Whatever the data lacks, the model cannot recognise.
- It makes both kinds of error, false alarms and misses, and needs tuning.
- It often cannot say why it flagged something, which matters when a decision must be justified.
- Evasion: an attacker alters malware slightly, again and again, until the model lets it through.
- Poisoning: an attacker corrupts the training data, so that the model learns to treat the attack as normal.
Such a tool assists analysts and does not replace them. A person reviews any action with serious consequences, and the other layers of control stay in place.
Common misconception
“An AI-based security tool learns by itself, so it needs no tuning or supervision.”
It learns from data that people chose, and it can be evaded or poisoned. Its results have to be checked, its errors fed back and its consequential decisions reviewed by a person.
Worked example: Naming what hit the plumbing merchant
Investigators reconstruct the attack that began with the clerk's spreadsheet.
- The spreadsheet looked like an invoice and hid a malicious purpose. That makes it a Trojan horse. The code inside it was a macro, run when she enabled content.
- The macro wrote no program to the disk. It used the computer's built-in administration tool to fetch instructions from the internet and ran them in memory. That is fileless malware.
- The signature scanner had no file to compare with its patterns, so it reported nothing.
- Over the weekend the code copied itself to other computers through a weakness in file sharing, with nobody touching a key. That part behaved as a worm.
- On each machine it encrypted the files and left a demand. The purpose makes it ransomware.
- Behavioural detection would have had something to see on Friday: a spreadsheet starting an administration tool that connects to the internet.
One attack carried four names, each describing a different aspect: how it arrived, how it hid, how it spread and what it was for.
A question, worked through
A firm of architects with 80 laptops was hit by ransomware. The attacker signed in remotely with a stolen password, then used the laptops' own built-in administration tools to copy drawings out and to start the encryption. No malicious file was written to any disk. The firm's signature-based anti-malware was fully updated and reported nothing.
Which addition would MOST improve detection of an attack like this one?
Decide on your answer, then open the reasoning
- The question asks about detection. The decisive facts are a valid password, built-in tools and no malicious file.
- Rule out b and c together. Signature detection compares files with known patterns. With no malicious file there is nothing to compare, however many products or updates there are.
- Option d is a strong preventive control. Here the attacker ran tools that are a legitimate part of each laptop, so they would be on the allow list.
- Option a records behaviour: an administration tool run remotely at an odd hour, drawings copied out in bulk, hundreds of files rewritten in minutes. It can also isolate a laptop.
- Only a would have seen this attack. The answer is a.
Answer: A. Endpoint detection and response on every laptop
Choosing between good answers
- Malware crosses a network with nobody opening anything
- it is a worm. If it hides inside a useful-looking program it is a Trojan horse. If it attaches to files and travels with them it is a virus.
- Harmful code planted by an insider goes off on a date or an event
- it is a logic bomb.
- Malware is new, changes its form or leaves no file
- choose behavioural detection or EDR. Signature detection will not match.
- One attack shows in email, on endpoints and in cloud services and must be seen as one
- choose XDR.
- A machine learning tool proposes an action with serious consequences
- choose the answer that keeps a person's review.
Check your understanding
4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 4
What to remember
- A virus needs a host file. A worm spreads across networks by itself. A Trojan horse relies on a person being tricked and does not copy itself.
- Ransomware encrypts for payment, spyware gathers information, a rootkit hides, a backdoor gives hidden entry, a logic bomb waits for a condition, a bot obeys a remote controller.
- Signature detection finds known malware. Heuristic detection finds variants and some new malware. Behavioural detection also finds fileless malware.
- EDR records and analyses all endpoint activity and can isolate a device. XDR joins endpoints with email, network, identity and cloud.
- Machine learning tools depend on their training data and can be evaded or poisoned. People review their serious decisions.
Say it from memory
How does anti-malware recognise malware, and how do EDR and XDR differ from it?
Anti-malware blocks malicious files: by signature for known malware, and by heuristic and behavioural detection for new malware. EDR records all activity on each endpoint, analyses it and lets analysts isolate a device. XDR correlates endpoints with email, network, identity and cloud sources.
What do machine learning and AI-based security tools do well, and what are their limits?
They learn patterns from data, so they flag malware and behaviour that no signature describes and sort large volumes of alerts. They depend on their training data, make false alarms and misses, are hard to explain, and can be defeated by evasion or by poisoning. People review their serious decisions.
Which two questions tell a virus, a worm and a Trojan horse apart, and how does each answer them?
Does it need a host file, and does it need a person to act? A virus needs a host file and usually a person who opens it. A worm needs neither: it uses a weakness in a network service. A Trojan horse needs no host file but needs someone tricked into running it, and it does not copy itself.
What are a rootkit, a logic bomb and fileless malware?
A rootkit alters the system to hide itself and other malware, usually with administrator-level control. A logic bomb is code planted in a legitimate system that sets off a harmful action when a condition is met, typically the work of an insider. Fileless malware runs in memory using the system's own legitimate tools, leaving no malicious file on disk to scan.
What does integrity checking find, and what habits make anti-malware work well?
Integrity checking keeps hashes of important files and reports any change, including those made by rootkits, but says that a file changed, not why. Signatures are updated at least daily, files are scanned as they are opened with scheduled full scans, a central console shows every device, users cannot switch it off, and suspect files go to quarantine.
Sources
- NIST SP 800-83 Rev. 1: Guide to Malware Incident Prevention and Handling for Desktops and Laptops, NISTThe definitions of viruses, including macro, boot sector and multipartite viruses, worms, Trojan horses and blended attacks, and of backdoors, bots, keystroke loggers and rootkits.
- #StopRansomware Guide, Cybersecurity and Infrastructure Security Agency, with the FBI, NSA and MS-ISACRansomware as malware designed to encrypt files, and double extortion in which data is also stolen and its release threatened.
- Glossary: logic bomb, National Institute of Standards and Technology, Computer Security Resource CenterA logic bomb as code intentionally inserted into a software system that sets off a malicious function when specified conditions are met.
- Zero day attack (NIST CSRC Glossary), National Institute of Standards and TechnologyA zero-day attack as one that exploits a previously unknown vulnerability.
- Obfuscated Files or Information: Polymorphic Code (T1027.014), The MITRE CorporationPolymorphic code as code that changes its footprint to evade detection, and that the name metamorphic is also used for it.
- NIST AI 100-2 E2025: Adversarial Machine Learning, A Taxonomy and Terminology of Attacks and Mitigations, National Institute of Standards and TechnologyEvasion and data poisoning as classes of attack on machine learning systems.