Some Linux Distros Found Vulnerable By Default
TuringTest writes "Security Focus carries an article about a security compromise found on several major distros due to bad default settings in the Linux kernel. 'It's a sad day when an ancient fork bomb attack can still take down most of the latest Linux distributions', says the writer. The attack was performed by spawning lots of processes from a normal user shell. Is interesting to note that Debian was not among the distros that fell to the attack. The writer also praises the OpenBSD policy of Secure by Default."
So what would a good limit to the number of processes spawned be?
I mean what can say what is good for everyone?
Saying that if you think the fork bomb is good grep bombs are more fun and particularly good for silincing the mass of Quake 3 players in an undergraduate lab:
'grep foo
Oh hang on did i just discover a new exploit
Sorry, but this article seems pretty retarded to me. Windows is insecure because people can use IE bugs to install scumware that takes over your entire machine... Linux is insecure because ordinary users who are legitimately logged into your machine can fork off as many processes as they want? Huh?
Sure, maybe if you're running a server that allows remote logins, you want to restrict how many processes a user can run. But as a single-user system, I want to be able to run as many processes as I choose, not be restricted by the distribution author's ideas of what's good for me.
I really wonder what kind of Debian installation he runs. Just a couple of weeks ago I had to reboot my Debian box after some experimenting with an obfuscated fork bomb. Won't work again now that I set some ulimits, but they're not there by default.
:(){ :&:;};:
In case anyone is interested, here's the obfuscated fork bomb:
Doesn't OpenBSD still install 'ftpd' by default? Although it is not turned 'on', the fact is it is still on the file system ready for exploit and requires rigoriously patched unless you take steps to remove it. Doesn't this seem like a dubious definition?
I'm all for making special install kernels and distros "out of the box" to be as hardened as possible. I would love see many distros do a "paranoid" configuration. There are plenty of things OpenBSD does right but that does not excuse OpenBSD. Just like Linux and every other operating system out there, they can still strive to do better.
I came up with the idea of a ping/fork DoS attack (mostly as a joke)
:)
In pseudocode:
while (true) {
ping(target)
fork()
}
I seriously thought of posting this to a few script kiddie sites, so the kiddies could crash themselves long before the pinging does any damage
--buddy
Linux users don't know what accounting is yet, because they haven't realised what *BSD is (except maybe that "OpenBSD is really secure, innit, i'm going to use it for a firewall ain't I").
Users use resources. If an admin wants to starve their untrustworthy users of resources, they can (and, if they've a lot of untrustworthy users, its highly recommended), but there is simply no compelling reason why it should be turned on by default.
Athletic Scholarships to universities make as much sense as academic scholarships to sports teams.
... where gentoo had a default kernel
(can we PLEASE not bring genkernel into this? it sucks.)
Karma: Negative (Mostly affected by dorm trolling)
The difference being that a default install of *anything*, except possibly OpenBSD, should be in a situation where there might be users on it that you don't trust completely. For my personal use of linux, all I need is a box that is secure from hackers, not users.
I generally agree with what you're saying, but there should be "some" way for the system to differentiate between useful processes spawning tasks to achieve a computational goal, vs an abhorrent process run amuck. In one formerly well-known OS, each user had a process limit that was something sane. Special users for certain programs needed their process limit raised. This was a per-user setting and "nice" programs always warned when the process limit needed to be exceeded at which time the sysadmin could raise it if appropriate.
If you open up Cygwin on Windows XP, and run:
:(){:|:&};:
it will bring your system to a halut (mine at least).
Currently I've got a 2.8Ghz 512Mb ram, XP SP2.
I couldnt even get into my task manager, I got about 10 virtual memory errors. Then I rebooted and tried with the task manager open. Once the VM graph shot striaght up past 1GB, it stopped refreshing (4 seconds).
sig: Playfully doing something difficult, whether useful or not
Is there a ulimit equivalent for Win32?
Just as an after thought, why don't people run public Windows servers and allow people to login, like Unix shell servers?
Get your own free personal location tracker
And if you are administrating a true multi-user old-style-Unix type server, you should know enough to stop people fork bombing you (i.e. quotas).
:)
*shuffles nervously* So, out of curiousity, for my.. . err... desktop... how do I stop this exactly?
Maybe I'm just biased, because last year, I had a horrible time overcoming some hard-coded limits (on stack size) when trying to run some Fortran code on a SunOS box.
Athletic Scholarships to universities make as much sense as academic scholarships to sports teams.
while [1] do
fubar &
done
Then I did chmod +x fubar, and typed "fubar &"
oops.
The system load started climbing and everyone else on the machine started bitching. I thought it would crash, and went over to the local admin and fessed up. Of course, we were all interested in what would happen. Nobody could get in to kill it, and the processes were spawning so fast that we couldn't catch it. It was taking forever just to log int. But the load leveled off, and it wasn't going to crash. The admin was going to reboot it, but then I said "wait a second!" I went back to my window that was open. Know what I typed?
rm -f fubar
I suppose you could make it more nasty by making the file name create a copy of itself and name it the process id, so that you wouldn't be able to rename it.
cp $0 .$$
./.$$ &
This will leave all the process files laying around, but you could code something to remove them. But this gets the point across.
My beliefs do not require that you agree with them.
AFAIK, no, the TCP/IP stack ISNT in the windows kernal. it is a "network protocol plugin" so to speek, much like IPX/SPX, NetBEUI, etc.
"???@mylinuxbox ~ $ grep foo /dev/zero /dev/zero: Cannot allocate memory"
grep:
I don't think they're killed automatically. They seem to be running out of memory.
Of course, the same thing on my OpenBSD box doesn't run out of memory... Either a the GNU grep has a memory leak or the BSD grep has a check for something (long lines?).
I rarely criticize things I don't care about.
I used to work at a university that gave all students, faculty and staff unix accounts. A CS professor told us a story of a CS student in an operating systems course who wrote a program that forked so much they had to reboot the server. When some of the administration found out why the server had to be unexpectedly rebooted they wanted to punish the student, but thankfully the IT guys were able to save him. He definitely should not have had the ability to write such a program. Of course, after hearing this story everyone tried it, it didn't cause any problems.
Finding other idiots on
put this in notepad, save it as kill.bat then run it
d
:)
cmd
cmd
cmd
cmd
cmd
cmd
cmd
cmd
cmd
cm
cmd
kill.bat
kill.bat
kill.bat
I can drop my ath 2000 512mb system in say oh 10 seconds. Increase the amount of cmd's and kill.bat's for added effect
If I wanted easy I wouldnt be an engineer or a patriot.
The Gentoo discussion thread, with hard and soft resource limit recommendations, is here.
London's finest organic fairtrade coffee
The way that virtual memory is accounted for makes it totally impossible to provide for a "normal user" (e.g. someone running GNOME) and absolutelu prevent exhaustion of system resources on a modest desktop machine. The situation in which the user runs an OpenGL screensaver (colossal VM size due to userspace mapping say 256MB of graphics card) can't be distinguished in this way from the situation in which they allocate 256MB of RAM-backed VM and then strobe through it touching one byte at a time. One is normal usage, the other brings the machine to its knees.
Here's another example... it sounds OK to allow a user to run 24 processes, right? And it sounds OK to allow them to allocate 100MB of memory, right? But that's 2.4GB of memory you just permitted! And there's no way (due to lack of per-page inspection for performance reasons) for the kernel to distinguish if they've really got 2.4GB or if each process is sharing 98% of that memory with the rest.
Machines that are locked down enough to actually _prevent_ (not detect, but prevent) resource exhaustion are usually quite useless. Very few scenarios require you to do this, it's often enough to prevent trivial fork-bombs and put up a big warning saying "We catch you breaking it, we make you pay".
In the past I've been awakened in the dead of night by my IDS'es detecting a fork bomb and it's always been self inflicted - some dumbass^H^H^H^H^H^H^Hmisinformed programmer not understanding why it's important to check the return status of a fork() or set alarms to kill off hung sockets.
I found some earlier kernels ignored RLIMIT_CPU, RLIMIT_RSS, and RLIMIT_NPROC, and setting the CPU and RSS limits in Apache was ineffective. This was in the Red Hat 9 / 2.4.20 kernel days. I have not researched this in a year or so. If all this stuff works now, let me know so I can insert a "ulimit -Hu 10" in future startup scripts as a "courtesy" to inattentive programmers.
Give a man a fish and you have fed him for today. Teach a man to fish, and he'll say "WHERE'S MY FISH, YOU IDIOT?"
For instance, imagine writing a recursive program to calculate the factorial of a number (note: no error checking included, and I'm letting the kth factorial number for k
Now assume that instead of typing (x-1) in the recursive call on the next to last line, the user types (x+1). If the user calls this with x > 2 and you don't have some limit on the number of recursive calls a function can make, this program will never end (unless you exceed the stack limit, which is not a graceful way to exit.) If there is a limit, the program will hit that limit and error, giving the programmer a chance to catch their typo. If the user really was interested in blowing the stack and they have the authority to change the recursion limit, they can do so if they want
Y|
That's what job limits are for. Shameless plug: get jobprc, a GPL'd command-line job creator (written by me) here.
How? I thought by default that you have to be root to change the ulimit (either up or down)I tried the
Easy to modify the "fork bomb" script for Windows.
start cmd
start cmd
start cmd
start cmd
start cmd
start cmd
start cmd
start cmd
start cmd
start kill.bat
start kill.bat
start kill.bat
start kill.bat
start kill.bat
start kill.bat
Try it! My machine has been freezed in about 15 seconds.
There's probably some more obvious ones, if I thought about it a bit.
I guess I wouldn't mind if Fedora came with defauts that stopped a forkbomb on my box, if I was stupid enough to run one ... but if they fucked it up and set it too low I guarantee I'd be very pissed.
ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
I know you meant this as a joke, but it brings up an interesting question: why is SSH enabled by default on most linux distros? As Linux moves toward higher desktop use, does it really make sense to have remote access enabled by default? Surely if you need or use this functionality (as I do), you can determine how to activate it yourself, no?
Namaste
Fail - The OS grinds to a halt and after waiting five minutes, there is no recourse other than cutting power and rebooting.
Pass (one/a) - The OS grinds, but the user can navigate to a feature (console, Control-ESC in KDE, etc) that allows the user to quickly kill the offending process(es).
Pass (one/b) - The OS grinds or not, but regardless automatically kills the offending process. I consider this to be a worse level than the following.
Pass (two) - The OS grinds and automatically offers the user a method to kill the offending process(es). (KDE had something like that at one point. It may still). Sometimes you may want to let it run.
Pass (three) - The OS does not grind and upon approaching resource limits, offers the user an option to shut down the process or let it run.
And finally...
Pass (four) - The OS does not grind and upon approaching resource limits, offers the user an option to increase limits, potentially by moving the process to another machine or allocating more systems to the process. Presumably the migration would be automatic (and transparent) if the resource limits were higher than the local machine.
Obviously, "user" may be a combination of user and admin in certain cases (multi-user machine, accessing other machines off a local cluster, etc).
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien