Malware types
Name malware by how it gets in, hides and what it does
Viruses, worms and trojans get in; rootkits and fileless malware hide; ransomware, spyware and RATs do the damage.
Malware names can feel like a zoo. Sort them by three questions. How does it get in? A virus rides on a file you run. A worm spreads by itself. A trojan pretends to be something useful. How does it hide? Rootkits bury themselves in the operating system. Fileless malware lives in memory, using tools already on the machine. And what does it do? Encrypt and extort, spy, give remote control, join a botnet, or destroy. Real samples mix all three.
Analysing malware · Going deeper
Signs of infection, and how analysts study a sample
Indicators of compromise, sandboxing, static analysis and dynamic analysis; signatures versus behaviour.
Indicators of compromise, sandboxing, static analysis and dynamic analysis; signatures versus behaviour. Signs on an infected system. Behaviour unexpected processes, CPU or disk spikes, new scheduled tasks or services, disabled security tools. Network connections to unfamiliar domains at regular intervals (beaconing), large uploads at odd hours. Files and accounts renamed or encrypted files, ransom notes, new admin accounts, logs that were cleared. Two ways to study a sample. Static analysis. Examine the file without running it: its hash, strings, imports, signatures and packing. Fast and safe, defeated by obfuscation. Dynamic analysis. Run it in an isolated sandbox and watch what it does: files touched, registry changes, network calls. Reveals behaviour; some malware detects sandboxes and stays quiet. Detection. Signature detection matches known patterns and misses new or changing code. Behaviour-based detection, the core of modern endpoint detection and response (EDR), flags what code does, such as mass file encryption or credential dumping, whatever it looks like.
Signs on an infected system
- Behaviour unexpected processes, CPU or disk spikes, new scheduled tasks or services, disabled security tools.
- Network connections to unfamiliar domains at regular intervals (beaconing), large uploads at odd hours.
- Files and accounts renamed or encrypted files, ransom notes, new admin accounts, logs that were cleared.
Two ways to study a sample
Static analysis
Examine the file without running it: its hash, strings, imports, signatures and packing. Fast and safe, defeated by obfuscation.
Dynamic analysis
Run it in an isolated sandbox and watch what it does: files touched, registry changes, network calls. Reveals behaviour; some malware detects sandboxes and stays quiet.
Detection
Signature detection matches known patterns and misses new or changing code. Behaviour-based detection, the core of modern endpoint detection and response (EDR), flags what code does, such as mass file encryption or credential dumping, whatever it looks like.
Worms and patching
WannaCry hit 59 days after the fix was already available
WannaCry (2017) used the EternalBlue exploit against an already-patched Windows flaw, MS17-010.
Here is what a worm looks like in real life. On the fourteenth of March 2017, Microsoft fixed a flaw in Windows file sharing. A month later, an exploit for it, EternalBlue, leaked onto the internet. On the twelfth of May, WannaCry used it to spread from machine to machine with no clicks at all. More than two hundred thousand victims in a hundred and fifty countries. Fifty-nine days after the patch. In England’s health service, eighty-one hospital trusts were hit and about nineteen thousand appointments cancelled. Every infected device was unpatched or unsupported.
Injection
SQL injection turns a user name into a database command
SQL injection is prevented by parameterised queries, with input validation and least privilege as extra layers.
Many attacks on applications come down to one mistake: mixing data with code. On a login page, the attacker types this as their user name. The application glues it into a query. Now the condition, one equals one, is always true, and the two dashes turn the password check into a comment. The attacker is in, often as the first user: the administrator. A parameterised query sends the query and the values separately. Whatever the user types, it stays a value.
Web application attacks · Going deeper · 1 of 4
The other injections and web attacks you need to know
Know command injection, directory traversal, CSRF, SSRF, insecure deserialisation and the OWASP Top 10.
Know command injection, directory traversal, CSRF, SSRF, insecure deserialisation and the OWASP Top 10. Command injection input reaches an operating-system command: a file name such as “report.pdf; rm -rf /”. Avoid shell calls; pass arguments as a list. Directory traversal “../../etc/passwd” in a file path escapes the intended folder. Resolve paths and check they stay inside it. Cross-site request forgery (CSRF) a malicious page makes your logged-in browser send a request, such as a transfer. Defences: anti-CSRF tokens and SameSite cookies. Server-side request forgery (SSRF) the attacker makes the server fetch an internal address, such as the cloud metadata service at 169.254.169.254. Behind the 2019 Capital One breach. Insecure deserialisation turning untrusted data back into objects runs attacker-chosen code. Log4Shell was a lookup-injection cousin of this. Broken access control changing ?account=1001 to 1002 shows someone else’s data (an insecure direct object reference). It tops the OWASP Top 10. The OWASP Top 10 is the standard list of web application risks. Secure coding, code review, testing tools (SAST, DAST) and a web application firewall work together; none is enough alone.
- Command injection input reaches an operating-system command: a file name such as “report.pdf; rm -rf /”. Avoid shell calls; pass arguments as a list.
- Directory traversal “../../etc/passwd” in a file path escapes the intended folder. Resolve paths and check they stay inside it.
- Cross-site request forgery (CSRF) a malicious page makes your logged-in browser send a request, such as a transfer. Defences: anti-CSRF tokens and SameSite cookies.
- Server-side request forgery (SSRF) the attacker makes the server fetch an internal address, such as the cloud metadata service at 169.254.169.254. Behind the 2019 Capital One breach.
- Insecure deserialisation turning untrusted data back into objects runs attacker-chosen code. Log4Shell was a lookup-injection cousin of this.
- Broken access control changing ?account=1001 to 1002 shows someone else’s data (an insecure direct object reference). It tops the OWASP Top 10.
Injection · Going deeper · 2 of 4
Cross-site scripting runs an attacker’s code as a trusted site
Cross-site scripting (XSS), stored or reflected, is stopped by output encoding, Content Security Policy and HttpOnly cookies.
Injection can target your users’ browsers too. An attacker posts a forum comment with a script hidden in it. The forum stores it and serves it to everyone who opens the page. Each visitor’s browser runs the script as if the forum wrote it. Here, it sends their session cookie to the attacker, who can now be them. The fix: encode output, so a script tag shows as harmless text. Add a Content Security Policy to block inline scripts, and mark session cookies HttpOnly so scripts cannot read them.
Injection · Going deeper · 3 of 4
A buffer overflow writes past the box, over what runs next
A buffer overflow overwrites adjacent memory; memory-safe languages, ASLR, DEP and stack canaries defend.
Some flaws live deep in memory. This C code sets aside eight bytes for a name, then copies the input in without checking its length. A short name fits, and the function returns normally to the address stored next to it. Send sixteen bytes, and the extra eight overwrite that return address. The attacker chooses where the program goes next: to their own code. Defences stack up: copy with length checks, use memory-safe languages, and let the operating system make memory non-executable and randomise addresses.
Memory safety · Going deeper · 4 of 4
Why most serious bugs are memory bugs, and the related flaws
About 70% of serious bugs at Microsoft and in Chromium are memory-safety bugs; also know use-after-free, race conditions and integer overflow.
About 70% of serious bugs at Microsoft and in Chromium are memory-safety bugs; also know use-after-free, race conditions and integer overflow. Related flaws. Use-after-free the program keeps using memory it already released, which an attacker may have refilled. Integer overflow a number wraps around (255 + 1 = 0 in one byte), so a size check passes when it should fail. Race condition (TOCTOU) time of check to time of use: the file or value changes between the check and the action. Null pointer dereference usually a crash, so a denial of service. Platform defences. ASLR randomises where code and data sit in memory, so the attacker cannot guess addresses. DEP / NX marks data areas non-executable, so injected bytes cannot run as code. Stack canaries a secret value before the return address; if it changes, the program stops. Governments, including CISA and its partners, urge vendors to publish memory-safety roadmaps and write new code in memory-safe languages.
Related flaws
- Use-after-free the program keeps using memory it already released, which an attacker may have refilled.
- Integer overflow a number wraps around (255 + 1 = 0 in one byte), so a size check passes when it should fail.
- Race condition (TOCTOU) time of check to time of use: the file or value changes between the check and the action.
- Null pointer dereference usually a crash, so a denial of service.
Platform defences
- ASLR randomises where code and data sit in memory, so the attacker cannot guess addresses.
- DEP / NX marks data areas non-executable, so injected bytes cannot run as code.
- Stack canaries a secret value before the return address; if it changes, the program stops.
Governments, including CISA and its partners, urge vendors to publish memory-safety roadmaps and write new code in memory-safe languages.
CVE and disclosure
Every public flaw gets a number, then the race begins
A CVE identifies each flaw; zero-day means no patch yet, n-day means a patch exists. Coordinated disclosure gives vendors time.
Every vulnerability follows a path. Someone finds it. Ideally a researcher, who reports it privately to the vendor. It gets a CVE number, a patch ships, and an advisory goes out. Then attackers reverse the patch and the exploitation spreads. Before a patch exists, it is a zero-day. After, it is an n-day: fixed, but not yet everywhere. In 2025 more than forty-eight thousand CVEs were published. About a hundred and thirty every day.
CVE and disclosure · Going deeper · 1 of 2
CVSS rates how easy and how bad, not how urgent for you
The CVSS base score combines exploitability and impact, from 0 to 10. Log4Shell scored 10.0.
How bad is a vulnerability? CVSS puts a number on it. Here is Log4Shell. First, how easy is it to exploit? Over the network, low complexity, no privileges, no user action. That is the maximum. Then, how bad is it? Scope changed, meaning it reaches beyond the vulnerable component. And high impact on confidentiality, integrity and availability. Together: ten point zero, critical. But CVSS is severity, not risk. Your risk depends on whether you run it, and whether it can be reached.
Prioritising vulnerabilities · Going deeper · 2 of 2
CVSS 4.0, CISA KEV and EPSS
Combine CVSS with CISA KEV (known exploited) and EPSS (likely to be exploited) and your own exposure.
Combine CVSS with CISA KEV (known exploited) and EPSS (likely to be exploited) and your own exposure. Three signals. CVSS severity on a 0 to 10 scale: Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9, Critical 9.0 to 10.0. CVSS 4.0 (2023) adds threat and environmental metrics and splits user interaction into passive and active. CISA KEV the Known Exploited Vulnerabilities catalog: flaws seen exploited in the wild. US federal agencies must fix them by set deadlines under Binding Operational Directive 22-01; everyone else uses it as a must-patch list. EPSS the Exploit Prediction Scoring System from FIRST: the probability that a flaw will be exploited in the next 30 days, updated daily. Your context. The same CVE matters more on an internet-facing VPN than on an isolated lab machine. Asset criticality, exposure and compensating controls turn a severity score into a priority. A scan report sorted by CVSS alone sends teams after the wrong things. Exploited plus exposed comes first.
Three signals
- CVSS severity on a 0 to 10 scale: Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9, Critical 9.0 to 10.0. CVSS 4.0 (2023) adds threat and environmental metrics and splits user interaction into passive and active.
- CISA KEV the Known Exploited Vulnerabilities catalog: flaws seen exploited in the wild. US federal agencies must fix them by set deadlines under Binding Operational Directive 22-01; everyone else uses it as a must-patch list.
- EPSS the Exploit Prediction Scoring System from FIRST: the probability that a flaw will be exploited in the next 30 days, updated daily.
Your context
The same CVE matters more on an internet-facing VPN than on an isolated lab machine. Asset criticality, exposure and compensating controls turn a severity score into a priority.
Patch management
Attackers now exploit new flaws in days, not months
Average time to exploit fell from 63 days to 5 (Google Mandiant). Prioritise by exploitation and exposure.
How long do you have to patch? Less every year. Google’s Mandiant measured the average time from a flaw becoming known to its first exploitation. Sixty-three days in 2018. Forty-four. Thirty-two. Then, in 2023, five. And seventy percent of exploited flaws were zero-days, attacked before any patch existed. So patch by real risk. Known exploited first, then likely to be exploited, then by severity. Where you cannot patch, isolate or disable until you can.
Running patch management · Going deeper
The patch cycle, compensating controls and end-of-life systems
Patch management runs inventory, prioritise, test, deploy, verify; compensating controls cover the gaps.
Patch management runs inventory, prioritise, test, deploy, verify; compensating controls cover the gaps. When you cannot patch yet. Isolate move the system into its own segment, or off the internet. Disable turn off the vulnerable feature or service. Virtual patching a web application firewall or IPS rule blocks the exploit pattern. Monitor extra detection for exploitation attempts. End of life. Software past its vendor’s end of support never gets fixes. WannaCry spread widely through unsupported Windows versions. Replacing it is a business decision, recorded as a risk until it is done.
When you cannot patch yet
- Isolate move the system into its own segment, or off the internet.
- Disable turn off the vulnerable feature or service.
- Virtual patching a web application firewall or IPS rule blocks the exploit pattern.
- Monitor extra detection for exploitation attempts.
End of life
Software past its vendor’s end of support never gets fixes. WannaCry spread widely through unsupported Windows versions. Replacing it is a business decision, recorded as a risk until it is done.
Lesson complete
You finished “Malware and vulnerabilities”
Nicely done.