Malware fundamentals: families, delivery, persistence, and the response

What malware categories describe, how infections usually start, where persistence hides on Windows, Linux, and macOS, and why rebuilding usually beats cleaning.

Lesson 10 of 18 · 13 min read · practice only with authorization

Diagram

The life of a typical infection

Follow the path. One example at a time.

Step 1 of 4

Delivery

A phishing attachment, a cracked installer, a malicious ad, or a compromised update.

Illustration: Delivery
# Delivery
# A phishing attachment, a cracked installer, a malicious
# ad, or a compromised update.
What changes the outcome
Confidence

Unknown remnants may stay

Credentials

Often forgotten

Time

Open-ended hunting

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Names describe behavior

    What fails
    Worm, trojan, ransomware, and infostealer describe how something spreads or what it does, and one sample can be several.
    Who is affected
    Responders who chase the label instead of the impact.
    What you would notice
    A ticket titled with a family name and no affected hosts.
    What you change
    Record the behavior observed and the systems and accounts touched.
  2. Persistence is enumerable

    What fails
    Each operating system has a short list of autostart locations.
    Who is affected
    The host owner if a reinstall misses one.
    What you would notice
    A new scheduled task or launch agent with no change ticket.
    What you change
    Baseline autostart entries and alert on additions.
  3. Credentials outlive the cleanup

    What fails
    Stealers take browser sessions, tokens, and saved passwords that keep working after the host is clean.
    Who is affected
    Every service the user was signed into.
    What you would notice
    Sign-ins from new locations after the host was rebuilt.
    What you change
    Revoke sessions and rotate secrets as part of every malware response.

The main categories

Viruses infect other files. Worms spread themselves across networks. Trojans pretend to be something useful. Ransomware encrypts or steals data for extortion. Spyware and infostealers collect data. Rootkits hide other components. Remote access trojans give an operator control. Wipers destroy data. Most modern intrusions use several pieces, often legitimate admin tools alongside custom code.

Autostart locations to know

On Windows, check Run and RunOnce registry keys, scheduled tasks, services, WMI event subscriptions, and startup folders; Sysinternals Autoruns lists them all. On Linux, check systemd units, cron, shell profiles, and authorized_keys. On macOS, check LaunchAgents, LaunchDaemons, and login items.

# Linux: units and timers added recently
systemctl list-unit-files --state=enabled | head
find /etc/systemd/system ~/.config/systemd -name "*.service" -newer /etc/hostname
crontab -l; ls -la /etc/cron.d
# macOS
ls ~/Library/LaunchAgents /Library/LaunchDaemons

Handling samples safely

Do not run unknown files on a workstation or upload customer files to public sandboxes without permission. Analysis belongs in an isolated VM with no shared folders, and samples are stored in password-protected archives labeled as malicious.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A host is cleaned of an infostealer. What must also happen?

Go deeper

