Blog

Living off the land: the weaponization phase

BY Red Team

April 25, 2018 | 5 MINS READ

Attacks/Breaches

Insider Threats

Threat Intelligence

Want to learn more on how to achieve Cyber Resilience?

TALK TO AN EXPERT

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.

Background

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

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.


Figure 1: Lucky Strike Menu

The Lucky Strike main menu offers pen-testers options to weaponize a document from an existing payload or a new payload.


Figure 2: Adding New Payloads.

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.


Figure 3: File Type Selection

After selecting the payload, the user has the option to embed it into an Excel or Word document.


Figure 4: Malicious file executed

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

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.

Figure 5: BITSAdmin File Download & Schedule Task

PowerShell

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.


Figure 6: Powershell Script Downloading Emotet

Mitigation Strategies

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.

Conclusion

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.


Sources

[1] https://www.esentire.com/blog/living-off-the-land-the-reconnaissance-phase/

[2] https://github.com/curi0usJack/luckystrike

[3] https://researchcenter.paloaltonetworks.com/2018/02/unit42-sofacy-attacks-multiple-government-entities/

[4] https://msdn.microsoft.com/en-us/library/windows/desktop/aa362813(v=vs.85).aspx

[5] https://securelist.com/the-banking-trojan-emotet-detailed-analysis/69560/

Red Team
Red Team Penetration Testing Team

Read the Latest from eSentire