Malware is malicious code that’s used to obtain unrestricted access to a victim machine. This makes the ability to harvest and take advantage of victim data effortless and is usually automated.
In the current cybersecurity threat landscape, we see most botnets propagating via exploits and file-based malware. Anything that touches the disk has the ability to be blocked via access controls on the host.
The notable delivery techniques for malware is through exploitation (exploit kits and malvertising) and social engineering (tricking users into opening bad software). Defense in depth strategies generally focus on preventing the exploit/malware from landing via network access controls. If a threat actor is able to get initial code execution on a machine it is up to the access controls on the host system to prevent successful compromise.
The most popular ways to execute code on a host system is through binary executables, scripts and shellcode. Shellcode can be utilized in many ways and it often does not need to touch disk as such blocking shellcode will not be covered in this post. Examples of some common code execution methods is below:
Common Binary Executables
Common Script Code
Code execution has many layers at which it can be stopped. For example, there are ways to stop interpreters from interpreting script code on a windows system.
In the majority of attacks, we see threat actors utilizing a benign piece of software (dropper) to download the malicious payload which executes and carries out the malicious instructions. Common file formats that are utilize to execute the initial instructions can be seen below:
- HTML / HTA
- ZIP / 7ZIP / RAR
- EXE / DLL / MSI
- Macros (DOCM, XLSM, POTX)
- VBA / VBS / VBE
One of the most effective ways to protect against compromise is by limiting what someone has the ability to do when they get onto a machine. Consider enforcing these best practices within your organization:
- Don’t allow general users to connect to the local administrator account – this limits what users can execute and install themselves.
- Limit what software can be allowed on the system. This helps limit the attack surface that a threat actor can target. Consider using a tool like Microsoft Local Administrator Password Solution (LAPS) to address the randomization of the local administrator account.
- Change the default execution of specific applications to stop malicious files from being executed when a user double clicks on them. Keep in mind that unfortunately this step alone won’t stop scripts from being interpreted by WSH when executed from the command line.
- Reduce the risk that comes with embedded VBA macros within Microsoft Office documents. This is an avenue that threat actors tend to target as it gives them code execution capability once the macro is allowed to run on a victim PC. There are many different ways to attempt to block document macros and up until Office 2016 users were still able to enable macro content if they deemed it to be “safe”. Office 2016 has included new features that essentially does not allow users to execute a macro even if they think it is legitimate. This was a big problem for Office 2013 because in most of the Microsoft word campaigns included an image instructing the user to enable the malicious content resulting in compromise.
- Enforce application whitelisting rules to ensure only approved applications are executed.
There are many security features that can be implemented at the host level to harden a Windows system. The best practices suggested here address just a few configuration changes that can be made to make it harder for a threat actor to execute code.
Although not all of these recommendations are applicable to all environments, they can be used as an information resource for those who are looking to implement hardening changes within their environment.
In many cases the delivery mechanisms are generally the same for most malware strains. Ransomware is a form of malware that is utilized by threat actors to hold the victims of an attack hostage to extort money. The delivery mechanisms described here are commonly used to deliver the malicious payload, which results in full compromise.
The ability to stop the initial execution of malicious code will stop the execution of a malicious payload - effectively stopping its ability compromise.
When it comes to malware-based attacks, you can’t count on technology alone to detect and block the attack. Unwitting employees can deploy malware by clicking on a malicious attachment. It’s in these situations that leveraging managed detection and response (MDR) capabilities is essential. Through advanced hunting and anomaly detection, MDR is able to detect and block malware-based attacks even after they’ve breached perimeter defenses. At eSentire we call this micro-incident response.