Specific techniques, exercises, and glossary cards for this topic.

  1. 01Persistence an inventory can seeHostile programs try to run again after a reboot. Includes the diagram and a defensive fix.
  2. 02Documents and signed installersA document with a macro and an installer with a valid signature are both delivery. Includes the diagram and a defensive fix.
  3. 03Viruses and worms: how self-spreading code moves and how networks contain itA virus needs a host file or user action; a worm spreads by itself across networks. Includes the diagram and a defensive fix.
  4. 04Trojans and backdoors: disguised programs and the persistence they leaveA trojan poses as something useful; a backdoor gives continued access. Includes the diagram and a defensive fix.
  5. 05Spyware, keyloggers, and adware: unwanted monitoring and how to find itSpyware collects activity or keystrokes; adware injects ads and often tracks browsing. Includes the diagram and a defensive fix.
  6. 06Ransomware: the intrusion before the encryption and how to recoverModern ransomware is a human-operated intrusion: initial access, credential theft, lateral movement, backup destruction, data theft, then encryption. Includes the diagram and a defensive fix.
  7. 07Rootkits and bootkits: hiding below the operating system and how Secure Boot helpsRootkits hide processes, files, and connections by tampering with the OS; bootkits load before it. Includes the diagram and a defensive fix.
  8. 08Botnets: how infected devices are controlled and how takedowns workA botnet is a set of infected devices controlled centrally or peer-to-peer, used for DDoS, spam, credential stuffing, and proxying. Includes the diagram and a defensive fix.
  9. 09Cryptojacking: stolen compute for mining and how to spot itCryptojacking runs cryptocurrency miners on someone else’s servers, cloud accounts, containers, or browsers. Includes the diagram and a defensive fix.
  10. 10Mobile malware: banking trojans, spyware, and sideloaded appsPhones face banking trojans that abuse accessibility services, sideloaded apps from links, and targeted spyware. Includes the diagram and a defensive fix.
  11. 11Polymorphic and metamorphic malware: why hash-based detection is not enoughPolymorphic malware changes its encrypted wrapper each time; metamorphic code rewrites itself. Includes the diagram and a defensive fix.
  12. 12Advanced persistent threats: using threat intelligence and ATT&CK to defendAPT groups run long, goal-driven campaigns. Includes the diagram and a defensive fix.
  13. 13Exploit kits and drive-by downloads: why patched browsers ended an eraExploit kits like Angler and RIG fingerprinted visitors and served browser or plugin exploits through compromised sites and malicious ads. Includes the diagram and a defensive fix.
  14. 14Malware analysis for defenders: triage, static and dynamic analysis in an isolated labA safe workflow for analyzing a suspicious file: handling rules, hash and reputation triage, static analysis (strings, imports, PE structure, YARA), dynamic analysis in an isolated VM or sandbox, and turning results into detections. Includes the diagram and a defensive fix.
  15. 15Detecting and removing malware: triage, containment, and when to reimageA practical endpoint response process: confirming an alert, isolating the host, collecting evidence, scoping other affected machines, deciding between cleaning and rebuilding, and resetting credentials. Includes the diagram and a defensive fix.
  16. 16Infostealers: stolen browser sessions and the accounts they openInfostealers such as RedLine, Lumma, and Vidar grab saved passwords, cookies, and tokens from browsers and sell them as logs. Includes the diagram and a defensive fix.
  17. 17Remote-access tools: legitimate RMM software used by intrudersAttackers install legitimate remote management tools like AnyDesk, ScreenConnect, or Atera because they are signed and trusted. Includes the diagram and a defensive fix.
  18. 18Wipers: destructive malware and planning for total data lossWipers destroy data or boot records instead of encrypting for ransom, often in geopolitical conflicts (Shamoon, NotPetya, HermeticWiper, AcidRain). Includes the diagram and a defensive fix.

Exercises

  1. 01Control benchThe same stolen credential can delete the only backups. Choose the copy that credential cannot reach.
  2. 02Terminal mission: A login script that ships your historyEvery interactive shell on ops-02 makes a small HTTP request after each command. Find the startup file responsible, the shell variable it abuses, and where the data goes.
  3. 03Terminal mission: A service that restarts itselfAn unfamiliar service on build-03 keeps reconnecting to an outside address. Use systemctl to find the unit, read the unit file, and identify the binary it starts.
  4. 04Terminal mission: A ransom note rule that stops flagging the FAQA loose ransom-note rule fires on finance documents that mention bitcoin. Read a tighter rule that uses a regex, a count, and filesize, measure the difference, and explain each condition.

Glossary

  1. 01RansomwareSystems and backups are encrypted or stolen, and work stops until recovery or payment.
  2. 02TrojansSoftware the person meant to run also does something else.
  3. 03WormsA program spreads by itself, usually through an exposed service or a reused password.
  4. 04RootkitsThe program hides under the tools you would use to see it.
  5. 05SpywareThe program watches the session and reports out.
  6. 06InfostealersSaved passwords, session cookies, and files are packaged and sent away.
  7. 07Remote-access toolsA tool meant for administration is left behind so someone else can return.
  8. 08WipersThe intent is destruction, not a ransom note.
  9. 09CryptojackingSomeone else's computer mines, and the bill or the CPU graph is the clue.
  10. 10Mobile malwareA phone profile or a sideloaded app has the same reach as the user's accounts.