How does malicious software infect computers?
The purpose of this section is to look at ways in which malware finds its way onto personal computers. This is essential to defending against malicious programs. We user the term "malware" here in the most general sense, meaning any harmful, damaging, intrusive or irritating software installed by stealth means.
Viruses
A viruses is a piece of malicious code which embeds itself into the code of an existing program file, such as an .exe file. When the program file is executed by the unsuspecting user, the virus code executes too. There are two results: firstly, some sort of malicious action will be carried out, such as deleting all the documents in the user's personal folder; secondly, the virus code will copy itself to any other executable file available on the computer.
The best protection against viruses is, not surprisingly, a good, up-to-date antivirus program.
Worms
Worms are similar to viruses in that they are self-reproducing. However, they are independent programs, which do not need a host program to exist. They can move from one computer to another across networks.
As with viruses, the best protection is a good antivirus program.
Trojan Horses
Trojans, or Trojan Horses, are named after the wooden horse in Greek mythology. Essentially, they are something nasty packaged as something nice. A Trojan is a malicious program disguised as a game, screensaver, antivirus program (ironically), video or music file. Trojans do not self-replicate, i.e. they cannot spread from file to file or computer to computer by themselves. They need someone to be fooled into running them. When a trojan is executed, it could perform any number of malicious actions; a common type of Trojan is a Trojan downloader. This doesn't itself do anything harmful, but it downloads and installs some other piece of software which will.
The best protection against trojan horses is to keep your eyes open and your brain switched on. Remember, a trojan is dependent on the user to install it.
Exploit
An exploit is malicious code in a web page or pdf file etc which takes advantage of a vulnerbility in the browser or pdf reader program that allows it to execute. The result is a drive-by download, i.e. the download and installation of malicious software caused by the user simply opening a document.
The best protection against exploits is to keep all of your software, that is antivirus program, operating system, office suite, pdf reader browser and so on, as up to date as possible. This removes the vulnerabilities which would otherwise be attacked by the exploits.