Latest / CyberCode Academy / Course 42 - Mobile Malware Analysis Fundamentals | Episode 14: Architecture and Essential Toolkits
Transcript
- 0:00Speaker 1: Imagine for a second that you are a well, a
- 0:03Speaker 1: digital detective.
- 0:04Speaker 2: Oh I like that visual.
- 0:05Speaker 1: Right, You're sitting in this dim room, the glow of
- 0:09Speaker 1: the monitors is lighting up your face, and on the
- 0:11Speaker 1: desk right in front of you sits this single highly
- 0:15Speaker 1: suspicious mobile.
- 0:16Speaker 2: App just waiting to be opened exactly.
- 0:18Speaker 1: I mean, maybe it looks like a harmless calculator utility,
- 0:21Speaker 1: or you know, a fun little puzzle game you'd just
- 0:24Speaker 1: download on a whim.
- 0:25Speaker 2: But you have a sinking feeling about it, Yeah.
- 0:27Speaker 1: A really bad feeling, like it's secretly scraping your contact
- 0:30Speaker 1: data or tracking your GPS location, or maybe it's hiding
- 0:35Speaker 1: malicious code that's just waiting for a command to strike.
- 0:38Speaker 2: And I mean you can't exactly just ask the app
- 0:40Speaker 2: what it's doing.
- 0:41Speaker 1: No, definitely, right, you have to completely dissect it yourself, right, And.
- 0:44Speaker 2: To perform that kind of digital surgery, you need a
- 0:50Speaker 2: highly specialized operating room, a secure lab exactly. You need
- 0:54Speaker 2: an environment where you can safely, prod poke and just
- 0:57Speaker 2: tear this thing apart without letting whatever code is inside,
- 1:01Speaker 2: you know, escape into your own.
- 1:02Speaker 1: Network, which is our exact mission for today's deep dive.
- 1:05Speaker 1: We are building a mobile malware analysis.
- 1:08Speaker 2: Lab from the ground up.
- 1:09Speaker 1: Yeah, we're going to equip you with the exact software
- 1:12Speaker 1: toolbag you need to pry open iOS and Android applications.
- 1:17Speaker 1: We'll show you how to separate the harmless code from
- 1:19Speaker 1: the real threats and understand exactly what is happening under
- 1:24Speaker 1: the hood.
- 1:25Speaker 2: And you know, building a truly secure lab means thinking
- 1:27Speaker 2: about a lot of things your hardware, like whether you
- 1:31Speaker 2: use physical test phones or virtual emulators, and of course
- 1:34Speaker 2: you're networking.
- 1:35Speaker 1: Right ensuring it's completely isolated so the malware cannot phone
- 1:38Speaker 1: home or infect your personal devices exactly.
- 1:42Speaker 2: But today our lens is focused entirely on the software
- 1:45Speaker 2: side of the equation. We are mapping out the specific
- 1:48Speaker 2: tools of the trade you need installed on your forensic workstation.
- 1:51Speaker 1: So get started. I think we have to look at
- 1:53Speaker 1: what is known as static analysis, and let's begin our
- 1:57Speaker 1: investigation on the iOS side of things.
- 1:59Speaker 2: That's good.
- 2:00Speaker 1: I'd like to think of static analysis as looking at
- 2:02Speaker 1: the architectural blueprints of a house without actually walking through
- 2:05Speaker 1: the front door.
- 2:06Speaker 2: That is a really great way to look at it.
- 2:07Speaker 1: Yeah, you are mapping out the structure, finding out where
- 2:11Speaker 1: the windows and doors are located. But you aren't like
- 2:14Speaker 1: turning on the lights, running the water, or stepping on
- 2:16Speaker 1: any potential booby.
- 2:17Speaker 2: Traps That analogy holds up perfectly. Actually, you are analyzing
- 2:22Speaker 2: the code at rest.
- 2:23Speaker 1: Right before it actually does anything.
- 2:25Speaker 2: Exactly, before you ever execute a potentially dangerous piece of software,
- 2:30Speaker 2: you absolutely must examine its static code to understand the landscape.
- 2:34Speaker 1: But on iOS, I mean, apps are compiled down into
- 2:37Speaker 1: a machine readable format.
- 2:38Speaker 2: Right, Yeah they are. You can't just read the code
- 2:40Speaker 2: like a book, so you need to pull.
- 2:42Speaker 1: The application apart and translate it back into something human readable.
- 2:45Speaker 2: Precisely, you need a disassembler.
- 2:47Speaker 1: Which brings us to a bit of a dilemma for
- 2:49Speaker 1: anyone building a lab. There are a few major disassemblers
- 2:53Speaker 1: on the market, but Ida pro is basically the industry
- 2:57Speaker 1: heavyweight champ.
- 2:58Speaker 2: Oh absolutely, it's the name everyone here is for.
- 3:00Speaker 1: But I look at the price tag for an Ida
- 3:02Speaker 1: pro license, and I mean it feels like you need
- 3:05Speaker 1: a corporate budget just to open the door.
- 3:07Speaker 2: Yeah, it is a massive financial investment. It's usually reserved
- 3:10Speaker 2: for large enterprise security teams or dedicated reverse engineering firms.
- 3:15Speaker 1: So it's overkill for an independent researcher.
- 3:18Speaker 2: Totally overkill if you're just setting up a lab on
- 3:21Speaker 2: the total opposite end of the spectrum, though, you have Gidra.
- 3:24Speaker 1: Oh right. Getra was actually developed by the NSA and
- 3:27Speaker 1: released to the public for free, wasn't it.
- 3:29Speaker 2: Yeah, completely free?
- 3:30Speaker 1: Free sounds great, but I imagine there's a catch.
- 3:33Speaker 2: The catch is definitely the user experience. I mean, Getra
- 3:36Speaker 2: is an absolute powerhouse, but in the grand scheme of
- 3:39Speaker 2: reversing tools, it's still finding its footing in the mobile.
- 3:43Speaker 1: Space and the interface.
- 3:44Speaker 2: It has a remarkably steep learning curve. If you are
- 3:48Speaker 2: just starting out, it can feel like trying to fly
- 3:51Speaker 2: a space shuttle before you've learned to drive a car.
- 3:53Speaker 1: Oh wow, okay, so where is the sweet spot for
- 3:57Speaker 1: our digital detective? Then what do we actually put in
- 3:59Speaker 1: our two.
- 4:00Speaker 2: The primary recommendation here is a tool called Hopper. It
- 4:03Speaker 2: just hits that perfect middle ground.
- 4:05Speaker 1: Popper.
- 4:05Speaker 2: Yeah, it's a highly affordable, deeply powerful and crucially for
- 4:09Speaker 2: analyzing Apple devices. You can get specific iOS scripts designed
- 4:13Speaker 2: to work seamlessly with it.
- 4:15Speaker 1: So Hopper actually understands the specific ways iOS applications.
- 4:19Speaker 2: Are structured exactly. It's tailored for it. Oh and I
- 4:22Speaker 2: should mention binary Ninja and rad Air are also solid
- 4:25Speaker 2: alternatives out there.
- 4:26Speaker 1: Good to know. Well, let's talk about that iOS structure
- 4:29Speaker 1: for a second, because there is a specific tool called
- 4:31Speaker 1: class dump that seems entirely built around it.
- 4:34Speaker 2: Oh, class dump is essential.
- 4:36Speaker 1: But why do we need a dedicated tool just to
- 4:38Speaker 1: dump classes?
- 4:40Speaker 2: Well, it has to do with how Apple applications are
- 4:43Speaker 2: historically built. iOS apps are largely written in a language
- 4:46Speaker 2: called Objective C or increasingly swift and Objective C is
- 4:51Speaker 2: an object oriented language, but unlike some languages that compile
- 4:55Speaker 2: down to pure stripped machine code, it relies on something
- 4:58Speaker 2: called run time reflection runtime reflection.
- 5:01Speaker 1: What does that mean? In practice?
- 5:03Speaker 2: It means it actually keeps a map of its own structure,
- 5:05Speaker 2: like the names of its classes, its methods, its variables,
- 5:08Speaker 2: embedded right inside the code.
- 5:09Speaker 1: Oh I see, So it literally brings its own.
- 5:11Speaker 2: Bluecrint with it precisely, and class dump simply reads that
- 5:14Speaker 2: embedded map and generates a clean text file showing you
- 5:18Speaker 2: all that underlying architecture.
- 5:19Speaker 1: That sounds incredibly useful.
- 5:21Speaker 2: It is. If you see a class named, say, use
- 5:24Speaker 2: a location tracker with a method called senda server, you
- 5:28Speaker 2: immediately know where to focus your investigation.
- 5:30Speaker 1: You don't have to guess it is the absolute best
- 5:33Speaker 1: tool for.
- 5:33Speaker 2: That specific job without a doubt.
- 5:35Speaker 1: Okay. I see another tool mentioned here called j toool,
- 5:38Speaker 1: which is framed as an upgrade to an older utility
- 5:41Speaker 1: called O tool. But if otool already analyzes object files,
- 5:47Speaker 1: why do we care about an upgrade.
- 5:48Speaker 2: That entirely comes down to cognitive load. Otool is a
- 5:52Speaker 2: classic foundational utility shore but when you run it, it
- 5:56Speaker 2: spits out an incredibly dense, unformatted wall.
- 5:58Speaker 1: Of text, just a total nightmare to read exactly.
- 6:01Speaker 2: J toool is a modern port that cleans up that output.
- 6:04Speaker 2: I mean, when you are staring at terminal screens for
- 6:06Speaker 2: eight hours a day trying to find a single anomaloust
- 6:09Speaker 2: line of code.
- 6:10Speaker 1: Formatting and readability are not just nice to have, No,
- 6:13Speaker 1: they are forensic necessities.
- 6:15Speaker 2: You will miss things if the formatting is garbage.
- 6:18Speaker 1: That makes total sense. And speaking of readability, iOS uses
- 6:22Speaker 1: a very specific file format for its executables called Maco.
- 6:26Speaker 2: Yep, Maco. It's the foundation of how Apple software runs right.
- 6:30Speaker 1: And to look at those files, we have a tool
- 6:32Speaker 1: called macko view. I assume this does something similar to
- 6:36Speaker 1: j tool, but with a graphical interface.
- 6:38Speaker 2: That's the key. Macoview gives you a clean, visual, graphical
- 6:41Speaker 2: user interface to explore those binaries.
- 6:44Speaker 1: So no command line exactly.
- 6:46Speaker 2: Instead of typing command line prompts to see different sections
- 6:49Speaker 2: of the file, you can just click through the headers,
- 6:52Speaker 2: the load commands, and the binary structure. You know, just
- 6:55Speaker 2: like navigating a regular file explore.
- 6:57Speaker 1: It makes orienting yourself inside a complex mack go file much.
- 7:00Speaker 2: More intuitive, way more intuitive.
- 7:02Speaker 1: Now, I want to bring up a tool that really
- 7:04Speaker 1: surprised me, mob SF or the Mobile Security Framework.
- 7:08Speaker 2: Ah, yes, mob SF.
- 7:10Speaker 1: Anyone who has dabbled in mobile analysis knows MOBSF as
- 7:13Speaker 1: the undisputed king of Android static analysis. It's an automated
- 7:17Speaker 1: all in one framework. It is, but apparently it's highly
- 7:20Speaker 1: recommended for iOS now as well.
- 7:22Speaker 2: Yeah, it catches a lot of people off guard because
- 7:25Speaker 2: it was so deeply associated with Android for years.
- 7:28Speaker 1: I always thought of it as just an Android tool.
- 7:30Speaker 2: Most people do. Yeah, but the developers have built out
- 7:33Speaker 2: fantastic parsing capabilities for iOS binaries.
- 7:36Speaker 1: Now, really, how does it work for iOS?
- 7:39Speaker 2: You basically feed it an iOS app and it will
- 7:41Speaker 2: automatically extract the property list files, analyze the security flags
- 7:46Speaker 2: on the binary and give you a really solid automated
- 7:49Speaker 2: initial assessment of the app security posture.
- 7:52Speaker 1: That's amazing, Just a quick to automated overview before you
- 7:55Speaker 1: dive in manually.
- 7:56Speaker 2: Exactly. It saves so much time.
- 7:58Speaker 1: Wait, I have to stop us here. We're talking about
- 8:00Speaker 1: disassembling code, mapping classes, and feeding binaries into framework. Yeah,
- 8:04Speaker 1: we've got a whole toolkit going, but Apple tightly controls
- 8:08Speaker 1: its ecosystem. If you download an app from the app Store,
- 8:11Speaker 1: it is protected by fair play DRM encryption.
- 8:15Speaker 2: Ah right, the encryption problem.
- 8:17Speaker 1: The app is completely scrambled on the hard drive. If
- 8:20Speaker 1: I pull an encrypted app off an iPhone and drop
- 8:23Speaker 1: it into Hopper, isn't it just going to look like
- 8:24Speaker 1: digital static?
- 8:26Speaker 2: Yes? That is the fundamental roadblock of iOS analysis. If
- 8:31Speaker 2: you look at the app file at rest, it is
- 8:33Speaker 2: completely unreadable. Apple's DRM ensures that.
- 8:37Speaker 1: So how can any of these static analysis tools possibly work?
- 8:40Speaker 1: I mean, we don't have Apple's mastered decryption keys.
- 8:43Speaker 2: We don't need the keys if we exploit how the
- 8:45Speaker 2: operating system itself functions.
- 8:47Speaker 1: Wait, what do you mean?
- 8:47Speaker 2: Think about it? For the iPhone to actually run the app,
- 8:50Speaker 2: the phone's processor has to be able to read the
- 8:52Speaker 2: code right right, which means at the exact moment you
- 8:55Speaker 2: tap the app icon and it launches, the iOS operating
- 8:59Speaker 2: system decrypts the code and loads it into the phone's
- 9:02Speaker 2: active memory or ram.
- 9:04Speaker 1: Oh has to unmask itself to run exactly.
- 9:07Speaker 2: And that is where a brilliant tool called Dumpty cryptied
- 9:10Speaker 2: comes into play.
- 9:10Speaker 1: How does that work?
- 9:11Speaker 2: Well, you run the app on a customized jailbroken iPhone.
- 9:15Speaker 2: When the operating system decrypts the app into memory, Dumpty
- 9:18Speaker 2: crypted steps in, pauses everything and essentially scoops that clean
- 9:22Speaker 2: unencrypted code straight out of.
- 9:24Speaker 1: The ramp, just grabs it red out of memory.
- 9:26Speaker 2: Yep, and saves into a new file on your machine.
- 9:29Speaker 2: Now you have a clean binary that you can drop
- 9:31Speaker 2: into hopper.
- 9:32Speaker 1: That is a fascinating workaround. So all right, we've mapped
- 9:36Speaker 1: the house with our static tools. We know the layout,
- 9:39Speaker 1: we have the blueprints, but blueprints won't tell you if
- 9:42Speaker 1: the pipes are going to burst when you turn on
- 9:43Speaker 1: the water. To catch malware in the act, like to
- 9:47Speaker 1: see what networks it tries to connect to or what
- 9:49Speaker 1: files it modifies, we have to actually turn it on.
- 9:52Speaker 2: Right, we are moving into dynamic analysis.
- 9:55Speaker 1: Static analysis tells you what the code might do. Dynamic
- 9:58Speaker 1: analysis tells you what the code actually do does in
- 10:00Speaker 1: real time.
- 10:01Speaker 2: But to dynamically analyze an iOS app, you have to
- 10:04Speaker 2: get it onto your test device first. Yeah, and you
- 10:07Speaker 2: can't just use the app store.
- 10:08Speaker 1: No, you have to sideload it. Sideloading is essentially tricking
- 10:12Speaker 1: the device into accepting an application that hasn't been officially
- 10:16Speaker 1: blessed by Apple servers exactly, And for that we need
- 10:19Speaker 1: a specific set of tools, things like cydia Impactor, app sync,
- 10:23Speaker 1: I Device Installer, or iOS deploy.
- 10:26Speaker 2: Yeah. Those tools handle the complex cryptographic signing requirements behind
- 10:30Speaker 2: the scenes. They allow you to push that modified or
- 10:32Speaker 2: decrypted application back onto a physical test device so you
- 10:36Speaker 2: can run it.
- 10:37Speaker 1: And doing this usually requires a jail broken device, right,
- 10:40Speaker 1: We need root access to bypass the operating system's standard protections.
- 10:44Speaker 2: Absolutely, you can't do deep dynamic analysis without a jail break.
- 10:47Speaker 1: For years, cidio was the absolute king of managing software
- 10:51Speaker 1: on jailbroken phones. But the landscape has shifted, right, Cilio
- 10:55Speaker 1: seems to be the modern standard.
- 10:57Speaker 2: Yeah, software architectures evolve in city eventually just showed its
- 11:01Speaker 2: age Celio is the newer package manager. It's actually built
- 11:05Speaker 2: off the foundations of Citia, but specifically modernized to work
- 11:08Speaker 2: on newer iOS versions and sixty four bit architectures.
- 11:12Speaker 1: So it's how you install all your underlying forensic tools
- 11:15Speaker 1: directly onto the iPhone itself.
- 11:17Speaker 2: Exactly, it's your hub.
- 11:18Speaker 1: Okay, once we have that root access and the app
- 11:20Speaker 1: is running, we need to buggers to watch it. The
- 11:22Speaker 1: two big names here are LdB.
- 11:24Speaker 2: And GDB, right the heavy hitters.
- 11:27Speaker 1: Both let you pause the app, look at the memory,
- 11:29Speaker 1: and step through the code line by line, but LdB
- 11:32Speaker 1: is heavily favored. Why choose one over the other if
- 11:35Speaker 1: they basically do the same thing.
- 11:36Speaker 2: It comes down to modern architecture support and again user experience.
- 11:41Speaker 2: LdB is the default debugger for Apple's own development ecosystem,
- 11:45Speaker 2: so it.
- 11:46Speaker 1: Just understands modern iOS funded much better.
- 11:48Speaker 2: Yes, but honestly, the biggest quality of life feature. LEDB
- 11:53Speaker 2: supports robust color coded output and deep Python scripting.
- 11:57Speaker 1: Color coding. That sounds almost trivial, and we're talking about
- 12:00Speaker 1: advanced malware analysis.
- 12:02Speaker 2: It sounds trivial until you're debugging a complex application for
- 12:05Speaker 2: six straight hours. Their point, when you're staring at terminal
- 12:08Speaker 2: windows having memory addresses in one color, executable commands in another,
- 12:13Speaker 2: and variables in a third. I mean it makes a
- 12:15Speaker 2: massive difference in cognitive.
- 12:17Speaker 1: Fatigue because GDB just gives you what monochrome text.
- 12:20Speaker 2: Yeah, traditionally just walls of monochrome text, which leads to
- 12:23Speaker 2: eyestrain and you just start missing details.
- 12:26Speaker 1: Oh. I should note there is another dynamic tool called
- 12:28Speaker 1: Reveal that exists to help visualize the app's user interface
- 12:31Speaker 1: as it runs. But it's a paid commercial tool, so
- 12:35Speaker 1: we aren't highly recommending it for someone bootstrapping a lab
- 12:38Speaker 1: from scratch.
- 12:39Speaker 2: Right, we want to focus on accessible tools that give
- 12:42Speaker 2: you the highest return on investment for your time and
- 12:45Speaker 2: for dynamic analysis, the real power comes from dynamic frameworks.
- 12:49Speaker 1: Right. Frameworks like sycrypt, Freedom, Objection, and Needle.
- 12:53Speaker 2: Those are the gold standards.
- 12:54Speaker 1: These aren't just a buggers. These let you actively inject
- 12:57Speaker 1: your own code into the malware while it's running. You
- 13:00Speaker 1: can hook into functions and change their behavior on the fly.
- 13:03Speaker 2: It's incredibly powerful.
- 13:05Speaker 1: But wait, I have to jump in here with a
- 13:06Speaker 1: massive warning for anyone setting these up.
- 13:08Speaker 2: Oh, the Python issue.
- 13:10Speaker 1: Yes, looking at the operational requirements for tools like Needle
- 13:14Speaker 1: or Objection. They are heavily, heavily reliant on Python.
- 13:17Speaker 2: They are, and that introduces a significant infrastructure risk to
- 13:21Speaker 2: your lab machine.
- 13:22Speaker 1: If you just start globally installing all these different Python
- 13:25Speaker 1: based security tools on your main operating system, you will
- 13:29Speaker 1: destroy your machine's ecosystem.
- 13:30Speaker 2: It will be a total mess.
- 13:32Speaker 1: One tool demands Python two point seven, another strictly requires
- 13:35Speaker 1: Python three. One needs version one point zero of a
- 13:38Speaker 1: specific cryptography library, and another needs version two point zero.
- 13:42Speaker 2: And if you install them all in the same place,
- 13:44Speaker 2: the dependencies just override each other. Suddenly nothing runs.
- 13:47Speaker 1: It is a harsh lesson every analyst learns. Usually the
- 13:50Speaker 1: hard way you must use Python virtual.
- 13:53Speaker 2: Environments isolate every single tool into its own self contained bubble.
- 13:57Speaker 1: It takes a few extra minutes to set up, but
- 13:59Speaker 1: it will save you days of rebuilding a corrupted lab machine.
- 14:03Speaker 2: Consider your sales warned seriously.
- 14:06Speaker 1: All right, let's shift our focus. We've spent a lot
- 14:08Speaker 1: of time dissecting Apple's walled garden. But what happens when
- 14:12Speaker 1: we jump the fence over to Android.
- 14:14Speaker 2: It's an entirely different operating system built on completely different
- 14:18Speaker 2: architectural principles.
- 14:19Speaker 1: So that means throwing out almost everything in your toolkit
- 14:22Speaker 1: and starting fresh.
- 14:23Speaker 2: Basically, yeah, yeah, you cannot use an iOS disassembler on
- 14:26Speaker 2: an Android application. They speak completely different languages, right.
- 14:29Speaker 1: Android apps are primarily built using Java or more recently Caughtlin,
- 14:34Speaker 1: and for static analysis on Android, one tool stands above
- 14:37Speaker 1: the rest as an absolute foundational powerhouse. Andro Guard.
- 14:41Speaker 2: Oh. Andro guard is fantastic because it's written in Python.
- 14:44Speaker 2: It is highly accessible for writing custom.
- 14:46Speaker 1: Scripts, which we just learned to put in a virtual
- 14:49Speaker 1: environment exactly.
- 14:51Speaker 2: But yeah, it is incredibly well maintained, deeply documented, and
- 14:55Speaker 2: packed with features specifically designed to tear apart Android application
- 14:59Speaker 2: packages commonly known as APK files.
- 15:02Speaker 1: What exactly does it do with the apk?
- 15:04Speaker 2: It maps the permissions, finds the hidden certificates and just
- 15:08Speaker 2: rips out the core code for you to look at.
- 15:10Speaker 1: But there is a unique roadblock with Android. Because Java
- 15:14Speaker 1: is a relatively well understood language, it's notoriously easy to decompile.
- 15:19Speaker 2: Right. You can turn the machine code back into readable
- 15:22Speaker 2: Java fairly easily.
- 15:23Speaker 1: And malware authors know this, so they scramble the code
- 15:26Speaker 1: before they release it.
- 15:27Speaker 2: Yes, this is the concept of obfuscation. Imagine trying to
- 15:31Speaker 2: read a novel where the author has systematically replaced every
- 15:34Speaker 2: character's name, every location, and every verb with a random,
- 15:38Speaker 2: meaningless bar.
- 15:39Speaker 1: Code that sounds impossible to read.
- 15:41Speaker 2: It is when you decompile an obfuscated app. Instead of
- 15:44Speaker 2: seeing clearly named functions like steel user password, you see
- 15:49Speaker 2: function a variable B.
- 15:51Speaker 1: It is deliberately designed to confuse the analyst and hide
- 15:54Speaker 1: the logical flow. So how do we solve the scramble?
- 15:57Speaker 1: How do we turn the barcodes back into something we
- 15:59Speaker 1: can actually?
- 16:00Speaker 2: You reach for deappuscation tools. This is where utilities like
- 16:04Speaker 2: classy shark and the class name deobfuscater become vital.
- 16:07Speaker 1: What do they do exactly?
- 16:08Speaker 2: They use pattern recognition and structural analysis to trace those
- 16:12Speaker 2: scrambled meaningless names and untangle them. They map the relationships
- 16:16Speaker 2: so you can slowly rebuild a readable structure.
- 16:19Speaker 1: All right, So once you've untangled the web, you need
- 16:21Speaker 1: to actually read the underlying logic. That's where jad x
- 16:23Speaker 1: comes in, right.
- 16:24Speaker 2: Yes, jat x is a highly reliable Java decompiler that
- 16:28Speaker 2: translates the raw Delvic byte code back into clean, readable
- 16:33Speaker 2: Java code.
- 16:34Speaker 1: But you have to be prepared for edge cases.
- 16:36Speaker 2: I assume always sometimes you aren't dealing with a standard
- 16:40Speaker 2: application file. Sometimes you pull a file off an Android
- 16:43Speaker 2: device that has been heavily optimized specifically for that device's
- 16:46Speaker 2: unique hardware runtime, so jat X can't read it, not natively.
- 16:50Speaker 1: Yeah.
- 16:51Speaker 2: To analyze those you need a specialized translation tool called
- 16:54Speaker 2: Oak two decks. It takes those highly optimized hardware specific
- 16:58Speaker 2: files and converts them back into standard dex.
- 17:00Speaker 1: Files, the generic format that JADX and androguard actually understand exactly.
- 17:05Speaker 2: You're constantly translating things back into a language your tool speak.
- 17:09Speaker 1: Now. I noticed another utility in the Android toolbag called sign.
- 17:14Speaker 1: Why do we need a cryptographics signing tool just to
- 17:17Speaker 1: look at malware?
- 17:18Speaker 2: Because of Android's internal security mechanisms. Just like iOS, Android
- 17:24Speaker 2: will flat out refuse to install an application if it
- 17:27Speaker 2: doesn't have a valid cryptographic signature.
- 17:29Speaker 1: But if you are analyzing a piece of malware, its
- 17:31Speaker 1: certificate might be expired, intentionally broken, or stripped out completely exactly.
- 17:36Speaker 2: And that's where the sign tool comes in. It allows
- 17:38Speaker 2: you to artificially inject a brand new test certificate into.
- 17:41Speaker 1: The malware, so you are basically giving the app a
- 17:44Speaker 1: fake ID.
- 17:45Speaker 2: Pretty much a fake ID which tricks the Android test
- 17:48Speaker 2: device into letting you install it.
- 17:50Speaker 1: Brilliant fake IDs for malware. Oh, I also see Android
- 17:53Speaker 1: Studio on the list I have to ask. Android Studio
- 17:56Speaker 1: is the official development software used by engineers to build apps.
- 18:00Speaker 1: Is why is a reverse engineer using a developer tool
- 18:03Speaker 1: to tear them down?
- 18:04Speaker 2: It is a fair question. While it is built for creation,
- 18:07Speaker 2: it is incredibly useful for destruction too. How so Well,
- 18:12Speaker 2: it has highly robust built in emulators, so you can
- 18:15Speaker 2: spin up fake Android phones of any size or version
- 18:18Speaker 2: in seconds.
- 18:19Speaker 1: Oh that's handy.
- 18:20Speaker 2: Very It also has incredibly powerful log viewing capabilities, which
- 18:24Speaker 2: are crucial for watching an app's behavior and deep debugging features.
- 18:28Speaker 1: But I imagine running an entire operating system emulator inside a
- 18:33Speaker 1: development environment takes a huge toll on your computer.
- 18:36Speaker 2: Oh, it is a massive resource hog. Androids Studio will
- 18:39Speaker 2: eat your machin's RAM for breakfast.
- 18:41Speaker 1: Good to know.
- 18:42Speaker 2: Yeah, if your forensic lab machine isn't heavily spessed with
- 18:44Speaker 2: a lot of memory, running Android Studio while doing other
- 18:47Speaker 2: analysis will bring your system to a grinding halt. You
- 18:50Speaker 2: have to keep a close eye on your system resources.
- 18:53Speaker 1: So we've cracked the Android code statically we've unscrambled the obfuscation. Now,
- 18:58Speaker 1: just like with iOS, we need to catch them in
- 19:00Speaker 1: the act. We need to watch it run dynamically.
- 19:02Speaker 2: And there are two main theaters of war when watching
- 19:05Speaker 2: Android malware run. What it's doing locally in the device's
- 19:09Speaker 2: memory and what is whispering over the internet.
- 19:11Speaker 1: Let's start with memory. The standout tool here is Volatility.
- 19:15Speaker 2: Volatility is just an unparalleled memory forensics framework.
- 19:19Speaker 1: How does it work?
- 19:20Speaker 2: When malware is running, it often has to decrypt its
- 19:23Speaker 2: darkest secrets, things like encryption keys for ransomware, stolen passwords,
- 19:28Speaker 2: or hidden command instructions, and it stores them temporarily in
- 19:31Speaker 2: the device's RAM to use them.
- 19:33Speaker 1: And Volatility lets you grab that.
- 19:35Speaker 2: Yeah, it allows you to dump that active memory and
- 19:37Speaker 2: search through it. It is literally like freezing time and
- 19:41Speaker 2: extracting the malware's active thoughts at that exact millisecond.
- 19:45Speaker 1: That is incredibly cool. And to interact with the app
- 19:47Speaker 1: while it runs, we also use Java specific debuggers like
- 19:50Speaker 1: ambug and jdb.
- 19:52Speaker 2: Right along with frameworks like drozer and frostmon which monitors
- 19:56Speaker 2: every single time the malware touches the file system.
- 19:58Speaker 1: And it is worth noting that free to an objection
- 20:01Speaker 1: the dynamic conjection frameworks we discuss for iOS. They work
- 20:04Speaker 1: phenomenally well on Android too, Right, they really do.
- 20:07Speaker 2: The knowledge transfers perfectly between the two platforms.
- 20:10Speaker 1: That's great, but freezing memory and watching files only tells
- 20:13Speaker 1: you half the story. Mobile malware rarely acts in isolation.
- 20:17Speaker 2: No, it is almost always designed to communicate with a
- 20:20Speaker 2: remote command and control server. It needs to send your
- 20:24Speaker 2: stolen data back to the attacker.
- 20:26Speaker 1: Who is it talking to and what data is it sending.
- 20:29Speaker 1: To figure that out, we have to intercept the network traffic.
- 20:33Speaker 1: And this is actually a beautifully cross platform skill.
- 20:36Speaker 2: It really is. The network interception techniques we use for
- 20:39Speaker 2: Android are the exact same ones we use for iOS.
- 20:42Speaker 1: Network interception is arguably the most critical and often the
- 20:45Speaker 1: most revealing part of dynamic analysis. Definitely, the heavy hitters
- 20:49Speaker 1: for this job are burp suite and mint proxy. These
- 20:53Speaker 1: are men in the middle tools, Right. I like to
- 20:55Speaker 1: think of a man in the middle attack like a
- 20:57Speaker 1: correct post office. The malware thinks it's sending a sealed
- 21:00Speaker 1: letter directly to its creator server. But we can figure
- 21:03Speaker 1: the test phone so that all of its traffic routes
- 21:06Speaker 1: through our laptop first.
- 21:07Speaker 2: So we act as the post office exactly.
- 21:10Speaker 1: We intercept the envelope, carefully open it, read the stolen
- 21:13Speaker 1: data inside, and then we can choose to pass it
- 21:16Speaker 1: along to the server to see how the server responds,
- 21:19Speaker 1: or we can just burn the letter and drop the connection.
- 21:22Speaker 2: You control the entire flow of information. You can even
- 21:25Speaker 2: modify the data before sending it along to see if
- 21:28Speaker 2: you can trick the attacker server into revealing more about itself.
- 21:31Speaker 1: It's so clever. And to capture the broader network picture,
- 21:35Speaker 1: like not just the specific HTDP traffic, but all the
- 21:38Speaker 1: raw data packets flying back and forth, you rely on
- 21:42Speaker 1: tools like wire shark, TCP dump and Charles Proxy.
- 21:45Speaker 2: Yeah, they record everything on the wire, so you have
- 21:47Speaker 2: a permanent forensic record of the exact sequence of communication.
- 21:50Speaker 1: And just for pure operational ease, it's worth having a
- 21:54Speaker 1: graphical FTP and SSH client like cyberduc installed.
- 21:57Speaker 2: Oh definitely. It just makes the constant chow or of
- 22:00Speaker 2: moving files, scripts and memory dumps back and forth between
- 22:03Speaker 2: your friends of computer and your test devices much faster.
- 22:06Speaker 1: Well, we have covered a massive amount of architectural ground today.
- 22:09Speaker 2: We really have. The big takeaway here is understanding balance
- 22:12Speaker 2: building a successful malware analysis lab isn't just about downloading
- 22:16Speaker 2: one or two magic tools. It requires carefully balancing your hardware,
- 22:21Speaker 2: ensuring your networking is fiercely isolated, and then mastering this
- 22:25Speaker 2: exact software toolbag we've just unpacked.
- 22:27Speaker 1: You need the right tool for the specific obstacle in
- 22:30Speaker 1: front of you. Exact and speaking of having the right
- 22:33Speaker 1: tool for the obstacle, let's do a quick review exercise
- 22:36Speaker 1: to reinforce how these pieces fit together for you listening
- 22:39Speaker 1: at home.
- 22:40Speaker 2: Well, let's hear the scenario.
- 22:41Speaker 1: Okay, imagine you're handed a suspicious mobile app. You've isolated
- 22:45Speaker 1: your network and you know it's an Android app, But
- 22:48Speaker 1: when you run it through androguard, the Java code is
- 22:51Speaker 1: completely scrambled. Instead of function names, you're just seeing meaningless.
- 22:55Speaker 2: Letters barcode analogy exactly.
- 22:58Speaker 1: Based on what we discussed, which too tools are you
- 23:00Speaker 1: going to reach for first to unscramble those class names?
- 23:03Speaker 2: Think back to how we translate that barcode back into English.
- 23:07Speaker 1: The answer is classy shark and the class name dubfusekater.
- 23:11Speaker 1: Those are your go to tools for untangling the obfuscation
- 23:14Speaker 1: web and getting back to readable logic.
- 23:16Speaker 2: Spot on.
- 23:17Speaker 1: So We've outlined the ultimate digital detective toolkit, but I
- 23:21Speaker 1: want to leave you with a final, somewhat provocative thought.
- 23:24Speaker 2: Tom all over, Okay, I'm listening.
- 23:27Speaker 1: We spend a lot of time today talking about workarounds.
- 23:30Speaker 1: We talked about sideloading, jail breaking, faking certificates, and bypassing
- 23:34Speaker 1: encryption just to make these analysis tools function.
- 23:38Speaker 2: Right, jumping through all those oops.
- 23:40Speaker 1: But Apple and Google are constantly, relentlessly updating their mobile
- 23:45Speaker 1: operating systems to block these exact techniques, always in the
- 23:50Speaker 1: name of user security, which.
- 23:51Speaker 2: Begs a really difficult question.
- 23:53Speaker 1: Who is really winning the arms race? Is it the
- 23:56Speaker 1: security researcher is trying to build these labs to understand
- 23:59Speaker 1: the threats and protect or is.
- 24:00Speaker 2: The increasingly lock down nature of these mobile ecosystems actually
- 24:05Speaker 2: benefiting the malware authors exactly?
- 24:08Speaker 1: Are these strict os protections just giving attackers dark encrypted
- 24:11Speaker 1: corners to heiden where researchers can't easily follow.
- 24:14Speaker 2: That's a scary thought.
- 24:15Speaker 1: It's that dim room again. You have the malicious app
- 24:18Speaker 1: on the desk, you have your complete toolbag ready to go.
- 24:21Speaker 1: The real question is will the phone's own security system
- 24:24Speaker 1: even let you open it? Think about that the next
- 24:27Speaker 1: time your device insists on a mandatory security update.