The Cybersecurity Canon: Cybercrime and Espionage: An Analysis of Subversive Multi-Vector Threats

We modeled the Cybersecurity Canon after the Baseball or Rock & Roll Hall-of-Fame, except for cybersecurity books. We have more than 25 books on the initial candidate list, but we are soliciting help from the cybersecurity community to increase the number to be much more than that. Please write a review and nominate your favorite. 

The Cybersecurity Canon is a real thing for our community. We have designed it so that you can directly participate in the process. Please do so!

Book Review by Canon Committee Founder & Palo Alto Networks CSO, Rick Howard: Cybercrime and Espionage: An Analysis of Subversive Multi-Vector Threats (2011) by Will Gragido and John Pirce

Executive Summary

Cybercrime and Espionage, published in 2011, is a book that was ahead of its time. The authors were pushing the envelope in terms of how the security community should think about advanced threats. However, almost five years later, there is not enough in here to make the book Cybersecurity Canon material. Gragido and Pirc present some stimulating ideas, but in the end, the security community has not adopted many of them.

My recommendation is to read this book if you are interested in how our community has evolved in terms of thinking about adversary campaigns. However, if you are looking for a state-of-the-art book about cybercrime and cyber espionage, this is not it.

Introduction

Will Gragido and John Pirc published this book in February 2011 — the year after the commercial industry experienced its wake-up call in terms of cyber espionage: Operation Aurora. [1] Aurora refers to the adversary campaign launched at Google and other commercial organizations that was designed to steal intellectual property, collect information on human rights activists, and gather intelligence regarding on-going FBI wiretap operations. [2]

What made Aurora notable was Google’s reaction to it. They went public and accused the Chinese government of being responsible for the attacks. Before Aurora, most commercial organizations would not admit that they had been breached, even though nation states had been targeting commercial organizations for at least a decade. Business leaders worried that admitting a breach would significantly affect the bottom line. After Aurora and Google’s public mea culpa, it became easier for other commercial entities to admit that they had been breached. Fast-forward to today, and public breach notifications are so common that it is difficult to keep up with them all.

But this was the beginning. Before Aurora, the only significant cyberthreat to the commercial world at the time was crime. After, cyber espionage became something that we all had to worry about. This is the context for the book: defining cybercrime and cyber espionage as motivations — what makes them different and what makes them the same.

Impressions

The two authors, Will Gragido and John Pirc, are experienced cybersecurity professionals, and it is clear that they know what they are talking about; but the book is a bit disorganized in terms of who the target audience is. The content is a mix of introductory and advanced material. However, I did not see that the book had a through line. The authors’ analysis of the cybercrime world is at the introductory level. If you want a more in-depth book on the same topic that was published around the same time, consider Kingpin, written by Kevin Poulsen. [3] If you are looking for something a little more recent, consider Spam Nation by Brian Krebs, which was inducted into the Canon earlier this year. [4] The espionage material is more advanced, but if you want to go deeper, consider Kim Zetter’s Countdown to Zero Day [5], another Canon inductee, or Richard Bejtlich’s The Practice of Network Security Monitoring. [6]

I do give the Gragido and Pirc credit though for covering some advanced ideas ahead of their time that have not really become popular until just recently. One idea that I really like is that commercial organizations should build their own intelligence teams to track adversary campaigns. They published the book almost five years ago, and this was not universally accepted at the time. It is not universally accepted today either, but more and more organizations are starting to understand the value of such teams. As an aside, this is one of the reasons I got hired at Palo Alto Networks: to build an intelligence team that we eventually called Unit 42.

Gragido and Pirc push their own intelligence model called MOSAIC: Motive, Awareness, Open Source Intelligence Collection, Study, Asymmetrical Intelligence Correlation, Intelligence Review and Interrogation and Confluence. It is a good framework for an intelligence analyst; unfortunately, the model has not really caught on. Most intelligence organizations — the CIA, the FBI, and the NSA, as well as Unit 42 — use a model called The Intelligence Cycle. [7][8] They are basically the same thing, but the MOSAIC model has more detail.

The authors introduce a new phrase called Subversive Multivector Threats (SMTs), a sort of superset to what the cybersecurity community used to call the Advanced Persistent Threat (APT). They even explain the origin of the APT phrase, a phrase the military had been using for almost a decade in an UNCLASSIFIED setting to mean anything that involved Chinese government-sanctioned cyber espionage. Gragido and Pirc were ahead of their time, understanding that the community needed another name to label similar attacks that did not originate from China. Thus, they came up with SMTs, but the community has not embraced that term. We have evolved the APT phrase to include everything instead.

