Malware

On this page 7

Malware, short for malicious software, is any program, script or code fragment that is intentionally designed to compromise the confidentiality, integrity or availability of a system, for example by stealing data, encrypting files, spying on users or taking remote control. In cybersecurity, malware is the umbrella term for viruses, worms, trojans, ransomware, spyware, rootkits and similar threats, and it is the technical payload of most attacks after initial access has been gained.

What makes code malware is intent and lack of authorization, not the technique. Remote administration tools, scripting engines and encryption are legitimate in the hands of an administrator, and they become malicious when an attacker uses them without the owner’s consent.

How malware is classified

Malware is classified along two independent axes: how it spreads and what it does once it runs. A single sample usually belongs to several categories at once, so a worm can carry a ransomware payload, and a trojan can install a rootkit. Labels used by security vendors therefore describe dominant behavior rather than strict biological-style species.

The following table compares the three classic propagation mechanisms, which still determine how quickly an infection can grow inside a network.

MechanismNeeds a host fileSelf-replicatesNeeds user action
VirusYes, it inserts itself into files or boot sectorsYesUsually, to run the infected file
WormNo, it is a standalone programYes, across networksNo, it exploits services automatically
TrojanNo, it poses as legitimate softwareNoYes, the victim installs or opens it
Propagation mechanisms compared

Worms are the most dangerous in terms of speed, because they spread without human help. In 2017, WannaCry used the SMBv1 exploit known as EternalBlue to infect hundreds of thousands of Windows computers within days, mostly systems that lacked a security update released two months earlier.

Main malware types by payload

The payload defines the business impact of an infection. Modern attacks often chain several payloads: a small loader downloads an infostealer, and the stolen credentials later enable a ransomware deployment.

TypePrimary goalTypical behavior
RansomwareExtortionEncrypts files and often steals data first for double extortion
InfostealerCredential and data theftHarvests browser passwords, session cookies and crypto wallets
Remote access trojanPersistent controlOpens a hidden channel for commands, screenshots and file transfer
RootkitConcealmentHides files, processes or network activity, sometimes at kernel level
Botnet agentResource abuse at scaleJoins a centrally controlled network for spam or denial of service
CryptominerTheft of computing powerMines cryptocurrency and causes sustained high CPU or GPU load
WiperDestructionOverwrites data or boot records, sometimes disguised as ransomware
Spyware and keyloggersSurveillanceRecords keystrokes, messages, location or audio
Common payload types and their goals

A growing share of attacks uses fileless techniques, which run code in memory through built-in tools such as PowerShell or WMI. This approach, called living off the land, leaves few files on disk and blends with normal administrative activity, which defeats purely file-based scanning.

How malware reaches a system

Malware needs an initial access vector before it can run. The table links the most common vectors to the mechanism they exploit and to the control that most reduces their risk.

VectorMechanismMost effective control
Phishing attachments and linksThe user opens a document, archive or fake login pageEmail filtering, macro blocking and user training
Exploited vulnerabilitiesUnpatched internet-facing services run attacker codeFast patching of known exploited flaws
Stolen credentialsAttackers log in to VPN or remote desktop servicesMulti-factor authentication
Software supply chainA trusted update or package carries malicious codeVendor assessment, code signing and integrity checks
Drive-by downloads and malicious adsA compromised or fake website delivers a payloadBrowser updates and web filtering
Removable mediaInfected USB drives introduce code into isolated networksDevice control and disabled autorun
Infection vectors and key controls

Once running, malware typically pursues persistence, privilege escalation and lateral movement. Frameworks such as MITRE ATT&CK catalog these behaviors as tactics and techniques, which gives defenders a common language for detection coverage.

Detecting and analyzing malware

No single detection method catches all malware, because attackers use packing, obfuscation and polymorphism to change how their code looks while keeping its behavior. Effective defense layers several methods with different strengths.

MethodStrengthWeakness
Signature matchingFast and precise for known samplesMisses new or modified variants
Heuristic and rule-based analysisDetects suspicious structures, for example with YARA rulesHigher false-positive rate
Behavioral monitoring (EDR)Detects malicious actions regardless of file formRequires tuning and skilled analysts
Sandbox detonationObserves real behavior in isolationEvasive samples detect the sandbox and stay dormant
Machine learning classifiersGeneralizes to unseen samplesCan be evaded by adversarial modifications
Detection methods and their trade-offs

Analysts distinguish static analysis, which inspects code without running it, from dynamic analysis, which observes execution in a controlled environment. The results are distilled into indicators of compromise, such as file hashes, domains and IP addresses, which are short-lived, and into behavioral detections, which remain useful far longer.

Reducing the impact of malware

Because some malware will eventually run, mature organizations design for containment and recovery, not only prevention. The most effective measures are well established:

  • Patch known exploited vulnerabilities first, especially on internet-facing systems.
  • Remove local administrator rights and apply least privilege, which blocks many persistence and escalation techniques.
  • Use application allowlisting on servers and high-value workstations.
  • Keep offline or immutable backups and test restores regularly, because ransomware operators target backup systems deliberately.
  • Segment networks so that a single infected host cannot reach every server.

A common mistake is to treat a cleaned machine as trustworthy. After an infection with a rootkit or a remote access trojan, the safe practice is to rebuild the system from a known-good image and reset every credential that was used on it.

Understanding it simply

Malware is software made to cause harm. It can sneak in through an email attachment, a fake website or an unpatched program, and then it works quietly in the background against the computer’s owner.

Some malware locks files and demands money, some steals passwords, and some lets criminals control the computer from afar. The best protection combines several habits: keeping software updated, being careful with unexpected attachments and keeping backups that an attacker cannot reach.

Applied in practice

An accounting firm with 120 employees receives an email with a compressed invoice attachment. One employee opens it, and a script inside launches a loader that downloads an infostealer. Within minutes, the infostealer collects saved browser passwords and attempts to contact a remote server.

The firm’s endpoint detection and response agent flags the unusual sequence of a script spawning PowerShell and making an outbound connection. It isolates the laptop from the network 14 minutes after the attachment was opened. The security provider rebuilds the laptop, resets the employee’s passwords and checks for logins from unknown locations. A review shows that the same campaign later delivered ransomware to similar firms, so early behavioral detection prevented a far more costly incident.