Latest / CyberSecurity Summary / The Art of Mac Malware, Volume 2: Detecting Malicious Software
Transcript
- 0:00Speaker 1: Welcome to the deep Dive. Today, we're plunging into a
- 0:03Speaker 1: stack of sources focused on a genuinely fascinating and critical topic,
- 0:09Speaker 1: how security tools can programmatically detect mego s malware.
- 0:13Speaker 2: That's right, you've shared excerpts from the Art of Mac Malware,
- 0:17Speaker 2: which really gets deep into the technical underpinnings. You know
- 0:21Speaker 2: how security software spots malicious activity IMAX, often at a
- 0:25Speaker 2: very low level.
- 0:26Speaker 1: Think of this as your shortcut. Really, our mission is
- 0:29Speaker 1: to pull out the most important insights from these pages.
- 0:32Speaker 1: We want to help you understand what makes Mac malware
- 0:34Speaker 1: tick and critically, how tools can find it, even the
- 0:38Speaker 1: nie stuff.
- 0:39Speaker 2: Exactly getting to the core knowledge without you having to
- 0:41Speaker 2: weighe through every line of code yourself.
- 0:43Speaker 1: It's about moving beyond just like lists of known threats.
- 0:47Speaker 2: Right, understanding the fundamental mechanics of detection.
- 0:49Speaker 1: Okay, let's unpack this. So the first big challenge you hit,
- 0:52Speaker 1: maybe the most fundamental one, is the flaw and traditional
- 0:55Speaker 1: signature based detection.
- 0:57Speaker 2: Absolutely scanning for known malicious bites as it's efficient, sure
- 1:01Speaker 2: for malware you've already seen.
- 1:03Speaker 1: But the drawback is huge massive.
- 1:05Speaker 2: It completely fails against anything new, unique, or even just
- 1:09Speaker 2: slightly tweaked.
- 1:10Speaker 1: And you see this play out perfectly with that fruitfly
- 1:12Speaker 1: example from the material. Oh yeah, this thing spied on
- 1:15Speaker 1: people for what over a decade, completely undetected.
- 1:19Speaker 2: Just because no signature existed for it. Yet it was
- 1:22Speaker 2: actively using mics and webcams, which.
- 1:24Speaker 1: Is an incredibly observable behavior, right, even if the code
- 1:28Speaker 1: bytes were unknown.
- 1:29Speaker 2: Exactly behavior.
- 1:30Speaker 1: So the core idea here, the real shift is understanding
- 1:33Speaker 1: that all malware doesn't matter how new or stealthy it is,
- 1:36Speaker 1: it has to interact with the system somehow.
- 1:39Speaker 2: It has to leave a trace. These interactions generate events.
- 1:43Speaker 1: Things like spawning processes, accessing files.
- 1:45Speaker 2: Connecting to networks.
- 1:46Speaker 1: Yeah, all observable, and these behaviors they often reflect the
- 1:50Speaker 1: malware's goals right directly.
- 1:52Speaker 2: Adwaar messes with your browser, a back door opens, a
- 1:55Speaker 2: listening port. Anything wanting persistence must modify this system.
- 2:00Speaker 1: Somehow, writing files, changing settings.
- 2:02Speaker 2: Precisely, and programmatically detecting those behaviors. That's where the real
- 2:07Speaker 2: power in modern detection lies.
- 2:09Speaker 1: So if behavior is the key, then a logical starting
- 2:12Speaker 1: point is looking at what's running right now on the system.
- 2:15Speaker 2: Makes sense. Most Mac malware tends to run as a standalone.
- 2:19Speaker 1: Process, So analyzing the info, the metadata about these processes
- 2:24Speaker 1: is a great first step, definitely. One simple technique highlighted
- 2:27Speaker 1: is just looking for hidden files or directories in the
- 2:30Speaker 1: process's path.
- 2:31Speaker 2: You know, the leading dot trick. Malware loves hiding things
- 2:34Speaker 2: that way. What legitimate apps almost never benign system stuff
- 2:38Speaker 2: user apps, They just don't hide their main executable path
- 2:42Speaker 2: like that. So finding a process running from a dot path,
- 2:45Speaker 2: that's a really strong heuristic, a good early flag.
- 2:49Speaker 1: You can also pull out the run time arguments, like
- 2:51Speaker 1: what command line options were used when it launched.
- 2:54Speaker 2: And these can screen what a process is up to.
- 2:56Speaker 2: The calendar two ad example is just perfect right, looked legit,
- 2:59Speaker 2: but but when it launched its hidden cryptomnor xmr stack.
- 3:03Speaker 2: The arguments literally mentioned monarow and a mining pool address.
- 3:07Speaker 2: Hard to miss.
- 3:08Speaker 1: Yeah, not exactly subtle.
- 3:10Speaker 2: Even just having unusually long or complex arguments for a
- 3:14Speaker 2: simple looking app can be suspicious in itself.
- 3:17Speaker 1: Okay, what about process hierarchies. The parent child relationship.
- 3:21Speaker 2: Also crucial helps you trace the chain of execution. How
- 3:25Speaker 2: did this thing actually start?
- 3:27Speaker 1: Because sometimes the malware gets launched by something else.
- 3:29Speaker 2: Exactly and the source points out some simple ways to
- 3:32Speaker 2: get the parent process ID. They often just point back
- 3:35Speaker 2: to launched, the main system launcher, which isn't that helpful.
- 3:39Speaker 1: Sometimes ah okay, But using the.
- 3:41Speaker 2: More specific Application Services APIs things like get process for
- 3:45Speaker 2: PD with process serial numbers. That gives you the true
- 3:49Speaker 2: user level of parent.
- 3:50Speaker 1: So you'd see finder or the dock launching calculator for instance,
- 3:53Speaker 1: precisely or spotlight.
- 3:55Speaker 2: You get the real origin, which is vital context.
- 3:58Speaker 1: You mentioned launched. Can you get infodirectly from it too? Oh?
- 4:01Speaker 2: Yeah. Launch keeps a ton of details about running processes.
- 4:04Speaker 2: You can programmatically query it and parse out key value
- 4:07Speaker 2: pairs looking for suspicious settings or properties.
- 4:10Speaker 1: And another technique mentioned is programmatically running command line tools
- 4:14Speaker 1: like automating what an analyst might do manually.
- 4:16Speaker 2: Exactly, using something like the NS task API m code,
- 4:20Speaker 2: n S task.
- 4:21Speaker 1: That's Apple's way to run external commands, right.
- 4:24Speaker 2: So you can automate running say vmap to see what
- 4:27Speaker 2: libraries a process is loaded into memory, or LSOLF to
- 4:30Speaker 2: list its open files and network connections.
- 4:32Speaker 1: We saw that trojanized I term example earlier. Vmap could
- 4:35Speaker 1: spot that weird library.
- 4:37Speaker 2: Load absolutely, or LSoft could show you unexpected network sockets
- 4:41Speaker 2: opened by a process, very powerful for dynamic analysis.
- 4:45Speaker 1: The source also mentions getting file descriptors using proppit info.
- 4:48Speaker 2: Yes, file descriptors are how processes handle files, network sockets pipes.
- 4:53Speaker 2: By filtering for the network types like afinet for IPv
- 4:56Speaker 2: four or a finet six for IV six.
- 4:58Speaker 1: You can find open network connections.
- 5:00Speaker 2: And extract the local and remote IP addresses. The ports
- 5:03Speaker 2: basically map out as network activity.
- 5:05Speaker 1: And you can even figure out the architecture Intel, Apple, Silicon.
- 5:08Speaker 2: Yeah, programmatically check if it's native or running translated under Rosetta.
- 5:13Speaker 2: All this process info builds a really rich picture.
- 5:16Speaker 1: Okay, so that's looking at live processes. What about analyzing
- 5:19Speaker 1: the actual files the executables before they run static analysis? Right?
- 5:23Speaker 2: Static analysis is inspecting the bleed print the binary file
- 5:27Speaker 2: itself without running it. It's different from dynamic analysis where
- 5:30Speaker 2: you watch it run.
- 5:31Speaker 1: And this static look can reveal a lot.
- 5:33Speaker 2: Definitely. You can see its direct dependencies, the shared libraries
- 5:36Speaker 2: it links against, so you.
- 5:38Speaker 1: Know what system capabilities it intends to use.
- 5:41Speaker 2: Exactly that trojanized I term against. Statically parsing it show
- 5:46Speaker 2: that suspicious link to lib crypto using a relative path
- 5:49Speaker 2: inside the app bundle not typical.
- 5:52Speaker 1: You can also pull out symbols like function names YEP.
- 5:55Speaker 2: The names of functions and APIs inside the binarya that
- 5:58Speaker 2: it calls. These can really give away its purpose.
- 6:00Speaker 1: So if you see function names related to network sockets
- 6:03Speaker 1: or key logging, big.
- 6:05Speaker 2: Red flag using a tool like MM on malware like
- 6:08Speaker 2: DAZZLESFI can show you functions clearly related to its malicious activities.
- 6:12Speaker 2: You can even do programmatic introspection to explore properties within
- 6:15Speaker 2: the code.
- 6:16Speaker 1: Static analysis can also spot packers right mm hmm malware
- 6:20Speaker 1: trying to hide its code.
- 6:21Speaker 2: It can sometimes packers leave obvious clues like section names.
- 6:26Speaker 2: The IP store malware had that up xdeast section pretty
- 6:29Speaker 2: clear giveaway it was packed with UPX.
- 6:31Speaker 1: But I guess malware authors could just rename that section.
- 6:34Speaker 2: Oh absolutely, custom packers modified ones, they won't have those
- 6:37Speaker 2: obvious names. Name based detection.
- 6:40Speaker 1: Is brittle, So how else do you detect packing?
- 6:43Speaker 2: Entropy? Calculation is a good alternative. Packed code is usually compressed.
- 6:47Speaker 1: Or encrypted, which makes it look more random.
- 6:50Speaker 2: Exactly, it increases the randomness the entropy. You can measure
- 6:54Speaker 2: this programmatically, and if a binaries code section has anomalously
- 6:58Speaker 2: high entropy compared to typical piled code, it's a strong
- 7:01Speaker 2: sign it might be packed.
- 7:02Speaker 1: Okay, shifting gear slightly. Code signing, how does that fit in?
- 7:06Speaker 2: Code signing is absolutely vital on macOS. It helps security
- 7:09Speaker 2: tools reduce false positives. If something is properly signed by
- 7:13Speaker 2: a trusted developer.
- 7:14Speaker 1: You're less likely to flag it just because it does
- 7:16Speaker 1: something slightly unusual.
- 7:18Speaker 2: Right, and it confirms the software hasn't been tampered with
- 7:20Speaker 2: since it was signed. Apple System's pretty.
- 7:22Speaker 1: Robust here, but malware authors try to get around it
- 7:26Speaker 1: using maybe fake certificates or stolen ones.
- 7:28Speaker 2: They do ad hoc signing, fraudule inserts, yeah, stolen developer IDs, Yeah,
- 7:34Speaker 2: we see it all. But here's a really interesting point
- 7:36Speaker 2: from the source. Okay, malware is rarely notorized. Notorization is
- 7:41Speaker 2: that extra step where developers submit their app to Apple
- 7:44Speaker 2: before distributing it.
- 7:45Speaker 1: Apple scans it for malware.
- 7:46Speaker 2: The scan it, so if an app is notorized, it's
- 7:49Speaker 2: past that check it's highly likely to be benign. Malware
- 7:53Speaker 2: authors generally can't or won't go through that notorization process,
- 7:57Speaker 2: so lack.
- 7:58Speaker 1: Of notorization isn't proof of malice, but having notorization is
- 8:01Speaker 1: a strong sign of legitimacy, a.
- 8:03Speaker 2: Very strong signal yes. And you can check all this
- 8:05Speaker 2: programmatically using Apple's built in security frameworks, the secypis so
- 8:09Speaker 2: your tool.
- 8:10Speaker 1: Can automatically check is it signed, is the cert valid?
- 8:13Speaker 1: Is it revoked?
- 8:14Speaker 2: Is it notarized exactly? You can automate what the code
- 8:17Speaker 2: design command line tool does detect if something like evil
- 8:20Speaker 2: Quest is unsigned or if Creative Update certificate was revoked.
- 8:23Speaker 1: And you can specifically check if it's signed by Apple itself.
- 8:27Speaker 2: Yeah, using the anchor Apple requirement string crucial for verifying
- 8:31Speaker 2: that core system components haven't been tampered with or replaced.
- 8:34Speaker 1: All right, So beyond analyzing the code or the process,
- 8:36Speaker 1: malware needs to stick around.
- 8:38Speaker 2: Persistence the fundamental goal for most threats, yeah, surviving a reboot,
- 8:43Speaker 2: and to do that it has to modify the system
- 8:46Speaker 2: in some detectable way.
- 8:47Speaker 1: These modifications leave footprints, like.
- 8:49Speaker 2: What common mechanisms are launch agents and launched demons. These
- 8:53Speaker 2: use configuration files plists in specific system folders like.
- 8:57Speaker 1: That dazzles by example, pretending to be software update exactly.
- 9:02Speaker 2: Others include browser extensions injecting dynamic libraries dlibs, into legitimate
- 9:07Speaker 2: processes adding log in items.
- 9:09Speaker 1: The source goes into detail on the background Task Management
- 9:12Speaker 1: subsystem BTM. That's Apple's internal thing.
- 9:14Speaker 2: Yeah, it manages certain types of persistent items storing info
- 9:17Speaker 2: in a database file. You can dump it manually with
- 9:20Speaker 2: cephal tool dumptium, but programmatically.
- 9:22Speaker 1: You can get fancier right.
- 9:24Speaker 2: Security tools can actually load the BTM damon's code dynamically,
- 9:28Speaker 2: open access its internal functions, read and de serialize that
- 9:31Speaker 2: database file directly, and enumerate all the registered items. Find
- 9:35Speaker 2: that ones.
- 9:36Speaker 1: Getting details like the path, the developer.
- 9:39Speaker 2: Id tmid how it runs. Yeah, and the.
- 9:41Speaker 1: Knock knock tool is mentioned as doing this comprehensively.
- 9:44Speaker 2: Knock Knock is a great example. It uses various plugins, checks, BTM,
- 9:48Speaker 2: browser extensions, dillib hijacks, log in items, a whole lot
- 9:51Speaker 2: more to try and find everything set to run automatically, and.
- 9:54Speaker 1: It shows you the critical details for each item path,
- 9:57Speaker 1: hash's signature status.
- 9:59Speaker 2: Virus total results. The plist file involves signing status. If
- 10:03Speaker 2: flagg windtail is a malicious login item, show dazzle spy
- 10:07Speaker 2: as unsigned. Really useful for an analyst or a tool?
- 10:10Speaker 1: What about bypassing these checks malware tries that too, right,
- 10:13Speaker 1: always a.
- 10:13Speaker 2: Cat and mouse game. One simple bypass mentioned is just
- 10:16Speaker 2: running cell tool reset BTM.
- 10:18Speaker 1: Wipes the BTM database, clean clears.
- 10:20Speaker 2: The database, stops alerts until the next reboot. But you
- 10:23Speaker 2: can detect that specific behavior using Apple's Endpoint Security framework.
- 10:28Speaker 2: You monitor for process executions at seven TPU dexic and
- 10:32Speaker 2: if you see seven to fel tool running with the
- 10:34Speaker 2: reset BTM argument, you can block it. You can deny
- 10:37Speaker 2: the execution right there, prevent the bypass clever.
- 10:40Speaker 1: What about the other bypass sending a stop signal?
- 10:43Speaker 2: Sending sig stop to the BTM agent process itself just
- 10:47Speaker 2: pauses it stops it from reporting.
- 10:49Speaker 1: And endpoint security can catch that too.
- 10:51Speaker 2: Yep. Endpoint security has events related to signal delivery. You
- 10:55Speaker 2: can monitor for signals targeting critical security processes like the
- 10:58Speaker 2: BTM agent and block them.
- 11:00Speaker 1: So snapshots are good, persistence checks are good, but you
- 11:03Speaker 1: really need continuous real time monitoring.
- 11:06Speaker 2: Absolutely essential to catch things as they happen.
- 11:09Speaker 1: One source for this is the system log.
- 11:12Speaker 2: Huge amount of data in the unified log. Now there
- 11:14Speaker 2: aren't public APIs for efficiently streaming it in real time,
- 11:18Speaker 2: but reverse engineering the log stream command reveals private APIs
- 11:22Speaker 2: you could use programmatically okay, and crucially you can apply
- 11:25Speaker 2: filters predicates to only get the log messages you care.
- 11:28Speaker 1: About, like only messages about webcam access.
- 11:31Speaker 2: It's exactly filter for the core media IO subsystem. Maybe
- 11:35Speaker 2: specific strings like cmio extension property device control PID which
- 11:39Speaker 2: indicates hardware access, then pull out the process ID, path,
- 11:43Speaker 2: et cetera from the log message. Oversight uses this method.
- 11:47Speaker 1: Network monitoring too, continuously using the network extension framework.
- 11:52Speaker 2: Right. Network extension is key for host based monitoring because
- 11:55Speaker 2: it tells you which process is making the connection. Using
- 11:58Speaker 2: APIs like endstat manager Create, you get callbacks with network
- 12:02Speaker 2: statistics and connection info.
- 12:03Speaker 1: But the source really emphasizes DNS monitoring as being particularly effective.
- 12:08Speaker 2: It is highly effective and efficient. Why because almost any
- 12:11Speaker 2: malware calling home to a command and control server needs to.
- 12:14Speaker 1: Look up the server's domain name first.
- 12:16Speaker 2: Right, So monitoring DNS requests and responses instantly flags any
- 12:20Speaker 2: new process trying to use the network and reveals where
- 12:23Speaker 2: it's trying to connect, often to suspicious domains like.
- 12:26Speaker 1: The iweb updater example, begonning to iweb services cloud dot com.
- 12:30Speaker 2: Just seeing a request for that known bad domain is
- 12:33Speaker 2: a strong indicator, or the three CX.
- 12:35Speaker 1: Attack that was huge customers notice traffic to MS storage
- 12:38Speaker 1: boxes dot com.
- 12:39Speaker 2: And comparing that domain registered via name cheap with weird
- 12:43Speaker 2: whis to the legit THREECX dot cloud domain. That unusual
- 12:49Speaker 2: network behavior was the critical.
- 12:50Speaker 1: First clue and the DNS monitor tool implents.
- 12:53Speaker 2: This YEP uses network extension to watch DNS traffic cash
- 12:57Speaker 2: it potentially block suspicious requests. Need special entitlements, of course,
- 13:01Speaker 2: since it's system wide monitoring.
- 13:03Speaker 1: Okay, you've mentioned it a few times now endpoint security,
- 13:07Speaker 1: this seems like a really core piece.
- 13:09Speaker 2: It's the modern low level framework from Apple for building
- 13:12Speaker 2: security tools. It lets you monitor and critically control system.
- 13:16Speaker 1: Events, stress starts, file access, network events.
- 13:19Speaker 2: All sorts of things. It requires specific entitlements from Apple
- 13:22Speaker 2: on Apple Dot Developer, Dot, Endpoint, dash Security, dot Client,
- 13:25Speaker 2: and needs proper packaging even for background tools.
- 13:27Speaker 1: The slogger tool is mentioned for exploring the events.
- 13:30Speaker 2: Super useful. Let's you see what's available. It seven type
- 13:33Speaker 2: pin notive xx for process execution, notify, create or unlink
- 13:37Speaker 2: for file events.
- 13:38Speaker 1: Lots more, and you mentioned the key difference notify versus OFUTH.
- 13:42Speaker 2: Events critical distinction notify events notify tell you after something happened,
- 13:48Speaker 2: useful for logging ofth events. AUX, however, intercept the action
- 13:53Speaker 2: before it happens.
- 13:53Speaker 1: Giving the security tool a chance to say.
- 13:55Speaker 2: Yes or no exactly. Your tool receives the authorization request
- 13:58Speaker 2: and can respond with EASE RESULTALLO or ESOS results then
- 14:02Speaker 2: a real preventative power.
- 14:04Speaker 1: And the event data is rich process path, arguments.
- 14:07Speaker 2: Path RGS, essexacarg CPU type, imaging, apotype, full code signing details,
- 14:13Speaker 2: id T, id C to hash.
- 14:15Speaker 1: And on newer mac os you get parent and responsible
- 14:18Speaker 1: process info. Two audit tokens.
- 14:20Speaker 2: Yeah. Audit tokens bundle up the security context, helping you
- 14:23Speaker 2: accurately track process lineage right within the event data.
- 14:26Speaker 1: Hugely valuable, and you can mute noisy events.
- 14:28Speaker 2: You don't need right control the fire hose. Yeah, but
- 14:31Speaker 2: the authodents are where you block things.
- 14:33Speaker 1: Like we discussed blocking a settle tool reset BTM or
- 14:35Speaker 1: SIG stop signals to the BTM agent.
- 14:37Speaker 2: Using EZEPOPEXAC or the appropriate signal off event.
- 14:40Speaker 1: You could also protect specific files or folders like my documents.
- 14:44Speaker 2: Definitely monitor a seven timee puth opin it's fifthempeth in
- 14:48Speaker 2: the link for files and sensitive locations if the process
- 14:52Speaker 2: trying to access or delete them isn't trusted.
- 14:54Speaker 1: Deny it stop malware like Windtail from grabbing or deleting
- 14:58Speaker 1: your stuff.
- 14:59Speaker 2: Percisely.
- 15:00Speaker 1: Block block is the tool example here using endpoint security
- 15:03Speaker 1: for real time persistence detection.
- 15:06Speaker 2: Yes, block block uses endpoint security and some file monitoring
- 15:09Speaker 2: specifically to catch persistence attempts in real time. It alerts
- 15:13Speaker 2: the user immediately and lets them block the action. Uses
- 15:17Speaker 2: a privileged demon for monitoring and a user agent for
- 15:19Speaker 2: the UI.
- 15:20Speaker 1: So it really sounds like you need to put all
- 15:21Speaker 1: these techniques together. It's not just one magic bullet.
- 15:24Speaker 2: Not at all. That's the key takeaway. Sophisticated detection is layered.
- 15:28Speaker 2: A tool might spot suspicious network traffic first.
- 15:31Speaker 1: From the DNS or a network monitor right then.
- 15:33Speaker 2: It pivots, checks the process, arguments the code signing, looks
- 15:37Speaker 2: for persistence attempts. Maybe it does a quick static scan
- 15:40Speaker 2: of the binary. It combines the evidence.
- 15:42Speaker 1: The Dazzle spy case fits that persistence caught by file monitoring.
- 15:46Speaker 1: Maybe endpoint security is notified create for the betlist and.
- 15:50Speaker 2: It's network C and C access caught by network or
- 15:54Speaker 2: DNS monitoring looking for that hard coded IP and three CX.
- 15:58Speaker 1: The initial flag was that we your DNS look up
- 16:01Speaker 1: via network monitor.
- 16:02Speaker 2: Exactly Yeah, mcstorage boxes dot Com. That anomalous behavior was
- 16:07Speaker 2: the trigger later data exfiltration to another domain as MSA
- 16:12Speaker 2: dot Wiki would also be caught by the same network monitor.
- 16:15Speaker 1: So wrapping this up, what's the big picture here? From
- 16:19Speaker 1: this deep dive, I think it's clear.
- 16:21Speaker 2: That detecting modern Mac malware isn't just about keeping lists
- 16:24Speaker 2: of known bad files anymore. It's part of it, but
- 16:27Speaker 2: not the whole game.
- 16:28Speaker 1: It's really about observing and analyzing the behaviors. What are
- 16:31Speaker 1: processes and files actually doing on the system exactly?
- 16:35Speaker 2: Looking for those footprints malware has to leave how it persists,
- 16:39Speaker 2: how it talks on the network, how it uses system resources.
- 16:42Speaker 1: And understanding how security tools can tap into macOS itself.
- 16:46Speaker 1: Using things like endpoint security logging network extensions to watch
- 16:50Speaker 1: for these behaviors programmatically, it.
- 16:51Speaker 2: Gives you much deeper, more resilient security insight. It shows
- 16:55Speaker 2: that even clever threats often leave tracks if you know
- 16:58Speaker 2: where and how to look.
- 16:59Speaker 1: So even sophisticated stuff isn't invisible.
- 17:02Speaker 2: Often not no, which leads to maybe final thoughts that
- 17:05Speaker 2: you on Okay, if detection is increasingly focused on behavior,
- 17:09Speaker 2: on spotting things that look unusual or interact with the
- 17:12Speaker 2: system in sensitive ways, does that mean legitimate, non malicious
- 17:16Speaker 2: software that just happens to be poorly written or maybe
- 17:19Speaker 2: does something unconventional could end up getting flagged by these
- 17:22Speaker 2: same tools. Where does legitimate but weird behavior end and
- 17:25Speaker 2: potentially unwanted behavior begin.