The Plan is Mightier than the Sword – Persistence

31 May 2016

In the last blog post, I talked about the requirement for planning as part of an APT. Another requirement is the “P” of APT – persistence.

Successful attacks are typically staged, that is, they rely on multiple stages before a successful completion. An attack might breach a particular organization in order to loot documents that can then be reused as the bait for a spear-phishing campaign. As this process indicates, the idea of only one weakness or vulnerability being exploited in order for an attack to succeed is woefully outdated. A small vulnerability, imaginatively compounded with others, is what will enable an attacker to compromise a secured target. This is especially true for social engineering, a technique that uses the careful aggregation of information leaks to build up a profile of a target.

With large organizations with tens of thousands of employees, an attacker will likely prioritize their targets in terms of which are the most likely to provide the desired access or data. Taking the time to comprehensively profile key target personnel and their relationships is what increases the likelihood of a social engineering pretext being accepted. In order to create a convincing impersonation of a business client or partner, mistakes must be minimized. As technologies such as two-factor authentication become prevalent to mitigate weak password practices, tricking users will most likely remain an effective attack method.

Persistence in passive information gathering allows the attacker to understand the target and their weakness before a packet is even sent to the target's network. Once the attacker has decided on a particular Course of Action (COA) in order to compromise the target, a low attribution infrastructure may be used for conducting the attack, for example, pre-compromised machines forming a botnet of Operational Relay Boxes (ORBs). In order to complete the initial intrusion, exploits may be used, but tricking the user into enabling macros in an Office document, for example, is less likely to be detected by host or network based security devices. Malware such as Remote Access Trojans (RATs) may be dropped onto the victim’s machines but the presence of foreign binaries on a system are another chance to be detected by, for example, application white listing systems. Process injecting into white-listed processes and remaining purely in memory (like Duqu 2.0) may be required for hardened targets, but abusing systems administration tools such as PowerShell is also a popular approach.

Using these available tools allows an attacker to explore and enumerate the internal network without relying on the introduction of any additional tools. Once the initial intrusion is complete and a foothold is established inside the perimeter of the target network, persistence comes into play again during the internal information-gathering phase. An attacker has only limited control of where they will end up behind the perimeter, and the next task is to discover the target assets in order to complete the mission. This process can be daunting in the case of organizations with tens or even hundreds of thousands of employees, a similar number of machines, dozens of internal networks accessible only through specific VPNs or “jumpboxes” (machines that allow access to other networks) and many types of internal security devices.

As stealth is critical to success, techniques such as privilege escalation and active network/port scanning may well be off the table due to the noise they create in logs and elsewhere. Therefore it is persistence that pays off. An attacker must wait for extended periods of time to gather the necessary information in order to fully map out the networks behind the perimeter. This step is vital to the operation. Without an accurate map of the internal networks, the attacker has no idea of how to establish a "flight path" towards the target assets. In the case of Su-Bin, the attackers complained in emails that the work took longer than expected due to the complexity of Boeing's internal networks. Any network reconnaissance may have to be done in a way to not trip any internal security controls, typically achieved by masquerading as legitimate network traffic. Luck may also play an important role here. If the attacker lands on a corporate desktop machine used by a network engineer that contains up-to-date network diagrams, then the attacker's work is dramatically simplified. However, this cannot be relied upon; any crumb of information is likely to be taken from compromised machines, not only any documents on the local file system, but also emails and instant messenger logs may provide useful clues. Identification of user names, network file systems, naming conventions, password policies and file system layouts are useful here as well as live credentials.

Credentials are worth gold. Many tricks will be used to find them. Social engineering of users from inside the organization itself may be a useful tactic, especially as the trust which social engineering exploits will typically be even higher between people in the same organization. Credentials are preferred to exploits as they are significantly stealthier, especially if they are used at similar times and from the same places as the legitimate user typically would. Again, the goal is to not be noticed and exploits may fail or be detected by host or network detection systems. An attacker may use harvested credentials to move laterally throughout the network, in order to entrench themselves deeply in the network and survive if a compromised host goes offline for whatever reason. Gathering data and credentials from these compromised machines and exfiltrating them out of the target's network undetected will further serve the purpose of in-depth internal reconnaissance.

In order for an attack to successfully be persistent, it requires significant resources and my next blog post will tackle this in more detail.