> For the complete documentation index, see [llms.txt](https://ret2basic.gitbook.io/ctfnote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ret2basic.gitbook.io/ctfnote/red-teaming/exploitation/password-spray.md).

# Password Spray

## What is Password Spray?

Rather than the usual dictionary brute force methods involving a dictionary of hundreds if not millions of password entries, the idea of **password spray** is to reverse the process: introduce a list of **as many users as possible**, while trying just **a single password** attempt against tens or hundreds of user accounts.

## Username Enumeration

Here is a username list example:

<https://github.com/insidetrust/statistically-likely-usernames>

We can enumerate usernames using SMTP `VRFY` method:

```shell
head -n 50 john.txt > users.txt
smtp-user-enum -M VRFY -U users.txt -t $IP
```

This is same as the Metasploit module `auxiliary/scanner/smtp/smtp_enum` .

## Password Selection

Now that we have validated some users, we should determine **one** (recommended) or two (maximum) commonly-used passwords we can use for our attack.

Regarding commonly used passwords, real-world experience has shown that one of the most commonly used passwords are usually found to be the **current season**, along with the current year, e.g., **Spring2022**.

Another very common password is **"CompanyName"** along with a numerical value, e.g., **FooCorp01**, **FooCorp02**, etc.

## SSH Password Spray

Spray a single server:

```shell
hydra -L users.txt -p <password> ssh://$IP -t 4
```

Spray multiple servers:

```shell
hydra -l <username> -p <password> -M ssh_servers.txt ssh -t 4
```

{% hint style="danger" %}
When bruteforcing SSH, always use **4 threads**. This is because >= 4 threads may get caught by defense mechanism.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ret2basic.gitbook.io/ctfnote/red-teaming/exploitation/password-spray.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
