> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/web/authentication/username-enumeration-via-response-timing.md).

# Enumeração de Nomes de Usuário via Tempo de Resposta

### Enumeração de nome de usuário via tempo de resposta

Este laboratório é vulnerável à enumeração de nome de usuário com base no tempo de resposta. Para resolvê-lo, você precisa identificar um nome de usuário válido, realizar um ataque de força bruta à sua senha e, em seguida, acessar a página da sua conta.

```bash
Suas credenciais: wiener:peter
```

### **Análise Inicial**

Ao testar uma grande quantidade de senhas, o aplicativo exibe uma mensagem de erro indicando que um número excessivo de tentativas foi detectado.

<figure><img src="/files/b64fda7ce7dcca12090de12f0d2b79cf8c4f27da" alt="" width="477"><figcaption></figcaption></figure>

Para contornar essa proteção, o seguinte cabeçalho é adicionado:

```bash
X-Forwarded-For: 127.0.0.2
```

### **Medição do Tempo de Resposta**

Envie uma solicitação com um **senha** para o usuário `wiener`:

{% code overflow="wrap" %}

```bash
username=wiener&password=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
```

{% endcode %}

Em seguida, observa-se que a resposta leva cerca de **3 segundos** para chegar.

Por outro lado, se a mesma solicitação for enviada com um nome de usuário inválido\*\*, a resposta é **quase instantânea**:

```bash
username=dwdwd&password=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
```

Essa diferença, portanto, torna possível distinguir um válido **nome de usuário** de um inválido.

#### **Lista com o Intruder**

No Intruder, usamos a **Pitchfork** técnica.

* Primeira posição: lista de **nomes de usuário** a serem testados

<figure><img src="/files/4360f259f9a65fb30db2c3c3a1f5f34fcb33b974" alt=""><figcaption></figcaption></figure>

Segunda posição: lista de **diferentes endereços IP** enviados para `X-Forwarded-For`

<figure><img src="/files/f45d4693fb74c459911bcc1863a8e937de97431a" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/6cf354b2a3e14e20f6c83fb9b17ce49ca8b0d073" alt=""><figcaption></figcaption></figure>

O campo **resposta concluída** é analisado:

Respostas associadas a um usuário válido têm um tempo significativamente maior (o Apache indica um valor muito maior).

<figure><img src="/files/e58e2c67f2b597f7be8e2d09f2f3ea3a9420102c" alt=""><figcaption></figcaption></figure>

Isso permite identificar o usuário correto.

#### \*\*Força Bruta da Senha\*\*

Após encontrar o nome de usuário válido, você inicia o ataque à sua senha.

<figure><img src="/files/79b98b17304837087341ecfa040be8aa64c60891" alt=""><figcaption></figcaption></figure>

Percebemos que a tentativa com a senha **chelsea** produz uma resposta diferente: um **302 Found**, sinal de que a autenticação foi bem-sucedida.

<figure><img src="/files/bf1390e739bb8d8515689fea6b189aa64d89819f" alt=""><figcaption></figcaption></figure>

O acesso à conta é então confirmado.

<figure><img src="/files/c7505ce7210bbf66dba856e168710cd4db5243e3" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/pt-br/web/authentication/username-enumeration-via-response-timing.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.
