Computer viruses work by attaching themselves to other programs and replicating when those programs are run. There are different types of malware including viruses, worms, and Trojan horses. Viruses first emerged when personal computers became widespread and people shared software over bulletin boards and floppy disks. Early viruses embedded themselves in executable files or boot sectors to automatically spread. Later, email viruses and worms that exploited security vulnerabilities allowed malware to spread more easily over networks. Spyware is generally not designed to damage computers but can track users and change browser settings without permission. People can help protect themselves by using antivirus software, avoiding unknown programs, and practicing safe web browsing habits.