## In-depth Analysis of Hydraq ###### The face of cyberwar enemies unfolds Zarestel Ferrer and Methusela Cebrian Ferrer CA ISBU Senior Researchers, Melbourne Australia Abstract There are thousands of undetected online threats and malware attacks from around the world every day. Most of these attacks take place in cyberspace, where unsuspecting people fall prey to various forms of cybercrime. Common cyber criminal activity involves stealing sensitive information such as credit card details, online login credentials, browsing history and email addresses. However, notable skilled attacks occur when the target is in possession of highly-valuable information that could be leveraged as a weapon for warfare. _Hydraq is a family of threats used in highly sophisticated, coordinated attacks against large and_ high-profile corporate networks. It is referred to as Operation Aurora, _Google Hack Attack and_ _Microsoft Internet Explorer 0-day (CVE-2010-0249). An in-depth code investigation and analysis_ will highlight _Hydraq features and capabilities, and as it unfolds, questions will unravel on to_ whether the discovery of this threat is just the beginning of a global arms race against cyberwarfare. ----- # Table of Contents **Introduction** **3** **Anatomy of an Attack** **4** **1. How Hackers Gain Access** **5** 1.1 Reconnaissance 5 1.2 0Day Hack Attack 5 1.3 MS10-002 (CVE-2010-049) Analysis 5 1.4 Hydraq Binary Shellcode 7 **2. How Hackers Maintain Access** **9** 2.1 Win32/Hydraq (EXE) Dropper: Generating Random Service 9 2.2 Win32/Hydraq (DLL) Backdoor: Method of Installation 10 **3. Cyber Spy In Control** **11** 3.1 Initialization of the Backdoor Configuration 11 3.2 Command and Control 11 3.3 Backdoor Configuration: Resource Section and Registry Key 12 3.4 Backdoor Communication Protocol 0x00: Establishing Communication 13 3.5 Backdoor Communication Protocol 0x01: Execution of Client-Server Commands 17 3.6 Backdoor Command Reference 19 3.7 Backdoor Command Table 21 3.9 Backdoor Commands In Action 24 **Summary** **28** **Safe Computing Habits** **29** **Appendix A - Other variant method of installation** **31** **Appendix B - Initial Handshake** **33** **Appendix C - Customize Character Decoding** **33** **Appendix D - Real-time Graphical Control** **35** **Appendix E - Domain Name List** **36** **Reference** **37** CA ISBU ISI WHITE PAPER IN DEPTH ANALYSIS OF HYDRAQ 2 ----- # Introduction _“In mid-December, we detected a highly sophisticated and targeted attack on our corporate_ _infrastructure originating from China that resulted in the theft of intellectual property from Google._ _... we have evidence to suggest that a primary goal of the attackers was accessing the Gmail_ _accounts of Chinese human rights activists.”_ This statement was taken from a Google blog post entitled "A new approach to China"[[1]], in which Google declared its decision to stop censoring its search results in China. _Internet freedom vs cyber crime is a deep issue that crosses all boundaries; and the same brought_ global debate about internet censorship and human rights [[2]]. This incident prompted authorities and world leaders to discuss and work on matters of cyber crime; taking into consideration that cyber threats may affect national security [[3]]. The report _“Tracking GhostNet: Investigating a Cyber Espionage Network”[ [4]] as published last_ year, highlights cyberwarfare as a major global concern. Evidently, an increasing wealth of online information and resources will attract attackers. For highprofile threats such as Hydraq, it is important to understand the underlying attack technique and its technical details. This paper seeks to explore and discover the level of skill the attackers employed to successfully deploy this highly sophisticated attack. CA ISBU ISI WHITE PAPER IN DEPTH ANALYSIS OF HYDRAQ 3 ----- ###### Anatomy of an Attack Reconnaissance Internet activity ### [Attacker] [Target User] Deploying attacks IE 0-day Exploit Attack (CVE-2010-049) **Remote Shellcode APIs** shell32.SHGetSpecialFolderPathA urlmon.URLDownloadToFileA ...kernel32.CreateFileA ...kernel32.GetFileSize // decrypt downloaded file ...kernel32.CreateFileA ...kernel32.SetFilePointer ...kernel32.ReadFile ...kernel32.WriteFile ...kernel32.CloseHandle ...kernel32.CloseHandle ...kernel32.DeleteFileA ...kernel32.MultiByteToWideChar // Execute Win32/Hydraq dropper kernel32.CreateProcessInternalW Reconnaissance Internet activity Deploying attacks IE 0-day Exploit Attack (CVE-2010-049) **Win32/Hydraq allows remote attacker gain control.** ### [Attacker] [Target User] covert communication channel transmission of sensitive information CA ISBU ISI WHITE PAPER IN DEPTH ANALYSIS OF HYDRAQ 4 |R ying e c o n n t a r i a attacks s c s n o s a v n e m c r i I Win32/Hydraq t e s E s c i 0 o o - n d m allow a s o m y f u s re E n e x i m n c p o s a i lo te t t i i i t o v I e n A t n i c t t n a h attack e f c e a r o r k r n n ( g n e m C t e a l V ain t a i E c o - t i n 2 cont v 0 r i 1 t ol 0 . y - 0 4 9 )|Col2| |---|---| **Win32/Hydraq allows remote attacker gain control.** covert communication channel transmission of sensitive information **Win32/Hydraq allows remote attacker gain control.** covert communication channel covert communication channel ----- ###### 1. How Hackers Gain Access 1.1 Reconnaissance Profiling the target is a basic principle of hacking. This refers to a reconnaissance phase where the attacker evaluates and determine ways to launch a successful attack. Reconnaissance with Whois, DNS and IP/Network could provide preliminary information about the target organization’s infrastructure. In addition, a combination of social engineering and physical (on-site) reconnaissance is also considered as a valuable source of information. To learn more about the target, attackers performs passive and active scanning to understand the target network topology, platforms, ports and services, vulnerabilities and security defenses. The profiling also extends to people that have knowledge and access to the target organization including employees, contractors, and visitors. Cyber reconnaissance is very useful in this case, gathering detailed information through social networking sites and tracing digital footprints through search engine results. Attackers could compromise the “circle of trust” of the target, including friends, family members and even internet browsing habits can be analyzed to successfully gain access. ###### 1.2 0Day Hack Attack _Hydraq exploits the zero-day (0day) vulnerability in Internet Explorer, which is referred to as_ CVE-2010-0249 [[5]] and MS10-002 [[6]]. In reconnaissance stage, Hydraq masterminds have been able to devise a plan for successful hacking attack. Evidently, the authors found an opportunity to target Internet Explorer and evade security detection through an unknown vulnerability. Sophisticated social engineering tricks can then be deployed to entice target users to visit a compromised web site. ###### 1.3 MS10-002 (CVE-2010-049) Analysis It is a common characteristic for attackers to obfuscate malicious JavaScript to conceal the code’s real intentions and also avoid detection by security scanners [Listing 01]. CA ISBU ISI WHITE PAPER IN DEPTH ANALYSIS OF HYDRAQ 5 ----- **OBFUSCATED** **DeOBFUSCATED** **< Shellcode >** **< Exploit Code >** [Listing 01 - Hydraq JavaScript (JS/Hydraq) distributed for targeted attack] In general use, obfuscation is designed for code protection regardless of whether the intentions are good or bad. _Hydraq’s malicious JavaScript contains code that takes advantage of Internet Explorer (IE)_ HTML object handling flaw and is triggered when IE tries to access a deleted or incorrectly initialized HTML object. [Listing 02] Once the exploit attack is successful, Hydraq’s binary shellcode will then execute on the target system. ``` var e1=null; function ev1(evt) { e1=document.createEventObject(evt); document.getElementById("sp1").innerHTML=""; window.setInterval(ev2, 50); } function ev2() { p="\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\ u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0 d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0 c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d\u0c0d" ; for(i=0;i** **< Exploit Code >** ----- ###### 1.4 Hydraq Binary Shellcode As shown in Listing 01, Hydraq binary shellcode is u% encoded. A simple bitwise XOR encryption and 0xD8 as the key, will reveal the hidden instruction. ```