Skip to contentSkip to conversation

Forking shell bombs

DISCUSSION Ryan Underwood 15 participants 18 messages Jul 8, 2003 – Jul 13, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

Quoted 3 lines

That's what per-user process limits are for. Doesn't matter if it's a shellscript or something else; any system without limits set is vulnerable.

I agree, but it would also be nice to have a way to clean up after the fact without giving up the box. My limit is set at 2047 processes which, while being a lot, doesn't seem like enough to guarantee a dead box. (Don't many busy systems have more than this number running at any given time?)

Quoted 14 lines

It's a base redhat kernel, after the cannot allocate memory, my system returned to normal operation and it didnt die.
Is this the type of behavior you were looking for? or am i off base?

Linux sloth 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

$ :(){ :|:&};:
[1] 3071

$
[1]+ Done : | :

$ -bash: fork: Cannot allocate memory

Review

Quoted 3 lines
(quoted diff) +0 -3
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory

Nope, on my system running stock 2.4.21, after hitting enter, wait about 2 seconds, and the system is frozen. Telnet connects but never gets a shell. None of the SysRq process-killing combos have any effect. After a few failed killalls (which eventually killed the one shell I was able to get), and Alt-SysRq-S never completing the sync, I gave up and Alt-SysRq-B.

What does ulimit -u say on your system? 2047 on mine.

Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>, icq=10317253
#2 lore raw

1023 here. System still died. It is a PII 233-ECC with 256 megs of ram though.

--

/"\ / For information and quotes, email us at

 \ /  ASCII RIBBON CAMPAIGN / [email protected]
  X   AGAINST HTML MAIL    / http://www.lrsehosting.com/
 / \  AND POSTINGS        / [email protected]

-------------------------------------------------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Ryan Underwood
Sent: Tuesday, July 08, 2003 3:28 PM
To: [email protected]
Subject: Re: Forking shell bombs

What does ulimit -u say on your system? 2047 on mine.

--
Ryan Underwood, <nemesis at icequake.net>, icq=10317253 -

#3 lore raw
In reply to Ryan Underwood
Quoted 43 lines · Ryan Underwood

Hi,

Quoted 5 lines

That's what per-user process limits are for. Doesn't matter if it's a shellscript or something else; any system without limits set is vulnerable.

I agree, but it would also be nice to have a way to clean up after the fact without giving up the box. My limit is set at 2047 processes which, while being a lot, doesn't seem like enough to guarantee a dead box. (Don't many busy systems have more than this number running at any given time?)

Quoted 14 lines

It's a base redhat kernel, after the cannot allocate memory, my system returned to normal operation and it didnt die. Is this the type of behavior you were looking for? or am i off base?

Linux sloth 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

$ :(){ :|:&};:
[1] 3071

$
[1]+ Done : | :

$ -bash: fork: Cannot allocate memory

Review

Quoted 3 lines
(quoted diff) +0 -3
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory

Nope, on my system running stock 2.4.21, after hitting enter, wait about 2 seconds, and the system is frozen. Telnet connects but never gets a shell. None of the SysRq process-killing combos have any effect. After a few failed killalls (which eventually killed the one shell I was able to get), and Alt-SysRq-S never completing the sync, I gave up and Alt-SysRq-B.

Quoted 4 lines

What does ulimit -u say on your system? 2047 on mine.

$ ulimit -u
3072

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

#4 lore raw

Hi,

Quoted 3 lines · jhigdon

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

I haven't, but a previous poster indicated that they had (2.5.74) with the same results.

I wonder if we could find an upper limit on the number of allowable processes that would leave the box in a workable state? Unfortunately, I don't have a spare box to test such things on at the moment. ;)

Thanks,

Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>, icq=10317253
#5 lore raw

HP/UX and some other systems, have kernel parameters that can be set for max number of processes, and or threads. I'm not a big fan of it myself, since there are instances where it would appear to be a 'fork attack' but be legitimate threads or forks.

Not to mention it is just tacky... A better solution is:

Know thy users, .... and thy baseball bat.

-- Sir Ace

Quoted 17 lines · Ryan Underwood

Hi,

Quoted 3 lines · jhigdon

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

I haven't, but a previous poster indicated that they had (2.5.74) with the same results.

