Blog

Blog

Usernames Matter More than Passwords

We've all got password policies. In fact, if there's one policy that your company has in the IT Security arena, it's probably a password policy! We require all kinds of things of our users. You have to pick a password that's at least eight characters long, includes upper and lower case, has at least one number or a special character, etc., etc. Even with all of this, there's an enormous vulnerability in our deployed systems that our security personnel tends not to notice. What if I told you that there's a trick that I use when performing penetration tests that always recovers at least five percent of the accounts in the domain without requiring that I capture the password hashes and that can be performed without locking out anyone? If you want the answer, read to the end!

What this technique is based on is a failure to really think through the complete problem of authentication. In fact, most organizations write policy and train users in security awareness about only a part of the authentication equation and this leads to a rather sizable vulnerability that we've probably ignored. The problem is that we're only paying attention to half of the authentication problem.

"What problem?", you ask? The username/password equation. In our policies we tend to put all of our energy, or at least the vast majority, into the selection and protection of a password. To be frank, whatever policy you create for passwords I can promise you that some user somewhere can select a password that completely adheres to your policy yet is obviously an extremely poor password. For example, when we require the standard three out of four (upper, lower, number, special), which seems like a great starting point and which is the standard almost everywhere, I guarantee that you will find users selecting "Password1", which meets all of the requirements. Indeed, if you enable password histories with forced password changes, their next most likely password will be "Password2". You can see where this is going.

(For a demonstration about this issue in Windows domains, take a look at this short video:http://auditcasts.com/screencasts/16-hacking-windows-user-accounts-with-powershell)

In any event, back to the equation. We focus on the password half of the authentication problem, but tend to overlook the sensitivity of the username. If I can discover the most complex password every created but I lack the username for which it is the key that password has no value. In fact, you can turn this problem around in your head for a second. If we kept our usernames secret, we could theoretically tell people our password with no enormous risk of compromise.

I'm sure there's some part of you that fights against the logic of that last sentence. Even if we kept our usernames secret, there's something in us that tells us that passwords still have to be secret. That's fine, but see if you can apply that same logic to the username. What makes it any less sensitive? The real answer is that it is equally sensitive, but because we tend to base them on common schemes (first initial last name, first initial middle initial last name, etc.) we don't view them as sensitive even though they are.

So what can we do with this bit of reasoning? One thing is that we can use it defensively to demonstrate to people why selecting strong passwords matters. Let's take a moment and examine how we could leverage this information if we were a less than honorable employee in an organization.

If we wanted to compromise other accounts in our company, we have everything we need without requiring extra permissions or rights. First of all, we'll want to find out what our password lockout policy is. This is pretty easy to do. If you're somewhat technical, you can easily discover the password lockout policy by querying your local system or examining the group policies that apply to you. Let's assume that accounts lock out after six bad password attempts.

The next thing we need is a list of usernames to attack. Again, this is a simple problem. If we were to imagine a Windows infrastructure, we could use the free Microsoft Admin Pack tools for 2003 or 2000 Server to run DSQuery and DSGet. For instance, we could do something like this:

dsquery user -limit 0 > fdn_users.txt
for /f "skip=1" %%i in (fdn_users.txt) do dsget user %%i -samid >> UserIDs.txt

The first command extracts all of the fully qualified user names from the Active Directory. This, by the way, requires no special rights or permissions in the domain. Any user can extract this data provided that we haven't added access controls to our schema (which is pretty unusual in practice in my experience). The second line uses a simple "for" statement to loop through the results file and to query the actual SAM account name for each user that was discovered. Voila! We now have half of our username/password formula.

What about the other half? Let's take what we know about users and their behavior. That is, we know that regardless of our policies, some users will find a way to pick a poor password. We might start with our example password formula (Password1). Now we're not going to write the script for you to go and recover accounts with, but how difficult would it be to do something like this in a script and use the exit code to test for success?

for /f %%i in (UserIDs.txt) do TryUser.bat %%i

And in a script named TryUser.bat to do something like this (This won't work as is...):

net use \\domain_server\NetworkShare /user:%%1 Password1
if( not successful ) {
net use \\domain_server\NetworkShare /user:%%1 Password2
} else if( not successful ) {
net use \\domain_server\NetworkShare /user:%%1 Password3
} else if( not successful ) {
net use \\domain_server\NetworkShare /user:%%1 Password4
}
}
}

(Some time after writing this I decided that I may as well show you some working code.. Take a look at this video for a demonstration of how to do this in just a few lines of Powershell code:http://auditcasts.com/screencasts/16-hacking-windows-user-accounts-with-powershell)

The only thing actually missing (aside from working code is a test that we were successful that then reports the users with weak passwords. If nothing else, this should serve to illustrate how serious selection of a good password is. It might be worthwhile to include a discussion or demonstration of this type of technique in a security awareness training environment. Of course, the danger is that you might be giving people good ideas of how to attack your own network!

Of course, the real beauty of this type of test (which is an excellent thing to do during a penetration test) is that we never violate the account lockout policy. It also doesn't require us to actually recover the password hashes and break them. Instead, we start with one captured account and leverage that into a family of compromised accounts very quickly. From there, it's really only a matter of time, but we've managed to fly under the radar. Unless someone is watching for multiple password failures from a single system (that don't actually lock out) we won't be discovered.

Even so, it is important that we stop viewing this as simply a password problem but instead we must view it as a complete problem. Both halves of the equation are equally important. Users must learn to protect both and to select passwords that will fail this type of test.

David Hoelzer teaches several full week courses ranging from basic security through to advanced exploitation and penetration testing. For a thorough treatment of this specific issue and a discussion of controls to mitigate this and similar issues, consider attending thefull week course on Advanced System & Network Auditing. More information can be found here: AUD 507 course. AUD 507 gives both auditors and security professionals powerful tools to automate and manage security over time.

4 Comments

Posted September 21, 2011 at 1:12 PM | Permalink | Reply

Craig

Great thoughts here. But the conclusion seems to focus only on user education and awareness.

How can a user be taught to protect their username? If they are easily obtainable from AD, what is a user to do?

Also, many systems now allow password complexity rules such as "no dictionary words." It is easy to add a list of guessable passwords that are not allowed.

Anytime a technical control can be implemented it will be more effective than relying on users to change their behavior.

Posted September 21, 2011 at 4:36 PM | Permalink | Reply

David Hoelzer

Hey Craig-

It's not that I disagree with you entirely, but I think you're overlooking something. You are correct that technical controls are better, but at some point we have to get people to buy in. I don't care what technical control you put in place with regard to user authentication, users will find ways to defeat it.

If you require super strong passwords, I assure you that they will figure out how to pick bad passwords. If you force them to use smart cards, they will store the card with the computer. If we don't educate them as to why it's so important they will fail to buy in. They are ultimately the final control that decides whether or not our information will be disclosed.

Posted September 22, 2011 at 6:31 AM | Permalink | Reply

itauditsecurity

David,
I understand and agree with the user awareness piece, but not sure how a user can protect the username when companies force them to be standard. If you know one, you can figure out any others, so not sure how this applies to insiders.

Also, users have been told they should not use the same password everywhere, especially on the Internet. What they haven't been told is that using the same username on the Internet has the same downside you mentioned. Most users won't do this anymore than they'll use different passwords, but for those more sensitive accounts/sites, it's worthwhile. It also confuses marketers, but this is becoming more difficult as more sites require email accounts as usernames or require a Facebook or other big-name login.

I would go as far to say that user awareness can be better than technical controls. One company I worked in did not get hit by a popular virus because the users were warned and not one of them (not a small company) opened that particular nasty email. We had no technical controls against the virus as our virus vendor website was maxed out, so I could not download the update to stop that virus. Talk about a human firewall....

Posted September 22, 2011 at 6:42 AM | Permalink | Reply

David Hoelzer

Absolutely! You've hit the nail on the head.

There's almost nothing that users can do to protect the account logon ID... This makes the passwords even more critical, which is sort of the point. Users can always find ways to select bad passwords.

There are a couple of "right" answers to this, in my opinion. The first is, users must truly be aware of why good passwords are so critical (that's what this demo is really about, in a very real sense.) The fix is to stop telling them to create good passwords, which they are really bad at, and teach them to create pass phrases. Honestly, I can type my 23 character passphrase faster than any "strong", random 8 character password I've ever had.

The second is, use multi-factor auth. Some might say that this is is the right answer and tell you to forget about password strength. I disagree. This is a supplement, but just like picking bad passwords, users often defeat the strength of multi-factor auth by storing the token with the computer.

The third is a future solution. When someone figures out how to truly authenticate a user reliably using something other than a password, they will become a billionaire. I don't know what the next authentication solution will be, but we need to find one. Could the answer be implanted RFID with digital certificates? That would sure be strong.. Passwords are really an ancient technology and it's time for us to figure out the right upgrade path!

Post a Comment






* Indicates a required field.