Viruses, Trojans and Spyware (AQA GCSE Computer Science): Revision Notes
Viruses, trojans and spyware
What is malicious code?
Malicious code, also called malware, is software that has been created with the intention to cause harm and disrupt how computer systems work, or to steal personal data. This harmful software is usually installed on your device without you knowing about it.
Malware is an umbrella term that covers any type of hostile or intrusive software. Understanding the different types helps you recognise threats and protect your systems effectively.
There are several different types of malware, but the three main ones you need to know about are viruses, trojans, and spyware. Each works in a different way to cause problems for computer users.
Viruses
A virus is a computer programme that hides inside another programme on your computer. Think of it like a parasite - it needs a host programme to survive and spread. The virus code only runs when you open or execute the host programme that it's hiding in.
How viruses work and spread
Viruses are particularly dangerous because they can make copies of themselves and spread to other programmes on your computer. This process is called replication. Once a virus has infected one programme, it can insert copies of itself into other programmes, which can then be passed on to other computers.
Viruses commonly spread through:
- Email attachments from unknown sources
- Files, programmes or games downloaded from websites
- Infected memory sticks, CDs or DVDs
- File sharing between computers
What damage can viruses cause?
Viruses can cause serious and potentially irreversible damage to your computer system. Understanding these risks helps you appreciate why prevention is so critical.
Viruses can cause serious problems for your computer system:
- Delete or corrupt data - making your files unusable
- Fill up your hard drive or SSD - causing your computer to run very slowly or become completely unresponsive
- Spread to other programs - infecting more parts of your system over time
Staying safe from viruses
Protection Tips: To protect yourself from viruses, you should:
- Avoid opening emails and attachments from people you don't know
- Don't use unidentified memory sticks or external storage devices
- Only download software from trusted websites and companies
Trojans
Trojans are programmes that trick users into installing them by pretending to be legitimate and useful software. The name comes from the famous "Trojan Horse" from ancient Greek mythology - something that appears harmless on the outside but contains something dangerous hidden inside.
How trojans work
Trojans are often offered as free software, which makes them particularly appealing to users. However, the malicious code hidden inside them only becomes apparent once the software has been installed on your computer.
Unlike viruses, trojans don't replicate themselves, but they can be just as damaging. Their main danger lies in their deceptive nature - users willingly install them thinking they're getting legitimate software.
What trojans can do
Some trojans are just annoying - they might change your desktop layout or add unwanted icons to your screen. However, others are much more serious and can:
- Delete important files from your computer
- Create backdoors - secret entry points that allow hackers to access your computer remotely
- Send screenshots and record key presses to a hacker's computer
- Steal your personal information including passwords and bank details
Protection against trojans
Best Practices for Trojan Prevention: The best way to avoid installing trojans is to:
- Only download and install programmes from trusted websites and companies
- Be suspicious of "free" software that seems too good to be true
- Read reviews and check the reputation of software before installing it
Spyware
Spyware is malware that comes bundled or packaged with other software, often free programmes that users download from the internet. It's designed to secretly gather information about you and send it back to whoever created it.
How spyware works
Spyware is particularly sneaky because it installs itself alongside software that you actually want. When you download and install what appears to be legitimate free software, the spyware gets installed at the same time without you realising it.
This bundling technique makes spyware especially dangerous because users are unknowingly agreeing to install it when they think they're only installing the legitimate software they want.
What information does spyware collect?
Spyware gathers personal information about users, including:
- Keyloggers that record every key you press on your keyboard, allowing criminals to capture your passwords and other login details
- Browsing habits and websites you visit
- Personal files and documents stored on your computer
- Email addresses and contact lists

Detecting and removing spyware
Most anti-virus software will also detect spyware, but you can also get specialised software designed specifically to find and remove spyware from your computer. As with other forms of malware, you should always be careful about downloading and installing free software from the internet.
Protecting your system with anti-malware software
Anti-malware software is designed to detect and remove all types of malware, including viruses, trojans, and spyware. This software protects your system in several important ways:
Real-time protection
Continuous Monitoring: Real-time protection works behind the scenes to keep you safe as you use your computer.
- Continuously scans incoming network traffic to check if files have been infected with viruses
- Monitors downloads and email attachments as they arrive on your computer
- Blocks suspicious activity before it can cause damage
System scanning
- Performs periodic scans of your entire system looking for malicious programmes
- Checks all files and folders on your computer regularly
- Can be scheduled to run automatically at convenient times
Quarantine and removal
- Quarantines infected files when malware is detected, preventing them from running and causing damage
- Allows users to attempt to clean or remove the malicious code
- Provides options to delete infected files if they cannot be repaired
Staying up to date
Anti-malware software needs to receive regular updates from the internet because it relies on having up-to-date definitions of known viruses and malware. These updates tell the software how to identify new threats by their code signatures. Without regular updates, your anti-malware software won't be able to protect you against the latest threats.
Key Points to Remember:
- Viruses hide inside other programs and only run when the host programme is executed - they can replicate and spread to other programmes
- Trojans trick users into installing them by appearing to be legitimate software, but they contain hidden malicious code
- Spyware comes bundled with other software and secretly gathers personal information like passwords and browsing habits
- Anti-malware software provides essential protection through real-time scanning, periodic system checks, and quarantine capabilities
- Always keep your security software updated and only download programmes from trusted sources to stay safe online