You are not logged in.

#1 2007-06-27 21:11:52

skymt
Member
Registered: 2006-11-27
Posts: 443

Why no forkbomb protection?

The following code will bring down a default Arch install if entered in a shell:

:() { :|:& }; :

It's called a forkbomb, and it works by spawning infinite processes, hogging all available resources and making the system unresponsive. It's also completely preventable. The ulimit command sets resource consumption limits for each user. If Arch set a reasonable default process limit (400 should be safe, I can't imagine a single user hitting it except in a forkbomb situation) in /etc/profile, it would remove a potential DoS risk with no real side effects.

Offline

#2 2007-06-27 21:28:58

colnago
Member
From: Victoria, BC
Registered: 2004-03-25
Posts: 438

Re: Why no forkbomb protection?

I think ulimit is set, but maybe too high (8190?).  I will check when I get home.  The last time I tried to fork bomb arch, it came back.  Maybe it just took a bit to hit the limit and you restarted before that?  ...or maybe the config was changed and i am blowing hot air.

Cheers

Offline

#3 2007-06-27 21:36:02

Login_Here
Member
Registered: 2007-06-27
Posts: 24

Re: Why no forkbomb protection?

The output of ulimit -u (max user processes) is 32768, which I assume is more than enough for a fork bomb to make a computer unresponsive.

Offline

#4 2007-06-27 21:41:23

somairotevoli
Member
Registered: 2006-05-23
Posts: 335

Re: Why no forkbomb protection?

Mine is

bash-3.2$ ulimit -u
4095

I have not changed mine.  hmm

Offline

#5 2007-06-27 21:51:36

Login_Here
Member
Registered: 2007-06-27
Posts: 24

Re: Why no forkbomb protection?

I haven't changed mine either. It probably varies depending on the specifications of the computer Arch has been installed on.

Offline

#6 2007-06-27 21:59:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,019

Re: Why no forkbomb protection?

There's been some topics about forkbombs already.

Offline

#7 2007-06-27 23:00:45

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Why no forkbomb protection?

this has been covered before

the best option right now: set ulimits yourself.
my ulimit is unset (test box), and it is defaulting to 768.
Pretty sure it is based on memory and other system info..


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#8 2007-06-28 18:05:55

Kenetixx
Member
From: /unvrs/mlkywy/earth/aust/home
Registered: 2006-09-09
Posts: 258
Website

Re: Why no forkbomb protection?

LOL just tried this on a server box at work and killed it  big_smile


http://binaryritual.net

There is no spoon.......

Offline

#9 2007-06-28 18:47:40

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Why no forkbomb protection?

Kenetixx wrote:

LOL just tried this on a server box at work and killed it  big_smile

Are you sure your original name here on this forum wasn't more appropriate? tongue

Offline

#10 2007-06-30 12:20:56

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Why no forkbomb protection?

On my machine I have my limits set to allow maximal 1024 procs, the bash bomb ( :(){ :|:& };: ) ended after like half a minute but when I executed "perl -e "fork while fork" " I had put myself in a giant DoS, whatever I tried to execute gave me a "fork: resource temporally unavailable" and I was totally locked out while perl kept my cpu at 100% and my procs kept jumping up to 1024...
I managed to kill my screen session and that stopped it... But in a tty without screen I would have been totally locked out... I couldn't even login in another tty because setuid couldn't fork...

So the limit stuff gives full protection against bash bombs but perl still manages to achieve a DoS...

Last edited by Ramses de Norre (2007-06-30 12:21:07)

Offline

#11 2007-07-01 01:51:51

hacosta
Member
From: Mexico
Registered: 2006-10-22
Posts: 423

Re: Why no forkbomb protection?

well if this is a single user system the best protection in to not run it (:

Offline

#12 2007-07-01 10:23:16

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Why no forkbomb protection?

hacosta wrote:

well if this is a single user system the best protection in to not run it (:

I was curious whether I was protected or not smile

Offline

#13 2007-07-01 18:12:13

oli
Member
From: 127.0.0.1
Registered: 2006-02-07
Posts: 164
Website

Re: Why no forkbomb protection?

Arch is an operating system with the able user in mind, so it's up to you.


Use UNIX or die.

Offline

#14 2007-07-01 18:32:40

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Why no forkbomb protection?

oli wrote:

Arch is an operating system with the able user in mind, so it's up to you.

Yes, but the problem with a forkbomb is the non-root user being able to crash the machine (or at least cause a DoS). I knew very good what I was doing when I executed those forkbombs but I wanted to test what the abilities of non-root users were in an Arch system and it seems like the knowledgeable dude that gets access to your machine can crash it easily...

Offline

#15 2007-07-01 21:15:01

_adam_
Member
From: Dora, Alabama
Registered: 2006-05-18
Posts: 94

Re: Why no forkbomb protection?

this largely depends on the system and how much it can handle before crashing. there is no one perfect solution to forkbombs. you as the admin, need to assess the situation for your machine and make the changes accordingly in /etc/security/limits.

Offline

#16 2007-07-02 01:19:58

normc
Member
From: Ottawa, Canada
Registered: 2004-06-28
Posts: 277
Website

Re: Why no forkbomb protection?

When I tried it all I get is

bash: fork: Resource temporarily unavailable

It does this for a while (couple of minutes) then stops. Any thing else I'm running keeps working.


Norm

Offline

#17 2007-07-02 07:28:24

raul_nds
Member
From: Lisbon, Portugal
Registered: 2007-06-28
Posts: 258

Re: Why no forkbomb protection?

Lol. I didn't even know about this. When I wanted to do fork bombs I just wrote a program in C =\ I guess this is the kind of things that it should be up to the user. Every process is a fork of some other. I once wrote a project for college that had an insane ammount of forks, but without crashing the computer, so I guess there really isn't a good number to choose as a limit.

Offline

#18 2007-07-02 09:06:32

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: Why no forkbomb protection?

normc wrote:

When I tried it all I get is

bash: fork: Resource temporarily unavailable

It does this for a while (couple of minutes) then stops. Any thing else I'm running keeps working.

That's what bash does here too, but perl is naughtier...

Offline

Board footer

Powered by FluxBB