Another advanced idea presented that I really liked was the concept that there are humans behind these attacks. Tools do not attack our systems. Humans — often organized into groups — attack our systems, and they use tools to accomplish some goal. These adversary groups can be rated in skill level from novice to expert and have motivations like cybercrime and cyber espionage; and it helps defenders do a better job by understanding that context, according to the authors. I wholeheartedly agree. But today, I think we can expand that motivation list to include hacktivism, cyberterrorism and cyberwarfare, and I thought their definitions of hackers’ maturity levels were not definitive enough to be useful.

Also, Gragido and Pirc introduce a two-tiered categorization scheme for adversary campaigns, where Tier – 1 campaigns target:

“… air-gapped networks or networks that would be considered highly secured, such as those of power companies (supervisory control and data acquisition or SCADA networks), governments, and defense organizations.” [9]

Tier-2 adversary campaign plans are all other APT campaigns. This two-tiered system seems ill-conceived today. The security community considers SCADA networks in general, and power companies in particular, as being at least 10 years behind the rest of the community [10].  And government networks have proven to be even less secure than most commercial organizations, except for maybe the intelligence community’s networks and some select defense networks. [11] I do not see a need for this two-tiered system in today’s threat environment.

One last advanced idea that I really liked was that threat prevention is possible. There has been a trend in the industry these past five years where security leaders have thrown their hands in the air saying they cannot possibly stop the APT, and that it is better to concentrate their precious resources solely on detection and mitigation. This is just plain wrong, and Gragido and Pirc do well to point that out. If I can prevent 90 percent of all attack campaigns because most adversaries use known techniques, why not do it? That lets me concentrate my resources on finding the unknown techniques. Detection and mitigation is important, but these activities hould be balanced with a robust threat prevention program. Even in 2011, Gragido and Pirc asserted this philosophy.

Conclusion

Cybercrime and Espionage is a book that was ahead of its time. I give the authors credit for pushing the envelope as to how the security community’s thinking around advanced threats should evolve. If you read it when it was published, it would have stimulated your thought process around your own security program. But almost five years later, there is not enough in here to make the book Canon material. Gragido and Pirc present some stimulating ideas, but in the end, the security community has not adopted many of them. My recommendation is to read this book if you are interested in how our community has evolved in terms thinking about adversary campaigns. However, if you are looking for a state-of-the-art book about cybercrime and cyber espionage that will stand the test of time, this is not it.

Sources

[1] “Google Hack Attack Was Ultra Sophisticated, New Details Show,” by KIM ZETTER, Wired Magazine, 14 January 2010, Last Visited 5 July 2015, http://www.wired.com/2010/01/operation-aurora/

[2] “Google Aurora Hack Was Chinese Counterespionage Operation,” by Mathew J. Schwartz, Information Week: Dark reading, 21 May 2013, Last Visited 5 July 2015, http://www.darkreading.com/attacks-and-breaches/google-aurora-hack-was-chinese-counterespionage-operation/d/d-id/1110060?

[3] “The Cybersecurity Canon: Kingpin,” by Rick Howard, Palo Alto Networks, 11 February 2014, Last Visited 9 July 2015, http://researchcenter.paloaltonetworks.com/2014/02/cybersecurity-canon-kingpin/

[4] “The Cybersecurity Canon: Read Rick Howard’s First-Look Review of SPAM Nation by Brian Krebs,” by Rick Howard, Palo Alto Networks, 17 November 2014, Last Visited 9 July 2015, http://researchcenter.paloaltonetworks.com/2014/11/cybersecurity-canon-rick-howard-reviews-brian-krebs-spam-nation/

[5] “The Cybersecurity Canon: Countdown to Zero Day: Stuxnet and the Launch of the World’s First Digital Weapon,” by Rick Howard, Palo Alto Networks, 28 January 2015, Last Visited 9 July 2015, http://researchcenter.paloaltonetworks.com/2015/01/cybersecurity-canon-countdown-zero-day-stuxnet-launch-worlds-first-digital-weapon/

[6] “The Cybersecurity Canon: The Practice of Network Security Monitoring,” by Rick Howard, Palo Alto Networks, 10 November 2014, Last Visited 9 July 2015, http://researchcenter.paloaltonetworks.com/2014/11/cybersecurity-canon-practice-network-security-monitoring/

