# What is the difference between a virus, a worm and a trojan?

All three are malware, but they spread differently. A virus attaches itself to a file or program and spreads when someone opens or shares that file. A worm spreads by itself across the network, usually through a vulnerability, with no user action, which is why worms can infect hundreds of machines within an hour. A trojan pretends to be something useful, such as an invoice or a free tool, so the user installs it willingly; it does not copy itself, but it often opens a back door. For defenders, the worm is the loudest on the network, because it scans and connects to many machines quickly.

FAQ: [What is…? Network and security terms](https://netsenx.com/en/faq/glossary) · https://netsenx.com/en/faq/what-is-the-difference-between-a-virus-a-worm-and-a-trojan

## Read next

- https://netsenx.com/en/what-is-ndr
- https://netsenx.com/en/problems-we-solve

## Related questions

- [What is a DDoS attack?](https://netsenx.com/en/faq/what-is-a-ddos-attack)
- [What is a brute-force attack?](https://netsenx.com/en/faq/what-is-a-brute-force-attack)
- [What is a port scan?](https://netsenx.com/en/faq/what-is-a-port-scan)
- [What is a man-in-the-middle attack?](https://netsenx.com/en/faq/what-is-a-man-in-the-middle-attack)
- [What is a vulnerability in IT security?](https://netsenx.com/en/faq/what-is-a-vulnerability)
