What is a computer virus?

Next story

Computer viruses are one of the most commonly talked about threats for desktops, laptops and Macs, but what are they and why are they such a threat?

A computer virus is a program or piece of code designed to attach itself to a file, 'infect' a computer, perform a task then replicate and spread.

That replication is the key to defining a computer virus vs. a simple piece of malware or another security problem. Much like the flu, or COVID-19, a virus relies on replication to spread from one device to another.

It's a piece of malicious code, or an entire program, designed to change something about the computer it infects, and it needs to latch onto another file to spread. This change could be as simple as your default browser, but could be as insidious as altering important code and revealing personal information.

The interesting thing to remember is that malware on its own is not a computer virus. The two often get lumped together when people are talking about cyber threats, as do computer worms. Computer viruses aren't quite the threat they used to be, in part because many cybercriminals have now moved on to more dangerous and lucrative methods. That doesn't mean you shouldn't be wary, though.

Remember: Computer viruses and malware are not the same. Simply put, a computer virus is a type of malware.

In this guide, we'll cover exactly how computer viruses spread, the different types of computer viruses, how to detect them and finally, how an antivirus software can protect you from these malicious attacks.


How do computer viruses spread?

There are a number of incredibly common ways for computer viruses to spread. In a world that's nearly 'always on', where your phone and laptop are constantly connected to the internet, there are multiple ways you could unwittingly contract a computer virus. Some of these may be incredibly obvious, while others may be much more secretive.

Gone are the days of a virus only spreading from computer to computer simply by infected floppy disks. There are now numerous ways for a virus to arrive on your computer: they can be downloaded as their own file, or latch themselves onto another program or file you're downloading.

A computer virus requires a host file or program and once infected, this virus can spread to your computer through any one of the following methods:

  • Text and email attachments

  • File downloads from infected websites

  • Social media links

  • App downloads on Android or iPhone

  • USB sticks and other external devices

  • Torrenting and file sharing

For example, you really want that screensaver of a cute pug licking your laptop screen, but it's only available on some fairly questionable sites. You download it and suddenly your default browser has changed, you're getting ads all the time or your entire device is being held to ransom. You've unwittingly installed a computer virus. It had latched itself to a file, you'd downloaded it and installed it. You've provided the user action it needed to help it spread.

There must be user action to allow a computer virus to transmit. Programs that self-replicate aren't classed as viruses; they are computer worms. The need for manual action, like opening a document with a virus attached, is why they've declined in popularity. It's why computer worms have become increasingly popular, as they don't rely on user action to spread or install.


The different types of computer virus

A few types of known viruses you may hear mentioned include:

  • Browser hijackingyou will find problems in your web browser. You may have a new homepage or be redirected to web pages you don't want to visit.

  • Polymorphic virus – a virus designed to evade detection by constantly changing its root code.

  • File infector – this is one of the most common types of virus and it adds code to your executable files or programs.

  • Direct action – most viruses would be described as 'direct action' viruses. The code will lie dormant in a file, like an email attachment, waiting for you to execute it.

  • Boot sector viruses – a type of attack which will execute when you boot up your laptop or PC.

  • Web scripting virus – you'll find these on infected web-pages and they can attack your computer from those pages.

  • Resident virus – a type of virus which adds itself to your computer memory and executes when you boot up or load your operating systems.

  • Multipartite virus – known for its versatility, the clue is in the name for this virus. It can spread in multiple ways across one computer or whole computer networks.

  • Macro virus – these viruses are often hidden in email attachments. They're written in the same language as the file or software they are attached to.

At ESET, we protect computers and mobile devices from a range of cyber threats. This includes protection from computer viruses. Many security threats get rolled up into the conversation around computer viruses, so it can often be helpful to go back to basics in breaking down exactly what a computer virus is, and what it's not.

  • Is malware a computer virus?
    Malware can be a virus but isn't, in itself, a virus. Malware stands for 'malicious software' and a virus can be a type of malware. Most new and emerging threats are actually malware, rather than viruses, as they offer significantly more opportunity for cybercriminals. There are many different types of malware, and not all of these are computer viruses.

  • Is a trojan a computer virus?
    Trojan horses can be a computer virus. A trojan is a program designed to look like a legitimate program or something friendly, just like the real Trojan Horse was, and that makes it perfect for getting computer viruses onto your system. Maybe you're downloading music using file sharing or your friend just sent you some photos. Always scan any files you're downloading because they could be deliberately made to dupe you into letting a computer virus onto your system.

  • Is a computer worm a virus?
    A computer worm is not a computer virus. While a virus is designed to replicate and spread, it needs user action and a file to latch onto. A computer worm, however, doesn't need a file or program host and can replicate itself across an entire computer network without any input from a user. Generally, once a worm is on a network or system, it'll install malware or perform another malicious action.

  • Is ransomware a virus?
    Ransomware can be a computer virus. Ransomware is any software designed to hijack your system and demand ransom, often in return for either access to your files or to prevent the spread of misinformation about you. The very first case of ransomware came about by a virus, and many still do. A ransomware virus will need a user to download or install it, but many ransomware programs now use computer worms to infect entire computer networks instead.

  • Is adware a virus?
    Adware is not a computer virus. Adware, while annoying, is simply a type of malware. It's not always malicious either. Some adware is simply part of other software. Adware becomes malicious when it's deliberately trying to make you do something you don't want to do. This can be as innocuous as changing your browser or incessantly displaying adverts with the simple goal of making money, but more malicious agendas can be when adware is trying to take you somewhere dangerous or make you download a file that does contain a virus.

  • Is spyware a computer virus?
    Spyware is not a computer virus. As with adware, it's another type of malware. A virus you've downloaded could install spyware, but the spyware itself isn't the virus. Spyware is designed to track your activities or steal sensitive information.

  • Is email spam and phishing a virus?
    Email spam is not a virus, but it can contain a virus. There are three different types of spam email: those intended simply to annoy, those intended to phish a user to prompt them to share sensitive information and finally, those which try to trick a user into downloading a file. It's these email attachments which may be the virus, rather than the email or text message itself.

