LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-22-2007, 09:06 AM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
fork bomb (again)


Hi there,
Could anyone please explain me how does the following fork bomb function?

Code:
$0 && $0 &
I now what a fork bomb is but I don't understand that command. So $0 is the name of the script, && is logical AND (1&&1=1 else 0) and & at the end put the command in background.

I don't understand how this could fork child processes.

For those who doesn't know that a fork bomb is (as a concept ) look here: http://en.wikipedia.org/wiki/Fork_bomb


Thanks
 
Old 02-22-2007, 10:57 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
The $0 is a fork of the original process that called it.

This fork in turn calls $0 as a fork of itself.

This next fork calls $0 as a fork of itself as well.

etc...

Of course the && spawns yet another fork chain that way as well so it's doing it twice on each invocation.

Since $0 for each invocation is the same program/script name it's calling multiple copies of the original program/script name.

It's a lot like just typing:
while true
do $0 &
done
 
Old 02-22-2007, 11:03 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,927
Blog Entries: 4

Rep: Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013Reputation: 4013
And for what it's worth, there is usually a limit on the number of processes any one session can spawn.
 
Old 02-22-2007, 01:51 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Correct - Depending on kernel parameters. Unfortunately for monolithic apps one sometimes has to bump up NPROC et al to allow the single admin account of the app to open more than would normally be prudent for a single real user. Once it's wide open for that admin user it's wide open for all users. e.g. if one were running Oracle EBusiness Suite most of the process would be started by a single appl user. That wouldn't prevent someone else from shooting the system in the foot by created some loop that eats up CPU and/or memory by utilizing the same resources over and over.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bomb them from orbit ;) ////// General 2 02-15-2007 02:40 PM
CMOS Bomb? joewee General 3 12-24-2006 02:04 PM
fork bomb namit Linux - Security 4 12-06-2005 05:48 PM
Debian's Fork Bomb Prevention / ULIMIT win32sux Debian 2 03-27-2005 11:57 PM
LINUX is the BOMB 69RocketGC LinuxQuestions.org Member Success Stories 1 01-12-2005 07:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration