VOOZH about

URL: https://www.geeksforgeeks.org/computer-networks/difference-between-virus-worm-and-trojan-horse/

⇱ Difference Between Virus, Worm and Trojan Horse - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Difference Between Virus, Worm and Trojan Horse

Last Updated : 25 Sep, 2025

Viruses, worms, and Trojan horses are all types of malicious software that can damage your computer, but they differ in how they get in, spread, and replicate.

👁 virus_

Virus

A virus is malicious code that attaches itself to a legitimate program or file and activates when the host is run. It requires user action (like opening an infected file) to spread. Viruses can corrupt files, delete data, or disrupt system performance by replicating into other programs.

How it works:

  • Infects a host file or program by appending or embedding its code.
  • When the host runs, the virus code executes and may perform payload actions (delete/modify files, corrupt data).
  • It copies itself into other files or shared media; propagation depends on user actions (opening/sharing infected files).

Worm

A worm is a standalone malware program that spreads automatically without needing a host file or user action. It exploits vulnerabilities in operating systems, applications, or networks to replicate across devices. Worms often consume large amounts of bandwidth and system resources, causing slowdowns or crashes.

How it works:

  • Exploits OS or application vulnerabilities, network services, or weak configurations.
  • Automatically copies itself to remote machines (via network shares, open ports, or email vectors).
  • Often spawns many instances, consuming CPU, memory, and network bandwidth.

Trojan Horse

A Trojan horse (Trojan) is malicious software disguised as legitimate or useful software. Unlike viruses and worms, it does not self-replicate. Instead, it tricks users into installing it. Once inside the system, it can steal sensitive data (like login or credit card details), create backdoors, or allow attackers remote access.

How it works:

  • Delivered as a seemingly useful app, installer, or document.
  • Once executed, it can open backdoors, log keystrokes, exfiltrate data, or download additional malware.
  • Often provides persistent remote access to an attacker (a “gateway” into the system).

Difference Between Virus, Worm, and Trojan Horse

Virus

Worm

Trojan Horse

A software that attaches itself to other programs to harm.

A standalone software that replicates to spread across systems.

A disguised software that steals information.

Replicates by attaching to other programs.

Self-replicates without attaching to other programs.

Does not replicate itself.

Cannot be controlled remotely.

Can be controlled remotely.

Can be controlled remotely.

Modify or delete information.

Consume system resources and slow down systems.

Steal sensitive information.

Executed via infected executable files.

Executed via system vulnerabilities.

Executed through deceptive software.

Can corrupt or delete files.

Can cause significant slowdowns and network congestion.

This can lead to data breaches and unauthorized access.

Often spread through infected files and email attachments.

Commonly spread through network connections and vulnerabilities.

Typically spread through downloads and phishing emails.

Often detectable by antivirus software.

More difficult to detect as they exploit system vulnerabilities.

Often hidden in legitimate-looking software.

Can cause loss of data and corruption of programs.

Can overload system resources and network bandwidth.

Can steal personal and financial information.

Comment

Explore