CYBER SECURITYNews

Sophos uncovers how attack code behaves while hiding in memory and built protection against it

The discovery will make it significantly harder for adversaries to use memory as a defense evasion technique.


The memory region of a hacked computer is a popular hiding place for malware because security scans donā€™t tend to cover memory. As a result, the malware is less likely to be detected and blocked.Ā  The types of malware attackers try to install in memory include ransomware and remote access agents. Remote access agents are the enablers for the rest of an attack so the earlier they are spotted and blocked the better.

Sophos researchers have worked out a way to defend against such malware in memory based on how it behaves. They found that attack code shares a common behaviour in memory regardless of the type of code or its purpose.

  • Unlike normal software applications that are installed in the main memory region, attack code is injected into a part of the memory known as the ā€œHeap.ā€ (The Heap provides temporary additional memory space for applications that need some extra room, for instance to store or unpack code.)Ā 
  • Adversaries add their attack code in stages. To begin with, a small file known as a ā€œloaderā€ is injected into the Heap memory. The loader then needs extra Heap memory space to accommodate the needs of main payload, which could be a remote access agent like Cobalt Strike. It needs the extra memory to be allocate ā€œexecutionā€ rights so the malware can run.Ā 

Sophos researchers have designed a practical protection that blocks the allocation of execution permissions from one Heap memory to another. The protection is named Dynamic Shellcode Protection.Ā 

ā€œPreventing attackers from taking hold in a compromised network is the goal of defenders everywhere,ā€ said Mark Loman, director of engineering, Sophos. ā€œThis goal is critical because once a remote access agent has been installed, it can facilitate most of the active adversary tactics that will take place during the attack. These include execution, credential access, privilege escalation, discovery, lateral movement, collection, exfiltration, and the release of the ransomware.Ā 

ā€œCode intended for malicious use evades detection by being heavily obfuscated and packed and loaded directly into memory. Computer memory is not routinely scanned by security tools so that even when the code is de-obfuscated and unpacked in order to run, its presence is often not detected. Sophos has identified a characteristic ā€“ ā€˜Heap-Heapā€™ memory allocation ā€“ that is typical across multi-stage remote access agents and other attack code being loaded into memory and has built protection against it.ā€

Dynamic Shellcode Protection is integrated into Sophos Intercept X.Ā  It is already having an impact, uncovering the presence in memory of Cobalt Strike in a Conti ransomware attack.

General Advice for Defending Against Ransomware

  • Shut down internet-facing remote desktop protocol (RDP) to deny cybercriminals access to networksĀ 
  • If you need access to RDP, put it behind a VPN connectionĀ 
  • Use layered security to prevent, protect and detect cyberattacks, including endpoint detection and response (EDR) capabilities and managed response teams who watch networks 24/7Ā 
  • Be aware of the five early indicators an attacker is present to stop ransomware attacksĀ 
  • Have an effective incident response plan in place and update it as needed. If you donā€™t feel confident you have the skills or resources in place to do this, to monitor threats or to respond to emergency incidents, consider turning to external experts for helpĀ 

Follow us onĀ Telegram,Ā Twitter,Ā Facebook, orĀ subscribe to our weekly newsletterĀ to ensure you donā€™t miss out on anyĀ future updates. Send tips toĀ info@techtrendske.co.ke.Ā 

Facebook Comments

Young Scientists Kenya (YSK) 2024 Kenya Launch | TechTrends

TechTrends Media Editorial

We cover Technology and Business trends in Kenya and across Africa. Send tips to editor@techtrendske.co.ke

Have anything to add to this article? Leave us a comment below

Back to top button