This is the second blog in a series focusing on “Living Off the Land” tools.
Each installment of this series focuses on a specific stage of the Cyber Kill Chain framework. The topic of this blog post is the use of tools during the weaponization stage. Part one of this series—the reconnaissance stage—can be found here.1
Adversaries take advantage of tools that are pre-installed on systems to execute malicious code while avoiding suspicion. A robust detection plan is critical for businesses to prevent adversaries from successfully employing weaponized documents. The term weaponization is used to describe when a business tool or document is fitted with a malicious payload. The tool can be weaponized internally or externally depending on the product. Weaponized documents are one of the most popular infection vectors used by adversaries to gain access to a network. In the past six months, eSentire has detected a variety of weaponized documents, delivered by adversaries, utilizing native tools. Some of the most popular weaponization tools include PowerShell, BITSAdmin, Shell Commands and Ceritutil. Identifying the malicious use of Living Off the Land tools is difficult; however, there are a variety of steps that can be taken to monitor this activity.
Malicious documents are a well-known tool used by adversaries to gain entry into corporate environments. Specifically, Microsoft Documents can be weaponized with malicious macros or through the use of Dynamic Data Exchange (DDE). Lucky Strike, BITSAdmin and PowerShell will be the focus of this blog.
Lucky Strike is a tool that generates malicious documents, both macros and DDE, built entirely from PowerShell commands 2. It was developed by Jason Lang to quickly weaponize documents during penetration tests. Researchers at Palo Alto recently published an article detailing the advanced persistent threat (APT) Sofacy, utilizing Lucky Strike to weaponize excel documents destined for government organizations 3.
BITSAdmin is a Command-line tool that can be used to create jobs to download or upload and monitor their progress 4. It is currently deprecated and may not be included in future versions of Windows, however it is still installed on Windows 10. The tool is catered towards administrators who manage and patch multiple endpoints. The tool can be leveraged to download and execute remote software.
The versatility of PowerShell allows the command language to be used both legitimately and maliciously, making detection and prevention more difficult.
Lucky Strike has been identified in both simple attacks by low skilled actors and complex attacks carried out by Advanced Persistent Threats (APTs). By using Lucky Strike, attackers incorporate PowerShell into their attacks. This reduces the chance of discovery by defenders as it is a tool one would expect to see active on a machine. Since Lucky Strike is made entirely from PowerShell, it allows individuals to execute the script directly on the compromised network. This allows documents to be weaponized directly on the file servers without having to first exfiltrate the document.
The following screen captures demonstrate how Lucky Strike can be used.
The Lucky Strike main menu offers pen-testers options to weaponize a document from an existing payload or a new payload.
For this demonstration we added a new shell command to display a pop-up warning. As shown in figure 2, Lucky Strike also supports PowerShell scripts, Executables and Com Scriptlets.
After selecting the payload, the user has the option to embed it into an Excel or Word document.
The weaponized document is then sent to the user. When it is opened, the payload will be executed similar to Figure 4. Please note the user would have had to allow Macros.
At the time of writing, the default Lucky Strike script was detected by Windows Defender, but this could be avoided by changing the script.
BITSAdmin has a variety of commands that are useful for both legitimate and malicious actors. The tool is relatively simple to weaponize due to its wide range of uses. Figure 5 shows an example of a BITSAdmin command that was incorporated into a weaponized file. When the file is launched, it starts a BITSAdmin command line argument. This command retrieves a file from the internet and saves it into the temporary directory under the name ms_tmp.exe. The file is then configured as a scheduled task and executed.
PowerShell is the most commonly observed scripting language in this form of attack, but it should be noted that other scripting methods, such as VBS or batch, may also be used to pull files. In figure 6, the weaponized word document launches a malicious word document that is heavily obfuscated to retrieve an Emotet dropper from a URL. Emotet is an advanced banking Trojan that first appeared in the summer of 2014 and has been active since 5.
Mitigation during the weaponization stage is a difficult proposition, as it may take place entirely on the attacker end. Even so, there are steps you can take which will reduce the effectiveness of weaponized documents and aid in overall threat prevention.
- Block Macros: Average users will not need to open macros received in their inbox. Blocking macros reduces the overall attack surface.
- User Education: DDE relies on user interaction. As such, staff education is an important step in preventing successful attacks.
- Restrict privilege: Some scripts require administrative privilege to run. Restrictive user privileges, based on user requirements, will reduce the potential impact of compromise. Batch files cannot be blocked so user restriction is very important.
- Block executables: Preventing an executable from opening will stop a wide variety of threats before they ever have the chance to be realized. This step may cause an impact to business and should be fully assessed prior to implementation.
- Keep Anti-Virus Software up to date: Anti-Virus should not be solely relied upon; encoding a weaponized document may allow adversaries to evade detection.
- Endpoint monitoring: Employing endpoint detection provides a comprehensive view of company assets and can help to identify issues before they spread or become critical.
These tools are popular amongst adversaries. As such, knowing the steps adversaries take to weaponize documents and exploit Living Off the Land techniques is an important step in preventing successful attacks. Living Off the Land tools present unique difficulties to defenders, requiring defenders to be aware of all possible options to limit adversary activity. The mitigation strategies stated above offer a variety of options to help limit the threat landscape, identify potential intrusions and block the attack before it’s successful.
Stay tuned for the next instalment of this blog series focusing on the delivery stage of the cyber kill chain.