A computer virus is simply one of many types of cyberthreat, and while there aren't as many being made as there used to be, there are still thousands out there you need to protect yourself from.


How does a computer virus attack?

A computer virus will only attack your device through user input. This means you won’t open your computer one day to find you’ve been infected overnight. A computer virus attacks by:

  1. Attaching itself to a file, document or program – this is how a virus spreads from computer to computer; it either attaches itself based on its code or is attached by another person or program.

  2. Remain dormant on the file – the virus itself won’t activate simply from the file being downloaded. It will need to be activated.

  3. The infected program is executed – when a user opens, runs or executes an infected file or program, the virus activates and the malicious code kicks in.

  4. The virus spreads – at this stage, the virus code spreads on your computer however it’s programmed to do so. It could infect one particular file or a whole network.

  5. The computer virus attacks – depending on the type of virus, this could be as simple as changing your default search engine or as malicious as stealing your private data or holding your entire network to ransom. Some ‘viruses’ are nothing more than someone having some fun, but most are designed to cause serious problems, harm your device or steal data for financial gain.


How do I know if I’ve got a computer virus?

You won’t always be able to tell straight away when a virus has infected your computer. Some virus codes are insidious enough that they will remain undetected without a scan while destroying data, for instance.

The telltale signs you’ve got a computer virus may include:

  • Poor computer performance – a malicious software program, like spyware, that’s been installed on your computer by a virus will be ‘always on’, which means it will eat up a lot of your system resources. It could make your device run very slowly.

  • Sudden increases in processing and fan use – in addition to this, rather than simply running slowly, you may notice spikes in processing activity if you check usage graphs, or your fan may go into overdrive when you’re only performing menial tasks. This is because there are tasks you don’t know about running in the background while your computer operates.

  • Regular pop-ups – while some of these may appear useful, you should be very wary if you suddenly get frequently spammed with pop-ups. Sometimes they may even be trying to make you download an antivirus program, but in general they’ll be aiming to get you to either supply financial information or download another virus.

  • Changes to default web browsers, homepage or search engine – notice a change to your web browser you never made? There’s a good chance a virus has caused this. This often happens as a form of adware to make money, or else direct you to places you wouldn’t want to go.

  • Freezing or crashing frequently – this could be because of the previously mentioned performance issues, but it can also be because some viruses target your hard drive and damage it.

  • Programs you never installed launching on startup – some computer viruses will install malware or a computer program you never wanted. These may be easily visible when you load your computer up, or some may only appear when you’re looking at performance information.

  • Emails being sent which you never wrote – some viruses target your emails, rather than your computer system. These viruses will be designed to spread through emails. If you notice your sent box is suddenly full of emails you never wrote, there’s a good chance you have a virus. In this instance, you should immediately alert anyone it sent an email to.

  • Password changes – if you suddenly can’t log in to key accounts, whether it’s your operating system or your email, then you may have a virus. Some viruses will install a computer code designed to hijack your accounts.

  • Deleting files and corrupting files – if you notice that important files or documents are either disappearing or being corrupted, you may well have a virus and malware.

  • Ransom notifications – this one is a little more obvious, as it’ll usually take over your entire system or computer network. The ransomware won’t always be a virus, but it often is. You’ll find your computer or files inaccessible as you’ll be stuck on a screen asking for money or information.

  • Your antivirus or anti-malware software sends you an alert – one of the more obvious ways of spotting a virus is when your antivirus programs and anti-malware software alert you to a problem. This could happen during a scan or as soon as you open or download an infected file. It may even block the executable file.

It’s worth noting this is not an exhaustive list. There may be other ways to tell if you have a PC virus or a malware problem.


How do I remove computer viruses?

Removing a computer virus can sometimes be quite simple, but in some cases it can be much more complicated.

First of all, you’ll need to find out whether you’re virus-free or actually have a virus on your device. If you don’t have antivirus software installed, you may need to rely on one of the signs above to spot it. Once you’ve done this, you’ll probably need to search for information on how to remove it, then follow potentially complex steps. This can’t guarantee removal, and for some viruses you’ll need in-depth knowledge on how a computer works.

With antivirus protection, like ESET, it’s much simpler. You’ll have two options: either run a scan or have our Host-Intruder Prevention System (HIPS) pro-actively target threats.

If you think you may have a virus or you’ve only just installed your antivirus protection, then run a scan:

  1. Run a virus scan – under ESET’s protection, you could run a full system scan or a customised scan of a particular part of your computer system.
  2. Isolate infected files
  3. Remove infected files

If you already have our virus protection software installed, then HIPS may block a virus automatically. It works something like this:

  1. HIPS scans downloaded and executable files pro-actively
  2. Block and flag potential threats – this includes threats like ransomware and can block them before they can do anything to your computer. HIPS uses a database of known threats and machine learning to block any potential new attacks.
  3. Infected files are removed


What’s the best way to protect my device from viruses?

The best way to protect your computer or your network is to invest in robust computer security that offers antivirus protection. A powerful antivirus and anti-malware software, like ESET, runs regular scans and blocks threats before they ever have a chance to attack your device.

Preventing computer viruses before they happen is the best form of defence. ESET uses a combination of machine learning, scans and a suite of security options to block viruses, phishing and other cybersecurity threats before they can take hold. ESET offers powerful antivirus protection for PC, alongside antivirus software for macOS.