Wednesday, September 08, 2010 03:48:35Login · Register
 

    Challenge Activity
02:59:54 - lacanian
     - Completed basic [13]
02:47:44 - chuiy
     - Completed basic [8]
10:12:24 - blabla
     - Completed basic [2]
10:04:32 - blabla
     - Completed basic [1]
09:22:30 - satishek
     - Completed privilege [4]
09:13:29 - mandrake
     - Completed crack [2]
04:18:55 - Iceheart456
     - Completed decrypt [3]
04:18:28 - InferiorHell
     - Completed decrypt [3]
04:18:12 - Iceheart456
     - Completed decrypt [2]
04:17:02 - Iceheart456
     - Completed decrypt [1]
04:16:34 - InferiorHell
     - Completed decrypt [2]
03:54:07 - InferiorHell
     - Completed decrypt [1]
03:42:18 - InferiorHell
     - Completed basic [4]
03:06:00 - mandrake
     - Completed decrypt [7]
02:54:04 - lacanian
     - Completed basic [12]
02:31:49 - am107cs019
     - Completed decrypt [7]
 

    Scoreboard Top 20
UserPoints
Abhineet4795   
auditorsec4795   
ne0114795   
Null Set4795   
blandyuk4780   
bluechill4750   
Teddy4730   
TurboBorland4475   
Qwexotic4460   
tiiger11114205   
preet4180   
LiquidFusi0n4175   
OnlyHuman4125   
samthg4110   
satishek3900   
pilchdragon3660   
Override3655   
chronic123640   
dash803590   
Torrment3515   
 

    Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
 

    Users Online
· Guests Online: 9

· Members Online: 0

· Members on IRC: 6
TurboBorland, sirEgghead, Satan911, NoX, louve, LK

· Bots Online: 1
GoogleBot

· Total Members: 1,476
· Newest Member: blabla
 

 

 

 

    Top 10 Forum Posters
UserPosts
bluechill915   
Qwexotic692   
cruizrisner476   
Null Set350   
TurboBorland331   
Stormc1nd3r308   
auditorsec299   
madf0x296   
Override238   
jakecrepinsek235   
 

    Affiliates
 

Bruteforcing: There will always be a need.
     
Bruteforcing is something we've learned to take for granted lately. Maybe it's due to the fact that we have so many tools available to brute force passwords for us. Or, maybe we say things like: "Yeah. Bruteforcers are so easy. I'll get around to writing one whenever I feel like it." But then, we never seem to get around to it, and quickly lose focus of why this type of attack is useful for a hacker to learn.

In the real world, I've never been so up to my eyes in the need to crack MD5 hashes, that I've had to use a rainbow table. I'm sure there are scenarios where this could be beneficial. But, for all the purposes I've seen, gaining access to real world systems, involved implementing something custom, on the fly, and off the cuff. Predefined lists of hashed passwords were absolutely no help. And, I found myself coding up simple bruteforcers built around a target specific implementation. Let me give you an example:

Corporate Meatpuppet Jim, is the head peon for the local branch of Big Business Corp LTD (store number 1123), that delivers to you, your never ending supply of useful gadgets. But Jim is just the figurehead, and not the person you see handing you gadgets every week. In fact, you've never even met Jim. Instead, you've become friends with Bill, the guy that drives the truck for Big Business Corp. Bill is a friendly, down to Earth, nine-to-fiver, that's always willing to tell you the kind of crap he's going through at work. It seems there's always some sort of drama going on in the corporate world, and he always has a fresh load of gossip to give. But, they don't treat Bill well at all, and he knows something doesn't look too bright in his future. But, the ties are tied too tight at BBCLTD, and they won't even give Bill a clue whether or not he should be looking for another job. His family could really use that information.

One day, curiosity bites you, and you decide to take the information Bill has given you, and see what's happening at Big Business Corp for yourself. It dawns on you, "Hey! They let school children take tours of the facility on field trips, why wouldn't they allow one of their best customers to come down and take a look as well?" Long story short, you find yourself in Jim's office, talking about lame and contrived corporate BS, that seems to be going in one ear and out the other, when you stumble across some interesting information. It turns out, that Jim is a forgetful guy, and likes to write things down on sticky notes he posts haphardly around the walls of his office. So, as he's filling your deaf ears with useless corporate garbage, you're looking around ... "trying to get a feel for the place" ... when you see, in big bold print:


Big Business Corp LTD - Primary Teleconferencing Hub
1-800-555-1234
user id = 1123
password = 123456#
alternate user id = 11231123
password = 654321#


Your hacker senses start tingling, and you draw some really good conclusions about this information:

