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!


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.

protected by Community Oct 6 '16 at 10:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.