Malware Types and Safe Analysis Basics for Beginners

The word malware (malicious software) covers any program designed to harm systems, steal data or give an attacker control. Understanding the families, how they behave and how analysts study them is essential for defenders. This lesson explains the landscape at a conceptual level and teaches safe, introductory analysis techniques you can practise on harmless files. It does not teach how to write malware.

Major Malware Types

TypeBehaviourKey trait
VirusAttaches to legitimate files and spreads when they are run or sharedNeeds a host file and user action
WormSpreads automatically across networksSelf-propagating, no user action needed
TrojanDisguised as something useful or legitimateRelies on deception
RansomwareEncrypts or locks data and demands paymentDirect financial extortion; see Ransomware: How It Works
Spyware / infostealerCollects credentials, browser data, keystrokes, screenshotsQuiet data theft
Remote access trojan (RAT)Gives an attacker remote control of a machineInteractive access
BackdoorHidden way to regain accessPersistence
Rootkit / bootkitHides itself and other malware, deep in the operating system or boot processStealth
Botnet clientEnrols the device into a network controlled remotelyUsed for spam, fraud, denial of service
CryptojackerUses your computing power to mine cryptocurrencySlow systems, high power use
Loader / dropperDelivers and installs other malwareFirst stage of an attack
WiperDestroys data or systemsDisruption rather than profit
Fileless malwareOperates in memory using legitimate tools such as scripting enginesLeaves few files to scan
Adware and PUPsUnwanted advertising or bundled softwareNuisance, sometimes a gateway to worse
Logic bombTriggers when a condition is metOften insider-planted

How Malware Typically Gets In

  • Phishing emails and malicious attachments or links.
  • Drive-by downloads and malicious advertising.
  • Pirated software, cracks and key generators, a very common source of infection.
  • Fake apps and browser extensions, including outside official stores.
  • Exploitation of unpatched software and exposed services.
  • Removable media and compromised software updates or dependencies (supply chain).

What Malware Does After It Arrives

  1. Execution: runs through a user action or an exploited flaw.
  2. Persistence: arranges to survive reboots, for example via startup entries, scheduled tasks, services or registry run keys.
  3. Defence evasion: hides, disables security tools, packs or obfuscates its code.
  4. Credential access and discovery: looks for passwords and maps the environment.
  5. Command and control (C2): contacts attacker infrastructure for instructions, often disguised as normal web or DNS traffic.
  6. Objectives: steal, encrypt, spread, spy or disrupt.

These stages map neatly to the frameworks in Threat Actors and the Cyber Attack Lifecycle, and each one is a chance for defenders to detect the infection.

Signs of Infection

  • Unexpectedly slow system, high CPU or disk use, or fans running constantly.
  • Security tools disabled or unable to update.
  • Unknown programs, browser extensions, startup items or scheduled tasks.
  • Unexpected network connections, especially at odd hours.
  • Files renamed or inaccessible; ransom notes.
  • Browser redirects, pop-ups or changed settings.
  • Accounts showing logins you did not make.

Safe Analysis: Principles

Malware analysts follow strict safety rules, and beginners should too:

  1. Use an isolated virtual machine with no connection to your real network, no shared folders, no clipboard sharing and a clean snapshot to restore.
  2. Never analyse on your daily computer.
  3. Start with harmless files until you are experienced. Do not download live malware samples as a beginner.
  4. Do not run unknown files outside the isolated environment.
  5. Keep the host and hypervisor patched.

Static Analysis: Examining Without Running

Static analysis inspects a file without executing it. Practise on a harmless file such as a standard system program in your Linux VM:

# What kind of file is it?
file /bin/ls

# Compute its fingerprint (hash)
sha256sum /bin/ls

# Extract readable strings (look for URLs, commands, messages)
strings -n 8 /bin/ls | head -n 40

# View metadata and linked libraries
ldd /bin/ls
readelf -h /bin/ls | head -n 15

On Windows executables, analysts examine the PE header, imported functions (which hint at capabilities such as network or file access), embedded resources and signs of packing (high entropy). Beginners can use tools such as pestudio, DIE (Detect It Easy) and CyberChef on harmless programs to learn the structure.