1) - Whatever is being said on that hub is so important they needed to password protect the information.
2) - The user id is based on the store number.
3) - The password is extremely easy to replicate.

Now you start examining the problems.

1) - Jim's password may be old, and may have changed.
2) - Even if it's not, using the local branch to gain access may not be the wisest move you could make.
3) - That there's no way Cain, Abel, or your good friend John, are going to help you with this.

There's only one solution now, and that's to whip up a quick and dirty bruteforcer to give us passwords for any branch. In this example, we would need a system to attempt different passwords for a given store number, convert those passwords into DTMF tones, and then either continue, or break, based on what kind of response we get from the system designed to log in to the hub. Since this article isn't about changing strings of characters into DTMF tones, I'm going to simply walk you through the things you'll need to know in order to write the bruteforcer.

First thing we need is a way to plug in each possible combination (technically called a permutation). We have a range of valid characters, in this case 0-9, arranged in an array six characters long, giving us 10 ^ 6 possible combination for the result, since our keyspace (0-9) is ten digits wide. That's only one million, which is a hell of a lot better than the astronomical permutations used for some computer passwords. Anyway, there are two ways we can do this. We have an iterative approach, or a recursive approach.

In most cases, we have to resort to a recursive approach, because we simply don't know how long our passwords may be. In this case that's not necessary, so we could use either. There's a lot to be said about using an iterative vs recursive approach when it comes to speed and memory usage. But, in the real world, all of those concerns tend to be theoretical. In any event, I'll show you both methods, so that you're familiar.

For an iterative approach, we simply nest a set of for loops, like so:

Code

int lowChar = (int)'0';
int highChar = (int)'9';

for(int i =  lowChar; i <= highChar; i++)
{
   password[0] = (char)i;
   for(int j = lowChar; j <= highChar; j++)
   {
      password[1] = (char)j;
      for(int k = lowChar; k <= highChar; k++)
      {
         password[2] = (char)k;
         for(int l = lowChar; l <= highChar; l++)
         {
            password[3] = (char)l;
            for(int m = lowChar; m <= highChar; m++)
            {
               password[4] = (char)m;
               for(int n = lowChar; n <= highChar; n++)
               {
                  password[5] = (char)n;
                  password[6] = '#';
                  password[7] = 'a33;';
                  CheckPassword( password );
               }
            }
         }
      }
   }
}





That's a LOT of looping. But that can't really be avoided, even if we use a recursive approach. Iterative approaches are generally faster, but the recursive approach is much more clean, and really only starts to becomes a problem memory wise, when dealing with passwords that are thousands of characters in length. So, a more universal solution might look somthing like this:

Code

int lowChar = (int)'0';
int highChar = (int)'9';

void recurse(int pos, char* password, int length)
{
   int i = 0;

   for(i = lowChar; i <= highChar; ++i)
   {
      password[pos] = (char)i;

      if(pos < (length - 1))
      {
         recurse(pos + 1, password ,length);
      }
      else
      {
         CheckPassword( password );
              }
   }
}

void bruteforce(int length)
{
   char password[length];
   password[length] = 'a33;';
   recurse(0, password, length);
}





In both of the above code examples, the CheckPassword() function is where we would have written the code to convert the password to DTMF tones and monitor the response from the teleconferencing hub. But, this could have been anything, including comparing two MD5 hashes. The function call just makes the code more universal, and much easier to read. Hopefully this all makes sense. ;)

As it turns out, Big Business Corp LTD did have intentions of firing Bill, those sorry bastards. But, thanks to our help, Bill and his family, don't have to worry, since we gave him that bit of information just in time for him to look for a new job. He still comes by every once in a while, but we've since found a better company for our own personal gadget needs.
 
Comments
 
#1 | DTrem13 on 06/21/2010 14:06
Very interesting! Thanks for writing this article Smile
#2 | Pr0t0n on 06/21/2010 18:06
Same here, very interesting.
#3 | OnlyHuman on 06/21/2010 20:35
Thanks for the replies everybody. The story is obviously made up, but this was based on a very real attack vector I discovered. The sticky note thing is real too. I know it's a funny story, but I guess you could say, that the main point of the article, is to open a few eyes to the possibilities available once you understand certain attack methods at a working level. I'm sure, that there are several, not so obvious applications, that exist in your every day life, just like this one. It's all a matter of being able to see them. I hope that message came through well.

Thanks again. And enjoy!
 
 
Post Comment
 
Please Login to Post a Comment.
 
 
Ratings
 
Rating is available to Members only.

Please login or register to vote.

Awesome! Awesome! 100% [1 Vote]
Very Good Very Good 0% [No Votes]
Good Good 0% [No Votes]
Average Average 0% [No Votes]
Poor Poor 0% [No Votes]