Latest / CyberCode Academy / Course 14 - Wi-Fi Pentesting | Episode 6: WPA/WPA2 Cracking Introduction: Exploiting the WPS Vulnerability
Transcript
- 0:00Speaker 1: Welcome back to the Deep Dive. Today, we're going to
- 0:02Speaker 1: get into a really interesting corner of cybersecurity. We're talking
- 0:05Speaker 1: about Wi fi security, and our mission today is to
- 0:09Speaker 1: look at WPA and WPA two, these protocols that were
- 0:15Speaker 1: designed to be pretty much unbreakable, only to find out
- 0:18Speaker 1: that the best way to get around them has nothing
- 0:21Speaker 1: to do with fancy math. It has more to do
- 0:24Speaker 1: with just well, a button.
- 0:26Speaker 2: That's the real irony here. And if you think back
- 0:28Speaker 2: to the older stuff like WEP, oh, WEP was a mess,
- 0:32Speaker 2: a total mess. You could crack that encryption in what
- 0:34Speaker 2: a few minutes. It really didn't matter how much traffic
- 0:36Speaker 2: was on the network. The design was just fundamentally broken.
- 0:39Speaker 1: Exactly the protocol itself was the vulnerability. So when the
- 0:43Speaker 1: industry moved to WPA and then WPA two, they were
- 0:46Speaker 1: really trying to slam those door shut.
- 0:48Speaker 2: They were. This new generation was re engineered from the
- 0:52Speaker 2: ground up to make the core encryption incredibly robust.
- 0:55Speaker 1: And trying to brute force a modern WPA two key,
- 0:58Speaker 1: I mean, that's just not practical.
- 1:00Speaker 2: No, it's designed to be an exercise in futility. If
- 1:03Speaker 2: you have a decent password, say twenty characters mixed case.
- 1:07Speaker 2: You're talking decades to guess it. Even with a ton
- 1:10Speaker 2: of computing power, the crypto is solid, which.
- 1:14Speaker 1: Is why we're not talking about cracking this ih for today.
- 1:16Speaker 1: We're looking for that classic weakest link, that that one
- 1:20Speaker 1: little door that was put there for convenience a feature
- 1:23Speaker 1: a feature, right, and if it's misconfigured, it can just
- 1:26Speaker 1: completely bypass all that high tech security.
- 1:28Speaker 2: It's the classic trade off, isn't it ease of use
- 1:31Speaker 2: versus absolute protection? And we find this all the time
- 1:33Speaker 2: that something designed for a better user experience ends up
- 1:36Speaker 2: creating a vulnerability the original protocol just wasn't built to
- 1:40Speaker 2: defend against.
- 1:40Speaker 1: Okay, so let's unpack this. Our mission is clear. We're
- 1:43Speaker 1: going to establish just how strong WPA and WP two are,
- 1:46Speaker 1: and then we're going to expose this one specific feature
- 1:49Speaker 1: that acts as a loophole to get the key.
- 1:51Speaker 2: Let's do it.
- 1:52Speaker 1: So let's start with that baseline. WPA versus WPA two.
- 1:56Speaker 1: We know they're way better than WAP, but people often
- 1:58Speaker 1: just lumped them together. What's the real technical difference?
- 2:01Speaker 2: Well, structurally they're actually very very similar. They both use
- 2:04Speaker 2: what's called the four way handshake. To exchange keys when
- 2:08Speaker 2: a device connects, and.
- 2:09Speaker 1: That handshake is where the security really comes from.
- 2:11Speaker 2: Precisely, it makes sure the device and the router both
- 2:14Speaker 2: know the password without ever, you know, sending it through
- 2:17Speaker 2: the air. The main difference is in the ciphers they
- 2:20Speaker 2: use to protect the actual data after you're connected.
- 2:23Speaker 1: Okay, so the ongoing encryption right WPA.
- 2:26Speaker 2: The older one, it uses something called TKP Temporal Key
- 2:29Speaker 2: Integrity Protocol TKKP.
- 2:32Speaker 1: That sounds temporary like a transition.
- 2:34Speaker 2: That's exactly what it was. It was a stop gap.
- 2:36Speaker 2: It was designed to run on the old WEP hardware
- 2:39Speaker 2: that was still everywhere at the time. So it was better, sure,
- 2:42Speaker 2: but it had to make some compromises to stay compatible.
- 2:45Speaker 1: So if TKIP was the compromise, what was the upgrade
- 2:48Speaker 1: with WPA two.
- 2:49Speaker 2: WPA two made the full jump to the best standard available,
- 2:52Speaker 2: which is CCMP ZCMP. Yeah, it's a mouthful. It stands
- 2:56Speaker 2: for Countermode with cipher Blockchaining Message Authentication Code Protocol. The
- 3:02Speaker 2: important part is that it's based on as the Advanced
- 3:04Speaker 2: Encryption Standard AES.
- 3:06Speaker 1: Okay, now that's a name I recognize. That's what governments use,
- 3:09Speaker 1: the military it's the real deal.
- 3:11Speaker 2: It's the gold standard. It gives WPA to this incredible
- 3:15Speaker 2: resistance to anyone trying to sniff or tamper with your data.
- 3:19Speaker 1: Okay, So that raises a really important question. If WPA
- 3:21Speaker 1: two uses this military grade AES and WPA uses the
- 3:26Speaker 1: older TQIP, why are the ways to attack them to
- 3:30Speaker 1: get the key basically identical. Where's that shared weakness?
- 3:33Speaker 2: Ah, And that's the critical point, the difference between AES
- 3:36Speaker 2: and TKET that affects the security of your data while
- 3:40Speaker 2: it's in transit. Okay, but the weakness we're targeting today,
- 3:43Speaker 2: it doesn't break that data encryption. It bypasses the whole
- 3:46Speaker 2: key exchange process entirely. So the methods to get the
- 3:49Speaker 2: actual master network password they're the same for both WPA
- 3:52Speaker 2: and WPA two because the underlying framework for setting them
- 3:55Speaker 2: up is the same. If you can get around that framework,
- 3:58Speaker 2: it doesn't matter how strong the encryption is. The key
- 4:00Speaker 2: you get works for both.
- 4:01Speaker 1: That really narrows our focus. We're not attacking the crypto,
- 4:04Speaker 1: we're attacking the framework. So let's talk about that convenience feature,
- 4:08Speaker 1: the one that if it's misconfigured, lets you get the
- 4:11Speaker 1: key without touching the encryption. What is it?
- 4:14Speaker 2: It's called Wi Fi Protected Setup, or as everyone knows it, WPS.
- 4:18Speaker 1: WPS little button on the rater sometimes it has like
- 4:22Speaker 1: a circular arrow icon on it.
- 4:23Speaker 2: That's the one. And it was designed for a very
- 4:26Speaker 2: innocent reason, pure usability. The idea is to help you
- 4:29Speaker 2: connect devices that don't have a keyboard, like a wireless
- 4:32Speaker 2: printer or an old smart TV.
- 4:34Speaker 1: Yeah, it makes it super simple. You press the button
- 4:36Speaker 1: on the router, press it on the printer, and boom,
- 4:38Speaker 1: they're connected, no friction at all.
- 4:40Speaker 2: It's solved a real problem for users. But and here's
- 4:43Speaker 2: the catch that physical button press wasn't the only way
- 4:47Speaker 2: WPS worked. When WPS is active, it opens up this
- 4:50Speaker 2: alternative way to authenticate. Okay, Instead of needing the full long,
- 4:54Speaker 2: complicated WPA key, a device can connect using a simple
- 4:58Speaker 2: numeric code, specifically an eight digit numeric pin.
- 5:03Speaker 1: An eight digit PI in wait a second, hold on,
- 5:06Speaker 1: We just went from a full length alphanumeric special character password,
- 5:10Speaker 1: a cryptographic fortress down to just eight numbers.
- 5:14Speaker 2: Just eight numbers. That is a tiny, tiny search space
- 5:17Speaker 2: in comparison.
- 5:18Speaker 1: It's the single most important detail we're going to talk
- 5:20Speaker 1: about today, isn't it.
- 5:21Speaker 2: Absolutely If an attacker had to guess the full WPA key,
- 5:25Speaker 2: they're looking at trillions and trillions of possibilities, But by
- 5:28Speaker 2: going after the wpspin, suddenly they're only dealing with ten
- 5:34Speaker 2: to the power of eight one hundred million possibilities.
- 5:37Speaker 1: Okay, but one hundred million is still a lot of guesses.
- 5:39Speaker 1: I mean, if a router had any kind of brute
- 5:42Speaker 1: force protection, you know, locking you out after a few
- 5:45Speaker 1: bad attempts, this wouldn't work.
- 5:46Speaker 2: Right, you are one hundred percent correct. If it had
- 5:48Speaker 2: a strong walkout, this would be tough. But here's the
- 5:50Speaker 2: next failure in the design. In many many routers, the
- 5:54Speaker 2: way they check that pin. They don't treat it as
- 5:58Speaker 2: one single eight digit number.
- 6:00Speaker 1: What do you mean?
- 6:00Speaker 2: They split it in half. The router actually checks the
- 6:03Speaker 2: first four digits of the PIM. If those are correct,
- 6:06Speaker 2: then it checks the last four digits, and the eighth digit,
- 6:09Speaker 2: by the way, is just a check sum of the
- 6:10Speaker 2: first seven. So it's predictable.
- 6:12Speaker 1: That is, that's a huge detail. So an attacker doesn't
- 6:14Speaker 1: have to guess the whole eight digit combination at once exactly.
- 6:18Speaker 1: They can check the first four digits on their.
- 6:19Speaker 2: Own, that's right, which completely changes the math. Instead of
- 6:23Speaker 2: checking one hundred million combinations, how many possibilities are there
- 6:28Speaker 2: for just four.
- 6:29Speaker 1: Digits ten thousand ten to the fourth power.
- 6:32Speaker 2: Ten thousand, So an attacker just has to try at
- 6:35Speaker 2: most ten thousand times to find the first half. Once
- 6:39Speaker 2: they have that, they move on to the second half.
- 6:41Speaker 2: And because that last digit is a checksum, there are
- 6:43Speaker 2: only about eleven hundred possibilities for the second part.
- 6:47Speaker 1: So you're telling me the maximum number of guesses is
- 6:49Speaker 1: about ten thousand for the first half, plus another eleven
- 6:52Speaker 1: hundred for the second. We're talking about roughly eleven thousand
- 6:56Speaker 1: attempts total, exactly.
- 6:58Speaker 2: We've gone from there aretical one hundred million guesses down
- 7:02Speaker 2: to just eleven thousand, and that is a number small
- 7:05Speaker 2: enough that you can route force it often in just
- 7:08Speaker 2: a few hours, not years.
- 7:09Speaker 1: That is the AHA moment. The entire security of the
- 7:12Speaker 1: network is undermined because someone decided to check the pin
- 7:16Speaker 1: in two halves. So once the attacker has that eight
- 7:19Speaker 1: digit PN.
- 7:20Speaker 2: What happens Once you have the PI nine, the software
- 7:22Speaker 2: can just use it to ask the router for the
- 7:25Speaker 2: real WPA or WPA two key and the router just
- 7:28Speaker 2: hands it over, So.
- 7:29Speaker 1: You haven't really cracked anything. You've just used a backdoor
- 7:31Speaker 1: that was designed for setting up printers.
- 7:33Speaker 2: You've politely asked for the key and the network gave
- 7:36Speaker 2: it to you. The implementation, not the cipher, was the vulnerability.
- 7:40Speaker 1: That's an amazing example of how easy of use can
- 7:42Speaker 1: create huge risks. But does this work on every WPA
- 7:45Speaker 1: network you might.
- 7:46Speaker 2: See out there, Oh, absolutely not. Know. This only works
- 7:49Speaker 2: if the network is set up in a specific insecure way.
- 7:52Speaker 2: There are two crucial conditions that have to be met.
- 7:54Speaker 1: Okay, let's lay those out. What's condition one?
- 7:56Speaker 2: First, WPS has to be enabled on the router. If
- 8:00Speaker 2: you've gone into your router settings and just turn WPS
- 8:03Speaker 2: off completely, then this entire attack is impossible.
- 8:06Speaker 1: Simple switch, huge impact. What's the second condition?
- 8:10Speaker 2: The network has to be using what we call normal
- 8:12Speaker 2: pion authentication. That's the mode where the router is just
- 8:15Speaker 2: sitting there waiting for any device to try and connect
- 8:19Speaker 2: using that eight digit PI. If it's listening for remote
- 8:22Speaker 2: PAN attempts, the attack works.
- 8:24Speaker 1: So what's the countermeasure? What's the setting that stops the
- 8:27Speaker 1: router from listening for that PI In.
- 8:29Speaker 2: It's a mode called push Button connect or PBC BBC.
- 8:32Speaker 2: If the router is in PBC mode, it will refuse
- 8:34Speaker 2: any PI in attempt any at all, unless someone has
- 8:38Speaker 2: physically pressed the WPS button on the router itself within
- 8:41Speaker 2: the last say two minutes.
- 8:43Speaker 1: So if it's in PBC mode, an attacker trying this
- 8:46Speaker 1: from their car down the street won't get anywhere. The
- 8:49Speaker 1: router just ignores them.
- 8:50Speaker 2: It completely ignores them. Because PBC requires you to be
- 8:52Speaker 2: physically present pressing that button. It turns a remote attack
- 8:56Speaker 2: into a physical one, which makes it basically impossible to
- 8:59Speaker 2: brute force.
- 9:00Speaker 1: That's the ultimate defense. Then, So what about modern routers?
- 9:03Speaker 1: Are they still shipping with this vulnerable PI mode turned on?
- 9:08Speaker 2: Thankfully no, the industry caught onto this vulnerability quite a
- 9:11Speaker 2: while ago. On most modern routers, you'll find WPS is
- 9:15Speaker 2: either turned off by default or the default setting is
- 9:18Speaker 2: the secure PBC mode.
- 9:19Speaker 1: That's good to hear, but I imagine there are still
- 9:21Speaker 1: millions of older routers out there just running in that
- 9:24Speaker 1: insecure mode.
- 9:25Speaker 2: And that's the reality because WPA and WPA two are
- 9:29Speaker 2: so tough to crack. Otherwise, if you're ever testing a
- 9:31Speaker 2: network security, checking for an insecure WPS configuration is always
- 9:37Speaker 2: always step one. If it's active, it is the path
- 9:40Speaker 2: of least resistance to the key.
- 9:42Speaker 1: This has been incredibly clear. The main takeaway here is
- 9:45Speaker 1: that even the strongest security protocols like WPA two can
- 9:49Speaker 1: be totally undermined by a feature that was added just
- 9:52Speaker 1: for convenience. You don't break the encryption, you just walk
- 9:55Speaker 1: around it, exactly.
- 9:56Speaker 2: And if you connect that to the bigger picture, you
- 9:58Speaker 2: see that security today isn't just about how strong your
- 10:01Speaker 2: algorithm is, it's about the entire systems configuration. It raises
- 10:04Speaker 2: a really important design question, which is, when you're building
- 10:07Speaker 2: any system, how do you balance the risk of a
- 10:10Speaker 2: usability future?
- 10:12Speaker 1: Right You're weighing a few minutes of convenience for the
- 10:14Speaker 1: user against a potential system wide failure exactly.
- 10:18Speaker 2: So here's a thought for you to take away. Think
- 10:19Speaker 2: of another piece of technology you use where a quick
- 10:22Speaker 2: connect or a simplified setup feature like say log in
- 10:27Speaker 2: with Google or a one click password button could potentially
- 10:31Speaker 2: open up an unexpected loophole that bypasses an otherwise strong defense.
- 10:35Speaker 1: That's an excellent challenge, a great reminder that you have
- 10:38Speaker 1: to look at the whole system, not just the lock
- 10:40Speaker 1: on the front door. Thank you for walking us through this. This
- 10:43Speaker 1: was fantastic I pleator and thank you our listener for
- 10:46Speaker 1: taking this deep dive with us. We will catch you
- 10:48Speaker 1: on the next one.