[7] “The Intelligence Cycle,” Central Intelligence Agency: Kids Zone, Last Visited 9 July 2015, https://www.cia.gov/kids-page/6-12th-grade/who-we-are-what-we-do/the-intelligence-cycle.html

[8] “The Intelligence Cycle,” Federation of American Scientists, Last Visited 9 July 2015, http://fas.org/irp/cia/product/facttell/intcycle.htm

[9] “Cyber Crime and Espionage: An Analysis of Subversive Multi-Vector Threats,” by Will Gragido & John Pirc, Syngres Publishing, 7 January 2011, Last Visited 10 July 2015, https://www.goodreads.com/book/show/10651366-cyber-crime-and-espionage?ac=1

[10] “SCADA systems: Riddled with vulnerabilities?” by Doug Drinkwater, SC Magazine, 26 August 2014, Last Visited 10 July 2015, http://www.scmagazineuk.com/scada-systems-riddled-with-vulnerabilities/article/368094/

[11] “4 Worst Government Data Breaches Of 2014,” by Jai Vijayan, InformationWeek: Government, 12 November 2014, Last Visited 10 July 2015,http://www.informationweek.com/government/cybersecurity/4-worst-government-data-breaches-of-2014/d/d-id/1318061

References

“APT1 Three Months Later – Significantly Impacted, Though Active & Rebuilding,” by Dan Mcwhorter 21 May 21 2013, Last Visited 9 July 2015, https://www.mandiant.com/blog/apt1-months-significantly-impacted-active-rebuilding/

“EU Data Protection Directive (Directive 95/46/EC),” by TechTarget, Last Visited 10 July 2015, http://searchsecurity.techtarget.co.uk/definition/EU-Data-Protection-Directive

“Internet Crime Complaint Center (IC3),” The Federal Bureau of Investigation (FBI) and the National White Collar Crime Center (NW3C), Last Visited 5 July 2015, http://www.ic3.gov/media/annualreports.aspx

“SAFE HARBOR PRIVACY PRINCIPLES,” by export.gov, Last Visited 10 July 2015, http://www.export.gov/safeharbor/eu/eg_main_018475.asp

[Palo Alto Networks Blog]

Spotlight on Advanced Persistent Threats in Industrial Control Systems

The challenge of APTs targeting Industrial Control Systems continues to evolve and escalate.  It is true that a number of the ICS-specific attacks in the years immediately following Stuxnet (e.g. Duqu, Flame, Shamoon) are not so interesting as derivatives of Stuxnet or in how they utilize more general, IT-centric exploits.  However, 2014 was a milestone year in that we saw two APTs that uniquely expanded on the initial methods used by Stuxnet:  Energetic Bear/Dragonfly (Havex) and Sandworm (Black Energy campaign). 

The most recent campaigns from these APTs have upped the bar in terms of “craftiness” with techniques combining more sophisticated social engineering, ICS protocol exploits, and exploits to automation-specific HMI software.  In the case of the APT attack to the German steel mill, also disclosed in 2014, we are reminded of potentially destructive cyberphysical effects that could occur when ICS systems are breached. (In this case, the destruction of a blast furnace.)

The “people, process, technology” discussion around security is very relevant here.  As always, the human element involved in social engineering is a particularly difficult challenge.  Most advanced attacks will employ some form of social engineering.  Education goes a long way in terms of mitigating the issue but motivated attackers will always find a way to trick a targeted individual into opening the malicious email attachment, loading and infected file on the free USB thumb drive, or visiting a seemingly innocent website housing drive-by malware, unknowingly initiating the APT attack.

To add, on the technology front, these attacks by well resourced actors like nation states and cybercriminal organizations typically use both known attacks and zero-day exploits and/or malware which conventional methods cannot detect nor prevent.  Combine social engineering and zero days, and you have a very effective methodology for establishing a beachhead for an ICS attack whether it is first into the IT side of the house or directly in the OT side.

Is APT Prevention a Holy Grail?

Many organizations assume they will breached, and think preventing advanced attacks is not feasible.  Hence, they try their best to isolate the SCADA/ICS network and stop known threats.  Capabilities to stop more advanced threats are typically non-existent or just starting to be deployed by some more forward-thinking organizations. Considering the high costs to organizations that are breached and the people and safety concerns associated with cyberphysical processes going awry in critical infrastructure, an inability to stop advanced threats should be something asset owners take seriously and address.

At Palo Alto Networks we believe that preventing attacks from APTs is possible.  No security solution is ever 100% effective, but we have a strong platform that makes it extremely hard for the bad guys, even the very sophisticated ones behind APTs, to successfully implement their attacks.  It is based on a platform approach that combines the power of the next-generation firewall, our threat intelligence cloud and advanced endpoint protection to prevent attacks and provide increased automation of security functions while providing correlated threat intelligence and logs.

Get up to Speed on APTs in ICS

We take a closer look at APTs in ICS and methods for protecting your organization against them using a platform approach in an upcoming webinar co-hosted by Mike Assante, Director of ICS at the SANS Institute, and myself.  Join us on Wednesday, July 22, to learn more about:

  • The evolution of APTs in ICS from the original Stuxnet to the recent Black Energy
  • The model of the APT attack lifecycle with a focus on the different phases and associated “kill points” which are critical to understand from a defensive standpoint
  • Best practices and technologies that help organizations better protect themselves from such attacks, particularly those using zero-day techniques

Register for the webinar at this link.  Thanks, and we hope to see you there!

[Palo Alto Networks Blog]

8 Practical Steps to Starting Risk Identification

Optimizing business risks associated with the use, ownership, operation, involvement, influence and adoption of IT within an enterprise is a key component in an enterprise’s ability to create value. This will allow the enterprise to reach the main objectives and it will most likely result in expansion.

Optimizing IT risks not only requires key practices of the company governance, such as the definition of risk appetite and policies, but also a continuous management process to identify, analyze, evaluate and treat IT risks covering the whole enterprise end-to-end.

However, a frequent issue is that organizations are limited in essential resources for IT risk management—for example, staff-related gaps (quantity and skills), lack of automated tools, restricted budget, incomplete inventories of IT assets and absence of historical data of loss events related with IT risks.

Although all these limitations are solvable, the solution may not come up immediately. As a result, an organization would still be exposed to unidentified IT risk scenarios that could overcome the established appetite or even the capacity to resist losses, compromising the sustainability of the company.

Therefore, the priority is to start as soon as possible by defining valid criteria to identify the IT risk scenarios and determine an optimized scope for the IT risk management process depending on the resources and capabilities available. To start the primary identification of the risk scenarios, the following eight steps are suggested:

  1. Consider internationally recognized standards and guidance, such as:
    1. COBIT 5 for Risk—provides 111 examples of IT risk scenarios
    2. MAGERIT—includes numerous threats for each type of assets/resources with their corresponding safeguards
    3. Additional documents from ISACA on topics such as big data, cloud computing, vendor management and social media
  2. Analyze business objectives of the organization to identify IT-related risks that could jeopardize its success.
  3. Collect the know-how of the experts within the organization scope (e.g., CISO, DBA and CTO) to engage them in the process of IT risk management.
  4. Assess news of vulnerabilities of the IT assets/resources adopted by the company.
  5. Apply “reverse engineering” over controls required by the ongoing regulations to infer/detect possible threats from those controls.
  6. Analyze the events of operational risk loss database to detect materialized IT risk scenarios.
  7. Once you have collected a considerable universe of scenarios, the organization´s possible scope of analysis should be formally defined. This will require a formal approval from the relevant bodies (e.g., risk committee).
  8. Approved register of IT risk scenarios should be enriched periodically, depending on: what actually happened about threats, updates of standards, new technological developments and improvement of the capacity level of the facilitators required for risk management.

Once the registry of risk scenarios is formally approved, the universe of assets/IT resources to analyze could be defined assigning priority to the most critical ones in terms of their support for the business processes. After this, the phase of IT risk analysis within the company could already be started with the most appropriate scope.

Franco Rigante, CISA, CRISC, PMP
IT – GRC Specialist
ISACA Communities Committee

[ISACA]

Tracking MiniDionis: CozyCar’s New Ride Is Related to Seaduke

Executive Summary

Unit 42 has uncovered a new campaign from the CozyDuke threat actors, aka CozyCar [1], leveraging malware that appears to be related to the Seaduke malware described earlier this week by Symantec. [2]

This campaign, which began on July 7, 2015, appears to be targeted at government organizations and think-tanks located in democratic countries [3], and utilizes compromised, legitimate websites for spear phishing and command and control activity.

Unit 42 discovered the extent of this attack using the Palo Alto Networks AutoFocus service, which allows analysts to quickly find correlations among malware samples analyzed by WildFire. All files referenced throughout the analysis are contained in the IOC table at the end of this blog.

Figure 1. Sample decoy presented to a user while downloader runs. Researchers discovered 6 unique decoys in use with similar lures targeting pro-democratic organizations.

Malware Details

The Initial Droppers: Decoy and Downloader

The current CozyCar campaign includes spear phishing emails that deliver the payload from either by a link to a .zip file on a compromised website or by direct delivery as an attachment to the phish.

At the time of our analysis, the phishing link was no longer active. When a user opens the attached file a poorly detected executable file [VT 1/54] is extracted. The initial dropper is a self-extracting archive (SFX). Upon execution, this executable file will drop two files in the %TEMP% directory: a decoy .wav file and the secondary dropper.

The CozyDuke group commonly uses legitimate media files to trick users. In reality, while the media — a .wav file with a female voice claiming to be a reporter looking for commentary — is played, the secondary dropper executes in the background. The secondary dropper requests a .swf file using SSL as illustrated in the HTTP traffic below.

As of this writing, the domain extranet.qualityplanning[.]com resolved to 64.244.34[.]200.

The secondary dropper then cleans up after itself with a simple vbs script (md5:0d132ee171768dc30d14590ed2dbadd1) that leaves only the decoy multimedia file behind. But what did the dropper do with the .swf file?

The Real Payload

While the player.swf file downloaded by the second stage dropper does contain media, it is, again, a decoy.

The actual flash component of this file is roughly 16kb, leaving approximately 200kb of the file unaccounted for. The second stage dropper contains decoding routines that decode the arbitrary binary data into an executable file.

The executable file is dropped in %appdata%/Roaming and appears to try and emulate legitimate software names: TimbuktuDaemon, SearchIndexer, RtkAudioService64, dirmngr, o2flash, and usbrefs64. This file was not observed on VirusTotal until July 9 and has extremely low detection rates [VT: 3/54].

It appears that the authors of this particular iteration of the CozyCar group’s malware internally call it “miniDionis” according to pdb strings left in the binary (c:\BastionSolution\Shells\Projects\miniDionis4\miniDionis\obj\Release\miniDionis.pdb). It also appears to be an iteration on the “forkmeimfamous” aka Seaduke malware analyzed by Unit 42 in a previous blog [4].

The malware stores 2 files in the %temp% directory: a configuration file and a secondary dll. The configuration file’s name matches the final characters of the bot_id that is contained within as per the sample below:

Figure 2. .net disassembly of the primary payload shows the author’s name for the project, “miniDionis”.

Analysis of the secondary dll file (name matches [A-Z0-9]{1}\.tmp) indicates that its primary function is to serve as a cleanup mechanism for the dropped binary. This is likely an attempt to thwart forensic investigations.

Further examination of memory dumps taken following the execution of miniDionis reveals some clues into the beaconing activity exhibited. The malware stores configuration values in memory as key:value pairs:

The configuration of miniDionis is a JSON blob with several important sections, which are described in the table below:

Key Functionality
autoload_settings dictionary containing values which control the malware’s behavior when executing via persistence mechanisms
app_name subkey of autload_settings, defines the value to be used as the malware’s name
delete_after subkey of autload_settings, boolean value that defines whether the executable is to be deleted after exectuing
exe_name subkey of autload_settings, defines the value to be used as the exectuable file’s name
cookie_name defines the value in which cookie data will be stored
enable_autoload boolean value which controls persistence
first_run_delay time in seconds to delay initial beaconing after execution
host_scripts dictionary containing the location of C2s
key_id equivalent to the bot_id; also used to derive values in C2 comms
keys dictionary containing an AES key and AES IV
aes aes value
aes_iv aes_iv
user_agent HTTP User-Agent header to be used when communicating with a C2

Table 1. ‘miniDionis’ configuration keys

Network Communications

The functional payload of this Trojan starts by creating a Mutex by splitting the “bot_id” value in the configuration on the hyphen (“-“) and using the second portion of the split string (specifically, “01MRLXW” in the case of this configuration).

From a functionality standpoint, the Trojan uses the concept of tasks that are processed and completed using a pool of threads. To obtain tasks, the Trojan will issue an HTTPS request to the C2 server (“host_scripts” in the configuration) that resembles the following example beacon:

