Advanced

How to Write a Linux Virus in 5 Easy Steps

Posted by Scott_Ruecker on · 35 comments
Tom's Hardware; By Tuan Nguyen
Mail this story
Print this story

It's easy for people to pick at Windows for being prone to virus and malware attacks. It's almost a given belief that if you're running a PC with a Windows operating system, you're much more susceptible to attacks than users with other operating systems. But let's quickly look at the reasons for this. First, it isn't really Microsoft's fault. It isn't that Windows is technically inferior, it's that the majority of the world runs on Windows. This fact alone is very attractive for any virus coder or exploiter. As a virus writer, you'd want to attack the majority, not the minority.

[Hmm..are you sure it's just five? - Scott]

Full Story

  Nav
» Read more about: Story Type: News Story; Groups: Linux, Microsoft

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (35)

This doesn't work

8 earlier comments in the full thread.

Did anyone actually read this article? It's the sorriest collection of recycled FUD I've seen in a long time:

Quoting: It isn't that Windows is technically inferior, it's that the majority of the world runs on Windows. This fact alone is very attractive for any virus coder or exploiter. As a virus writer, you'd want to attack the majority, not the minority...

There are many who are just not as educated--for various reasons--about software and Internet safety. So here we have a huge pool of people, many of which aren't informed. These are two main reasons why a Windows desktop is the prime target for attacks...

Despite its strong underpinnings, Linux has become too popular to ignore. Now, a blogger by the name of "foobar" has written a guide on how to efficiently infect a Linux user's system...

Because of its relatively low usage rate compared to Windows computers, Macs have traditionally been more secure only because no one really wanted to spend time to attack a small minority group....


Gack. What a confused collection of wrong. Windows gets infected more because it's dead easy, which should be obvious even to the "open source means more vulnerable" crowd. But of course facts are inconveniences to the Windows apologists. Windows gets infected because it is easy to exploit, and because the entire Microsoft software stack is designed with one overriding purpose: lockin. Performance and security are tiny afterthoughts. Blaming the user is the #1 talking point from the MS FUDbook, and it is a big fat lie. Windows gets infected even when the user does everything they're supposed to.

Linux and free Unixes like FreeBSD have equivalent or greater market share than Windows in nearly every market segment except the desktop, which means that popularity and open source should be a double whammy, and the entire infrastructure of the Internet, Google, Amazon, Facebook, the top 500 supercomputers, and so on should be massive wriggling infestations. It is truly amazing how the myths in this article persist despite years of abundant evidence to the contrary.

I thought the same thing TC. Especially
Quoting:It isn't that Windows is technically inferior, it's that the majority of the world runs on Windows.
which just made me laugh and realize right off that thea article was clueless.
Quoting:Well, duh. Even if the grub trick would not be possible this holds true. Take out the hard drive, put it in another machine and mount it from another OS. Then overwrite the passwd file. Any machine to which you have physical access can be broken. Only encryption helps. All the other access methods do not matter since you can always take out the drive anyway.
You don't even have to go that far - just stick in a LiveCD of most any distro (Puppy Linux will fit on a small CD) and reboot.

Of course this only works if you can boot from the CD without a BIOS password. Otherwise, you'll still have to crack open the case and reset the BIOS.

That Linux stuff is just so insecure.

(Truecrypt anyone? http://www.truecrypt.org/ )
Ok, here's a nice sudo-virus for ya (if you can get the user to run it).

chattr -R +iu /home

Would be amusing to see the practical effect that would have....
Damn you techiem2. I am posting this from the public library because....
I was wondering when someone was gonna call it what it is Carla, I read it, that's why I put the editor note I did in the lead..

;-)
Yeah the tomshardware article was just FUD but the linked to article seems to be pretty good. At first I thought it was just bogus, but using the sample code he provided did create a launcher that would try to run but I didn't have a valid url to download a file from, so I don't know. Though it did not create a new file in the .local folder.

The article of the original article does bring up some valid concerns, though the article in the newswire is FUD.
I don't know that it is 'valid'. For instance, from step 3:
Quoting:Now create a desktop launcher file for the installer of the malware, which is different than the launcher we use to restart the malware after a reboot. The desktop launcher for the installer is what we send as attachment in the email to the targeted user. It's what the user clicks on after they saved it.


In other words you send someone a file, they download it and run it. That just doesn't qualify in my book as

Quoting:prove that Linux is no more secure to malware than Windows is


When I had problems before leaving Windows, I didn't know what activex is. After a very serious infection requiring the reinstallation of XP, the tech guy told me to use IE with activex turned off. This is far different.

What if I told you to plug in your computer and dunk it in a bathtub full of water? Does anyone claim Linux protects you from that? How is that different from saying Linux doesn't prevent you from running programs that you shouldn't? It's far different from someone downloading a legitimate Excel spreadsheet and getting hit with a virus. (Yes, I did that too.)
Quoting:It isn't that Windows is technically inferior, it's that the majority of the world runs on Windows. This fact alone is very attractive for any virus coder or exploiter. As a virus writer, you'd want to attack the majority, not the minority...
This classic argument is easily debunked.

If the proposed hypothesis is correct, then it necessarily follows that the world's most popular web server must suffer from far more exploits than its competitors. But it doesn't. The number two web server is by far the most exploited. Therefore, the basis for the above quote is disproved.

So, what are the common elements between the most exploited operating system and the most exploited web server? The are both proprietary, Microsoft products (IIS and Windows.) And the common elements between the less exploited products in these comparisons? They are both Free, open source software (Apache and Linux.)

So, scientifically speaking, what is the correct hypothesis?
Quoting:I thought it was just bogus, but using the sample code he provided did create a launcher that would try to run but I didn't have a valid url to download a file from, so I don't know.


Point it at a file on your computer or on your network, that should be a good enough test.
IT's unlikely to work even on my little old ladies, because one of the things I do to educate is explain that, regardless of your operating system, you should not attempt to open files or emails that look strange - someimagename.jpg.desktop is pretty damn strange, and my little old ladies would be on the phone to me about it, or would simply delete the email, and tell me about it next time we spoke.
ta -

I think you hit the nail on the head. Linux desktops don't mask filenames the way Windows desktops do.
I was able to get the desktop launcher to create a new folder and copy a file into it without having to set it as executable, so this is a potential security hole that should be looked at. Though they would have to know what icon that the intended target is using for an .odt flle for it to trick anybody.
theboomboomcars: Icon paths are standardised across Linux desktops, so that shouldn't be too hard. I agree that the desktop spec should be changed to incorporate the executable bit, but the overall threat is very, very minimal.
>but the overall threat is very, very minimal.

Minimal is in the eyes of the beholder. If you expose all of your cherished family photos, tax info, etc to destruction, it may not seem so minimal.

OTOH --

You do have to participate in your own demise and Linux provides you with much more information than Windows.
> If you expose all of your cherished family photos, tax info, etc to destruction, it may not seem so minimal.

You do that everytime you power up your hard drive. :) Hard drive failure is a far more significant threat to your data than a Linux virus.
>> Hard drive failure is a far more significant threat to your data than a Linux virus.

