Latest / CyberCode Academy / Course 5 - Full Mobile Hacking | Episode 8: Technical Check for Mobile Indicators of Compromise using ADB and Command Line
Transcript
- 0:00Speaker 1: You know, it's kind of wild how much our phones
- 0:02Speaker 1: know about us these days. They're not just for calls anymore, right,
- 0:05Speaker 1: They've got our location, our photos, bank details, even our
- 0:09Speaker 1: private messages everything.
- 0:10Speaker 2: Oh. Absolutely, they're like little digital vaults holding incredibly sensitive data.
- 0:15Speaker 2: And well that makes them huge targets. So the question
- 0:17Speaker 2: is what happens when someone actually manages to break in?
- 0:20Speaker 1: Yeah, and we're not talking about some obvious virus warning
- 0:24Speaker 1: popping up. We mean something hidden.
- 0:27Speaker 2: Exactly, something stealthy. Today we're going to dig deep into
- 0:31Speaker 2: the technical breadcrumbs, the digital fingerprints left behind when an
- 0:36Speaker 2: Android device gets compromised.
- 0:37Speaker 1: These are the indicators of compromise or IOCs, right, the
- 0:41Speaker 1: subtle signs that tell you something's wrong under the hood.
- 0:43Speaker 2: That's the term. And our goal here is to kind
- 0:46Speaker 2: of equip you, the listener, with the know how to
- 0:49Speaker 2: act like a digital detective, to look beyond the shiny
- 0:52Speaker 2: interface and see what the operating system is really doing.
- 0:55Speaker 1: So finding activity that definitely shouldn't be there. But how
- 0:58Speaker 1: do you even start. You can't just trust what you
- 1:01Speaker 1: see on the screen.
- 1:02Speaker 2: I guess precisely. Malware is designed to hide. So we
- 1:06Speaker 2: need a way to bypass the normal user view and
- 1:09Speaker 2: talk directly to the device's core. We need essentially a
- 1:12Speaker 2: trusted back channel.
- 1:13Speaker 1: Okay, a back channel. How do we establish that?
- 1:16Speaker 2: Will use something called the Android debug Bridge or ADB.
- 1:19Speaker 2: Think of it as a well, a secure pipeline between
- 1:22Speaker 2: the phone and a separate computer you trust. Developers use
- 1:26Speaker 2: it all the time, but it's also a crucial tool
- 1:28Speaker 2: for forensic investigation.
- 1:29Speaker 1: Right ADB, and getting that set up involves enabling some
- 1:32Speaker 1: special settings on the phone itself, usually tucked away, and
- 1:36Speaker 1: developer options before you physically connect it.
- 1:38Speaker 2: Yes, exactly. That initial setup is key because once you
- 1:41Speaker 2: have that ADB connection, you gain some pretty powerful access.
- 1:46Speaker 1: What kind of access are we talking about.
- 1:47Speaker 2: We're talking about shell access. Once connected, you run a command,
- 1:50Speaker 2: a typically add shell, and that drops you right into
- 1:54Speaker 2: a command line interface. You're no longer dealing with icons
- 1:56Speaker 2: and menus. You're talking directly to the Linux kernel underneath Android.
- 2:00Speaker 1: Okay, so we've used ADB, We're in the shell. We're
- 2:03Speaker 1: past the graphical layer. Where does our detective work begin.
- 2:06Speaker 1: What's the first thing we look for.
- 2:08Speaker 2: Well, like any good investigation, you start with the exits
- 2:12Speaker 2: and entrances. You check the network. We need to ask
- 2:15Speaker 2: the phone, who are you talking to right now? Especially
- 2:18Speaker 2: when I'm not actively using an app?
- 2:20Speaker 1: Makes sense? Find out if it's making secret calls? What
- 2:23Speaker 1: command tells us that?
- 2:24Speaker 2: The command is netstat running netstat gives you a list
- 2:27Speaker 2: of all the current network connections incoming, outgoing everything. It
- 2:31Speaker 2: shows the local address, the foreign address that's connected to,
- 2:34Speaker 2: and the port numbers being used.
- 2:35Speaker 1: Okay, netstat, So if I run that on my phone
- 2:38Speaker 1: right now, what's normal and what screams compromise?
- 2:42Speaker 2: Normal looks like connections to you know, Google services, maybe
- 2:45Speaker 2: your email provider, perhaps your carrier servers. You'll see recognizable
- 2:49Speaker 2: names or IP addresses, and these connections usually happen over
- 2:52Speaker 2: standard ports like eighty for HGTP or four four three
- 2:56Speaker 2: for HGTPS secure web traffic.
- 2:57Speaker 1: Right, standard stuff.
- 2:59Speaker 2: The big flag ushing red light is when you see
- 3:01Speaker 2: an established connection, meaning it's active right now, going to
- 3:05Speaker 2: a strange foreign address and IP you don't recognize, and crucially,
- 3:10Speaker 2: if that connection is using a weird non standard port number.
- 3:14Speaker 1: Okay, that's where this idea of a reverse shell often
- 3:17Speaker 1: comes up, doesn't it? Can you break that down? Why
- 3:19Speaker 1: is that connection method so significant? Yeah?
- 3:21Speaker 2: Absolutely, so normally you connect out to a server to
- 3:24Speaker 2: get information, a reverse shell flips that the compromised device
- 3:28Speaker 2: initiates the connection outbound to the attacker's waiting server.
- 3:32Speaker 1: Ah, so the phone calls the hacker, not the other
- 3:34Speaker 1: way around exactly.
- 3:35Speaker 2: It creates this persistent tunnel allowing the attacker ongoing control
- 3:40Speaker 2: or a channel to siphon data from the device back
- 3:43Speaker 2: to their system.
- 3:44Speaker 1: And they often use specific unusual ports for.
- 3:46Speaker 2: This very often, especially with common hacking tools like metasploit.
- 3:50Speaker 2: The attacker might set up their listener on say port
- 3:53Speaker 2: four four four four. If you run netstat and see
- 3:55Speaker 2: an established connection going out to some random IP on
- 3:58Speaker 2: port four four four four four, it's about as close
- 4:00Speaker 2: to a smoking gun as you can get in this
- 4:02Speaker 2: kind of analysis.
- 4:03Speaker 1: Because port four four four isn't used for regular web
- 4:06Speaker 1: browsing or email or anything typical. It's like finding a
- 4:09Speaker 1: hidden door in your house.
- 4:10Speaker 2: Precisely. It strongly suggests that data is being actively exfltrated
- 4:14Speaker 2: or the attacker has live command line access through that tunnel.
- 4:18Speaker 2: It's a major indicator of compromise.
- 4:20Speaker 1: Okay, IOC number one Suspicious outbound established connections, especially on
- 4:26Speaker 1: weird ports like four four forty four. Got it, So
- 4:30Speaker 1: we've checked the network parameter. What's next We move inside
- 4:34Speaker 1: the device itself exactly.
- 4:35Speaker 2: Now we need to see who's actually doing things inside.
- 4:38Speaker 2: We look at the running processes and the users associated
- 4:41Speaker 2: with them.
- 4:41Speaker 1: How do we get that list?
- 4:42Speaker 2: There are a couple of useful commands. TOP gives you
- 4:44Speaker 2: a dynamic, real time view of the processes using the
- 4:47Speaker 2: most CPU or memory. It's good for seeing what's active
- 4:50Speaker 2: right now, or for a full static snapshot of everything running.
- 4:54Speaker 2: You use PSSSA that lists all processes.
- 4:57Speaker 1: Okay, TOP or PSSAA. When we look at that output,
- 5:00Speaker 1: what are we focusing on? Let's start with the users
- 5:02Speaker 1: running these processes.
- 5:03Speaker 2: Right, you'll see processes run by users like Route or system.
- 5:07Speaker 2: Those are the high privileged system accounts. That's generally expected
- 5:10Speaker 2: for core OS functions, but modern Android is built on sandboxing.
- 5:15Speaker 2: Every app you download usually gets its own unique, low
- 5:18Speaker 2: privileged user ID to keep it isolated. These often look
- 5:22Speaker 2: quite generic, something like a use zero, A one thirty
- 5:25Speaker 2: four or similar.
- 5:26Speaker 1: So seeing a process run by user oway one three
- 5:28Speaker 1: four isn't automatically bad if it's like my weather app.
- 5:32Speaker 2: Correct, that's normal sandboxing the problem arises, and this leads
- 5:36Speaker 2: us to IOC number two. When you see one of
- 5:38Speaker 2: these application specific user IDs like Uzera one, three four,
- 5:41Speaker 2: running something it absolutely shouldn't be running.
- 5:44Speaker 1: And what's the prime example of something it shouldn't be running,
- 5:46Speaker 1: a shell.
- 5:47Speaker 2: Or maybe a terminal, you need to scan that process
- 5:49Speaker 2: list very carefully. If you see a process named bash
- 5:53Speaker 2: shell or something similar and it's being run not by
- 5:56Speaker 2: root or system during boot up, but by a user
- 5:58Speaker 2: ID associated with a downloaded app, that is extremely suspicious.
- 6:02Speaker 1: Why what does that imply?
- 6:04Speaker 2: Think about it? Why would a normal mobile app, a game,
- 6:08Speaker 2: a social media client, whatever, need to run its own
- 6:12Speaker 2: command line interpreter in the background, hidden from view.
- 6:15Speaker 1: It wouldn't. That sounds like someone else is using that
- 6:18Speaker 1: shell exactly.
- 6:19Speaker 2: It strongly implies that the attacker who delivered the malicious
- 6:22Speaker 2: app has gained interactive command line access through that app's
- 6:25Speaker 2: permissions and user ID. They've essentially got a remote terminal
- 6:29Speaker 2: running on your phone. They can type commands, steal files,
- 6:33Speaker 2: turn on the mic, get your location, all through that
- 6:35Speaker 2: hidden shell process.
- 6:37Speaker 1: Wow. Okay, so IOC two is an unexpected user like
- 6:40Speaker 1: one of those UIDs running a shell process that's a
- 6:44Speaker 1: huge indicator of active compromise, a.
- 6:46Speaker 2: Very definitive one. It means they're not just passively stealing data,
- 6:49Speaker 2: they likely have active real time control.
- 6:52Speaker 1: All right, so we've checked network connections, we've checked for
- 6:55Speaker 1: a suspicious users running shells. What's the third major IOC
- 6:58Speaker 1: we can find using these process from PCAs.
- 7:01Speaker 2: The third one is looking at the actual names of
- 7:03Speaker 2: the processes or application packages themselves. Sometimes attackers are lazy
- 7:08Speaker 2: or they're using standard tools, and the malware process doesn't
- 7:11Speaker 2: even try that hard to hide.
- 7:13Speaker 1: Its name, so you might just see something blatantly malicious
- 7:16Speaker 1: in the list.
- 7:17Speaker 2: You might while sophisticated attackers might try to disguise their
- 7:20Speaker 2: payload as you know, system update or something innocuous. Quite often,
- 7:25Speaker 2: especially with widespread tools, the process name gives the game away.
- 7:29Speaker 1: Can you give a specific example something that leaves no doubt.
- 7:32Speaker 2: Absolutely If you're scanning the process list from PSAA and
- 7:35Speaker 2: you see a package name like calm dot, metasploit, dot.
- 7:39Speaker 1: Stage, metasploit, that's a well known penetration testing framework often
- 7:43Speaker 1: use for well hacking.
- 7:45Speaker 2: Exactly, Seeing colm dot, metasplit, dot stage or anything containing
- 7:49Speaker 2: metasploit or interpreter, which is its payload component is undeniable proof.
- 7:52Speaker 2: It means a payload generated by that specific framework is
- 7:55Speaker 2: running on the device. There's no ambiguity there. That's IOC
- 7:59Speaker 2: number three, a process name clearly linked to a known
- 8:02Speaker 2: hacking tool or framework.
- 8:04Speaker 1: Okay, so let's recap the three big technical IOCs we
- 8:07Speaker 1: can hunt for using add in shell commands. One suspicious
- 8:12Speaker 1: outbound network connections, especially establish ones on unusual ports like
- 8:16Speaker 1: forty four to forty four, found using netstat. Two an
- 8:21Speaker 1: unexpected user ID like USERA one three four running a
- 8:25Speaker 1: background shell or terminal process found using top or PSA
- 8:29Speaker 1: double check. And three finding processes with names that directly
- 8:32Speaker 1: reference known hacking tools like comm dot, metasploit, dot Stage
- 8:36Speaker 1: also in the PSA list.
- 8:38Speaker 2: You got it. Those three are powerful indicators you won't
- 8:41Speaker 2: typically find with just a standard antivirus scan.
- 8:43Speaker 1: Why is this ADB based forensic approach so important? Why
- 8:47Speaker 1: can't we just rely on, say, security apps from the
- 8:49Speaker 1: app store.
- 8:50Speaker 2: Well, it goes back to how this kind of malware
- 8:51Speaker 2: often gets delivered. Attackers are clever. They'll wrap their malicious
- 8:55Speaker 2: payload the reverse shell, the spyware inside an app that
- 8:57Speaker 2: looks legitimate or desirable, maybe a game, a utility. Anything.
- 9:01Speaker 2: You download the app granted some permissions, and the malicious
- 9:04Speaker 2: part starts running quietly in the background. It might not
- 9:08Speaker 2: drop easily detectable files. It exists mainly as a running
- 9:12Speaker 2: process making network connections or waiting for commands via that
- 9:16Speaker 2: hidden shell.
- 9:18Speaker 1: So a file based scanner might miss it because the
- 9:20Speaker 1: initial app package might look clean or be heavily obfuscated exactly.
- 9:25Speaker 2: But the behavior the network connection on port four four
- 9:28Speaker 2: four four, the background shell process that's much harder to
- 9:31Speaker 2: hide from the operating system itself. Using ADB and commands
- 9:35Speaker 2: like netstat and PS forces the OS to show you
- 9:38Speaker 2: what's actually happening in real time bypassing the malware's attempts
- 9:42Speaker 2: at concealment.
- 9:43Speaker 1: That makes a lot of sense. It's about looking at
- 9:45Speaker 1: the live activity, not just static.
- 9:46Speaker 2: Files precisely, and catching these things is critical because once
- 9:49Speaker 2: that reverse shell is established, the attacker often gets near
- 9:52Speaker 2: instant access to everything SMS, location, MIC, camera files. It's
- 9:57Speaker 2: total compromise.
- 9:58Speaker 1: So this kind of deep dive is really essential for
- 10:00Speaker 1: detecting these more advanced hidden threats.
- 10:02Speaker 2: It really is. It gives you a much clearer picture
- 10:05Speaker 2: of the device's true state.
- 10:06Speaker 1: Okay, this has been incredibly insightful. So to wrap things
- 10:09Speaker 1: up and make sure this sticks, let's pose a quick
- 10:11Speaker 1: review question for you, the listener. Good idea.
- 10:14Speaker 2: Let's say you're doing this check, you run netstat and
- 10:16Speaker 2: you find that established connection out to a weird IP
- 10:19Speaker 2: address on port four four four four. But then you
- 10:22Speaker 2: check the process list with PSA, and the process making
- 10:26Speaker 2: that connection has a really innocent sounding name like calm
- 10:29Speaker 2: dot Android dot system update. Why should you still consider
- 10:33Speaker 2: that device almost certainly compromised?
- 10:35Speaker 1: Think about what that port forty four to four to
- 10:37Speaker 1: four connection signifies, regardless of the process name attached to it.
- 10:41Speaker 1: The answer really lies in understanding the nature of that
- 10:44Speaker 1: abnormal network behavior itself. It's the tunnel, the unexpected outbound
- 10:49Speaker 1: call on a hacker's preferred channel that provides the strongest evidence,
- 10:52Speaker 1: even if they've tried to disguise the process name.
- 10:55Speaker 2: Absolutely trust the network behavior in that case. Now you've
- 10:58Speaker 2: got a solid grounding and how to start looking for
- 11:00Speaker 2: those hidden threats.