Evasive Malware: A Field Guide to Detecting, Analyzing, and Defeating Advanced Threats - podcast episode cover

Evasive Malware: A Field Guide to Detecting, Analyzing, and Defeating Advanced Threats

May 26, 202517 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

Focuses on understanding and counteracting evasive malware. It begins by introducing code analysis techniques to identify malicious intent. The material then details how malware employs context awareness to avoid detection in virtual environments and how it utilizes anti-reversing tactics like anti-disassembly and debugging interference. Further sections cover defense evasion strategies, including process injection and rootkits, and explores fileless malware. Finally, the text examines how malware uses encoding, encryption, and obfuscation to hide its malicious components.

You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cyber_security_summary

Get the Book now from Amazon:
https://www.amazon.com/Evasive-Malware-Understanding-Deceptive-Self-Defending-ebook/dp/B0C1YGWP76?&linkCode=ll1&tag=cvthunderx-20&linkId=faed0fc61f3b0db04a0353f61ffe2519&language=en_US&ref_=as_li_ss_tl


Discover our free courses in tech and cybersecurity, Start learning today:
https://linktr.ee/cybercode_academy

Transcript

Speaker 1

Imagine this digital parasite so cunning it can live inside your computer for weeks, just watching silently, making sure it stays completely hidden. It's kind of chilling, right, it really is.

Speaker 2

And what's fascinating, I think is the sheer ingenuity behind it all. This isn't always about instant damage. Often its stealth, long term access, you know, outburning right under our noses.

Speaker 1

Okay, yeah, let's unpack that. We're diving deep into these well, really clever tactics malware uses to stay invisible. We've got some great material here from a technical book that really breaks down how these things hide, dodge security, and just generally cause headaches for analysts. Our mission today pull out the most surprising, the most crucial bits of this whole digital cloak and dagger scene.

Speaker 2

And it's not just theoretical stuff. Understanding this is actually super valuable for well anyone online, whether you're in security or just tech curious. Grasping these ideas really shows why cybersecurity is such a constant battle, why we need innovation.

Speaker 1

Absolutely, we're going to cut through the jargon, try to show you how malware becomes this ultimate digital illusionist, how it knows if it's in a sandbox, how it confuses analysis tools, the really sneaky ways it hides what is actually doing.

Speaker 2

Yeah, the technical sophistication is pretty amazing. I mean, these are clever solutions, even if they are, you know, malicious.

Speaker 1

All right, So let's start at square one. How does malware first get a feel for its environment? Like a burglar checking if anyone's home, but digitally enumerting OS artifacts. What's that actually involve?

Speaker 2

Well, one of the first things it does is sort of take stock. It looks at running processes, files, folders, shared network drives. Like if it sees analysis software running or just way fewer user files than you'd expect, that's a red flag, might be a sandbox. The key thing is the malware authors expect this. They build these checks.

Speaker 1

In right, So it's like checking the guest list for undercover cops. Yeah, and it digs deeper than just files, right. Something about the Windows registry exactly.

Speaker 2

The registry is like the system's central control panel can look for specific keys, specific entries that are known markers for vms like VirtualBox or VMware. It might search for keys with names like vbox or VMware. It's like looking for manufacturer labels on the furniture gives the game away.

Speaker 1

H a digital fingerprint scanner for vms. And what about pipes not the plumbing kind?

Speaker 2

I guess yeah No. In Windows, pipes are communication channels between programs. Vms often set up unique ones. Malware can look for these specific pipe names. Like there's a tool pipe list. It can spot one called v goth service. That's VMware. So if the malware finds that pipe that specific channel, pretty good sign it's in VMware.

Speaker 1

That's clever, like a secret knock. Only the VM no be shared folder. I use those constantly between my VM and my main machine.

Speaker 2

Yeah, and a malware knows people do that. It can use a function a w netget provider name basically asks the system any shared drives connected. Since VM shared folders act like network connections, finding them is another clue it's not on a regular user's machine.

Speaker 1

Okay, So just by checking the basic layout, malware gets a decent idea if it's being watched. But it gets smarter, right looking for signs of a real.

Speaker 2

Human That's right. A huge difference between a real PC and an analysis box is well actual human activity or lack thereof. So malware looks for browser cookies, cache web data, browsing history. A system that's too clean, two pristine that screams sandbox like an empty house.

Speaker 1

Makes total sense my browser history alone. Yeah, yeah? What else? How else do they check for actual user interaction?

Speaker 2

They can count open windows. There's a function ENOM Windows. A typical user dozens, maybe hundreds of windows open applications running a sandbox might just have a few. I saw an example like ninety seven windows on a real system versus maybe you know, ten in a sandbox. It's using these normal system things as indicators real user versus automated analysis.

Speaker 1

Wow, ninety seven versus ten. That's a stark difference, like checking how many pairs of shoeser by the door. And they can look for specific apps running.

Speaker 2

Too precisely using ENOM Windows again, or find window. They look for common stuff like Microsoft Office email clients, things are real user would probably have open. And conversely they look for analysis tools Procmond, Fiddler, wire shark. If those windows are open, malware knows it's under the microscope.

Speaker 1

It's a digital game of hide and seek. But yeah, the stakes are way higher. Okay, what about connectivity? Does it check if it can phone home absolutely.

Speaker 2

Network awareness is key for sandbox evasion. One trick is checking the IP address. Some IP ranges like one ninety two point one six eight point five to six dot x are defaults for vms like virtual box. It can use get adapter as r usses to look for those, like checking the area code.

Speaker 1

Right, and I've definitely heard about malware trying to ping Google or something. How do they check general Internet access?

Speaker 2

Yeah? Common method send a DNS request that's the Internet's phone book basically, or an HTTP web request maybe to Google dot com like you said. Then it checks if it gets a real response back, no response or a weird one could mean it's in an isolated sandbox, no way out.

Speaker 1

So if it can't reach Google, it knows something's fishy. What about existing connections? Can it learn from.

Speaker 2

Those it can? Malware can list outgoing TCP connections using get TGP table. TCP is fundamental for Internet traffic. A real user's machine usually lots of connections to all sorts of places. A standbox, especially an isolated one, maybe very few or none. That lack of normal network chatter is another big clue. The point is it's actively probing using all these system signs okay.

Speaker 1

So the malware has done its checks, it thinks it might be watched. What's next? It doesn't just give up, surely.

Speaker 2

No way. That's where anti analysis kicks in. The goal now is to make the malwur's code incredibly difficult to understand for researchers, for automated tools, for anyone. It's like putting on a digital disguise, scrambling the blueprints.

Speaker 1

Right, scrambling the instructions so no one can figure out the plan. What are some basic ways they mess with the code itself?

Speaker 2

Well, a simple one is just inserting junk code, not constructions, things that do absolutely nothing, just clutters up the view for an analyst. Then there's control flow obfuscation that's making the code's execution path deliberately complex, twists, turns, dead ends, like adding fake roads to a map.

Speaker 1

Just adding detours to confuse anyone following. I also write about jump tables and indirect calls. Sounds more advanced.

Speaker 2

It is, instead of calling a function directly, malware might use a jump table basically a list of addresses. It jumps to an entry in the table to get to the real function. Indirect calls often using get proke address load library A hide things further, they look up function addresses at runtime. Sometimes they even use hashed function names like ro R thirteen hashing. There are tools like an Ida plug in ap hashes to help analyst decode these. It's like using a coded message instead.

Speaker 1

Of a direct phone number, instead of call function X. It's like, go here, then do whatever's hiding there. Definitely harder to follow. What about when someone actually tries to debug it? Run it step by step?

Speaker 2

Oh yeah, debugging interference, that's a whole category. The simplest is just checking if a debugger is attached, functions like is debugger present, check remote debugger present. More advanced ways use nquery information process. That's a powerful function. You can ask the OS directly, is there a debug port open our debug flag set? Is a debug object attached. It's like the malware constantly peeking over its shoulder, checking for that magnifying glass.

Speaker 1

And kernel debuggers for really low level stuff. Yep.

Speaker 2

They can try to detect those two using another function end query system information and a specific data structure system. Kernel debugger information checks if the kernel debugger is enabled. That's deep anti analysis, trying to avoid even the most thorough investigation.

Speaker 1

Wow, digging right into the system's core. What about breakpoints? Analysts need those to pause the code. Can malware spot them?

Speaker 2

They sure try. They can check memory attributes using functions like read process memory, virtual query, looking for weird memory protections like paygeno access or page guard. Those are signs of debugger might have set a break point. They can also try to bypass software breakpoints one inserted into the code, and even detect and remove hardware breakpoints set by the CPU itself using functions like set thread context. It's a constant cat and mouse game.