The Trojan manually creates the cookie in this HTTP request. The cookie contains ciphertext that the Trojan creates based on the “bot_id” in the JSON configuration. The Trojan compresses the “bot_id” string using zlib and then encrypts it using the RC4 algorithm using a generated key. The generated key is a SHA1 hash of two randomly created strings: the first of which is between 2 and 8 bytes long and the second is between 1 and 7 characters in length.

The ciphertext of the “bot_id” is then based64 encoded and finally the appended to the “cookie_name” (“SSID=”) in the configuration and sent within the HTTP request to the C2 server.

Unit 42 did not observe the first random string (between 2 and 8 characters in length) sent to the C2 in the first beacon, which would be required by the C2 to reproduce the exact SHA1 hash used as a key to generate the ciphertext in the cookie. Upon further examination we believe that the C2 will not be able to decrypt the cookie in the first beacon. Instead, the C2 will respond to the first beacon with data that the Trojan will use to extract a string, using a function named TrExtractKey seen in Figure 3, to replace the first random string used to generate the SHA1 hash.

Once the C2 and Trojan have synchronized using this string, the C2 will be able to decrypt subsequent network beacons because the Trojan includes the random string between 1 and 7 characters that makes up the second half of the SHA1 hash within the cookie field before the ciphertext.

Figure 3. TrExtractKey Function Used by MiniDionis to Obtain String from C2 to Synchronize Keys

The C2 communications, and several of the commands we will discuss in this blog, include a rather interesting technique to manually handle HTTP redirection, such as the HTTP 301 Moved Permanently and HTTP 302 Found status codes.

The technique used to handle these redirections involves checking for the presence of a “Location” field within the HTTP headers of the server response, then using regular expressions to parse the HTML within server response to find the appropriate URL.

The code contains three regular expressions to parse the HTML to locate the URL, the first of which is “<a.*?>.*?</a>” that locates all of the tags associated with link within the HTML.

The second regular expression of “onclick=\”Accept();\”” locates only links within the HTML with a specific “onclick” action.

The last regular expression of “href\\s*=\\s*(?:[\”‘](?<1>[^\”‘]*)[\”‘]|(?<1>\\S+))” to obtain the correct URL to interact with as the C2 server.

Command handler

Once the C2 and Trojan have synchronized and can decrypt their network communications the C2 server will begin responding to beacons from the Trojan with JSON blobs.

Unit 42 has not received any JSON blobs from an active C2 server, but based on static analysis of the Trojan determined the JSON would look as follows:

The Trojan takes this JSON blob and adds each task in the list into a pool for processing. Separate worker threads access this pool of tasks and process the commands and perform the necessary activities.

Unit 42 analyzed the Trojan’s command handler and found several commands, as seen in Table 2, which allows the threat actors to carry out a full range of activities on the system.

Command Sub-Command Description
cmd Checks for subcommands within the ‘data’ section, if not it attempts to run the ‘data’ using “cmd /c <data>’
cd Changes directory
pwd Returns current working directory
cdt Change to temporary directory
:set_update_interval Sets the timeout between network beacons
:proxy Configures proxy information
:exit Exits the Trojan and responds to the C2 server with “Bye!”
:wget Downloads a file from a specified URL
:uploadto Uploads a file to a specified URL
exec Launches an application and waits for it to exit
execw Launches an applications and does not wait for it to exit
upl Uploads or downloads from a list of files to or from the C2 server
srv Sends system information from the compromised system to the C2 server

Table 2. Available Commands within MiniDionis’ Command Handler

Conclusion

The actors behind the CozyDuke framework are highly sophisticated, motivated, and have become increasingly bold in their campaigns.

We recommend that other security practitioners review the included Indicators of Compromise (IoCs) to ensure they have not been targets in this campaign, and add the appropriate security controls to prevent future attacks.

This group is reliant on social engineering, and thus, user education remains of paramount importance.

Palo Alto Networks customers using WildFire were protected from this campaign. All known elements of this campaign have been accurately identified by WildFire as malicious.

IOCs

