Malicious software (malware) is a generic term to refer to any malicious or annoying software installed in the system which is designed to exploit a computer by carrying out unwanted actions without the user's consent.
The execution of malware can cause the disruption of computer operations and can be also used to gather sensitive information or gain unauthorized access to computer systems. Malware is not the same as defective software, which is software that has a legitimate purpose but contains harmful bugs that were not noticed before release.
In fact, computer viruses are actually a subset within the larger malware family, like other specimens such as worms, Trojan horses, adware, spyware, adware, rootkits, etc...
Nowadays, most of the malware is distributed via the Internet. One of the most common methods is known as the "drive‐by download". It downloads and runs the malicious file, for example through the Web or executing an attachment received via email, like a malicious PDF file. In many cases, the user is deceived into believing that a certain program or data is useful for them; for example, for a software to play video. In other instances, the infection is hidden to the user, who just has to visit a Web page that takes advantage of vulnerabilities in the Web browser to download and execute the malware. However, nearly any Internet protocol can be used to distribute malware, for example, P2P or instant messaging. Moreover, it is important to remember that physical storage devices can propagate malware; the distribution through USB pen drives is very common.