Speaker 1

It really is an arms race, isn't it. Analysts find a way, malware finds a way around it. I also saw something about checksums.

Speaker 2

Yes, check sums are section hashing. The malware calculates a digital fingerprint of its own code, stores it, then, while running it recalculates it compares them. If they don't match, maybe an analyst set a breakpoint changed to bite of code. The malware knows it's been tampered with, it might shut down or change behavior. It's like its own internal tamper seal.

Speaker 1

Its own integrity check if anything's off. It knows Okay, beyond just making analysis hard, how does malware hide its actions while running?

Speaker 2

That's covert code execution misdirection. One neat trick is using callback functions. For instance, with enom display monitors, malware gives this function a pointer to its own malicious code. The OS calls this code later during normal operations. It executes an unexpected time in an unexpected place. Harder to spot, like hiding a secret message in a routine phone call.

Speaker 1

Hiding the message and planside almost What about structured exception handling SECH sounds legitimate?

Speaker 2

It is legitimate. sEH is Windows way of handling errors, but malware abuses it. They can overwrite parts of the sEH chain the list of air handlers, so when an error does happen planned or unplanned, control gets redirected to the malour's code. Analysts can watch for this using debuggers like by a sixty forty bdree a monitor a specific spot in memory FS point zero. It's like turning an emergency exit into a secret.

Speaker 1

Entrance, turning air handling into a back door. That's devious. Okay, we've covered avoiding detection, avoiding analysis. What about actually bypassing defenses? And you know, staying on a system persist. Right.

Speaker 2

That brings us to defense evasion and persistence. Process injection is a big one. Running malicious code inside another legitimate process the key idea. By hiding inside something trusted like explored ex the bad activity is less likely to trigger alarms, like a.

Speaker 1

Stoke away on a legitimate ship. How's that work? Technically?

Speaker 2

The basic steps get a handle a reference to the target process. Open process, maybe end to open process. Then write the malicious code into that process's memory space using right process memory. Finally, force the target process to run that code. Create a remote thread NT, create thread x RTL, create user thread. Like slipping your own instructions into someone else's workflow.

Speaker 1

Sneaking code into another app's work space and making it run it. I also heard about process hollowing. Run PE sounds.

Speaker 2

Different, It is and more complex. You start a legitimate process, say Calculator dot exx, but in a suspended state paused. Then the malware on maps clears out the legitimate code from memory, replaces it with its own malicious code, then resumes the process. So from the outside it just looks like Calculator running, but it's actually the malware like swapping the crew for pirates while the ship's still dot.

Speaker 1

It's even sneak here, replacing the crew before it even sails. And process doppelganging. That sounds wild, it's pre k h Yeah.

Speaker 2

Uses NTFS transactions, that's the Windows file System's feature for temporary isolated changes. Malware starts a transaction, writes its malicious code to look like a legitimate file. Within that transaction, creates a process from that modified file. Then, crucially, it rolls back the transaction poof the file on disc goes back to normal Security scans the disc later, the malicious file isn't there anymore, leaves minimal traces on the filesystem itself.

Speaker 1

Very slick, wow, a digital vanishing act. And hooking. We mentioned that with the buggers, but it seems broader it is.

Speaker 2

Hooking means intercepting function calls in user mode set. Windows hookx is often used. Malware can use this to monitor or even change what other applications ares itself for doing, maybe to hide its own actions or steal data. It's like putting a wiretap on legitimate system calls, listening in, maybe changing.

Speaker 1

The message wiretapping system functions. Okay, what about hitting the actual security software antivirus EVR.

Speaker 2

Several tactics there. One is just trying to kill the secure processes or services directly, though that usually needs admin rights. They might also mess with registry settings for security products or even try to uninstall them. It's a direct.

Speaker 1

Assault, attacking the guards themselves. Yeah, and user count control bypasses getting around those, are you sure prompts?

Speaker 2

Yeah? UAC bypasses aim to run with admin rights without triggering that prompt. One way is abusing auto elevated Windows utilities, things like MSConfig dot ex, the system configuration tool. It runs elevated without a prompt. Malware might launch command prompt from MSConfig Sneaky DLL hijacking is another, placing a malicious DLL where a legit app expects to find one. Also

trying to get seat a bug privilege. That's a powerful permission that can be misused to mess with other processes and get around UAC.

Speaker 1

So tricking trusted tools are just grabbing the master keys. What about network defenses firewalls?

