I don't know if such a question is allowed on this site, sorry if it's not

For educational purposes I am asked to write a small virus running on Linux, which should just be able to inject itself into other binaries (but not anything else). I thought of injecting its code with a technique described here: http://www.securelist.com/en/weblog?weblogid=183651915 and this one (playing with the ELF format) but I couldn't find the assembly source. Do you have any links showing how to do such things? Thanks!

3 Answers 3


Here's sample code for run-time process injection on linux. This is how meterpreter does it.LibHiJack


You can probably write one using Alexander Bartolich's ELF Virus Writing How-To

A fellow by the name of Silvio Cesare had a Unix Virus mailing list in the mid-90s. Search for his name and "unix virus" and you'll find goodies like this.

You could also benefit from Tom Duff's Viral Attacks on Unix System Security . He gives an example sh-script virus, but I think you could transliterate that code to C and have a working virus.


In addition to @BruceEdiger's excellent answer, you might enjoy the following paper: Hunting for metamorphic.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .