Password spraying is a credential attack that tests a single password against many user accounts, exploiting common and default passwords to avoid account lockouts. This coverage includes a live demonstration using Hydra and practical defensive guidance for IT and security teams.
Password Spraying Attack
We're going to get into a password spraying attack, and I'll actually show you how to do that. Just a reminder though that this is for ethical hacking purposes only.
Here's an example of password spraying. Notice that the usernames are changing and the passwords are not. So maybe we use one or two or a few different passwords, but the idea behind this is we're testing out a lot of user accounts with just a few passwords here.
With the brute force attack, we were using different passwords. Notice it's counting up sequentially, so we've got 1, 2, 3, 4. That's because we're just trying everything on the same user account. In this case right here, we have the same password that we're trying on different user accounts. So that's the difference between brute force and password spraying. Although some would say that password spraying is a type of brute force attack, because you're sequentially trying many different combinations there.
So using Hydra to do password spraying, what we're going to do is specify a specific password and then use a username file. So we're going to use a bunch of different usernames, put those in a file, and then specify the password. Let's see what this looks like.
What I'm going to do is show you a list. I've got this users.txt, so let's take a look at that users.txt. We'll hit enter, and notice that we've got what looks like a bunch of different usernames in here, so we're going to test out these usernames.
To do that, we will type in our Hydra, and in this case we'll do an uppercase L, and it's users.txt that is the file that we're going to use. And we're going to test it out on just a single password in this case, so capital psrd exclamation point, and then 10.110.40ft. So we'll hit that and we'll get that started.
As you can see, it did find something. We had one valid password here, so B Jones has that password there. One reason why this is so effective is because people do reuse the same passwords, and there are common passwords out there, and so this could be a very effective attack.
I want to give you a common scenario that would be an easy target. At a lot of the companies that I worked with when I first took over the department, they had a default password, a temporary password, that they would set up a lot of accounts with when the users first started. We would set their accounts up, and we'd have this default user temporary password, and then they would use that to log in for the first time until they changed the password.
The problem is that many times those users didn't change the password, or if they were forced to, then they would change it to the same thing. So then what would happen is we'd have a lot of users with this really bad password.
So in this case, what we're going to do is run the same thing, but across the same users, with that temporary password. A lot of times I saw them look like this: temp password. Very basic, and it'd be the initial password they would get. And then we could just run this against that company, and look, we've already found this new employee has that temp password. So now we can be able to hack using that new employee's account.
I think there's a few points that could be made by this. Number one, don't have these weak temporary passwords that you give your users. If you give them a temporary password, make sure that it is complex enough that it follows the principles of a strong password. Otherwise, you're training your users to use weak passwords.
Another thing that I would say with this is that don't have the same temporary password that you hand out to every single user, because essentially what you've done is you've given them the tools to be able to hack other people's accounts. They know as soon as somebody's onboarded that they're going to have that temporary password, at least for a while.
And then number three is, as much as you can, just don't have temporary passwords, period. We really, as IT people, shouldn't know other people's passwords. So if you can avoid it at all, let the end user set their passwords without you ever seeing it.
So here's that attack card on password spraying, that's trying many users with the same password. And here we have the same password, and we're trying lots of users in order to crack these accounts.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →