Latest / CyberCode Academy / Course 20 - Malware Analysis: Identifying and Defeating Code Obfuscation | Episode 5: Identifying and Analyzing Cryptography in Malware
Transcript
- 0:00Speaker 1: Imagine for a second that you're a detective in some
- 0:02Speaker 1: old school noir film. It's raining outside. Obviously, the neon
- 0:06Speaker 1: sign across the street is flickering. You kick down the
- 0:08Speaker 1: door to a suspect safe house. You're ready to bust
- 0:11Speaker 1: this case wide open. You walk over to the desk,
- 0:14Speaker 1: grab the ledger that's supposed to have all the incriminating evidence.
- 0:17Speaker 2: And you open it up and let me guess, it's blank.
- 0:21Speaker 1: Worse, it's written in visible ink, or you know, it's
- 0:24Speaker 1: in a code that just looks like a cat walked
- 0:26Speaker 1: across a typewriter, just a jumbled mess of nonsense. You know,
- 0:30Speaker 1: the evidence is right there, right in front of you,
- 0:31Speaker 1: but you can't read a single word of it.
- 0:33Speaker 2: That is actually a painfully accurate description of my day
- 0:37Speaker 2: to day work.
- 0:37Speaker 1: I was hoping you'd say that, because today we aren't
- 0:40Speaker 1: talking about nineteen forties detectives. We are talking about the
- 0:43Speaker 1: reality of modern cybersecurity. We tend to assume that malware
- 0:47Speaker 1: authors are just writing code to break things, to steal
- 0:50Speaker 1: data or lock up files, but it turns out a
- 0:53Speaker 1: huge part of their job is just making sure you
- 0:55Speaker 1: can't read what they wrote exactly.
- 0:57Speaker 2: When we deal with malware. We almost never get the
- 0:59Speaker 2: lugs of reading the instructions in plain english. The authors
- 1:03Speaker 2: aren't just trying to break into systems, they are actively
- 1:06Speaker 2: trying to hide how they're doing it. They're building these
- 1:09Speaker 2: digital labyrinths to keep analysts like us out, and.
- 1:13Speaker 1: That is exactly what we're unpacking today. We're doing a
- 1:15Speaker 1: deep dive into the hidden language of malware, specifically focusing
- 1:19Speaker 1: on cryptography and obfuscation. We've got a stack of research,
- 1:24Speaker 1: some heavy technical docs, and a few fascinating case studies
- 1:27Speaker 1: that reveal how these digital burglars hide their tools.
- 1:31Speaker 2: And the mission for this deep dive is pretty specific.
- 1:34Speaker 2: We aren't going to sit here and admire the complexity.
- 1:36Speaker 2: We want to understand the why behind the disguise, learn
- 1:40Speaker 2: how to spot these hidden messages, sometimes without even looking
- 1:43Speaker 2: at the code itself.
- 1:44Speaker 1: I love a good mystery, but I have to play
- 1:46Speaker 1: Devil's advocate right at the start here. Why go through
- 1:49Speaker 1: all this trouble? I mean, if I write a virus,
- 1:51Speaker 1: why do I care if you can read it? As
- 1:53Speaker 1: long as it infects the computer?
- 1:54Speaker 2: Job done right, you'd think so, But it's all about
- 1:57Speaker 2: survival time. Malware authors use from talkography and encoding. To
- 2:01Speaker 2: hide the most sensitive parts of their operation, they need
- 2:04Speaker 2: to hide specific text strings the APIs. Those are the
- 2:07Speaker 2: system functions they call to.
- 2:09Speaker 1: Do things like open files or use.
- 2:10Speaker 2: The internet exactly, and especially their payloads, because if they
- 2:14Speaker 2: don't hide them, if an anti virus program or a
- 2:16Speaker 2: security analyst can easily see a string in the file
- 2:19Speaker 2: that says connect to this evil server or download ransomware
- 2:24Speaker 2: dot xs, the game is over before it begins. It
- 2:27Speaker 2: gets flagged, blocked, and the malware is dead on arrival.
- 2:31Speaker 1: So it's not just camouflage the survival mechanism. It's the
- 2:34Speaker 1: difference between walking into a bank with a mask on
- 2:37Speaker 1: versus you know, walking in with your ID pin.
- 2:39Speaker 2: To your chest precisely. And this hiding falls under a
- 2:42Speaker 2: broad category we call data encoding. This can range from
- 2:45Speaker 2: the remarkably simple to the incredibly complex. On the simple side,
- 2:50Speaker 2: you have things like Base sixty four encoding or basic Caesar.
- 2:53Speaker 1: Ciphers if you might have played with as a kid, Yeah.
- 2:55Speaker 2: Secret notes in class. And on the complex side, what
- 2:58Speaker 2: are we talking about there? Oh, they might use industry
- 3:01Speaker 2: standard encryption like AES or RC four, or even invent
- 3:05Speaker 2: their own custom algorithms just to mess with us. They
- 3:08Speaker 2: might create a puzzle that only their specific program knows
- 3:11Speaker 2: how to solve.
- 3:12Speaker 1: Okay, let's get visual here, because I want to help
- 3:14Speaker 1: the listener really picture this. You mentioned simple encoding. Let's
- 3:16Speaker 1: talk about the xor technique. I was reading about this
- 3:20Speaker 1: and there was this fascinating example about spotting a pattern
- 3:23Speaker 1: in raw data. It sounded almost like seeing a glitch
- 3:26Speaker 1: in the matrix.
- 3:26Speaker 2: It really is like that. It's a classic Tell Imagine
- 3:29Speaker 2: you're looking at a stream of raw data hex dump,
- 3:33Speaker 2: just rows and rows of numbers and letters. To the
- 3:36Speaker 2: untrained eye, it looks like complete.
- 3:38Speaker 1: Nonsense, just static, just noise.
- 3:40Speaker 2: Right, But suddenly you notice a pattern. You see the
- 3:43Speaker 2: hex value ninety seven, and you see it again and again.
- 3:46Speaker 2: It's repeating all over the payload, almost like a heartbeat.
- 3:49Speaker 1: So ninety seven is the clue. But why is it repeating?
- 3:52Speaker 1: Is the malware just obsessed with the number ninety seven.
- 3:54Speaker 2: It's not an obsession, it's a mathematical side effect. This
- 3:58Speaker 2: is usually happening in shell code. It's native machine code. Now,
- 4:02Speaker 2: native code has a quirk. It contains a lot of
- 4:05Speaker 2: null bytes, which are just zeros.
- 4:07Speaker 1: Okay, so the file is naturally sol of empty space,
- 4:10Speaker 1: lots of zeros.
- 4:11Speaker 2: Exactly now, the malwur author is using a technique called
- 4:15Speaker 2: xor encoding with a static key to hide the code.
- 4:19Speaker 2: Xor is a logical operation, and think of it like
- 4:22Speaker 2: a reversible toggle. In this case, the key they used
- 4:25Speaker 2: to lock the file happens to be the value ninety seven.
- 4:28Speaker 1: Okay, I'm with you.
- 4:29Speaker 2: Now here's the math that gives them away. When you
- 4:32Speaker 2: xor a zero with ninety seven, the result is ninety seven.
- 4:36Speaker 1: Wait. Really, so, because the underlying code has so many zeros,
- 4:39Speaker 1: the encryption just spits out the key over and.
- 4:41Speaker 2: Over, exactly every time the encryption algorithm hits a null
- 4:44Speaker 2: byte in the original code, which happens constantly, it spits
- 4:48Speaker 2: out the key itself in the encrypted version.
- 4:50Speaker 1: That is wildly cool. It's like the disguise is too thin.
- 4:53Speaker 1: The structure of the code underneath is forcing the encryption
- 4:55Speaker 1: key to reveal itself.
- 4:57Speaker 2: It's like trying to hide a zebra under a white sheet.
- 4:59Speaker 2: The stripe still show through. That's a great analogy.
- 5:02Speaker 1: So it's a flaw in the disguise. It is.
- 5:04Speaker 2: But here's the catch. Even though we can see the key.
- 5:08Speaker 2: The computer can't run that code directly. If the processor
- 5:12Speaker 2: tried to execute those ninety sevens, it would crash. It's
- 5:15Speaker 2: gibberish to the CPU.
- 5:16Speaker 1: Right, So it needs help.
- 5:18Speaker 2: It needs a little helper.
- 5:19Speaker 1: We call it a stub, a stub like a ticket stub.
- 5:21Speaker 2: Think of it more like the starter motor on a car.
- 5:24Speaker 2: It's a tiny loop of code right at the beginning
- 5:26Speaker 2: of the file that is not encrypted. Its only job
- 5:29Speaker 2: is to take the rest of the mess, run that
- 5:32Speaker 2: xor operation in reverse to unlock the real instructions, and
- 5:36Speaker 2: then hand over control.
- 5:38Speaker 1: So if you're an analyst and you see that little loop, you.
- 5:41Speaker 2: Found the entry point. You can see the loops taking
- 5:43Speaker 2: a hard coded key that ninety seven we mentioned, and
- 5:46Speaker 2: processing the bytes one by one. The code literally tells
- 5:49Speaker 2: you how to decrypt itself. It has to otherwise it
- 5:51Speaker 2: wouldn't work.
- 5:52Speaker 1: It's almost polite of them. Here are the instructions on
- 5:54Speaker 1: how to reveal my evil plan.
- 5:56Speaker 2: It is, isn't it. But they don't always make it
- 5:59Speaker 2: that easy. Sometime they use what we call tricks of
- 6:01Speaker 2: the trade to make an analyst's life miserable.
- 6:03Speaker 1: I want to get into those tricks. The notes mentioned
- 6:06Speaker 1: malicious office docs and macros. This feels like something that
- 6:10Speaker 1: hits close to home for a lot of people. You
- 6:12Speaker 1: open a word doc and bam, yeah, how are they
- 6:15Speaker 1: hiding code there? Oh?
- 6:16Speaker 2: Absolutely A common trick there involves base sixty four encoding.
- 6:20Speaker 1: Base sixty four is that format that turns data into
- 6:23Speaker 1: a long string of random looking letters in numbers right, yeah,
- 6:27Speaker 1: usually ends with an equal sign.
- 6:29Speaker 2: Correct. It's a way to represent binary data as text.
- 6:32Speaker 2: Malware authors love it because it's text safe, you can
- 6:35Speaker 2: put it anywhere. But they know we look for long
- 6:37Speaker 2: base sixty four strings. It's a massive red flag.
- 6:40Speaker 1: So what do they do?
- 6:41Speaker 2: They break it into little pieces.
- 6:43Speaker 1: Like shredding the note exactly.
- 6:45Speaker 2: They might take a long malicious command, chop it up
- 6:48Speaker 2: into twenty different variables, and then write a script that
- 6:51Speaker 2: glues them back together concatenation right at the last second.
- 6:54Speaker 1: So if you're just scanning the file for keywords, you
- 6:57Speaker 1: miss it because the words are all chopped.
- 6:59Speaker 2: Up right looking for download. But the file contains down
- 7:02Speaker 2: in one place and load in another. Sneaky. So the
- 7:05Speaker 2: takeaway here is that sometimes cracking the code isn't about
- 7:09Speaker 2: advanced math. It's just reassembling puzzle pieces exactly.
- 7:13Speaker 1: And sometimes the trick is even simpler, the mirror trick.
- 7:17Speaker 2: Oh, I laughed at this one. It's so simple it's
- 7:19Speaker 2: almost stupid, but I bet it works.
- 7:20Speaker 1: It works surprisingly well against automated systems. You look at
- 7:23Speaker 1: a script that looks like absolute garbage, but if you
- 7:26Speaker 1: squint or maybe hold it up to a mirror, you
- 7:28Speaker 1: realize it's just written backwards.
- 7:31Speaker 2: It's just the string in reverse that feels like something
- 7:33Speaker 2: a kid would do in a secret club.
- 7:35Speaker 1: It is simple but effective, but there's a smoking gun
- 7:38Speaker 1: to look for. In languages like JavaScript or VBScript, you
- 7:42Speaker 1: look for a function called evil.
- 7:44Speaker 2: Evil ev al. Why is that the clue?
- 7:47Speaker 1: Because Evil is a powerful and dangerous function. It takes
- 7:50Speaker 1: a string of text and executes it as actual code.
- 7:53Speaker 1: So the malware has to flip its backwards string around,
- 7:56Speaker 1: make it readable, and then feed it to Evil to
- 7:58Speaker 1: actually run it.
- 8:00Speaker 2: Evil is the point where the data turns into action.
- 8:02Speaker 2: It's the moment the actor steps onto the stage. That's it.
- 8:05Speaker 2: If you find Evil near a weird looking string, you've
- 8:08Speaker 2: likely found the point where the disguise comes off.
- 8:11Speaker 1: Okay, so we have repeating keys chopped up strings and
- 8:13Speaker 1: backward writing. What about when they get really difficult? The
- 8:18Speaker 1: notes mentioned something called stack strings. It sounded pedious.
- 8:24Speaker 2: Tedious is the perfect word, both for the author and
- 8:26Speaker 2: the analyst.
- 8:27Speaker 1: How does it work?
- 8:29Speaker 2: So normally a password or a URL sits in your
- 8:32Speaker 2: code as a complete word password one, two, three easy
- 8:35Speaker 2: to find. With stack strings, the malware builds that string
- 8:39Speaker 2: one character at a time in the computer's memory on
- 8:42Speaker 2: the stack.
- 8:42Speaker 1: So instead of writing the ransom note, it's like they're
- 8:45Speaker 1: cutting out letters from a magazine one by one. Write
- 8:47Speaker 1: at the moment they need to read it.
- 8:49Speaker 2: That's a great analogy. The code would look like, move
- 8:51Speaker 2: P to this memory slot, move Hey to the next slot,
- 8:54Speaker 2: move C to the next one. The word password never
- 8:56Speaker 2: exists as a full word on the disc.
- 8:58Speaker 1: Wow, And I'm guessing annually reconstructing that as a.
- 9:02Speaker 2: Nightmare incredibly slow. If you try to do it by
- 9:05Speaker 2: hand for every string, you'd be there for weeks. This
- 9:08Speaker 2: is where tools come in. Analysts use disassemblers like Ida pro.
- 9:12Speaker 2: Once you recognize the pattern, you can write a plug
- 9:15Speaker 2: in or a script automation to the rescue exactly. You
- 9:18Speaker 2: teach your tool to recognize that pattern and say Hey,
- 9:22Speaker 2: go through the whole file and whenever you see this
- 9:24Speaker 2: put it together for me. It turns a manual slog
- 9:27Speaker 2: into a one click solution.
- 9:29Speaker 1: That's a perfect segue. Actually, we've been talking about looking
- 9:32Speaker 1: at the code itself, zooming in on the bytes. But
- 9:35Speaker 1: what if we zoom out. How do we know if
- 9:37Speaker 1: a file is hiding something just by looking at the
- 9:39Speaker 1: file as a whole.
- 9:41Speaker 2: This is where we get into the concept of entropy.
- 9:43Speaker 1: Entropy that sounds like high school physics, Yeah, chaos disorder.
- 9:47Speaker 2: In information theory, it's effectively the same thing. It's the
- 9:50Speaker 2: measurement of randomness in a set of data. We use
- 9:53Speaker 2: Shannon's algorithm to measure this on a scale from zero
- 9:56Speaker 2: to eight.
- 9:57Speaker 1: Good, let's unpack that scale zero to eight. What are
- 9:59Speaker 1: the extremes.
- 10:00Speaker 2: The score of zero means absolutely no randomness. Imagine a
- 10:03Speaker 2: file that's just a million zeros in a row, totally predictable,
- 10:06Speaker 2: that has zero entropy en date. A score of eight
- 10:09Speaker 2: means total randomness. Every bite is unpredictable, like if you
- 10:14Speaker 2: flip a coin a million times.
- 10:16Speaker 1: So where does normal code sit.
- 10:18Speaker 2: Normal code English text? It usually sits somewhere in the middle.
- 10:21Speaker 2: It has structure patterns, certain commands repeat, but encrypted data
- 10:25Speaker 2: or compressed data to the computer, that looks like pure
- 10:29Speaker 2: random noise.
- 10:30Speaker 1: I see where this is going. So if you scan
- 10:32Speaker 1: a file and it has an entropy score of say
- 10:36Speaker 1: seven point eight.
- 10:37Speaker 2: The alarm bells should be ringing.
- 10:39Speaker 1: Because code shouldn't be that random exactly.
- 10:41Speaker 2: It means the file is likely packed wrapped in a
- 10:44Speaker 2: protective encrypted layer. It's a huge red flag before you
- 10:48Speaker 2: even look at a single line of code.
- 10:50Speaker 1: It's like picking up a book and finding out all
- 10:51Speaker 1: the pages are glued shut. You know someone is hiding
- 10:54Speaker 1: the text.
- 10:54Speaker 2: That's a great way to put it. And there's another
- 10:56Speaker 2: way to tell by looking at its luggage, or technically,
- 10:59Speaker 2: it's imports.
- 11:00Speaker 1: Imports. Those are the tools the program borrows from Windows.
- 11:03Speaker 2: Right right, No program is an EELERD. A normal program
- 11:07Speaker 2: imports dozens or hundreds of functions from the operating system
- 11:10Speaker 2: to do its job, and packed malware it travels light,
- 11:14Speaker 2: suspiciously light. Remember, the rapper's only job is to unpack
- 11:18Speaker 2: the real malware. It doesn't need to talk to the
- 11:21Speaker 2: network or draw a pretty window yet.
- 11:23Speaker 1: So when you look at the imports of a packed file.
- 11:26Speaker 2: You might see very few functions, maybe just a couple.
- 11:29Speaker 1: It's like someone's showing up to a construction site with
- 11:31Speaker 1: nothing but a box cutter. You know, they aren't there
- 11:34Speaker 1: to build the house. They're just there to open the package.
- 11:37Speaker 2: That is a fantastic way to put it. But sometimes
- 11:40Speaker 2: they do bring specific tools that give them away. We
- 11:43Speaker 2: look for specific libraries in the import list, like what
- 11:47Speaker 2: in Windows you might see system, dot security, dot cryptography,
- 11:51Speaker 2: or you might see imports like cryptiquire, context or cryptin random.
- 11:55Speaker 1: You'll seem pretty obvious crypt random gee, I wonder what
- 11:58Speaker 1: that does.
- 11:59Speaker 2: You'd be surprised. Sometimes they leave them right there, But
- 12:02Speaker 2: seeing those cryptolibraries is a smoking gun that there is
- 12:05Speaker 2: some heavy math going on inside that file.
- 12:08Speaker 1: Let's put this all together with a real world example.
- 12:11Speaker 1: We have a case study here involving a dot net file.
- 12:13Speaker 1: Now correct me if I'm wrong, but dot net is
- 12:15Speaker 1: a bit different from the native code we talked about earlier.
- 12:18Speaker 2: Right, it is, native code compiles down to machine code,
- 12:22Speaker 2: which is hard for humans to read. Dot Net, however,
- 12:25Speaker 2: compiles to what we call an intermediate language.
- 12:28Speaker 1: And what does that means us?
- 12:30Speaker 2: The good news is that dot net can be decompiled
- 12:33Speaker 2: back into something that looks almost exactly like the original
- 12:36Speaker 2: source code the hacker wrote.
- 12:37Speaker 1: That sells like a huge advantage for the detective. You're
- 12:40Speaker 1: not looking at x numbers anymore, you're looking at actual
- 12:43Speaker 1: code logic.
- 12:44Speaker 2: It's massive. In this case study, we analyze a suspect
- 12:47Speaker 2: file using a tool called pe studio. First thing, we
- 12:51Speaker 2: notice high entropy, so it's scrambled.
- 12:53Speaker 1: Step one, we know it's hiding something.
- 12:55Speaker 2: Step two we see it's a dot net binary. So
- 12:58Speaker 2: instead of a heavy duty disassembler, we open it in
- 13:00Speaker 2: a tool called d nspy. This tool lets us look
- 13:03Speaker 2: at the code structure as if we were the.
- 13:05Speaker 1: Developer, and what do we find inside?
- 13:08Speaker 2: Well, in this specific case, the malware author got a
- 13:10Speaker 2: little sloppy or maybe just lazy. We found a class
- 13:13Speaker 2: explicitly labeled and correct.
- 13:15Speaker 1: Incorrect sounds suspiciously like encryption.
- 13:17Speaker 2: Exactly, and inside that class the functions were named things
- 13:20Speaker 2: like decryptstring AES and encrypt file.
- 13:23Speaker 1: Wow, they really just labeled the do crimes.
- 13:25Speaker 2: Buttony good, So the code revealed they were taking base
- 13:28Speaker 2: sixty four strings, decoding them, and then using the AES
- 13:31Speaker 2: algorithm to unlock them.
- 13:33Speaker 1: Okay, so we see the lock aes. We see the
- 13:36Speaker 1: key is hidden in there somewhere. How do we beat it?
- 13:39Speaker 1: Do we have to do the math ourselves.
- 13:41Speaker 2: We have two main options. Option one is re implementation.
- 13:44Speaker 2: We literally copy their logic. We write a script in
- 13:48Speaker 2: Python or whatever that says do exactly what the malware does.
- 13:52Speaker 1: Fighting fire with fire, using their own logic against them.
- 13:55Speaker 2: Pretty much. But option two is often faster and frankly cool.
- 14:00Speaker 2: It's called dynamic analysis.
- 14:02Speaker 1: The dynamic meaning we analyze it while it's running.
- 14:05Speaker 2: Yes, remember, at some point the malware must decrypt the
- 14:08Speaker 2: password to use it. It has to exist in the
- 14:10Speaker 2: computer's memory and plaintext, even if just for a millisecond.
- 14:14Speaker 1: So you just wait for that millisecond.
- 14:15Speaker 2: You don't just wait, You force it to pause. You
- 14:18Speaker 2: use a debugger, You set a break point right at
- 14:20Speaker 2: the moment the decrypt string. As function finishes, you run
- 14:23Speaker 2: the malware. It hits the brake point and.
- 14:25Speaker 1: Freezes, like hitting pause on a movie right when the
- 14:28Speaker 1: plot twist is revealed.
- 14:29Speaker 2: Exactly, the program stops, the memory is frozen, and then
- 14:33Speaker 2: you just look in the memory register and there is
- 14:35Speaker 2: your decrypted string, the URL, the password whatever, sitting there
- 14:39Speaker 2: waiting for you.
- 14:41Speaker 1: That is incredibly satisfying. It's like waiting for the burglar
- 14:44Speaker 1: to dial the safe combination and then freezing time right
- 14:47Speaker 1: before you open the door, so you can write down
- 14:48Speaker 1: the numbers.
- 14:49Speaker 2: That's the power of dynamic analysis. You let the malware
- 14:52Speaker 2: do the heavy lifting for you.
- 14:54Speaker 1: I love that philosophy work smarter, not harder. Before we
- 14:58Speaker 1: wrap up, I want to touch on one more advance
- 15:00Speaker 1: detection method. You mentioned fingerprints earlier, right, not for the
- 15:03Speaker 1: malware authors, but for the algorithms.
- 15:05Speaker 2: Right, cryptographic constants.
- 15:07Speaker 1: Break that down for me. What is a cryptographic constant?
- 15:10Speaker 2: You see heavy encryption algorithms like MD five or SAHA
- 15:14Speaker 2: one aren't just random math. They're standardized and to work,
- 15:17Speaker 2: they depend on very specific initial values, specific giant numbers
- 15:23Speaker 2: to kickstart the calculation. We call the magic numbers.
- 15:26Speaker 1: So these numbers are distinct, like if I see a
- 15:28Speaker 1: certain string of numbers, I know for a fact it's
- 15:30Speaker 1: MD five exactly.
- 15:31Speaker 2: They are unique to the algorithm, and because they're required
- 15:34Speaker 2: for the math to work, the author can't really change them.
- 15:37Speaker 1: That sounds like a great way to search. You're not
- 15:40Speaker 1: looking for the malware, you're looking for the math.
- 15:42Speaker 2: It is They are plugins for our analysis tools, things
- 15:45Speaker 2: like idoscope or fine crypt two. You run these against
- 15:48Speaker 2: a file and they scan purely for these number patterns.
- 15:51Speaker 1: It's like a metal detector from math.
- 15:53Speaker 2: That's a good way to visualize it. The tool will
- 15:56Speaker 2: ping and say, hey, I found the magic constants for
- 15:59Speaker 2: the SAHA one algorithm right here at this memory address.
- 16:02Speaker 1: And why that's so helpful.
- 16:03Speaker 2: Because it points to you exactly to where the encryption
- 16:06Speaker 2: is happening. A file might be thousands of lines of code.
- 16:10Speaker 2: Instead of reading all of it, the tool drops a
- 16:12Speaker 2: pin on the map and says, start looking here. It
- 16:15Speaker 2: saves hours.
- 16:16Speaker 1: That is huge. It really seems like for every trick
- 16:19Speaker 1: the bad guys have, there's a tool or a method
- 16:22Speaker 1: to counter it. It's a game of cat and mouse.
- 16:24Speaker 2: It absolutely is, and the cat is getting smarter, but
- 16:27Speaker 2: so is the mouse.
- 16:28Speaker 1: So let's recap this journey because we've covered a lot
- 16:30Speaker 1: of ground. We started by looking at raw hex bites
- 16:33Speaker 1: and finding those repeating ninety sevens because of that exoar
- 16:37Speaker 1: encoding quirk right.
- 16:38Speaker 2: That showed us how simple patterns can betray encrypted code.
- 16:42Speaker 2: Then we talked about how a high entropy that chaos
- 16:44Speaker 2: score warns us that something is packed.
- 16:47Speaker 1: We covered how packed malware travels light with very few imports,
- 16:51Speaker 1: the box cutter at the construction site analogy, and how
- 16:54Speaker 1: specific libraries are dead giveaways.
- 16:57Speaker 2: And we walked through decompiling dot net code to find
- 16:59Speaker 2: those sloppy function names and using that freeze frame technique
- 17:02Speaker 2: to snatch secrets right out of memory.
- 17:04Speaker 1: It really covers the full spectrum. The core lesson for
- 17:07Speaker 1: me today seems to be that cryptography in malware isn't magic.
- 17:11Speaker 1: It feels like magic when you're the victim, but for
- 17:14Speaker 1: the analyst, it's just logic.
- 17:15Speaker 2: That's the key takeaway. It is just math and logic.
- 17:18Speaker 2: The malware author has a difficult problem. They have to
- 17:21Speaker 2: give the computer the key to unlock the payload, but
- 17:24Speaker 2: hide that key from us. It's a paradox. If the
- 17:27Speaker 2: computer can run it, the analyst can eventually read it.
- 17:30Speaker 1: I love it. If the computer can run it, the
- 17:31Speaker 1: analyst can read it. That's t shirt right there.
- 17:34Speaker 2: It's the golden rule of reverse engineering.
- 17:36Speaker 1: All right. I want to leave our listener with a
- 17:38Speaker 1: little challenge to test if they were listening.
- 17:41Speaker 2: Let's do it.
- 17:41Speaker 1: Okay, listener, here's your scenario. You have a suspicious file,
- 17:45Speaker 1: You run a scan and see an enter Pye score
- 17:47Speaker 1: of seven point six on a scale of zero to eight.
- 17:50Speaker 1: You also notice the file list's almost zero imports. What
- 17:54Speaker 1: does that tell you about the data inside? And why
- 17:57Speaker 1: are there so few imports?
- 17:58Speaker 2: Think about the wrapper we discussed, why would a rapper
- 18:02Speaker 2: need to be random and why would it need to
- 18:04Speaker 2: travel light?
- 18:05Speaker 1: Mull that over and any final thoughts on where this
- 18:08Speaker 1: is all going As a getting easier or harder.
- 18:11Speaker 2: It's an arms race. As our detection tools get better,
- 18:14Speaker 2: malware authors will invent new ways to hide. They might
- 18:17Speaker 2: move to cloud based keys where the key is never
- 18:19Speaker 2: even on the disc, or more complex dynamic loading. The
- 18:22Speaker 2: deep dive never really ends because the ocean keeps getting deeper.
- 18:26Speaker 1: Well that is equal parts terrifying and exciting. But hey,
- 18:29Speaker 1: that's why we're here to keep learning and keep up
- 18:31Speaker 1: with the chase. Thanks for joining us on this deep
- 18:33Speaker 1: dive into the hidden language of malware, Stay curious, stay safe,
- 18:37Speaker 1: and we'll catch you on the next one.