I wonder if we could find an upper limit on the number of allowable processes that would leave the box in a workable state? Unfortunately, I don't have a spare box to test such things on at the moment. ;)

Thanks,

#6 lore raw
In reply to Ryan Underwood

No such thing exists. I can have 10,000 processes doing nothing and have a load average of 0.00. I can have 100 processes each sucking cpu as fast as the electrons flow and have a dead box.

Learn how to manage resource limits and you can tuck another feather into your fledgeling sysadmin hat ;)

david

Quoted 19 lines · Ryan Underwood

Hi,

Quoted 3 lines · jhigdon

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

I haven't, but a previous poster indicated that they had (2.5.74) with the same results.

I wonder if we could find an upper limit on the number of allowable processes that would leave the box in a workable state? Unfortunately, I don't have a spare box to test such things on at the moment. ;)

Thanks,

#7 lore raw

Hi David,

Quoted 3 lines · David Ford

No such thing exists. I can have 10,000 processes doing nothing and have a load average of 0.00. I can have 100 processes each sucking cpu as fast as the electrons flow and have a dead box.

Well, like I said, in this specific case we talk about a fork bomb, not a bunch of idle processes. My question is what the upper limit to set, in order to ensure that processes that do nothing but "while (1) fork();" do not take down the system. Apparently 2047 is too high for 2.4.21, at least on my system. But, a slower box manages a 2047 ulimit fine with a 2.4.20 kernel.

Quoted 2 lines

Learn how to manage resource limits and you can tuck another feather into your fledgeling sysadmin hat ;)

I already know how to manage the limits, but I am asking why the system seems to hang indefinitely when a maximum of 2047 is set, but not when e.g. 1500 is set. Do you have any idea? Why would there be such a large change in behavior with such a small change in parameter?

Furthermore, why does my (slower, 600 < 800mhz) system running 2.4.20 kill off a fork bomb at a 2047 ulimit instantaneously, but 2.4.21 takes half an hour or more, at which point I give up?

Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>, icq=10317253
#8 lore raw
In reply to David Ford

Hi all.

It sounds like what is required is some way of basically saying "Don't permit new processes to be created if CPU usage > 75%" (where the 75% is configurable but less than 100%).

Best wishes from Riley.
---
* Nothing as pretty as a smile, nothing as ugly as a frown.

Quoted 12 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of David Ford
Sent: Wednesday, July 09, 2003 4:08 PM
To: Ryan Underwood
Cc: [email protected]
Subject: Re: Forking shell bombs

No such thing exists. I can have 10,000 processes doing nothing and have a load average of 0.00. I can have 100 processes each sucking cpu as fast as the electrons flow and have a dead box.

Quoted 22 lines

Learn how to manage resource limits and you can tuck another feather into your fledgeling sysadmin hat ;)

david

Quoted 15 lines · Ryan Underwood

Hi,

Quoted 2 lines · jhigdon

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

I haven't, but a previous poster indicated that they had (2.5.74) with the same results.

I wonder if we could find an upper limit on the number of allowable processes that would leave the box in a workable state? Unfortunately, I don't have a spare box to test such things on at the moment. ;)

Thanks,

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.500 / Virus Database: 298 - Release Date: 10-Jul-2003

#9 lore raw

On Sun, 2003-07-13 10:10:22 +0100, Riley Williams <[email protected]> wrote in message <[email protected]>:

Quoted 5 lines

Hi all.

It sounds like what is required is some way of basically saying "Don't permit new processes to be created if CPU usage > 75%" (where the 75% is configurable but less than 100%).

That won't allow a load > 0.75 . Bad idea.

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
      ret = do_actions((curr | FREE_SPEECH) & ~(IRAQ_WAR_2 | DRM | TCPA));
#10 lore raw
In reply to Riley Williams
Quoted 6 lines · Riley Williams

Hi all.

It sounds like what is required is some way of basically saying "Don't permit new processes to be created if CPU usage > 75%" (where the 75% is configurable but less than 100%).

Which would immediately cause problems for anyone running setiathome. My cpu useage has been 100% for 5 years.

Quoted 48 lines

Best wishes from Riley.
---
* Nothing as pretty as a smile, nothing as ugly as a frown.