Wow, that's a great point. I would love to see some statistics on that. I'm guessing the hard drive failure is a greater risk by a multiple in triple digits, perhaps more.
Um... I see "virus.jpg.desktop" and it's also not executable until I tell it it is.
Quoting:The number two web server is by far the most exploited.


Were can I find data to support this? Recently, as far as I understood, lots of Apache servers have been cracked too, making them spread Windows viruses.
>> Were can I find data to support this? Recently, as far as I understood, lots of Apache servers have been cracked too, making them spread Windows viruses.

Actually, my understanding is that there are an equal number of apache servers spreading malware as there are IIS servers spreading malware. That is not the same thing as counting cracked servers.

Last time I looked for the vulnerability statistics was about 4 years ago. They were easy to find on the web. IIRC, they were readily available on cert.org and sans.org.

Today, I went a looking expecting an easy task. But finding the stats today is needle-in-a-haystack material. It's not that the stats have skewed toward Apache, it's that they're nowhere to be found.

I'll do some more searching later, when I have more time.

I can do it in 3

I can do it in three:

1) Log in as root. 2) Run rm - rf / 3) Stare at screen as all your files disappear.

Stupid article. Anybody who downloads a program and installs it via root privileges (required on Linux) is asking for trouble. And that's basically what appears to be going on. Some Windows programs will happily install programs FOR you. (Ask those who've gotten burned by Microsoft Service Packs.) The most vulnerable will be the same sort of people who are willing to download a program to try to watch porn on a Windows PC. As another commenter pointed out, "You can't fix stupid."
Linux is also not secure from: 1. Dumping the computer into a running hay grinder. 2. Running the computer over with a steamroller. 3. Burning down the house in which the computer resides.

You see, Linux is just as vulnerable as Windows because the above three things will destroy your computer and take the data with it no matter the operating system.
Using it for a backstop while target practicing with a Smith & Wesson 500 does a fair job of showing of just how bullet proof Linux really is.

p.s. I have pictures ... somewhere
> 3) Stare at screen as all your files disappear.

Someone posted a YouTube of them doing that on a VM, just for kicks. Turns out it ran for a remarkably long time before choking.
@Bob, that's probably because the files didn't really disappear until all the open file handles go away. Any process reading a file will have an open handle. I like shred /dev/hda myself.
Only deleting /bin/rm or /bin/mkdir is also lots of fun. You should try it (on a VM I recommend), because the result is not as obvious as you might think.
It's interesting, as even when you lose utilities like cp, you can still use shell builtins ie. echo "file" > file. In theory, if you really wanted to, you could potentially recover from this by writing yourself enough programs using builtins like echo until you have a system that can copy files from another machine.

Of course it's much easier just to recover important files using a live disc (or just forget about them and reinstall)

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post