domain ff.whitebirchpaper[.]com
domain visionresearch[.]com
domain betawebservices.ntnonline[.]com
domain staff.shasta[.]com
hostname extranet.qualityplanning[.]com
hostname secure.hgl[.]com
hostname illuminatistudios[.]net
ip 103.254.16.168
ip 103.226.132.7
ip 122.228.193.115
md5 01039a95e0a14767784acc8f07035935
md5 0f9534b63cb7af1e3aa34839d7d6e632
md5 2e64131c0426a18c1c363ec69ae6b5f2
md5 70f5574e4e7ad360f4f5c2117a7a1ca7
md5 1dd593ad084e1526c8facce834b0e124
md5 42ffc84c6381a18b1f6d000b94c74b09
md5 719cf63a3922953ceaca6fb4dbed6584
md5 f415470b9f0edc1298b1f6ae75dfaf31
md5 ca770a4c9881afcd610aad30aa53f651
md5 24083e6186bc773cd9c2e70a49309763
md5 b0a9a175e2407352214b2d005253bc0c
md5 b55628a605a5dfb5005c44220ae03b8a
md5 26bd36cc57e30656363ca89910579f63
md5 a9c045c401afb9766e2ca838dc6f47a4
md5 f8cb10b2ee8af6c5555e9cf3701b845f
md5 c8b49b42e6ebb6b977ce7001b6bd96c8
md5 030da7510113c28ee68df8a19c643bb0
md5 e07ef8ffe965ec8b72041ddf9527cac4
md5 4cbd9a0832dcf23867b092de37c10d9d
md5 3a04a5d7ed785daa16f4ebfd3acf0867
md5 9018fa0826f237342471895f315dbf39
md5 98613ecb3afde5fc48ca4204f8363f1d
md5 e00bf9b8261410744c10ae3fe2ce9049
md5 51ea28f4f3fa794d5b207475897b1eef
md5 3195110045f64a3c83fc3e043c46d253
md5 1dd593ad084e1526c8facce834b0e124
url connectads[.]com
url kane-consulting[.]net
url edadmin.kearsney[.]com
url redbluffchamber[.]com

Sources

[1] https://securelist.com/blog/research/69731/the-cozyduke-apt/
[2] http://www.symantec.com/connect/blogs/forkmeiamfamous-seaduke-latest-weapon-duke-armory
[3]http://www.theregister.co.uk/2015/04/22/cozyduke_hackers_white_house_state_dept_malware/
[4] http://researchcenter.paloaltonetworks.com/2015/07/unit-42-technical-analysis-seaduke/

, and

[Palo Alto Networks Blog]

Unit 42 Technical Analysis: Seaduke

Earlier this week Symantec released a blog post detailing a new Trojan used by the ‘Duke’ family of malware. Within this blog post, a payload containing a function named ‘forkmeiamfamous’ was mentioned. While performing some research online, Unit 42 was able to identify the following sample, which is being labeled as ‘Trojan.Win32.Seadask’ by a number of anti-virus companies.

MD5 A25EC7749B2DE12C2A86167AFA88A4DD
SHA1 BB71254FBD41855E8E70F05231CE77FEE6F00388
SHA256 3EB86B7B067C296EF53E4857A74E09F12C2B84B666FC130D1F58AEC18BC74B0D
Compile Timestamp 2013-03-23 22:26:55
File type PE32 executable (GUI) Intel 80386, for MS Windows, UPX compressed

Our analysis has turned up more technical details and indicators on the malware itself that aren’t mentioned in Symantec’s post. Here are some of our observations:

First Layer of Obfuscation

Once the UPX packer is removed from the malware sample, it becomes quickly apparent that we’re dealing with a sample compiled using PyInstaller. This program allows an individual to write a program using the Python scripting language and convert it into an executable for the Microsoft Windows, Linux, Mac OSX, Solaris, or AIX platform. The following subset of strings that were found within the UPX-unpacked binary confirms our suspicions.

  • sys.path.append(r”%s”)
  • del sys.path[:]
  • import sys
  • PYTHONHOME
  • PYTHONPATH
  • Error in command: %s
  • sys.path.append(r”%s?%d”)
  • _MEI%d
  • INTERNAL ERROR: cannot create temporary directory!
  • WARNING: file already exists but should not: %s
  • Error creating child process!
  • Cannot GetProcAddress for PySys_SetObject
  • PySys_SetObject

Because the sample was written in Python originally, we’re able to extract the underlying code. A tool such as ‘PyInstaller Extractor’ can be used to extract the underlying pyc files present within the binary.

Figure 1. Extracted Python files from Seaduke

We can then use a tool such as uncompyle2 to convert the Python byte-code into the original source code. Once this process is completed, we quickly realize that the underlying Python code has been obfuscated.

Figure 2. Obfuscated Python code

Second Layer of Obfuscation

Tracing through the obfuscated code, we identify an ‘exec(ZxkBDKLakV)’ statement, which will presumably execute some Python code. Tracing further, we discover that this string is generated via appending a number of strings to the ‘ZxkBDKLakV’ variable. Finally, we find that after this string is created, it is base64-decoded and subsequently decompressed using the ZLIB library.

