Latest / CyberCode Academy / Course 14 - Wi-Fi Pentesting | Episode 9: WPA/WPA2 Cracking Efficiency: Optimizing Storage, Resumption, and Speed
Transcript
- 0:00Speaker 1: Welcome to the deep dive. Today. We're diving into efficiency
- 0:04Speaker 1: because if you're serious about network security analysis, especially WPA
- 0:08Speaker 1: and WPA two keys, you hit a wall, a giant
- 0:11Speaker 1: wall of numbers.
- 0:12Speaker 2: And that wall is all about size. I mean, for
- 0:14Speaker 2: strong encryption, you need massive word lists. We're not talking
- 0:18Speaker 2: megabytes here, We're talking lists that can easily blow past
- 0:21Speaker 2: say one point seven terabytes.
- 0:23Speaker 1: Wow. Okay, and that's just text data. That's enough to
- 0:26Speaker 1: overwhelm most standard hard drives for sure. And that scale
- 0:29Speaker 1: immediately creates two huge problems, right First is just storage.
- 0:34Speaker 1: How do you even keep one point seven terabytes of
- 0:36Speaker 1: passwords if your machine doesn't have the space.
- 0:38Speaker 2: And second, there's time even if you somehow get that list,
- 0:43Speaker 2: checking every single one of those possibilities, well, that takes
- 0:46Speaker 2: an astronomical amount of time.
- 0:47Speaker 1: So that's what we're tackling. We're going to look at
- 0:49Speaker 1: ways to get around needing disk storage at all, and
- 0:52Speaker 1: then how to take a process that could take hours,
- 0:55Speaker 1: maybe days, and shrink it down to just seconds exactly.
- 0:57Speaker 2: It's all about changing the workflow and changing where the
- 1:01Speaker 2: actual heavy lifting gets done.
- 1:03Speaker 1: Okay, let's unpack that. If storing one point seven terabytes
- 1:07Speaker 1: is off the table. We have to generate this massive
- 1:10Speaker 1: list without ever saving it. How does that even work?
- 1:14Speaker 2: We start with a tool called Crunch. It's really powerful
- 1:18Speaker 2: and it's built for one thing, generating every possible combination
- 1:22Speaker 2: of characters based on rules.
- 1:24Speaker 1: You set things like length, what characters to use, that
- 1:27Speaker 1: sort of thing exactly.
- 1:28Speaker 2: So normally you'd tell Crunch your rules and then use
- 1:30Speaker 2: the photo flag to name your output file. And that's
- 1:33Speaker 2: where you get that one point seven terrible monster file.
- 1:36Speaker 1: We were talking about the file we can't say.
- 1:38Speaker 2: The file we can't say. So the solution is actually, well,
- 1:41Speaker 2: it's surprisingly simple. You just leave out the file part entirely.
- 1:44Speaker 1: You just don't tell it where to save. So what
- 1:46Speaker 1: happens then? Does it just disappear?
- 1:48Speaker 2: It defaults to what's called standard output. It just starts
- 1:51Speaker 2: printing the words directly to your screen, one after the other,
- 1:54Speaker 2: scrolling by in real time. It's just a stream of data.
- 1:57Speaker 1: Okay, so the stream exists. Now how do we at
- 2:00Speaker 1: that stream? From Crunch over to our cracking tool air cracking.
- 2:04Speaker 1: It sounds like we need some kind of virtual plumbing.
- 2:06Speaker 2: That is a perfect analogy. We use the pipe character,
- 2:09Speaker 2: you know, the vertical line symbol. It's a basic feature
- 2:12Speaker 2: of the command line that acts like a conveyor belt.
- 2:14Speaker 1: Ah. So it takes the output from one command yep.
- 2:17Speaker 2: It takes that endless stream of passwords from crunch and
- 2:20Speaker 2: feeds it directly into the input of the next command,
- 2:22Speaker 2: which is air cracking.
- 2:24Speaker 1: So the passwords are being generated and then immediately used up.
- 2:27Speaker 1: They never build up in.
- 2:28Speaker 2: A file and that completely solves the storage problem.
- 2:30Speaker 1: So what does that full command look like.
- 2:32Speaker 2: It would look something like crunch eight eight, then the
- 2:36Speaker 2: pipe character, then air cracking dash, BBSSID dash a W
- 2:41Speaker 2: handshake file.
- 2:42Speaker 1: Okay, let's break that down. The tasha W flag is
- 2:45Speaker 1: for the BSSID the MC address of the router. But
- 2:48Speaker 1: the really clever bit here is the wuse right.
- 2:51Speaker 2: That's the key. The W tells aircracking to expect a
- 2:55Speaker 2: word list, but the single dash right after it is
- 2:57Speaker 2: the magic. It tells air cracking don't look for a file,
- 3:01Speaker 2: read your words from standard input from the pipe from
- 3:04Speaker 2: the pipe. It's the handshake between the two tools.
- 3:06Speaker 1: That's incredibly elegant. But you mentioned huge multi day lists.
- 3:11Speaker 1: If my system crashes two days in, I've lost all
- 3:14Speaker 1: that progress. And have to start from scratch.
- 3:17Speaker 2: And that is the big drawback of a simple pipe.
- 3:19Speaker 2: There's no session management. To solve that, we need to
- 3:22Speaker 2: add another tool into the middle of our pipeline.
- 3:25Speaker 1: And that tool is John the Ripper.
- 3:27Speaker 2: Yes, but we're not using it for cracking here. Its
- 3:29Speaker 2: job is purely administrative. It's like a traffic cop or
- 3:32Speaker 2: a smart bookmarking system.
- 3:35Speaker 1: So it sits in the middle and just keeps track
- 3:37Speaker 1: of our progress.
- 3:38Speaker 2: Precisely. It gets the stream from Crunch, it notes every
- 3:41Speaker 2: word that passes through, and then it passes that word
- 3:43Speaker 2: along to air cracking. If you stop, John remembers exactly
- 3:47Speaker 2: where you were.
- 3:47Speaker 1: So now we have a three part pipeline. Crunch generates
- 3:50Speaker 1: the words.
- 3:51Speaker 2: Pipes them to John the Ripper. John is set to
- 3:53Speaker 2: read from standard input that's the stridden flag, and you
- 3:57Speaker 2: give it a session name like session Session.
- 3:59Speaker 1: One, and then John outputs the words.
- 4:00Speaker 2: Again correct using the stirtout flag, and that second pipe
- 4:04Speaker 2: sends John's output straight to air Cracking, which is still
- 4:07Speaker 2: waiting with its sto command.
- 4:08Speaker 1: So if you have to stop, you just stop it
- 4:11Speaker 1: and to.
- 4:11Speaker 2: Resume you run a new command John restore Session one,
- 4:15Speaker 2: and John is smart it remembers the billions of words
- 4:17Speaker 2: you've already checked. It doesn't start over.
- 4:20Speaker 1: It just picks up where it left off.
- 4:21Speaker 2: It picks up at that exact word, generates only the
- 4:23Speaker 2: rest of the list, and pipes only the new stuff
- 4:25Speaker 2: to air cracking. So now you have zero storage and
- 4:29Speaker 2: full session persistence.
- 4:30Speaker 1: That is a truly optimized workflow. We've solved storage, and
- 4:33Speaker 1: we've solved progress loss, but we still have the issue
- 4:36Speaker 1: of time. And this is where it gets really interesting,
- 4:38Speaker 1: because the bottleneck isn't just the size of the list,
- 4:41Speaker 1: it's the math itself.
- 4:42Speaker 2: Yes, the real time sink is generating something called the
- 4:45Speaker 2: pair wise master key or PMK for every single password.
- 4:50Speaker 2: The system has to combine it with the network's name,
- 4:52Speaker 2: the e SUD using a cryptographic function called PBK two.
- 4:56Speaker 1: And PBK two is designed to be slow, isn't it.
- 4:59Speaker 1: It's not like a simple fast hash.
- 5:01Speaker 2: It's deliberately slow. It stands for password based key derivation
- 5:05Speaker 2: function two, and it forces thousands of rounds of hashing.
- 5:09Speaker 2: It's a security feature to make it slow for an attacker.
- 5:12Speaker 1: So air cracking has to do that expensive calculation for
- 5:15Speaker 1: every single password before it can even test it against
- 5:18Speaker 1: the handshake we capture.
- 5:19Speaker 2: Exactly, and that's where all your time is being spent. Now,
- 5:21Speaker 2: think about a scenario where you're just waiting, waiting to
- 5:25Speaker 2: capture that handshake because no one is using the network.
- 5:28Speaker 1: All that idle time is just being wasted.
- 5:30Speaker 2: It's a massive wasted opportunity. But we can use that
- 5:33Speaker 2: time by.
- 5:34Speaker 1: Pre calculating all of those pmks while we wait. This
- 5:38Speaker 1: sounds a bit like creating a very specific targeted rainbow table.
- 5:42Speaker 2: That's the idea PMK pre computation. We use a subtool
- 5:47Speaker 2: in the air cracking suite called aerolibbing to do all
- 5:50Speaker 2: that heavy lifting ahead of time.
- 5:52Speaker 1: Okay, walk me through it. How do we build this
- 5:54Speaker 1: PMK database?
- 5:56Speaker 2: First you create a database and you import your password
- 5:59Speaker 2: list into it. Command is pretty simple, something like aerolibbing
- 6:02Speaker 2: test to be impart passwords whoop a word list.
- 6:04Speaker 1: So now all the potential passwords are in a structured database.
- 6:07Speaker 2: What's next the network name the ESI. The math needs
- 6:11Speaker 2: that too, So you just echo the name like test
- 6:13Speaker 2: ap into a text file and then you import that
- 6:16Speaker 2: file into the database as well.
- 6:18Speaker 1: So the database has both the passwords and the network name,
- 6:21Speaker 1: and now comes the time consuming part.
- 6:23Speaker 2: Right now, while we're waiting, we run the batch command
- 6:27Speaker 2: ERROLB test to B batch. This tells the tool to
- 6:31Speaker 2: go through every single password, combine it with the e
- 6:33Speaker 2: sid using that slow PBK two function, and store the
- 6:37Speaker 2: final PMK result in the database.
- 6:40Speaker 1: And how long does that take?
- 6:41Speaker 2: In a test we ran, it took about three hundred
- 6:43Speaker 2: and sixty six seconds, so just over six minutes. But
- 6:46Speaker 2: the key is that six minutes we spent waiting anyway,
- 6:49Speaker 2: not six minutes after we finally got the handshake and the.
- 6:52Speaker 1: Payoff for that waiting what happens when we finally capture
- 6:55Speaker 1: the handshake file.
- 6:56Speaker 2: The quick crack you run air cracking, but you point
- 6:58Speaker 2: it to the database with the sr flag. In that
- 7:01Speaker 2: same test, the cracking time went from over two minutes
- 7:04Speaker 2: down to less than one second. Less than a second
- 7:06Speaker 2: because all the hard work was already done. It's a
- 7:08Speaker 2: massive operational game.
- 7:09Speaker 1: That's incredible, and we can go even faster. We've optimized
- 7:13Speaker 1: the workflow. But now let's talk about the hardware. How
- 7:16Speaker 1: do we shift this job to the fastest possible processor.
- 7:20Speaker 2: For that, we need to talk about the CPU versus
- 7:22Speaker 2: the GPU, your CTU, the central processing unit is the
- 7:26Speaker 2: general purpose brain. It's great at doing one thing after
- 7:29Speaker 2: another sequentially.
- 7:30Speaker 1: But a GPU, a graphics processing unit, is different.
- 7:34Speaker 2: Totally different architecture. It's designed for massively parallel tasks. Think
- 7:38Speaker 2: about a video game rendering millions of tixels at once.
- 7:42Speaker 2: It's doing thousands of tiny, repetitive calculations simultaneously.
- 7:45Speaker 1: And key cracking is basically the same thing. You're running
- 7:48Speaker 1: the exact same mathematical test, that complex ash function millions
- 7:51Speaker 1: of times, just with a different password input each time.
- 7:54Speaker 2: Exactly. It's a highly repetitive, parallelizable task, which means a
- 7:59Speaker 2: GPU is exponentially faster at it than a CPU.
- 8:02Speaker 1: But air cracking can't use a GPU, can it.
- 8:05Speaker 2: It cannot for raw GPU power, we have to switch
- 8:08Speaker 2: to another tool entirely, a specialized one called hashcat.
- 8:11Speaker 1: Okay, hashcat, What do we need to get that set
- 8:13Speaker 1: up and running?
- 8:14Speaker 2: First thing, you need a good GPU, and critically, you
- 8:17Speaker 2: need the right drivers installed. This is so important that
- 8:20Speaker 2: a lot of people actually run hashcat on Windows just
- 8:22Speaker 2: because the driver installation for graphics cards can be a
- 8:25Speaker 2: bit smoother.
- 8:26Speaker 1: Once that's sorted, I hear there's a file format issue.
- 8:29Speaker 2: That's right, hashtat can't read the standard dot cat file
- 8:32Speaker 2: from aircrack dash ang. You have to convert it into
- 8:35Speaker 2: a dot hd cap x file. There are online tools
- 8:38Speaker 2: for this. You just upload your file and it gives
- 8:39Speaker 2: you back the converted version. It's a necessary little step.
- 8:42Speaker 1: So we have the GPU, the right drivers, the word list,
- 8:45Speaker 1: and the converted handshake file. Let's talk about the command.
- 8:49Speaker 1: What flags does hashcat need.
- 8:50Speaker 2: There are three really important ones. First, you use minus
- 8:54Speaker 2: capital i AI that lists all the processing devices it
- 8:57Speaker 2: can see. It'll show you, for example, device one is
- 9:00Speaker 2: your GPU and device two is your CPO.
- 9:02Speaker 1: Okay, so we know which device is which.
- 9:04Speaker 2: Next, next is the hash type, which is the ash
- 9:07Speaker 2: M flag for mode. Hashcat supports hundreds of hashtypes, so
- 9:10Speaker 2: you look up wppop P two in its list and
- 9:13Speaker 2: that corresponds to the number twenty five hundred.
- 9:15Speaker 1: So mash M twenty five hundred, and then we just
- 9:18Speaker 1: tell it to use the GPU.
- 9:19Speaker 2: Yep, that's the ASHD flag for device. Since the GPU
- 9:22Speaker 2: was device one, we use MASHJAD one. So the whole
- 9:24Speaker 2: command looks like hashcat sixty four dot ExM twenty five
- 9:28Speaker 2: hundred dash D one, followed by your handshake file and
- 9:30Speaker 2: your word list file.
- 9:31Speaker 1: And what's the performance difference we're talking about here? What's
- 9:33Speaker 1: the payoff for all this setup?
- 9:35Speaker 2: It's astronomical. On a decent GPU, Hashcat was able to
- 9:38Speaker 2: check about fourteen million passwords in just over a minute.
- 9:42Speaker 2: It's a speed that a CPU just can't touch.
- 9:44Speaker 1: And does hashcat let you pause and resume?
- 9:47Speaker 2: It does? It has its own built in session management.
- 9:50Speaker 2: You can press P to pause and R to resume,
- 9:53Speaker 2: so you get that incredible speed combined with the persistence
- 9:56Speaker 2: we talked about earlier.
- 9:57Speaker 1: This whole deep dive has really been a master class
- 10:00Speaker 1: in workflow optimization. The solution wasn't just finding a faster machine,
- 10:05Speaker 1: It was about fundamentally changing the methodology to match the hardware.
- 10:09Speaker 2: Absolutely, we've really hit on three core strategies.
- 10:12Speaker 1: First, we use the pipe to generate word lists on
- 10:15Speaker 1: the fly with crunch, which completely eliminated the disk storage problem.
- 10:19Speaker 2: Second, we added persistence to that pipeline by slotting John
- 10:22Speaker 2: the ripper in the middle to manage the session.
- 10:24Speaker 1: And third we achieved maximum speed by offloading the heavy math,
- 10:29Speaker 1: either by pre calculating p and ks during idle time
- 10:32Speaker 1: or just throwing the raw power of a GPU at
- 10:35Speaker 1: the problem with.
- 10:36Speaker 2: Hashcat, and the real takeaway is that you have to
- 10:38Speaker 2: be adaptable. You have to ask where is the bottleneck?
- 10:41Speaker 2: Is it storage? Is it time? Is this a task
- 10:44Speaker 2: that has to be done in order? Or can I
- 10:47Speaker 2: do a million of them at once? The answer tells
- 10:49Speaker 2: you which tool or combination of tools you need.
- 10:53Speaker 1: It really shows the power of chaining tools together. You
- 10:56Speaker 1: don't always need one perfect tool. Sometimes you need a
- 10:58Speaker 1: few specialized ones where together exactly.
- 11:01Speaker 2: So, as a final thought for you to explore, think
- 11:03Speaker 2: about this. We combined Crunch with air cracking, and we
- 11:07Speaker 2: combined Crunch with John knowing that hashcat can also read
- 11:11Speaker 2: from standard input and manage its own sessions. How would
- 11:15Speaker 2: you build the ultimate pipeline? How would you combine the
- 11:17Speaker 2: wordless generation of Crunch directly with the GPU speed of
- 11:21Speaker 2: hashcat so that massive wordless never once touches your hard drive.
- 11:24Speaker 1: We'll leave that challenge with you. Thank you for joining
- 11:27Speaker 1: us on the deep dive.