Quoted 12 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of David Ford Sent: Wednesday, July 09, 2003 4:08 PM
To: Ryan Underwood
Cc: [email protected]
Subject: Re: Forking shell bombs

No such thing exists. I can have 10,000 processes doing nothing and have a load average of 0.00. I can have 100 processes each sucking cpu as fast as the electrons flow and have a dead box.

Quoted 21 lines

Learn how to manage resource limits and you can tuck another feather into your fledgeling sysadmin hat ;)

david

Quoted 15 lines · Ryan Underwood

Hi,

Quoted 2 lines · jhigdon

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

I haven't, but a previous poster indicated that they had (2.5.74) with the same results.

I wonder if we could find an upper limit on the number of allowable processes that would leave the box in a workable state? Unfortunately, I don't have a spare box to test such things on at the moment. ;)

Thanks,

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.500 / Virus Database: 298 - Release Date: 10-Jul-2003

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 7 lines
Cheers, Gene
AMD K6-III@500mhz 320M
Athlon1600XP@1400mhz  512M
99.26% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2003 by Maurice Eugene Heskett, all rights reserved.
#11 lore raw
In reply to jhigdon

Hello,

Debian 3.0 (woody) stable. Kernel 2.4.21 ...
bash 2.05a

$ulimit -u
1791

---

No problems here. In 1-2 secs the process dies and all is ok, i can work with the shell without any problem.

Seeya

Quoted 58 lines · jhigdon
Quoted 41 lines · Ryan Underwood

Hi,

Quoted 4 lines

That's what per-user process limits are for. Doesn't matter if it's a shellscript or something else; any system without limits set is vulnerable.

I agree, but it would also be nice to have a way to clean up after the fact without giving up the box. My limit is set at 2047 processes which, while being a lot, doesn't seem like enough to guarantee a dead box. (Don't many busy systems have more than this number running at any given time?)

Quoted 13 lines

It's a base redhat kernel, after the cannot allocate memory, my system returned to normal operation and it didnt die. Is this the type of behavior you were looking for? or am i off base?

Linux sloth 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

$ :(){ :|:&};:
[1] 3071

$
[1]+ Done : | :

$ -bash: fork: Cannot allocate memory

Review

Quoted 3 lines
(quoted diff) +0 -3
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory

Nope, on my system running stock 2.4.21, after hitting enter, wait about 2 seconds, and the system is frozen. Telnet connects but never gets a shell. None of the SysRq process-killing combos have any effect. After a few failed killalls (which eventually killed the one shell I was able to get), and Alt-SysRq-S never completing the sync, I gave up and Alt-SysRq-B.

Quoted 3 lines

What does ulimit -u say on your system? 2047 on mine.

$ ulimit -u
3072

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#12 lore raw

I set the ulimit -u 1791
and the box keeps running(2.4.20-gentoo-r5) , but we still need the problem corrected, any other user can run ther DOS and crash the box, is there any way to set ulimits for all users fixed ??, not by sourcein a bashrc or something like that ?? because the user can delete the line on .bashrc and thats it

Max

Signature · 6 lines
uname -a: Linux garaged 2.4.20-gentoo-r5 #6 SMP Wed Jun 4 15:32:53 Local time zone must be set--see zic m i686 Pentium III (Coppermine) GenuineIntel GNU/Linux
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GS/ d-s:a-28C++ILHA+++P+L++>+++E---W++N*o--K-w++++O-M--V--PS+PEY--PGP++t5XRtv++b++DI--D-G++e++h-r+y**
------END GEEK CODE BLOCK------
gpg-key: http://garaged.homeip.net/gpg-key.txt
#13 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tirsdag 8. juli 2003, 19:18, skrev Max Valdez:

Quoted 6 lines

I set the ulimit -u 1791
and the box keeps running(2.4.20-gentoo-r5) , but we still need the problem corrected, any other user can run ther DOS and crash the box, is there any way to set ulimits for all users fixed ??, not by sourcein a bashrc or something like that ?? because the user can delete the line on .bashrc and thats it

/etc/security/limits.conf, on my box.

- - Svein Ove Aas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/C0UL9OlFkai3rMARAnwsAKDEOnB8YqlzBu5TwjWFm3qVN2W8nACfZPSe weYkPZfbHktsk4Eubm3jFAM=
=4/Xo
-----END PGP SIGNATURE-----

