Latest / CyberCode Academy / Course 20 - Malware Analysis: Identifying and Defeating Code Obfuscation | Episode 2: Analyzing and Defeating Obfuscation in VBA
Transcript
- 0:00Speaker 1: Imagine for a moment that it's a standard Tuesday morning.
- 0:03Speaker 1: You've got your coffee, you're going through your inbox and
- 0:05Speaker 1: you see an email. It looks totally mundane, maybe an
- 0:10Speaker 1: invoice from a vendor you actually use, or a shipping
- 0:13Speaker 1: notification for that package you've been waiting for.
- 0:15Speaker 2: Looks legitimate. So you click the attachment, and for just
- 0:18Speaker 2: a split second, you see the little loading curssor spin.
- 0:22Speaker 2: Then the document opens, you see the invoice, and you
- 0:25Speaker 2: just carry on with your day.
- 0:26Speaker 1: But in that split second, something huge happened in the background.
- 0:31Speaker 1: A script executed, a set of instructions just ran on
- 0:35Speaker 1: your machine. Now, if you could freeze time right at
- 0:38Speaker 1: that moment, stop the clock and actually look at the
- 0:41Speaker 1: code that just ran, you might expect to see something obvious.
- 0:45Speaker 1: You know, lines of code that's a steal password or
- 0:47Speaker 1: download virus.
- 0:48Speaker 2: If only it were that simple. You almost never see that.
- 0:52Speaker 1: Instead, if you look at the code, you see well,
- 0:55Speaker 1: absolute gibberish. You see variables named cowkeeper. You see math
- 0:59Speaker 1: equations that calculate numbers for no reason at all. You
- 1:02Speaker 1: see words spelled backward, chopped up and glee back together.
- 1:07Speaker 1: It looks like a cat walked across a developer's keyboard.
- 1:10Speaker 2: This is the world of obfuscation. It's the dark art
- 1:13Speaker 2: of making code unreadable to humans while keeping it perfectly
- 1:17Speaker 2: executable for computers.
- 1:18Speaker 1: And that is exactly what we are decoding today. We're
- 1:21Speaker 1: doing a deep dive into the detective mode of cybersecurity.
- 1:25Speaker 1: We're going to learn how to analyze this obfuscated interpreted code.
- 1:29Speaker 2: Right and our mission today isn't just to read code
- 1:32Speaker 2: for the sake of it. It's to learn how to
- 1:33Speaker 2: cut through all that noise. We need to find the
- 1:36Speaker 2: smoking gun, the URLs, the file paths, the hidden payloads,
- 1:40Speaker 2: without getting tricked by the camouflage.
- 1:42Speaker 1: So let's unpack this camouflage first. The sources we're looking
- 1:46Speaker 1: at make a really clear distinction right out of the
- 1:48Speaker 1: gate between native code and interpreted code. Why does this
- 1:52Speaker 1: distinction matter so much when we're talking about hiding malware.
- 1:55Speaker 2: It's the foundational concept. I mean, if you don't get this,
- 1:58Speaker 2: you won't understand why the bad guys do with the
- 2:00Speaker 2: do native code think of languages like C or C
- 2:03Speaker 2: plus plus SI is compiled. That means a developer writes
- 2:07Speaker 2: the code, runs it through a compiler, and it turns
- 2:10Speaker 2: into machine language ones and zeros.
- 2:12Speaker 1: It's a binary file at that point exactly.
- 2:14Speaker 2: By the time it runs on your computer, it's already
- 2:16Speaker 2: unreadable to a human. You can't just open it in
- 2:18Speaker 2: notepad and read it. You need complex tools just to
- 2:21Speaker 2: make sense of it. But interpreted code like VBA that's
- 2:25Speaker 2: visual Basic for applications used in office docks or PowerShell
- 2:30Speaker 2: is different. It's not a pre baked cake. It's the recipe.
- 2:34Speaker 1: I like that analogy. So native code is the cake
- 2:36Speaker 1: you buy at the store. Interpreted code is the index
- 2:39Speaker 1: card with the instructions on how to bake it.
- 2:41Speaker 2: Precisely, when you run a PowerShell script, the computer is
- 2:44Speaker 2: reading English like text commands line by line in real
- 2:47Speaker 2: time and executing them. And because the computer needs to
- 2:50Speaker 2: read the text to run it, a security analyst can
- 2:53Speaker 2: read that text too.
- 2:54Speaker 1: I see. So if I write a PowerShell script that
- 2:56Speaker 1: says download malaurware from evilsite dot com, the computer understands it,
- 3:01Speaker 1: but so does the IT guy who catches it. It's transparent.
- 3:04Speaker 2: It is transparent by design, and that is a massive
- 3:08Speaker 2: problem for malware authors. They are working in a medium
- 3:11Speaker 2: that is inherently readable.
- 3:13Speaker 1: So they have to lie.
- 3:14Speaker 2: They have to lie, They have to use camouflage. They
- 3:16Speaker 2: have to break the readability for you, the human, without
- 3:20Speaker 2: breaking the ferditionality for the computer.
- 3:22Speaker 1: That sounds like a tough balance to strike. Yeah, let's
- 3:24Speaker 1: get into the tricks they use. The sources list a
- 3:27Speaker 1: few techniques that are designed to create what they call
- 3:30Speaker 1: mental friction.
- 3:31Speaker 2: Mental friction is the perfect term. They want you, the analyst,
- 3:35Speaker 2: to get a headache. They want you to look at
- 3:37Speaker 2: the screen, get confused, and just give up.
- 3:40Speaker 1: The first technique is nonsensical naming. This seems simple, but
- 3:44Speaker 1: looking at the examples, it's actually pretty disorienting.
- 3:47Speaker 2: It is simple, but it's so effective. In a normal program.
- 3:50Speaker 2: If a function downloads a file, a helpful programmer names
- 3:54Speaker 2: it download file helpful, clean, easy to maintain.
- 3:57Speaker 1: Right, it tells you exactly what it does.
- 4:00Speaker 2: Our author will strip that out. They'll replace it with
- 4:01Speaker 2: something random. One example from our source material was a
- 4:04Speaker 2: variable named booklet crescent, or another one called cowkeeper.
- 4:08Speaker 1: Cowkeeper.
- 4:10Speaker 2: Seriously, yes, cowkeeper.
- 4:12Speaker 1: So I'm reading this code trying to save my company
- 4:14Speaker 1: from a cyber attack. The clock is kicking and I'm
- 4:17Speaker 1: staring at a variable called cowkeeper equals fifty.
- 4:20Speaker 2: Eight, and your brain naturally tries to find meaning in it.
- 4:23Speaker 2: You stop and you think, wait, what is the cowkeep
- 4:26Speaker 2: is fifty eight? The number of cows? Is this a
- 4:28Speaker 2: reference to a server farm? Is it a date?
- 4:32Speaker 1: Yeah, you're trying to solve a puzzle that isn't there.
- 4:34Speaker 2: But it's a trap. It means absolutely nothing. It is
- 4:37Speaker 2: noise designed to waste your cognitive energy. It's strictly there
- 4:40Speaker 2: to slow you down.
- 4:41Speaker 1: And then they layer on the junk instructions. This is
- 4:43Speaker 1: where they add code that does.
- 4:45Speaker 2: Nothing, nothing useful for the program. Now they might add
- 4:49Speaker 2: a loop that counts to a million and then stops,
- 4:52Speaker 2: or they'll do basic addition and subtraction. A equal ten
- 4:56Speaker 2: beetles five C.
- 4:57Speaker 1: Is a plus B, but C is never used again.
- 5:00Speaker 2: Never used again. They define variables they never used. They
- 5:03Speaker 2: write entire functions that are never called. It's like filling
- 5:06Speaker 2: a book with random sentences just to hide the one
- 5:09Speaker 2: sentence that matters.
- 5:10Speaker 1: Right. If you're looking for a needle in a haystack,
- 5:12Speaker 1: their strategy is to just dump more hay on the pile.
- 5:15Speaker 2: That's a perfect analogy.
- 5:16Speaker 1: The third technique mentioned, and this one felt a bit
- 5:19Speaker 1: more like a crossword puzzle was string manipulation.
- 5:22Speaker 2: This is crucial text strings specifically, things like a URL,
- 5:26Speaker 2: an IP address, or a file name are usually the
- 5:29Speaker 2: smoking gun we're looking for. Those are the indicators of
- 5:32Speaker 2: compromise or IOCs.
- 5:34Speaker 1: So they can't leave them in plain sight.
- 5:36Speaker 2: No way. If you have a script that is five
- 5:39Speaker 2: hundred lines of gibberish, but line three hundred simply says
- 5:43Speaker 2: htt dot bad site dot com, you don't need to
- 5:46Speaker 2: read the gibberish. You just see the URL, block the
- 5:49Speaker 2: site and go home.
- 5:50Speaker 1: So they have to break it up.
- 5:50Speaker 2: They have to break it up. The sources gave a
- 5:53Speaker 2: really specific example of this. It involved the word environment.
- 5:56Speaker 1: Oh yeah, walk us through how they hid that.
- 5:58Speaker 2: Right. So the script defined a string called basin expand
- 6:01Speaker 2: b A S I n e e x pa n D.
- 6:05Speaker 2: Then it told the computer take the right six characters.
- 6:08Speaker 1: Okay, so if I take the right six characters of
- 6:10Speaker 1: basine expand, I get expanded correct.
- 6:12Speaker 2: Then it took another string environment strings, reversed it so
- 6:15Speaker 2: it spelled backward, and then told the computer to reverse
- 6:18Speaker 2: it back and concatenate or you know, glue them together.
- 6:21Speaker 1: So as the analyst, you have to mentally cut paste
- 6:24Speaker 1: and reverse just to read the word expand environment strings exactly.
- 6:28Speaker 2: And while you're doing that mental gymnastics, while you are
- 6:30Speaker 2: pulling out your hair trying to reverse a string in
- 6:33Speaker 2: your head, you might miss the actual malicious command hiding
- 6:36Speaker 2: on the very next line.
- 6:37Speaker 1: It works, It definitely works. I was annoyed just reading
- 6:40Speaker 1: about it. Okay, so we know the enemy's tapics. Let's
- 6:43Speaker 1: talk about the battlefield. The sources spend a lot of
- 6:45Speaker 1: time on office macro's VBA.
- 6:47Speaker 2: VBA is the classic stage one attack. You get a
- 6:50Speaker 2: word doc or an Excel sheet. It's usually not the
- 6:52Speaker 2: final weapon. It's the foothold. It's the key that opens
- 6:55Speaker 2: the door to let the real bad guys in.
- 6:57Speaker 1: But I thought we were told not to open suspicious documents.
- 7:00Speaker 1: I feel like we've been hearing disabled macros and don't
- 7:03Speaker 1: open attachments for twenty years.
- 7:04Speaker 2: We have, but people still do it. Yeah, a cleverly
- 7:07Speaker 2: disguised HR document, a payroll schedule, a bonus plan, twenty
- 7:11Speaker 2: twenty six dot doc. You know, curiosity wins, and when
- 7:15Speaker 2: it does and the user clicks enable content, the script runs.
- 7:19Speaker 2: When that happens, we need tools to analyze what happened
- 7:22Speaker 2: without infecting ourselves. One of the main tools mentioned is
- 7:25Speaker 2: only dump.
- 7:26Speaker 1: Only dump. It sounds like a generic brand trash bag.
- 7:30Speaker 2: It's actually a very powerful tool. Think of an office document,
- 7:32Speaker 2: like a sealed book, or even better, a file cabinet.
- 7:36Speaker 2: It's not just one text file. It's a container. It's
- 7:39Speaker 2: actually a zip file in disguise, holding text, images, formatting,
- 7:44Speaker 2: and macros.
- 7:45Speaker 1: And you don't want to open the book because the
- 7:47Speaker 1: pages might be.
- 7:48Speaker 2: Poisoned right if you open it. In word, the code
- 7:51Speaker 2: executes only dump lets you read the table of contents
- 7:54Speaker 2: without opening the cover. It scans the internal structure of
- 7:57Speaker 2: the file safely safe reading.
- 7:59Speaker 1: I like it. What are we looking for in this
- 8:01Speaker 1: table of contents?
- 8:02Speaker 2: We're looking for streams. These are chunks of data inside
- 8:05Speaker 2: the file. Specifically, we're looking for streams marked with the
- 8:09Speaker 2: letter M.
- 8:10Speaker 1: M for macro. Yes.
- 8:12Speaker 2: But here's the catch. Sometimes we'll see a lowercase M
- 8:15Speaker 2: that usually means an empty module. A macro is define,
- 8:19Speaker 2: but there's no code.
- 8:20Speaker 1: In it, so ignore that one.
- 8:21Speaker 2: Ignore those. We're looking for the capital M. That's where
- 8:24Speaker 2: the code lives.
- 8:25Speaker 1: Okay, so we use the tool. We find the stream
- 8:27Speaker 1: with the big M and we extract the code. Now
- 8:30Speaker 1: we're looking at that wall of text with cowkeeper and
- 8:34Speaker 1: booklet crescent. How do we even start?
- 8:36Speaker 2: You need an entry point. In VBA, code doesn't just
- 8:39Speaker 2: run randomly. It needs a trigger. We search for auto
- 8:42Speaker 2: open or auto open.
- 8:44Speaker 1: That makes sense when the document opens.
- 8:46Speaker 2: Do this exactly. Once you find that, you follow the thread,
- 8:50Speaker 2: and this is where you have to develop a kind
- 8:51Speaker 2: of pattern recognition. You have to mentally delete the noise.
- 8:55Speaker 1: The source said something interesting here regarding that noise. It said,
- 8:59Speaker 1: if you see a variable to find as booklet crescent
- 9:01Speaker 1: equals fifty eight, but it's never used again, delete it mentally.
- 9:05Speaker 2: It's the art of ignoring things. You highlight a variable
- 9:09Speaker 2: if it doesn't appear anywhere else in the code, or
- 9:11Speaker 2: if it just does some math that isn't used later,
- 9:14Speaker 2: it's junk. Strike it from your mind.
- 9:16Speaker 1: So what should we care about? What's the signal and
- 9:18Speaker 1: the noise?
- 9:19Speaker 2: In VBA, you look for two big keywords, create object
- 9:22Speaker 2: or call by name.
- 9:23Speaker 1: Why those specifically.
- 9:25Speaker 2: Because eventually the malware has to do something to your computer.
- 9:28Speaker 2: It has to create a network object to talk to
- 9:30Speaker 2: the internet, or a file system object to write a file.
- 9:34Speaker 2: It can't hide those calls completely. It needs to interact
- 9:37Speaker 2: with the Windows operating system.
- 9:40Speaker 1: So no matter how much they rename variables to cowkeeper,
- 9:43Speaker 1: eventually they have to say create Internet object.
- 9:46Speaker 2: They might try to hide the name of the object
- 9:48Speaker 2: inside a variable, but the command create object usually stands out.
- 9:52Speaker 2: That's your beacon in the fog.
- 9:53Speaker 1: Let's walk through the case study from the sources. This
- 9:56Speaker 1: was a specific VBA analysis. They extracted the macro and
- 10:00Speaker 1: it was messy, very messy.
- 10:01Speaker 2: They found a function named, and I'm not kidding, manslaughter.
- 10:05Speaker 1: A bit dramatic for a variable name.
- 10:07Speaker 2: Malware authors have a weird sense of humor sometimes, so
- 10:10Speaker 2: they trace this manslaughter function. They filter out the junk
- 10:13Speaker 2: variables and they find a variable called s t one.
- 10:16Speaker 2: St one is doing what it's concatenating or you know,
- 10:20Speaker 2: gluing together a URL. And this is the golden moment.
- 10:22Speaker 2: They identify an object called xmlh ttp.
- 10:25Speaker 1: Xml http that sounds like make a web request.
- 10:29Speaker 2: That's exactly what it is. Think of it as a
- 10:31Speaker 2: web browser with no screen. The logic revealed itself. The
- 10:35Speaker 2: script makes a request an open and send command to
- 10:38Speaker 2: that URL. It gets a response back, and then it
- 10:40Speaker 2: uses the open keyword again, but this time to create
- 10:43Speaker 2: a file in the computer.
- 10:44Speaker 1: And the source is mentioned looking for specific file extensions.
- 10:47Speaker 2: Here right, Yes, the script was looking for files ending
- 10:50Speaker 2: in dot vbs or dot bat.
- 10:52Speaker 1: So the story is open word doc dash macro runs
- 10:56Speaker 1: the back, goes to URL, downloads a dot bad file.
- 11:00Speaker 1: Datch runs it.
- 11:01Speaker 2: That's the narrative, and finding that narrative is the whole point.
- 11:04Speaker 2: You've gone from what is this gibberish to it downloads
- 11:07Speaker 2: a batchfile from this specific URL.
- 11:09Speaker 1: Now here's a question, why go through all this pain?
- 11:12Speaker 1: Why not just run the malware in a sandbox, like
- 11:14Speaker 1: a safe, isolated computer and see what it does.
- 11:16Speaker 2: That's a great question. Sandboxes are awesome tools, but they
- 11:20Speaker 2: have limits, like what well a sandbox runs the code
- 11:23Speaker 2: once observing behavior. Suppose the malware has a list of
- 11:26Speaker 2: five different websites that can download from. It tries the
- 11:28Speaker 2: first one, succeeds and stops. The sandbox reports it contacted
- 11:33Speaker 2: badsite dot com.
- 11:34Speaker 1: Success, we got it. We block badsite dot com.
- 11:38Speaker 2: But you miss the other four sites. If you analyze
- 11:41Speaker 2: the code manually, you see the whole list, You see
- 11:43Speaker 2: the backup plans, you get all the indicators of compromise,
- 11:46Speaker 2: all the IOCs.
- 11:47Speaker 1: Nice.
- 11:48Speaker 2: That makes your defense much stronger because now you can
- 11:50Speaker 2: block all five sites before they are even used.
- 11:53Speaker 1: That is a really good point. The manual work gives
- 11:56Speaker 1: you the full picture, not just the snapshot. Yeah, okay,
- 11:59Speaker 1: we've tackled office. Now we have to move to the
- 12:01Speaker 1: heavy hitter, the power tool, as the outline calls it, PowerShell.
- 12:06Speaker 2: PowerShell is it's a double edged sword. For system administrators,
- 12:10Speaker 2: it's a godsend. It can control everything in Windows. For hackers,
- 12:13Speaker 2: it's a dream come true because it's already installed on
- 12:16Speaker 2: every modern Windows machine.
- 12:17Speaker 1: The sources called this living off the land.
- 12:20Speaker 2: Right. You don't need to bring a weapon. The weapon
- 12:22Speaker 2: is already in the house. You just need to pick
- 12:23Speaker 2: it up.
- 12:24Speaker 1: So how does the attack usually happen? We left off
- 12:26Speaker 1: with the word doc downloading something.
- 12:28Speaker 2: Often that word doc will trigger cmd dot exx, which
- 12:33Speaker 2: then launches PowerShell. But here's the kicker. They use a
- 12:37Speaker 2: specific flag called.
- 12:38Speaker 1: Nk NG short for encoded Yes, and.
- 12:41Speaker 2: What follows isn't readable script. It's a massive wall of
- 12:45Speaker 2: random letters and numbers. This is Base sixty four encoding.
- 12:49Speaker 1: I've seen this. It looks like you fell asleep on
- 12:51Speaker 1: the keyboard. Just a block of alphanumeric soup, and if.
- 12:53Speaker 2: You try to just read it you can't. Base sixty
- 12:56Speaker 2: four is a way of representing binary data as text character.
- 13:00Speaker 2: You have to decode it. But there is a huge
- 13:03Speaker 2: gotcha here that the source material highlighted, and this trips
- 13:07Speaker 2: up a lot of junior analysts.
- 13:08Speaker 1: Oh right, the diamond question mark?
- 13:10Speaker 2: Yes, the dreaded black diamonds.
- 13:13Speaker 1: Explain this? Why does decoding it sometimes break?
- 13:16Speaker 2: Okay? So usually on the web text is encoded in
- 13:18Speaker 2: UTF eight it's the standard. But Windows what this has
- 13:21Speaker 2: been around a long time, it does things differently. It
- 13:23Speaker 2: uses UTF sixteen for this type of encoding.
- 13:25Speaker 1: So if I take that base sixty four string from
- 13:27Speaker 1: a Windows command and decode it using a standard web
- 13:30Speaker 1: tool set to UTFA.
- 13:31Speaker 2: You get garbage. You get these black diamonds with question
- 13:34Speaker 2: marks inside. It looks like a corrupted file.
- 13:36Speaker 1: Which is incredibly frustrated. I'd probably assume I made a
- 13:39Speaker 1: mistake where the file was broken.
- 13:40Speaker 2: Many people do. But it's not corrupt. You just need
- 13:44Speaker 2: to speak the right dialect. If you switch your decoder
- 13:47Speaker 2: settings to UTF sixteen, suddenly the text becomes clear readable code.
- 13:52Speaker 1: That is such a pro tip UTF sixteen. Okay, so
- 13:54Speaker 1: we decode it. Now we have the PowerShell script. Yeah,
- 13:57Speaker 1: but I'm guessing it's still messy.
- 13:58Speaker 2: Oh, it's a mess Often it's a one liner. Imagine
- 14:01Speaker 2: a ten page, say, written on a single line of texts.
- 14:04Speaker 1: Gross, that's unreadable.
- 14:06Speaker 2: It's awful. But there's a trick called refactoring, specifically the
- 14:10Speaker 2: semi colon trick.
- 14:11Speaker 1: This sounded oddly satisfying.
- 14:13Speaker 2: It is. In PowerShell, commands are separated by semi colons,
- 14:17Speaker 2: So the analyst simply does a find and replace. Find
- 14:20Speaker 2: every semi colon and replace it with semicolon plus new line,
- 14:24Speaker 2: and boom boom. Suddenly that dense block of text expans
- 14:27Speaker 2: into a vertical list of commands. You can see the structure,
- 14:30Speaker 2: you can see the flow. It's like magic.
- 14:32Speaker 1: I love that it's such a simple formatting fix that
- 14:34Speaker 1: changes everything.
- 14:35Speaker 2: Sometimes the best deoffuscation tool is just the enter key.
- 14:38Speaker 1: So we've talked about reading code what they call static analysis,
- 14:43Speaker 1: but the sources get into advanced tactics where we start
- 14:47Speaker 1: actually running the code dynamic analysis.
- 14:50Speaker 2: This is for when the math knots are just too tight,
- 14:53Speaker 2: if the code is doing complex decryption that would take
- 14:55Speaker 2: you hours to solve with a calculator. Don't let the
- 14:59Speaker 2: computer so it.
- 15:00Speaker 1: But isn't running malware bad? We established that at the start.
- 15:03Speaker 2: Running it. All the way is bad. Running it part
- 15:06Speaker 2: of the way is clever. We use tools like the
- 15:08Speaker 2: powershall I he the Integrated Scripting Environment. It lets us
- 15:11Speaker 2: set break points.
- 15:12Speaker 1: Breakpoints that's like a pause button exactly.
- 15:15Speaker 2: Imagine the script has a line that decodes a URL,
- 15:18Speaker 2: and the very next line downloads a virus from that URL.
- 15:21Speaker 1: We definitely want to stop before the second line, right.
- 15:23Speaker 2: So you put a break point on that second line.
- 15:25Speaker 2: You hit run. The script does the hard work of
- 15:28Speaker 2: decoding the URL, stores it in a variable, and then
- 15:31Speaker 2: it pauses.
- 15:32Speaker 1: And then you just hover your mouse over the variable and.
- 15:34Speaker 2: The computer shows you the clean decoded URL. You let
- 15:37Speaker 2: the malware tell you its secrets without letting it execute
- 15:39Speaker 2: the attack.
- 15:40Speaker 1: That is sleek. But there was one trick in the
- 15:42Speaker 1: sources that I think was my absolute favorite, the print
- 15:45Speaker 1: versus execute trick. This was used in the lab example
- 15:48Speaker 1: where they had a really stubborn script.
- 15:50Speaker 2: Ah yes, the IEX swap. This is a classic move.
- 15:53Speaker 1: It's bold set the scene force.
- 15:55Speaker 2: Okay, you have a script. It's double opuscated. It has
- 15:58Speaker 2: a base sixty four string, and inside that the code
- 16:02Speaker 2: is compressed using something called deflate stream.
- 16:05Speaker 1: So even if I decode the text, it's still compressed gibberish.
- 16:08Speaker 2: Right, decompressing streams manually is a nightmare. But look at
- 16:12Speaker 2: the very end of the script. The script eventually has
- 16:14Speaker 2: to run this mess in PowerShell. The command to run
- 16:17Speaker 2: this string as code is i ex invoke expression.
- 16:21Speaker 1: So i EX is the go button. It's the trigger.
- 16:24Speaker 2: I EX is the go button. It takes the confusing
- 16:26Speaker 2: string and executes it.
- 16:28Speaker 1: So what do we do.
- 16:29Speaker 2: We delete iex and we replace it with right output
- 16:32Speaker 2: or just print.
- 16:33Speaker 1: So instead of run this, we change the command to
- 16:35Speaker 1: show me this exactly.
- 16:37Speaker 2: You run the script. It does all the decoding, all
- 16:39Speaker 2: the decompressing, It gets the payload ready to launch, and
- 16:42Speaker 2: then instead of launching it, it harmlessly prints the secret
- 16:46Speaker 2: source code to your screen.
- 16:48Speaker 1: That is so cool. It's like handing a spy a gun,
- 16:51Speaker 1: but you secretly replace the bullets with a flag that
- 16:53Speaker 1: says bang.
- 16:54Speaker 2: That is a fantastic analogy. You use the malware's own
- 16:58Speaker 2: logic against it. It wants to deco code itself to run. Fine,
- 17:01Speaker 2: we'll let it decode itself and then we'll just read
- 17:03Speaker 2: the output.
- 17:04Speaker 1: And in that lab example, once they did that, the
- 17:06Speaker 1: code looked almost identical to what we saw before. It
- 17:09Speaker 1: revealed the net dot web client, the URLs, everything.
- 17:13Speaker 2: It turns a two hour headache into a five second win.
- 17:16Speaker 1: I love that, So let's zoom out. We've covered a
- 17:19Speaker 1: lot of ground. What is the big takeaway here for
- 17:22Speaker 1: someone trying to learn this skill.
- 17:23Speaker 2: The takeaway is that abpuscation is just a game of
- 17:26Speaker 2: hide and seek. The bad guys are throwing up smoke screens, noise, encryption, confusion,
- 17:32Speaker 2: but they are bound by the rules of the language.
- 17:34Speaker 1: They still have to talk to the computer.
- 17:36Speaker 2: They still have to talk to the computer. They still
- 17:37Speaker 2: have to create object, they still have to open a URL,
- 17:41Speaker 2: they still have to invoke expression. They can hide the variables,
- 17:44Speaker 2: but they can't hide the verbs.
- 17:46Speaker 1: And our job isn't to understand every single line of code.
- 17:49Speaker 2: No, and that's so important. You don't need to know
- 17:51Speaker 2: what booklet crescent equals. You just need the story. Where
- 17:55Speaker 2: does it go, what does it get? Where does it put? It?
- 17:57Speaker 1: Usually a teen folder, almost always a time Okay, before
- 18:01Speaker 1: we wrap up, I want to do a quick review
- 18:03Speaker 1: exercise for you, the listener, based on that last trick
- 18:06Speaker 1: we discussed, let's do it. Okay, picture this. You have
- 18:10Speaker 1: a malicious PowerShell script on your screen. You've refactored the semicolons.
- 18:15Speaker 1: You see the wall of text at the very end,
- 18:18Speaker 1: there's a command that is about to execute a hidden
- 18:21Speaker 1: decoded string. You want to see the code inside, but
- 18:25Speaker 1: you absolutely do not want to get infected. You see
- 18:28Speaker 1: the command iex or invoke expression. What do you do?
- 18:31Speaker 1: Sick a second, you delete iex and you swap it
- 18:34Speaker 1: for right output or print, and.
- 18:37Speaker 2: Just like that, you've turned a weapon into a roadmap.
- 18:39Speaker 1: I feel simpler already. Thank you for guiding us through
- 18:41Speaker 1: the chaos today. This really demystified the gibberish For me.
- 18:46Speaker 2: It was my pleasure. It's always fun to see the
- 18:48Speaker 2: patterns emerge from the noise.
- 18:50Speaker 1: To everyone listening, stay curious, don't be intimidated by the
- 18:54Speaker 1: wall of text. There's a story hiding in there. You
- 18:56Speaker 1: just have to know which words to ignore.
- 18:58Speaker 2: Patience and practice. That's the art.
- 19:00Speaker 1: See in the next deep dive