Wireless, IoT & Mobile Security Exercises
Nineteen exercises across the whole course, in the order of its sections. Most are the short analyses a reviewer does every week: read a frame, a configuration, a log or a manifest, decide, and say what to fix. Try each before opening the answer. Two answers include a program you can edit and run. Everything refers to the course's lab devices and synthetic data.
| # | Exercise | Practises |
|---|---|---|
| 1 | In scope or not? | Radio Law and Scope |
| 2 | Read the RSN element | Frames and PMF |
| 3 | Why WEP failed | From WEP to WPA3 |
| 4 | Which message is this? | The 4-Way Handshake |
| 5 | One passphrase, two SSIDs | Computing PMK, PTK and MIC |
| 6 | Choose a passphrase policy | Offline Guessing |
| 7 | KRACK triage | KRACK |
| 8 | Plan the WPA3 migration | WPA3-SAE, Transition Mode and Dragonblood |
| 9 | Review an Enterprise profile | 802.1X, Evil Twins |
| 10 | Harden the AP | AP Hardening |
| 11 | Classify the survey | Rogue APs and WIDS |
| 12 | Design the pairing | BLE Pairing, BLE Privacy and GATT |
| 13 | Old Bluetooth devices | KNOB, BIAS, BlueBorne |
| 14 | Firmware findings | IoT Threat Model, Firmware Analysis, Debug Ports and Secure Boot |
| 15 | Accept or reject the update | Update Security |
| 16 | The support tool's MQTT grant | MQTT and CoAP, Segmentation |
| 17 | Manifest and plist | Android Manifest, iOS Info.plist |
| 18 | Fix the token handling | Code Flaws, Certificate Pinning |
| 19 | Map and manage | MASVS, Security Models, App Testing, MDM |
Exercise 1: In scope or not?
Your scope lists BSSIDs 02:00:00:0a:0a:01 and …:02 of LabNet, passive survey and connection with supplied credentials allowed. During the survey you see LabNet on 02:00:00:0a:0a:5c, open. A colleague suggests connecting to it "to see what it is". What do you do?
Answer
Don't connect: the BSSID isn't in the scope, whoever owns it. Record what the passive survey shows (time, channel, signal, security, location) and report it to the client as a possible rogue AP or evil twin. The client can then check its wired side or authorise a follow-up.
Exercise 2: Read the RSN element
An RSN element body ends with the AKM list 02 00 | 00 0f ac 02 | 00 0f ac 08 followed by capabilities 80 00. What does the network offer, and what is your finding?
Answer
Two AKMs, PSK (2) and SAE (8): WPA2/WPA3 transition mode. Capabilities 0x0080 (little-endian) set MFPC but not MFPR: PMF capable, not required. Findings: transition mode (downgrade risk for WPA3 clients) and optional PMF; plan WPA3-only with PMF required once the clients allow it.
Exercise 3: Why WEP failed
Name WEP's three design flaws and, for each, the mechanism that replaced it in WPA2.
Answer
(1) 24-bit IVs repeat, so keystreams repeat → CCMP's 48-bit packet number as nonce, with fresh keys per session from the 4-way handshake. (2) CRC-32 as integrity, which is linear → CCMP's keyed CBC-MAC. (3) RC4 keyed with IV + fixed secret leaks the key → AES with session keys derived by the PRF.
Exercise 4: Which message is this?
An EAPOL-Key frame has Key Information 0x13ca, replay counter 2, a non-zero nonce and 56 bytes of key data. Which message is it, and what does the key data contain?
Answer
0x13ca = version 2, Pairwise, Install, Ack, MIC, Secure, Encrypted Key Data: M3 from the AP. The key data is the GTK (and the AP's RSN element) wrapped with the KEK.
Exercise 5: One passphrase, two SSIDs
The office uses the same passphrase on LabNet and LabNet-5G. Do the networks share a PMK? Run the program and explain what it means for an attacker with precomputed tables.
Answer
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
def pmk(passphrase, ssid):
return PBKDF2HMAC(algorithm=hashes.SHA1(), length=32, salt=ssid, iterations=4096).derive(passphrase)
for ssid in (b"LabNet", b"LabNet-5G", b"LabNet"):
print(ssid.decode().ljust(10), pmk(b"correct horse lab staple", ssid).hex()[:32], "...")LabNet 8645fb2441df1bd7775a3790a7c19d6a ...
LabNet-5G 65a499bc1b37c2f3b85a4815c40ffcc2 ...
LabNet 8645fb2441df1bd7775a3790a7c19d6a ...
Different SSIDs give different PMKs, because the SSID is the PBKDF2 salt; the same SSID always gives the same PMK. Precomputed tables only work for a specific SSID, which is why default SSIDs (shared by millions of routers) are worse than unique ones. The shared passphrase is still a single secret for both networks.
Exercise 6: Choose a passphrase policy
A small office must keep WPA2-PSK for an old label printer. Options: (a) LabOffice2026!, (b) 4 Diceware words, (c) 22 generated characters from letters and digits printed on a card in the server cupboard. Which, and what else?
Answer
(c): about 131 bits, far beyond offline guessing; (a) is a pattern guessed in seconds, (b) about 52 bits is too weak for offline attacks. Also: put the printer on its own SSID/VLAN (IoT segment) so the weak protocol protects only the printer, use WPA3 for everything else, enable PMF where possible, and rotate when staff leave.
Exercise 7: KRACK triage
An inventory finds 40 laptops patched in 2024, 12 IP cameras with 2016 firmware and no updates, and 3 Wi-Fi repeaters from 2017. What do you do about KRACK?
Answer
Laptops: nothing beyond normal patching. Cameras: treat their Wi-Fi as unencrypted; move them to an isolated IoT segment with egress only to the recorder, prefer wired connections, plan replacement. Repeaters: they act as Wi-Fi clients and may use 802.11r; check for vendor fixes, otherwise replace. Changing the passphrase doesn't help.
Exercise 8: Plan the WPA3 migration
LabNet has 60 WPA3-capable devices and 8 WPA2-only IoT devices. Write the migration in four steps.
Answer
- Create
LabNet-IoT(WPA2-PSK with a generated passphrase, PMF capable, its own VLAN) and move the 8 devices. 2. SwitchLabNetto transition mode with PMF capable, H2E and Transition Disable, and watch for clients that fail. 3. SwitchLabNetto WPA3-only, PMF required, strong groups only. 4. Push WPA3-only profiles to managed devices and add WIDS alerts forLabNeton WPA2-only BSSIDs (downgrade setups).
Exercise 9: Review an Enterprise profile
A laptop's LabCorp profile: PEAP-MSCHAPv2, "validate server certificate" on, trusted CAs = "all system CAs", no server name, outer identity alice@lab.test. List the findings and the fixed profile.
Answer
Any public CA's certificate for any domain passes, so an evil twin with a cheap certificate collects MSCHAPv2 exchanges; the real username leaks in the outer identity. Fixed: trust only the RADIUS CA, server name radius.lab.test, outer identity anonymous@lab.test, no user prompts, pushed by MDM; better, EAP-TLS with a device certificate.
Exercise 10: Harden the AP
The guest SSID has wpa=3, rsn_pairwise=CCMP TKIP, ieee80211w=0, wps_state=2, ap_isolate=0, and its admin page is reachable from the guest VLAN. Give the findings in order of priority.
Answer
- Admin page reachable from guests (management on the management network only). 2. WPS on (11,000-guess PIN). 3. No client isolation (guests attack each other). 4. WPA1/TKIP enabled. 5. PMF off. For a guest network, Enhanced Open (OWE) or WPA3-SAE with isolation and Internet-only access.
Exercise 11: Classify the survey
Sensor s4 hears: LabCorp on a known BSSID but now on channel 1 instead of 44; LabNet on an unknown BSSID, SAE+PSK, −38 dBm; Printer-Direct-5a on a BSSID next to a MAC seen on switch port 3/7. Classify each.
Answer
Known AP with changed settings (check change records: a reset or misconfiguration); evil-twin suspect (our SSID, unknown BSSID, very strong signal: close to s4); rogue AP on the wired side (a printer's Wi-Fi Direct bridging into the LAN: disable Wi-Fi Direct on the printer or move it to the IoT segment).
Exercise 12: Design the pairing
A new LabHome door sensor has no display, one button and a QR code on its label. It exposes "armed" (read), "arm/disarm" (write) and "battery" (read). Design pairing and GATT permissions.
Answer
LE Secure Connections Only; OOB pairing from the QR code (authenticated), accepted only for one minute after a button press; MITM flag set; "arm/disarm" write = authenticated encryption (plus app-level authorisation for multi-user homes); "armed" read = authenticated; "battery" read = encrypted. LE privacy with RPAs, no serial in advertisements.
Exercise 13: Old Bluetooth devices
A clinic's 2018 Bluetooth barcode scanners accept 1-byte encryption keys and can't be updated. What do you recommend?
Answer
KNOB-vulnerable: a nearby attacker can negotiate a 1-byte key and read scans in real time. Make the hosts enforce a minimum key size (patched OS settings reject short keys), pair only in a controlled area, disable discoverability, limit what the scanners transmit (no patient data in barcodes if possible), and plan replacement. Inventory them as accepted risk until then.
Exercise 14: Firmware findings
A firmware review finds: (a) support:support123 in /etc/shadow, (b) U-Boot with a 3-second boot delay and checksum-only verification, (c) an RSA private key under /etc/ssl/private, (d) a published CRA-style support period of 5 years. Rate and fix each.
Answer
(a) High: plaintext universal password (PSTI/ETSI 5.1 violation); remove the account or use unique per-device credentials. (b) High: interruptible bootloader and no secure boot; boot delay 0, console locked, secure boot with fused keys. (c) Critical if the key is the same in every unit: per-device keys provisioned into protected storage. (d) Not a finding: it meets the PSTI support-period requirement; check that the update mechanism can deliver it.
Exercise 15: Accept or reject the update
The device runs 2.1.0 with rollback floor 2.0.0. Which manifests does a correct client reject, and why? (a) 2.1.1 for the right class, valid signature, image hash matches; (b) 2.0.5, valid signature; (c) 2.2.0 valid signature, image hash differs; (d) 2.2.0, expired metadata.
Answer
(a) install; (b) reject: not newer than 2.1.0 (rollback); (c) reject: the image isn't the signed one; (d) reject: stale metadata (a freeze attack or an old mirror). After (a) installs a security fix, raise the floor to 2.1.1.
Exercise 16: The support tool's MQTT grant
The support tool was given labhome/+/state/# and labhome/hub-07/cmd/+ (for one customer's ticket). Check the grants and say what you would change.
Answer
def matches(filt, topic):
f, t = filt.split("/"), topic.split("/")
for i, part in enumerate(f):
if part == "#": return True
if i >= len(t) or (part != "+" and part != t[i]): return False
return len(f) == len(t)
grants = ["labhome/+/state/#", "labhome/hub-07/cmd/+"] # what the support tool was given
for topic in ("labhome/hub-01/state/power", "labhome/hub-07/cmd/relay", "labhome/hub-01/cmd/relay", "labhome/hub-01/fw/url"):
print(f"{topic:28} {'allowed' if any(matches(g, topic) for g in grants) else 'denied'}")labhome/hub-01/state/power allowed
labhome/hub-07/cmd/relay allowed
labhome/hub-01/cmd/relay denied
labhome/hub-01/fw/url denied
The tool can read every customer's state (all hubs), which is far more than one ticket needs, and its command grant is limited to hub-07 as intended. Fix: grant labhome/hub-07/state/# only, for the ticket's duration, with the tool authenticated by its own client certificate; log its activity.
Exercise 17: Manifest and plist
The Android build has android:allowBackup="true" and an exported ShareReceiver without a permission; the iOS build has NSExceptionDomains → api.lab.test → NSExceptionAllowsInsecureHTTPLoads = true. Fix each.
Answer
allowBackup="false" (or backup rules excluding tokens and keys); ShareReceiver exported="false", or a signature permission if only your apps use it (if it must accept shares from any app, validate its input strictly). Remove the ATS exception and fix the server's TLS; nothing of the app's own API should go over HTTP.
Exercise 18: Fix the token handling
The app stores the refresh token in UserDefaults, logs it at login, and its custom trust manager "pins" but returns early without checking when the pin list is empty. Write the fixes.
Answer
Token in the Keychain with kSecAttrAccessibleWhenUnlockedThisDeviceOnly (Keystore on Android); remove the log line and add a redacting logger; replace the custom trust code with the platform mechanism (NSPinnedDomains / network security config pin-set) on top of normal validation, with a CA pin and a backup pin, and make an empty pin set a build error, not "accept all".
Exercise 19: Map and manage
Map these to MASVS controls and say which can be enforced by MDM on company phones: (a) cleartext API traffic, (b) user-installed CAs, (c) exported activity, (d) devices without a passcode.
Answer
(a) MASVS-NETWORK-1, fixed in the app. (b) MASVS-NETWORK-1/2 in the app (trust only system CAs, pins); MDM can also forbid user CAs on managed devices. (c) MASVS-PLATFORM-1, fixed in the app. (d) a device policy, not an app control; MDM enforces it and conditional access blocks non-compliant devices (an app handling sensitive data can also require a device passcode, MASVS-AUTH-2/STORAGE).
Test yourself
Why do two networks with the same passphrase but different SSIDs have different PMKs?
- The BSSIDs differ
- The SSID is the PBKDF2 salt
- The channels differ
- They don't: the PMKs are equal
Key Information 0x13ca identifies which handshake message?
- M1
- M2
- M3
- M4
Which grant in Exercise 16 was too broad?
- labhome/hub-07/cmd/+
- labhome/+/state/#
- Both
- Neither
What is the best pairing method for a display-less sensor with a QR code?
- Just Works
- Legacy Passkey Entry
- Out of Band from the QR code, with LE Secure Connections
- No pairing