Latest / CyberCode Academy / Course 14 - Wi-Fi Pentesting | Episode 5: WEP Cracking: Packet Injection and Replay Attacks (ARP, Chopchop, Fragmentation, and SKA)
Transcript
- 0:00Speaker 1: Imagine for a moment that you're trying to pick a
- 0:02Speaker 1: lock on a security vault, let's say WP encrypted network,
- 0:06Speaker 1: But the.
- 0:07Speaker 2: Entire place is silent, right nobody's home exactly.
- 0:10Speaker 1: There's no traffic flowing, no data being sent. The network
- 0:14Speaker 1: is completely idle. Now, to crack the key, you need
- 0:18Speaker 1: a massive amount of evidence, specifically something called initialization vectors.
- 0:22Speaker 2: Or ivs, And if the network is dormant, you could
- 0:24Speaker 2: be waiting for days or even weeks for enough data
- 0:28Speaker 2: to just naturally appear.
- 0:30Speaker 1: And that's the whole problem, isn't it.
- 0:31Speaker 2: That waiting game really highlights the fundamental challenge of cracking
- 0:35Speaker 2: WP or wired equivalent privacy in these low traffic environments.
- 0:40Speaker 2: WEP relies on a statistical analysis of a huge volume
- 0:43Speaker 2: of these ivs to figure out the key.
- 0:45Speaker 1: So in a busy office or an active home network,
- 0:48Speaker 1: the data is just flying by.
- 0:50Speaker 2: And the key might be cracked in minutes. But the
- 0:52Speaker 2: moment you find an idle network, any kind of passive
- 0:55Speaker 2: cracking attempt just stalls out completely.
- 0:57Speaker 1: So our mission in this deep dive is to to
- 1:00Speaker 1: bypass that constraint. We need a technical.
- 1:02Speaker 2: Solution packet injection.
- 1:04Speaker 1: Exactly, we are going to explore some advanced, pretty low
- 1:08Speaker 1: level techniques that are used to force the router, the
- 1:11Speaker 1: access point to generate those new necessary IV data packets
- 1:17Speaker 1: at lightning speed.
- 1:18Speaker 2: We're basically learning how to manufacture the evidence we need
- 1:22Speaker 2: to reveal the key, even on the quietest networks, just
- 1:25Speaker 2: by exploiting some very specific weaknesses in the WEP protocol.
- 1:30Speaker 1: And these techniques are I mean, they're foundational for anyone
- 1:33Speaker 1: really trying to understand network security from the ground up right.
- 1:36Speaker 2: Oh, absolutely. We're looking at how to exploit the underlying
- 1:39Speaker 2: structure of critical network communications, like the Address Resolution Protocol
- 1:43Speaker 2: or ARP, to create this rapid, continuous feedback loop. The
- 1:47Speaker 2: ultimate goal is, well, it's elegantly simple.
- 1:50Speaker 1: Maximize the speed.
- 1:51Speaker 2: Maximize the speed at which the target generates new useful
- 1:54Speaker 2: packets that contain new ivs.
- 1:55Speaker 1: Okay, let's umpact this with you said, the workhourse of
- 1:58Speaker 1: packet injection, the request replay attack, that's.
- 2:01Speaker 2: The one the most reliable.
- 2:03Speaker 1: So before we get into the attack itself, we probably
- 2:06Speaker 1: need to understand what an ARP packet even is. For
- 2:09Speaker 1: anyone new to networking, you can think of an ARP
- 2:12Speaker 1: packet as as the way devices figure out who has
- 2:17Speaker 1: which IP address on a local network.
- 2:19Speaker 2: It's like shouting, hey, who is one ninety two point
- 2:21Speaker 2: one sixty eight point one point fifty and then waiting
- 2:24Speaker 2: for a reply.
- 2:25Speaker 1: And this specific type of communication is the key target
- 2:28Speaker 1: here because of how routers handle it.
- 2:30Speaker 2: And the core concept of the replay attack is surprisingly straightforward.
- 2:33Speaker 2: There is a prerequisite, though, Okay, the attacking machine must
- 2:36Speaker 2: first successfully associate or authenticate with the target network. This
- 2:41Speaker 2: is crucial. If the access point ignores you, the injection
- 2:44Speaker 2: just won't work.
- 2:45Speaker 1: Got it. So once you're associated, what's next?
- 2:48Speaker 2: You wait for any legitimate ARP packet to be transmitted.
- 2:51Speaker 2: You capture that single packet, and then instantly you retransmit
- 2:55Speaker 2: a copy of it right back into the network traffic.
- 2:57Speaker 1: So why why does retransmitting that one AR packet force
- 3:01Speaker 1: a new IV? That mechanism seems like the critical piece
- 3:04Speaker 1: of the puzzle. I mean, why doesn't the router just
- 3:05Speaker 1: ignore the duplicate.
- 3:07Speaker 2: And that that's the real beauty of the exploit WEP
- 3:10Speaker 2: by design, it just it doesn't have any kind of
- 3:13Speaker 2: replay protection built in, no protection at all.
- 3:15Speaker 1: None.
- 3:16Speaker 2: The router gets the retransmitted ARP request and sees it
- 3:19Speaker 2: as a legitimate request, it's forced to generate a response packet,
- 3:23Speaker 2: and every single response packet it generates has to be
- 3:26Speaker 2: encrypted with a brand new initialization vector. So by replaying
- 3:30Speaker 2: it over and over, over and over hundreds of times
- 3:32Speaker 2: per second, you create a data injection loop that rapidly
- 3:35Speaker 2: floods the target with useful ivs.
- 3:37Speaker 1: That sounds incredibly efficient. It relies entirely on the router
- 3:41Speaker 1: being obligated to respond and WEP being stateless enough to
- 3:45Speaker 1: not even check if you just saw that exact same
- 3:47Speaker 1: packet a millisecond ago.
- 3:49Speaker 2: It's the most reliable injection method precisely because it targets
- 3:52Speaker 2: a common required network function. It ramps up the data
- 3:56Speaker 2: collections so fast. In practical testing against a twenty eight
- 4:00Speaker 2: bit key, which is the longest WEP key, the encryption
- 4:04Speaker 2: was cracked after gathering only around forty seven thousand data packets,
- 4:08Speaker 2: and on.
- 4:08Speaker 1: An idle network you might get zero in that time,
- 4:10Speaker 1: So forty seven thousand in a few minutes is well.
- 4:12Speaker 2: It's game change, a total game changer.
- 4:14Speaker 1: But networks can be stubborn. What if the standard ARP
- 4:18Speaker 1: replay isn't fast enough, maybe because of a week signal
- 4:21Speaker 1: or packet errors. This is where we need alternatives.
- 4:24Speaker 2: Right exactly, And this is where we get into some
- 4:26Speaker 2: more advanced techniques that don't just replay the entire packet.
- 4:29Speaker 1: The chop chop and the fragmentation attacks.
- 4:31Speaker 2: That's right. The chop chop attack takes a step back.
- 4:33Speaker 2: It focuses on decryption before injection. Instead of just reinjecting
- 4:37Speaker 2: the captured ARP packet, this method tries to determine the
- 4:41Speaker 2: keystream of that packet first.
- 4:43Speaker 1: Okay, define keystream for us simply is that the sequence
- 4:47Speaker 1: of random bites that WEP mixes with the actual data
- 4:50Speaker 1: to encrypt it.
- 4:51Speaker 2: That's precisely right. WEP uses a key stream generated from
- 4:54Speaker 2: the IV and the static key which gets XR with
- 4:57Speaker 2: the plaintext data. The chop chop process is It's essentially
- 5:01Speaker 2: a sophisticated tool that uses known checksums and a lot
- 5:04Speaker 2: of iterative guesses to sort of peel back the layers
- 5:07Speaker 2: of a single captured packet and figure out that keystream.
- 5:10Speaker 1: So you capture one packet, run the tool, get the keystream,
- 5:13Speaker 1: and then what how do you turn that into a
- 5:15Speaker 1: flood of new ivs.
- 5:16Speaker 2: This is the clever bit of packet manipulation. Once enough
- 5:20Speaker 2: of the keystream is determined and testing has shown success
- 5:23Speaker 2: even with only about eighty six percent of it recovered,
- 5:26Speaker 2: we use that key material to construct a completely fake
- 5:29Speaker 2: or forged ARP packet.
- 5:31Speaker 1: Ah, so you're not replaying the original.
- 5:33Speaker 2: Not at all. We're creating a brand new, valid ARP
- 5:37Speaker 2: packet that's correctly encrypted using the pieces we just figured out.
- 5:41Speaker 2: We're leveraging the determined keystream to create an entirely new
- 5:44Speaker 2: packet that the access point will.
- 5:46Speaker 1: Trust I see, and injecting this new forged packet forces
- 5:49Speaker 1: the access point to generate a new response with a
- 5:52Speaker 1: new IV just like the standard ARP replay.
- 5:55Speaker 2: Precisely, and this method is highly efficient against difficult networks.
- 5:59Speaker 2: In successful demos, it required only around twenty three thousand ivs.
- 6:03Speaker 2: That's nearly half the data needed for the basic ARP
- 6:06Speaker 2: replay because the forged packet is often more reliable in
- 6:09Speaker 2: triggering the response.
- 6:10Speaker 1: That's a deep level of manipulation. Okay, let's move to
- 6:12Speaker 1: the fragmentation attack. You said it's conceptually similar to chop
- 6:15Speaker 1: shop capture, determined, forge and checked, but it has a
- 6:18Speaker 1: bigger data requirement upfront, a much bigger one.
- 6:21Speaker 2: The key requirement for the fragmentation attack is obtaining fifteen
- 6:24Speaker 2: hundred bytes of the PRGA or the pseudorandom generation algorithm
- 6:29Speaker 2: output PRGA. To put it simply, the PRGA is the
- 6:32Speaker 2: actual stream of pseudorandom key bits that WEP uses for
- 6:36Speaker 2: the encryption process. Once you have fifteen hundred bytes this stream,
- 6:40Speaker 2: you essentially have a reusable template.
- 6:42Speaker 1: Why that's specific number, fifteen hundred bytes? And what does
- 6:46Speaker 1: having that much let you do?
- 6:47Speaker 2: That size is significant because it's the maximum transmission unit,
- 6:51Speaker 2: the largest standard size of a packet on an ethernet network.
- 6:54Speaker 2: Once you have fifteen hundred bytes of the PRGA, you
- 6:57Speaker 2: can encrypt any subsequent packet you want up to that
- 6:59Speaker 2: maximum size. You're not guessing anymore. You can create arbitrary,
- 7:03Speaker 2: perfectly formed packets at will, so.
- 7:05Speaker 1: You're much closer to having the full encrusion capability, at
- 7:08Speaker 1: least temporarily. But I'm guessing many fifteen hundred bytes means
- 7:11Speaker 1: you need a really strong clear signal.
- 7:14Speaker 2: That is the critical trade off. This method absolutely requires
- 7:17Speaker 2: excellent signal strength and proximity to the target. The payoff, though,
- 7:20Speaker 2: is massive.
- 7:21Speaker 1: I'll mass.
- 7:22Speaker 2: Once you get those fifteen hundred bytes of PRGA, the
- 7:25Speaker 2: injection rate of the fragmentation attack is much much quicker
- 7:28Speaker 2: than even chop shop. We're talking about generating around four
- 7:32Speaker 2: hundred packets per second and successful demonstration the four hundred
- 7:35Speaker 2: a second. So once that initial data is collected, the
- 7:38Speaker 2: final key can be cracked almost instantly.
- 7:40Speaker 1: Okay, so now we have three powerful methods, the robust
- 7:43Speaker 1: AARP replay, the deeper chop chop attack, and the super
- 7:47Speaker 1: quick but signal dependent fragmentation attack. This brings up an
- 7:51Speaker 1: important question what happens if the network uses a rarely
- 7:54Speaker 1: seen but fundamentally different setup called shared key authentication or SKA.
- 8:00Speaker 2: This is a fascinating edge case because it completely changes
- 8:03Speaker 2: the starting line. How So, in open authentication, which is
- 8:06Speaker 2: the default, the router lets anyone associate with it first,
- 8:09Speaker 2: then it checks the password. SKA is much stricter. It
- 8:12Speaker 2: prevents association entirely unless the attacker can first correctly encrypt
- 8:16Speaker 2: a specific challenge phrase using the shared key.
- 8:19Speaker 1: And if the router prevents association, then the attacking machine
- 8:23Speaker 1: is an outsider, which means the first three injection methods
- 8:26Speaker 1: we talked about, which all rely on being associated, would fail.
- 8:29Speaker 2: Initially, yes, it feels like a complete roadblock.
- 8:32Speaker 1: But there's a workaround.
- 8:33Speaker 2: There is, and it's an elegant one that sort of
- 8:35Speaker 2: exploits the social layer of the network. The condition that
- 8:39Speaker 2: makes it possible is simple. SKA networks must have at
- 8:43Speaker 2: least one already connected client for the network to even function,
- 8:46Speaker 2: So you.
- 8:47Speaker 1: Exploit the presence of a legitimate, trusted user to sneak
- 8:50Speaker 1: your own packets in. How does that change the ARP
- 8:53Speaker 1: replay attack?
- 8:54Speaker 2: We perform a modified ARP replay. Instead of trying to
- 8:58Speaker 2: fape authenticate ourselves, which we know will fail against SKA,
- 9:01Speaker 2: we just observe the network and we identify the MA
- 9:04Speaker 2: address of an existing connected client. We then craft our
- 9:08Speaker 2: injected ARP replay packets using that legitimate MAAS address as
- 9:12Speaker 2: the source address.
- 9:13Speaker 1: Wait, so why does using the client's MAC address suddenly
- 9:16Speaker 1: make the injection work. It sounds like we're just relying
- 9:19Speaker 1: on the access points. What's basic trust model?
- 9:22Speaker 2: That's exactly what we're doing. We are exploiting a fundamental
- 9:25Speaker 2: trust issue since WEP isn't performing robust session management. The
- 9:29Speaker 2: injected packet just appears to the router as if it's
- 9:32Speaker 2: coming from a legitimate, already authenticated user.
- 9:34Speaker 1: It just sees a packet from a trusted MC in
- 9:36Speaker 1: processes it.
- 9:37Speaker 2: It sees a packet from a trusted MAA address and
- 9:39Speaker 2: processes it as part of the normal traffic flow, triggering
- 9:43Speaker 2: the required response and generating a new IV.
- 9:45Speaker 1: That's a perfect demonstration of exploiting protocol trust to bypass
- 9:48Speaker 1: a strict authentication rule. It avoids the SKA check entirely
- 9:52Speaker 1: as long as there's a client.
- 9:53Speaker 2: And this modified ARP replay is highly effective. It brings
- 9:57Speaker 2: the power and speed of the AIRP method to bear Again,
- 10:00Speaker 2: both standard WP and the rare SKA configuration. The outcome
- 10:04Speaker 2: is the same rapid data increase and a cracked key.
- 10:08Speaker 1: So what does this all mean for us? We've dissected
- 10:10Speaker 1: four distinct tactics to overcome the huge constraint of low
- 10:13Speaker 1: network traffic in WP cracking, the reliable AIRP replay, the
- 10:17Speaker 1: keystream based chop chop attack, the extremely quick fragmentation attack,
- 10:22Speaker 1: and finally, the client dependent method for SKA networks.
- 10:25Speaker 2: And the common thread across all of them is the
- 10:28Speaker 2: principle of forcing the access point to generate data through
- 10:31Speaker 2: packet injection and strategic packet forging. They all revealed that
- 10:36Speaker 2: core architectural weakness in wep's design around ivs and the
- 10:40Speaker 2: lack of any real replay protection.
- 10:42Speaker 1: And while WEP is thankfully obsolete and almost all modern contexts,
- 10:47Speaker 1: understanding these low level packet manipulation techniques is still essential
- 10:52Speaker 1: for appreciating the progress we've made in modern security. You
- 10:54Speaker 1: see how easy it was to force new reusable ivs
- 10:58Speaker 1: just by replaying traffic.
- 10:59Speaker 2: Absolutely and if we connect this to the bigger picture,
- 11:02Speaker 2: modern protocols like WPA two and WPA three make these
- 11:05Speaker 2: methods basically impossible. Ivs are far longer, they're computationally difficult
- 11:10Speaker 2: to predict, and they change much more frequently and randomly
- 11:13Speaker 2: through complex handshakes. They also include robust countermeasures against these
- 11:16Speaker 2: kinds of simple replay attacks, the.
- 11:18Speaker 1: Direct result of learning from WP's mistakes exactly. Okay, to
- 11:21Speaker 1: wrap this up, we'll leave you with a final thought
- 11:23Speaker 1: to mole over. If a network administrator wanted to detect
- 11:26Speaker 1: these kinds of rapid packet injection attacks, specifically that high
- 11:31Speaker 1: volume ERP replay before the key was cracked, what specific
- 11:34Speaker 1: metric beyond just counting total packets, what they need to
- 11:37Speaker 1: monitor to flag the suspiciously high frequency of identical packet retransmissions,
- 11:41Speaker 1: all coming from a single MSSE address. Think about how
- 11:44Speaker 1: they would distinguish that malicious injection from just legitimate busy
- 11:48Speaker 1: network traffic.