Hash lookups: a file’s SHA-256 can be searched on services such as VirusTotal to see whether others have already analysed it. Searching by hash does not upload the file. Do not upload confidential files, as uploaded samples are shared with the security community.

Dynamic Analysis: Observing Behaviour

Dynamic analysis runs a sample in a controlled sandbox and watches what it does: files created, registry and process changes, network connections. Commercial and free sandboxes exist online (for example, Any.Run and Hybrid Analysis) as well as self-hosted options such as CAPE. Analysts record:

  • Process tree and command lines.
  • Files and registry keys created or modified.
  • Network destinations, DNS queries and protocols used.
  • Persistence mechanisms.

Sophisticated malware may detect sandboxes and behave differently, so analysts combine static and dynamic techniques. Deeper reverse engineering with disassemblers and debuggers is an advanced skill best learned through structured courses.

Indicators of Compromise and Detection Rules

Indicators of compromise (IOCs) are observable evidence of an intrusion: file hashes, malicious domains and IP addresses, registry keys, filenames. They are easy to share but easy for attackers to change. Better detection focuses on behaviours, which are harder to alter.

Defenders write rules to find known patterns. YARA is a common pattern-matching tool. This harmless example rule flags any file containing a marker string that you choose, which lets you practise rule writing safely:

rule Lab_Marker_File
{
    meta:
        description = "Matches harmless lab test files containing a marker string"
        author = "Lab practice"
    strings:
        $marker = "LAB-TEST-MARKER-12345"
    condition:
        $marker
}
echo "LAB-TEST-MARKER-12345" > sample1.txt
echo "nothing to see here" > sample2.txt
yara lab_marker.yar .          # matches only sample1.txt

For safe testing of antivirus and endpoint tools, use the industry-standard harmless EICAR test file, published by the EICAR organisation at eicar.org, which security products are designed to detect. Follow their instructions and delete it afterwards.

Defending Against Malware

  1. Patch operating systems, browsers and applications quickly.
  2. Use endpoint protection with behavioural detection (EDR); see Endpoint Security and System Hardening.
  3. Restrict what can run: application allow-listing, blocking macros from the internet, standard user accounts.
  4. Filter email and web traffic.
  5. Segment networks so an infection cannot spread freely.
  6. Keep tested, offline or immutable backups.
  7. Control software sources: install only from official stores and vendors; avoid pirated software and cracks entirely.
  8. Monitor for persistence changes and unusual outbound traffic.
  9. Train people to report suspicious files and messages.

If You Suspect an Infection

  1. Disconnect the device from the network (unplug or disable Wi-Fi), but do not power it off if your organisation’s procedure says to preserve memory.
  2. Notify your security team or follow your incident response plan; see Incident Response.
  3. Do not delete evidence or reinstall before investigators advise.
  4. Change passwords from a clean device and revoke sessions.
  5. Restore from known-good backups after cleaning or rebuilding.

Practice Exercises

  1. Compute the SHA-256 of three files, then change one byte in one of them and recompute. What does this teach about hash-based detection?
  2. Run strings on a harmless program and identify three pieces of information it reveals.
  3. Write a YARA rule that matches files containing your chosen marker string, test it and confirm it does not match other files.
  4. List five persistence locations on Windows or Linux that a defender should check, then look at them on your lab VM.
  5. Explain why behaviour-based detection is stronger than hash-based detection.

Mentor tip: Beginners want to jump to live samples. Resist that. Spend your first months learning how normal software behaves; analysis is mostly the skill of recognising what is abnormal.

Educational use only: analyse only files you own or are authorised to examine, always inside an isolated lab. This lesson does not teach how to create malicious software.

Key takeaways
  • Malware families differ in spread and purpose: viruses, worms, trojans, ransomware, spyware, RATs, rootkits, loaders and more.
  • Infection stages (execution, persistence, evasion, C2, objectives) each offer detection chances.
  • Static analysis inspects files without running them; dynamic analysis observes behaviour in a sandbox.
  • Always work in an isolated VM and start with harmless files.
  • Patch, allow-list, back up offline and detect behaviours, not just hashes.

Related Lessons