Why Does Windows Have More Viruses Than Linux and OS X?

I’m writing this post because I recently overheard a conversation between two friends where one recommended that the friend switch from Windows to Mac or Linux because the latter operating systems are virus-proof and never get malware or rootkits. Uhhh, wrong. Totally wrong. Unfortunately, there are many people who believe this and think buying a Mac or installing Ubuntu will protect them somehow.

 There is some truth to the fact that Linux is a bit more secure, but OS X and Linux both have their share of viruses. Also, since a lot of people don’t run anti-virus software on their Macs because it’s deemed not necessary, when a virus starts spreading on OS X, it spreads like wildfire and no one even realizes they have a virus. The Flashback virus in 2012 infected over 600,000 machines and took Apple weeks/months to release a proper fix.
In this article, I wanted to go through the reasons why there are more viruses for Windows and explain whether Linux is really more secure than Windows and why.

Malware Comes From Many Places

The first thing that I explain to people is that all operating systems are prince to malware or viruses from the web and from email attachments. It doesn’t matter which OS you are on, if you visit a malware-infecting site, click on unscrupulous links or download and open unknown attachments, your computer can become easily infected.
Unfortunately, this is how most people end up with malware and viruses on their computer. It’s not as common to get  virus or get hacked by someone because of an OS level security flaw. Researchers are always finding security holes in Windows, IE, Office, etc, but the systems normally get patched up before the virus starts to spread or someone can take over your computer.
Since Windows is by far the most prevalent operating system, just the sheer number of devices ensures that Windows users will end up getting more viruses. Now that Macs are selling pretty well, the number of incidents of viruses and malware has gone up too. OS X is inherently not any more secure than Windows. The same is not true for Linux, which is inherently slightly more secure. I’ll explain that further down. When a Linux user does get a virus, though, it’s almost always related to an Internet-facing application like a mail server or web app.

Linux Users are Technically Savvy

In order to run Linux on a daily basis, you need to know a lot more about computers than a Windows or Mac user, plain and simple. Even though Linux in the consumer arena is quite small, Linux is huge on the back-end like web servers, etc. What’s surprising is that a lot of Linux servers don’t run any anti-virus. Why? Because the people who maintain them know what they are doing and the servers are hardened against potential attacks.
People who install Ubuntu also are less likely to get a virus by visiting a shady website (they’ll visit the site in a virtual machine) or downloading an infected attachment from their email. A lot of people in this category install extensions like NoScript, which prevent any scripts from running while browsing the web. Obviously, if you go to those lengths to ensure your security, you’ll be far less likely to be compromised.

Linux vs Windows Permissions

One huge advantage that Linux has over both OS X and Windows is user privileges. There are lots of annoying issues with Windows like the fact that someone can name a file “CuteGirl.jpg.exe” and when you double-click it to open, the file will be executed and your computer will now be infected. This kind of hack cannot be done in Linux. Why?
In order to execute a file in Linux, you have to make it executable. This means you have to specifically set it permissions in order for it to run. Another reason why Linux is more secure is that you need root level access in order to do anything. Most Linux users use a normal account and only log into the root account when they need to make specific changes to the system.
Windows also has Administrator and normal user accounts, but 99% of Windows users just log into their computer using the Administrator account, thereby losing all security advantages that the normal account would provide. Even if something manages to run in Linux, it can’t do anything unless it can gain access to the root account.
The special permissions needed and the use of non-root accounts in Linux make it a lot harder to create a virus that will actually spread like it can in Windows or OS X.

Linux is Open Source and That Matters

Another big advantage to using Linux is that everything is open source. You can see all the code and therefore it’s really hard to hide a virus in Linux software. If someone does create a proprietary software package for Linux, it’ll automatically be considered untrustworthy unless it’s coming from some huge well-known company.
Most people using Linux install software from the official package repositories of their Linux distribution. There is no official Microsoft repository for Windows software, it exists everywhere and anywhere. Even someone like me who works with computers all the time, I’ve downloaded and installed a piece of software that I thought was legit, but ended up with some spyware hidden. In my case, I only install unknown software in a virtual machine first and if everything runs fine in the VM, then I install it on my main machine.
On OS X, Apple has recently added a feature to the OS that will prevent installation of any software that is not in the Mac App store or a set of identified software developers. You can manually change the setting so that you can install any Mac software, but it’s a safeguard that I recommend Mac users enable as it gives you better security than a Windows machine where anything can be installed.

Other Factors

There are a couple of other factors that dictate why you don’t see as many viruses for Linux:
1. Linux is a heterogeneous environment. If you have ever thought about using Linux, the first thing you probably had to do was decide which Linux distribution (flavor) to install. There are literally thousands of Linux distributions out there and they are all different. The Linux Kernel is different and they all come with different packages and configurations. This is not the case with Windows. Having so many different forms of the OS makes it hard to write a virus that will spread through everything.
2. Linux has special command and functions for security purposes. When you learn Linux, you learn a lot about commands that let you perform certain security related tasks like sudo or chroot. These commands make performing special tasks in Linux more secure.
3. Linux Kernel is smaller. This one can probably be debated, but overall the Linux kernel is a lot smaller than the Windows kernel, when talking about the areas of the OS where permissions are checked and enforced. A smaller leaner kernel doesn’t necessarily mean more secure, but it definitely helps to keep things to a minimum.
4. Security-enhanced Linux. There are some Linux distributions that have a feature called SELinux or Security-enhanced Linux. It’s basically a set of kernel modifications that make it more secure. It’s part of Red Hat, CentOS, and even Ubuntu.
Hopefully, these article gives you a few more details as to why Linux is considered safer than Windows. It’s definitely not virus-proof and if one day everyone starts downloading and using Linux, the hackers will find new and innovative ways to get viruses there too! Enjoy!
Previous
Next Post »