Professional Web Applications Themes

How to avoid forkbomb? - FreeBSD

Hi, After reading this article: http://www.securityfocus.com/cgi-bin/sfonline/columnists-item.pl?id=308, I decided to give the forkbomb script a try which is below: #!/bin/sh $0 & $0 & The system was unresponsive for a couple minutes but then FreeBSD killed the script and the system was accessible. I started looking around for what my process limit was set at but I found a couple different values. ulimit -a outputs: core file size (blocks, -c) unlimited data seg size (kbytes, -d) 524288 file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 7264 pipe size (512 ...

  1. #1

    Default How to avoid forkbomb?

    Hi,

    After reading this article:
    http://www.securityfocus.com/cgi-bin/sfonline/columnists-item.pl?id=308,
    I decided to give the forkbomb script a try which is below:

    #!/bin/sh

    $0 & $0 &

    The system was unresponsive for a couple minutes but then FreeBSD killed
    the script and the system was accessible.

    I started looking around for what my process limit was set at but I
    found a couple different values.

    ulimit -a outputs:

    core file size (blocks, -c) unlimited
    data seg size (kbytes, -d) 524288
    file size (blocks, -f) unlimited
    max locked memory (kbytes, -l) unlimited
    max memory size (kbytes, -m) unlimited
    open files (-n) 7264
    pipe size (512 bytes, -p) 1
    stack size (kbytes, -s) 65536
    cpu time (seconds, -t) unlimited
    max user processes (-u) 3632


    kern.maxproc is set to 4036


    /etc/login.conf reads:

    :maxproc=unlimited:\

    My questions are:
    Am I looking at the correct values?
    Which is the actual process limit?
    What would you recommend that I set it to in order to have my machine
    shrug off the fork bomb sooner?
    What would be a good process limit for a LAMP webserver?
    How would I set the process limits?

    Thanks in advance.

    - Ryan


    Ryan Guest

  2. #2

    Default Re: How to avoid forkbomb?

    I apologize, I did not mention what version I was running. Here it is:

    5.3-RELEASE-p5

    Ryan J. Cavicchioni wrote:
     
    Ryan Guest

  3. #3

    Default Re: How to avoid forkbomb?

    in message <net>,
    wrote Ryan J. Cavicchioni thusly... 
    .... [/ref]

    FWIW, i tried a version (in ksh88 and possibly whatever /bin/sh
    would have been) on Sun Solaris 2.something (on Sparc), which caused
    .... absolutely nothing.

    IIRC, the version i tried was something like...

    :(){ :|:& }; while true; do :; done


    - Parv

    --

    Parv Guest

  4. #4

    Default Re: How to avoid forkbomb?

    Ryan J. Cavicchioni wrote: 

    Yes.
     

    The lower number, 3632, is the max processes permitted per user.
     

    Probably around 300.
     

    The # of Apache children you want to run + 50 or so...
     

    You could change login.conf (be sure to run "cap_mkdb /etc/login.conf"), or
    you could change the limits seen all processes by changing /etc/profile, or
    for specific user accounts by changing that user's startup scripts:

    # Set reasonable soft process limits.
    ulimit -Sc 100000
    ulimit -Sd 512000
    ulimit -Ss 65536
    ulimit -Sn 512
    ulimit -Su 256

    --
    -Chuck

    Chuck Guest

Similar Threads

  1. how to avoid 'nobody'
    By Peter in forum PHP Development
    Replies: 5
    Last Post: March 30th, 06:55 AM
  2. How can I avoid NaN
    By trints in forum Macromedia Flash Actionscript
    Replies: 5
    Last Post: February 27th, 03:15 PM
  3. How to avoid this
    By WWX webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 4
    Last Post: December 9th, 05:33 PM
  4. Avoid SmartNavigation
    By Jerad Rose in forum ASP.NET General
    Replies: 1
    Last Post: July 21st, 04:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139