How do computer viruses work?

There are a range of different computer viruses that work in all sorts of ways to infect your computer. Here we decode the most common techniques.


Asked by: Patrick Friend, Alton

Some viruses attack the computer’s boot sector, the area on the hard drive that hosts the code for the start-up routine. Such a root code virus causes havoc because it runs itself every time you switch on the computer. Other viruses are hidden in emails, games or attached documents. These applications will appear to run normally but in the background; the malign code plays tricks like sending infected emails to everyone in your contacts list.

Another kind of malicious agent is the worm. This is able to replicate itself, often programming the infected machine to send copies to myriad random computers. Successful worms spread almost exponentially through networks, consuming processing power and bandwidth as they go.

But some of the most widespread disruption comes from botnets. Malicious code, often spread through email attachments, installs itself on thousands of computers. The hijacked machines act as an unwitting army of zombies firing off spam emails or blitzing targets like defence or corporate mainframes. They overwhelm them with a barrage of requests for information in so-called distributed denial of service attacks.

Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun science facts.