The Linux Virus Writing HOWTO
Source: Wildsau
Writing a program that inserts code into another program file is one thing. Writing that program so that it can be inserted itself is a very different art. So although this document shows a lot of code and technique, it is far from being a "Construction Kit For Dummies". Instead I'll try to show how things work. Translation of infecting code to assembly is left as a (non-trivial) exercise to the reader.
An astonishing number of people think that viruses require secret black magic.
Here you will find simple code that patches other executables. But since regular users can't overwrite system files (we are talking about serious operating systems here) that is not even half the journey. To make any impact you need root permissions. Either by tricking the super user to run your virus, or combining it with a root-exploit. And since all popular distributions come with checksum mechanisms, a single command can detect any modification. Unless you implement kernel-level stealth functionality...