Speaker 2

DNS tunneling is one way hiding commanding control traffic inside what looks like normal DNS lookups, Domain generation algorithms DGAs. The malware creates tons of potential C two server addresses, dynamically harder for defenders to block them all, and multi stage attacks. A malicious document leads to a script, leads to a loader, leads to the final payload. Each stage might look less suspicious on its own. Playing cat and mouse with the network sensor.

Speaker 1

Black them all with their servers and kernel modules drivers. That sounds really deep.

Speaker 2

It is sophisticated stuff BYOVD. Bring your own vulnerable driver. They use legitimate, often signed drivers that have known security holes. Because the driver is signed, the OS trusts it. Malware exploits the vulnerability and the driver to interact with the kernel, maybe disabled security load, unsigned code. We saw Hermetic Wiper use an easy US driver. Zero Clear used a virtual box driver. Even trusted components can be turned into weapons.

Speaker 1

Like using a trusted delivery service to drop off a bomb and then it hits the ninja's right. Deep system compromise.

Speaker 2

That's the goal, deepest level of control and hiding dk web direct kernel object manipulation, directly messing with kernel data fructures, kernel hooking, intercepting core kernel functions like n tread file, controlling fundamental operations IRP hooking, manipulating iorequest packets to high activity, abusing kernel callbacks to get notified of system events and control them. And bootkits UAFI bootkits like Cosmic strand they infect the system firmware, the code that runs before Windows

even starts. Ultimate persistence, like building a secret base in the building's foundation.

Speaker 1

Saving up shop in the US foundations. Oh okay. Lastly, file is malware. No file to scan, sounds incredibly hard to find.

Speaker 2

It is operates mainly in memory, maybe the registry minimal disc footprint. They often use loo elbans living off the land binaries, legitimate Windows tools like certitil dot ex, PowerShell dot ex using the system's own tools against it to

download or routten code. System binary proxy execution helps bypass application whitelisting using things like REGZVR thirty two, dot ex, Rundel thirty two dot ex plus anti forensics, hiding files, corrupting logs, clearing event logs, and steganography, hiding data inside images or other files, trying to be ghosts in the machine.

Speaker 1

Ghosts in the machine exactly. Okay, so you've seen how they hide, how they evade, but the actual payload the harmful code itself that needs hiding.

Speaker 2

Two. Absolutely, that's where encoding encryption packing come in. Encoding is simpler, just changing the data format like BASICT four. Sometimes they use a tweaked character set to make it slightly harder. XR encoding is common to simple bitwise operation with a key. Like a basic cipher needs the.

Speaker 1

Key to unlock the simple cipher. Encryption sounds much tougher.

Speaker 2

Though it is uses strong math algorithms, symmetric same key in cryptocrypt, asymmetric different keys. Malware often uses windowsone crypto libraries, crypto API, or CNG finding the routines, identifying the algorithm, maybe watching memory in a debugger to see the decryptid data. That's how analysts tackle it. It's like a strong box, needing a specific.

Speaker 1

Key, cracking a serious code, and finally packing. I hear about pack malware constantly.

Speaker 2

Right packing compresses or encrypts the entire malware executable main goals evade av detection, obstruct analysis. Packed files often have very few imports visible initially, maybe just low library, a get proke address, and few readable strings. There's a small stub program that does the unpacking and memory at runtime

can be single stage or multi stage. Analysts use tools p Studio, Scilla plus dynamic debugging, set break points on memory allocation functions, watch for executable memory regions, find the jump back to the real code. It's like peeling laters off a disguised package to find the dangerous thing inside.

Speaker 1

Peeling the onion to find the rotten core. Wow. This has been well fascinating and maybe a bit unsettling seeing how ingenious malware is at hiding. It's just this constant back and forth, isn't it attackers and defenders always innovating.

Speaker 2

It absolutely is. The range of techniques, the sophistication. It highlights the creativity of attackers yet but also the huge challenge defenders face trying to keep up.

Speaker 1

For you listening, really think about what this means for your own security awareness. Normal system stuff can be twisted. If you want to dig deeper, definitely look into resources on malware analysis, general cybersecurity, maybe some of the specific techniques we mentioned.

Speaker 2

It really leaves you with a big question, doesn't it. As malware gets better and better at hiding, how do our defenses need to fundamentally change? How do we stay ahead in this digital conflict. It's a constant learning process.

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android