#14 lore raw
In reply to Max Valdez
Quoted 6 lines · Max Valdez

I set the ulimit -u 1791
and the box keeps running(2.4.20-gentoo-r5) , but we still need the problem corrected, any other user can run ther DOS and crash the box, is there any way to set ulimits for all users fixed ??, not by sourcein a bashrc or something like that ?? because the user can delete the line on .bashrc and thats it

You can set the limits using the pam limits module and set the hard limit so the user cannot revert it. Or with -ac just set no overcommit and it seems fine

#15 lore raw
In reply to jhigdon

On an Athlon 600 running 2.4.20, with ulimit -u 2047, the box recovers no problem from the fork bomb.

On my Celeron 800 running 2.4.21, ulimit -u 1500, the box recovers after 4-5 minutes.

ulimit -u 2047 (Debian's default ulimit), the box fights for 5-10 minutes, and no longer responds after 10. I can see fork perrors in the terminal like usual, but the machine no longer responds. (I waited more than half an hour.)

Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>, icq=10317253
#16 lore raw
In reply to jhigdon

Em Ter, 2003-07-08 às 17:43, jhigdon escreveu:

Quoted 2 lines

Have you tried this on any 2.5.x kernels? Just curious to see what it does, I plan on giving it a go later.

Athlon 1.0GHz with 1GB of memory running 2.5.74-bk6:

$ ulimit -u
2047

The system does not freeze, it becomes slow, but in some seconds becomes normal.

Signature · 4 lines
Luiz Fernando N. Capitulino

<[email protected]>
<http://www.telecentros.sp.gov.br>
#17 lore raw
In reply to Ryan Underwood
Quoted 6 lines

Nope, on my system running stock 2.4.21, after hitting enter, wait about 2 seconds, and the system is frozen. Telnet connects but never gets a shell. None of the SysRq process-killing combos have any effect. After a few failed killalls (which eventually killed the one shell I was able to get), and Alt-SysRq-S never completing the sync, I gave up and Alt-SysRq-B.

I've used killall -STOP several times since it will fill up the process table. once they're all in T state, I killall -KILL them. seems to work for me.

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#18 lore raw
In reply to Ryan Underwood

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 37 lines · Ryan Underwood

Hi,

Quoted 3 lines

That's what per-user process limits are for. Doesn't matter if it's a shellscript or something else; any system without limits set is vulnerable.

I agree, but it would also be nice to have a way to clean up after the fact without giving up the box. My limit is set at 2047 processes which, while being a lot, doesn't seem like enough to guarantee a dead box. (Don't many busy systems have more than this number running at any given time?)

Quoted 14 lines

It's a base redhat kernel, after the cannot allocate memory, my system returned to normal operation and it didnt die.
Is this the type of behavior you were looking for? or am i off base?

Linux sloth 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

$ :(){ :|:&};:
[1] 3071

$
[1]+ Done : | :

$ -bash: fork: Cannot allocate memory

Review

Quoted 3 lines
(quoted diff) +0 -3
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory
-bash: fork: Cannot allocate memory

Nope, on my system running stock 2.4.21, after hitting enter, wait about 2 seconds, and the system is frozen. Telnet connects but never gets a shell. None of the SysRq process-killing combos have any effect. After a few failed killalls (which eventually killed the one shell I was able to get), and Alt-SysRq-S never completing the sync, I gave up and Alt-SysRq-B.

Quoted 1 line

What does ulimit -u say on your system? 2047 on mine.

mb@lfs:~> ulimit -u
2047

my system doesn't freeze.
It becomes _very_ slow, but I can kill the forking processes. After killing, the system runs just fine.
I'm using 2.4.21.

- --
Regards Michael Buesch
http://www.8ung.at/tuxsoft
13:34:31 up 12 min, 2 users, load average: 1.32, 1.22, 0.74

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/C/4soxoigfggmSgRAjRDAJ9lH45Hr0LoAJTLwG4/Xlo6a2pE7ACeMUVl ITJ5Tucg2LLpYqkQ2Vk/dmY=
=qCMR
-----END PGP SIGNATURE-----