Figure 3. Second layer of obfuscation identified

The following simple Python code can be used to circumvent this layer of obfuscation:

The remaining Python code still appears to be obfuscated, however, overall functionality can be identified.

Final Payload

As we can see below, almost all variable names and class names have been obfuscated using long unique strings.

Figure 4. Obfuscation discovered in final payload

Using a little brainpower and search/replace, we can begin identifying and renaming functionality within the malware. A cleaned up copy of this code can be found on GitHub. One of the first things we notice is a large blob of base64-encoded data, which is additionally decompressed using ZLIB. Once we decode and decompress this data, we are rewarded with a JSON object containing configuration data for this malware:

Figure 5. Base64-encoded / ZLIB compressed data

This configuration object provides a number of clues and indicators about the malware itself. After this data is identified, we begin tracing execution of the malware from the beginning. When the malware is initially run, it will determine on which operating system it is running. Should it be running on a non-Windows system, we see a call to the infamous ‘forkmeiamfamous’ method. This method is responsible for configuring a number of Unix-specific settings, and forking the process.

Figure 6. Main execution of malware

Continuing along, we discover that this malware has the ability to persist using one of the following techniques:

  1. Persistence via PowerShell
  2. Persistence via the Run registry key
  3. Persistence via a .lnk file stored in the Startup directory

The malware copies itself to a file name referenced in the JSON configuration.

Figure 7. Persistence techniques

After the malware installs itself, it begins making network requests. All network communications are performed over HTTP for this particular sample; however, it appears to support HTTPS as well. When the malware makes the initial outbound connection, a specific Cookie value is used.

Figure 8. Initial HTTP request made

In actuality, this Cookie value contains encrypted data. The base64-encoded data is parsed from the Cookie value (padding is added as necessary).

EBJhZTlKiqN8nYWejKh7UpDycPlcrGMEcTE=

The resulting decoded data is shown below.

\x10\x12ae9J\x8a\xa3|\x9d\x85\x9e\x8c\xa8{R\x90\xf2p\xf9\\\xacc\x04q1

The underlying data has the following characteristics.

Figure 9. Cookie data structure

XORing the first single character against the second character identifies the length of the random string. Using the above example, we get the following.

First Character  : ‘\x10′
Second Character : ‘\x12′
String Length (16 ^ 18) : 2
Random String    : ‘ae’
Encrypted Data   : ‘9J\x8a\xa3|\x9d\x85\x9e\x8c\xa8{R\x90\xf2p\xf9\\\xacc\x04q1′

Finally, the encrypted data is encrypted using the RC4 algorithm. The key is generated by concatenating the previously used random string with the new one, and taking the SHA1 hash of this data.

This same key is used to decrypt any response data provided by the server. The server attempts to mimic a HTML page and provides base64-encoded data within the response, as shown below.

Figure 10. Server response

Data found within tags in the HTML response is joined together and the white space is removed. This data is then base64-decoded with additional characters (‘-_’) prior to being decrypted via RC4 using the previously discussed key. After decryption occurs, the previous random string used in key generation is updated with the random string. In doing so, the attackers have ensured that no individual HTTP session can be decrypted without seeing the previous session. If the decrypted data does not produce proper JSON data, Seaduke will discard it and enter a sleep cycle.

Otherwise, this JSON data will be parsed for commands. The following commands have been identified in Seaduke.

Command Description
cd Change working directory to one specified
pwd Return present working directory
cdt Change working directory to %TEMP%
autoload Install malware in specified location
migrate Migrate processes
clone_time Clone file timestamp information
download Download file
execw Execute command
get Get information about a file
upload Upload file to specified URL
b64encode Base64-encode file data and return result
eval Execute Python code
set_update_interval Update sleep timer between main network requests
self_exit Terminate malware
seppuku Terminate and uninstall malware

In order for the ‘self_exit’ or ‘seppuku’ commands to properly execute, the attackers must supply a secondary argument of ‘YESIAMSURE’.

Conclusion

Overall, Seaduke is quite sophisticated. While written in Python, the malware employs a number of interesting techniques for encrypting data over the network and persisting on the victim machine. WildFire customers are protected against this threat. Additionally, Palo Alto Networks properly categorizes the URL used by Seaduke as malicious.

[Palo Alto Networks Blog]

English
Exit mobile version