11/11/2003

64-bit AMD Opteron 64

Application of Win32 Executable File ƒ Legacy 64 bit platforms ƒ Inbuilt 128-bit bus DDR memory controller with memory bandwidth speed up to 5.3GB/s. Infectors on and AMD ƒ Benefits of 64-bit processors Opteron Based Win64 Systems ƒ Use of hyper transport protocol, “glueless” architecture.

Oleg Petrovsky and Shali Hsieh ƒ Increased integer dynamic range Computer Associates International Inc. ƒ Available in up to 8 way configuration with the clock speeds 1 Computer Associates Plaza, Islandia, NY 11749, ƒ Much larger addressable memory space of 1.4 GHz, 1.6 GHz and 1.8 GHz . USA

ƒ Benefits to database, scientific and cryptography ƒ Reuses already familiar 32-bit instruction set and applications extends it to support 64-bit operands, registers and memory pointers.

AMD64 Programming Model AMD64: Programming model Intel Itanium 64

X86 32-64 ƒ 64 bit Itanium line of processors is being developed by Intel

XMM8 X86 80-Bit ƒ Extends general use registers to 64-bit, adds additional eight 64-Bit X87 general purpose 64-bit registers. ƒ Itanium - 800 MHz, no on die L3 cache, Itanium 2 - 1GHz, RAX EAX AX 3MB L3 on die, Itanium 2003 (Madison) - 1.5 GHz, 6MB L3 on die cache, 410M transistors, largest integration on a RBX ƒ Reuses x86 instruction set. single silicon crystal today. XMM15 RCX ƒ Runs 32-bit code without emulation or translation to a native ƒ Itanium line of processors utilizes more efficient and robust XMM0 than legacy x86 instruction set architecture F instruction set. R8 L A ƒ Itanium has to use x86-to-IA-64 decoder a specifically ƒ Minimizes learning curve. tailored to x86 on chip emulator R15 G 64-Bit S XMM8 FS EIP ƒ EPIC instruction set architecture

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 1 11/11/2003

IA64 Programming model 32-bit application support 32-bit application support (cont.)

64-Bit 81-Bit 64-Bit 64-Bit ƒ 64 (WoW64), an abstraction layer Ntdll.dll gr0 fr0 br0 ar0 32 bit dlls gr1 fr1 ar1 between 64 bit executing environment and 32 bit processes. Branch registers Wow 64 Floating ƒ Wow64 consists of Wow64.dll, Wow64win.dll, Wow64cpu.dll General use Application point registers br7 registers Wow64.dll Wow64win.dll Wow64cpu.dll registers ƒ Wow64 intercepts and emulates system calls made by 32 bit applications in user mode Ntoskernel.exe Win32k.sys gr127 fr127 ar127 ƒ Wow64 prevents files and registry collisions HAL PAL

cpuid0 SYSTEMS FIRMWARE PROCESSOR x86-to-IA-64 ƒ 32 and 64 bit dlls are stored separately, 32 bit application decoder ip 64-Bit can only load 32 bit dlls as well as 64 bit application can only load 64 bit dlls.

Registry Redirector Registry Reflector Redirector

Wow64 32-Bit process HKLM\Software HKLM\Software\Wow6432Node ƒ Wow64 synchronizes certain registry keys to allow 64 and 32 ƒ Most of the file names of 64 bit Windows dlls are identical to bit programs connectivity through COM their 32 bit implementation 64-Bit HKLM\Software HKLM\Software ƒ Registry keys which are affected: ƒ Wow64 redirects %windows%\system32 to HKLM\Software\Classes HKLM\Software\\COM3, %windows%\syswow64 for 32 bit applications HKLM\Software\Microsoft\OLE, HKLM\Software\Microsoft\EventSystem ƒ File system redirection mechanism separates 64 and 32 bit Regedit 64-Bit Regedit 32-Bit HKLM\Software\Microsoft\RPC dlls for the use by 64 and 32 bit applications respectively

ƒ During the synchronization the keys information may be modified to reflect differences between 64 and 32 bit HKLM\Software\KEY_WOW64_32KEY environments

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 2 11/11/2003

File System Redirector (cont.) Interprocess communications PE vs. PE+

Machine signature +0x0 ‘P’,’E’ ‘P’,’E’ +0x0 Machine signature ƒ Name object such as mutexes, semaphores and file handles 0x0 0x0 Wow64 can be shared between 64 and 32 processes Machine signature +0x4 0x14C 0x200 +0x4 Machine signature 32-Bit process Optional header size +0x14 0xE0 0xF0 +0x14 Optional header size %windows%\System32 %windows%\SysWow64 ƒ Handles to windows can be shared (HWND) Optional header signature +0x18 0x10B 0x20B +0x18 Optional header signature 64-Bit ƒ RPC calls can be issued from 32 bit process to 64 bit and Base of data +0x30 +0x30 Image Base %windows%\System32 %windows%\System32 vice versa Image Base +0x34

Size of stack reserve +0x60 +0x60 Size of stack reserve ƒ COM local services can be shared Size of stack commit +0x64 Size of heap reserve +0x68 +0x68 Size of stack commit Size of heap commit +0x6C ƒ CreateProcess and ShellExecute can launch 64 bit or 32 bit Loader flags +0x70 +0x70 Size of heap reserve processes from within either 64 or 32 bit process +0x78 Size of heap commit

+0x80 Loader flags

Virus Threats on Windows 64 MBR Infection MBR Infection

Computer malware Computer malware ƒ GPT disk have a protective MBR sitting in the sector 0 System File System File preceding the GPT partition Boot viruses Boot viruses infectors infectors infectors infectors ƒ The GPT disk will appear as an MBR disk with possibly unrecognized partition instead of being appearing as NTFS Start up NTFS Start up unformatted directories directories System System ƒ The MBR is not used during the boot process of the Windows Initialization Initialization Executable files Executable files files files system

MBR GUIDPT Registry MBR GUIDPT Registry ƒ MBR viruses will not be able to propagate since the viral code will not be loaded and run during the GPT boot

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 3 11/11/2003

System Infection System Infection (Trojan/Worm) File Infection

Computer malware Computer malware ƒ Copying itself to a designated location System File System File Boot viruses Boot viruses infectors infectors ƒ Applying changes to the system registry run keys infectors infectors ƒ Inserting references to its code inside win.ini or system.ini files

NTFS Start up ƒ Copying itself in to the system startup folders NTFS Start up directories ƒ Modifying or substituting a program, that runs on every boot directories System by the OS, to run the malicious code System Initialization Initialization Executable files Executable files files ƒ Change associations to a known file types files

MBR GUIDPT Registry ƒ Install itself as a NT service MBR GUIDPT Registry

File Infection (Cont.) Win32.Swen.A Win32.Klez.H

Wow64

HKLM\Software\ HKLM\Software\Microsoft\Windows Wow6432Node\Microsoft\Windows \CurrentVersion\Run\ucfzyojza = \CurrentVersion\Run\ucfzyojza = ƒ Attaching viral code to the beginning of the executable “cxsgrhcl.exe ” “cxsgrhcl.exe autorun” image, original PE file is not modified. Wow64 ƒ Overwriting an original file, the original code is not HKCU\exefile\shell\open\command HKCU\exefile\shell\open\command (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*” preserved. HKCU\comfile\shell\open\command HKCU\comfile\shell\open\command ƒ Overwriting an original code preserving the original code in a (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*” %windows%\System32\wink??.exe %windows%\SysWOW64\wink??.exe HKCU\piffile\shell\open\command HKCU\piffile\shell\open\command HKLM\Software\ file stream (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*” HKLM\Software\Microsoft\Windows \CurrentVersion\Run\wink??.exe = Wow6432Node\Microsoft\Windows ƒ Modifying the PE+ header of an original file to point to viral HKCU\batfile\shell\open\command HKCU\batfile\shell\open\command “c:\windows\system32\wink??.exe” \CurrentVersion\Run\wink??.exe = code embedded in the file. (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*” “c:\windows\system32\wink??.exe” HKCU\scrfile\shell\open\command HKCU\scrfile\shell\open\command ƒ Using entry point obfuscation methods. (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*” HKCU\scrfile\shell\config\command HKCU\scrfile\shell\config\command (Default) = “cxsgrhcl.exe “%1” %*” (Default) = “cxsgrhcl.exe “%1” %*”

Zip file created by WinRAR in %windows% %windows%\cxsgrhcl.exe %windows%\cxsgrhcl.exe

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 4 11/11/2003

Win32.Klez.H File Infection Win32.Lovgate.J Win32.Lovgate.J File Infection

Wow64 32-bit ShellExecute(…) %windows%\System32\iexplore.exe %windows%\SysWOW64\iexplore.exe original file name PE Header %windows%\System32\kernel66.dll %windows%\SysWOW64\kernel66.dll PE Header 64-bit %windows%\System32\ravmond.exe %windows%\SysWOW64\ravmond.exe .text packed original ShellExecute(…) PE Header %windows%\System32\winexe.exe %windows%\SysWOW64\winexe.exe virus code .text %windows%\System32\winrpc.exe %windows%\SysWOW64\winrpc.exe .text virus code 64-bit %windows%\System32\.exe %windows%\SysWOW64\winhelp.exe PE Header HKCR\exefile\shell\open HKCR\exefile\shell\open\command\ .rsrc 64-bit .text command\(Default) = (Default) = %windows%\SysWOW64\ virus “%System%\winexe.exe “%1” %*” winexe.exe “%1” %* resources PE Header .rsrc virus 64-bit .text HKCR\txtfile\shell\open .rsrc HKCR\txtfile\shell\open\command\ resources .rsrc command\(Default) = (Default) = “winrpc.exe %1” PE Header “winrpc.exe %1” .text .rsrc HKCU\Software\Microsoft\ HKCU\Software\Microsoft\ Windows NT\CurrentVersion\ Windows NT\CurrentVersion\ Windows\run = “ravmond.exe” Windows\run = “ravmond.exe” .rsrc

Win32.Dumaru.A Win32.Dumaru.A File Infection Win32.Valla.2048

Wow64 WinExec(…)

%windows%\System32\load32.exe %windows%\SysWOW64\load32.exe Original file ƒ Search for .EXE extension %windows%\System32\vxdmgr32.exe %windows%\SysWOW64\vxdmgr32.exe 32-bit 64-bit ƒ Check PE signature PE Header PE Header 64-bit ƒ Add a new section named "XOR“ %windows%\dllreg.exe %windows%\dllreg.exe .text ƒ The virus doesn’t work on 64-bit Windows. In order .text PE Header to determine kernel32.dll memory address The virus virus code .text code assumes kernel32.ExitProcess() address to be HKLM\Software\ HKLM\Software\Wow6432Node\ Microsoft\Windows\CurrentVersion\ Microsoft\Windows\CurrentVersion\ .rsrc on the stack location 0x1c when called. Run\load32 = %System%\load32.exe Run\load32 = %System%\load32.exe ƒ The virus doesn’t infect 64 bit executables, the virus .rsrc code assumes the size of an optional PE header to NTFS file .rsrc be 0xe0 bytes long. The virus misses a location of a virus stream HKCU\Software\ HKCU\Software\ section table. Microsoft\Windows NT\ Microsoft\Windows NT\ resources CurrentVersion\Windows\ CurrentVersion\Windows\ run = %Windows%\dllreg.exe" run = %Windows%\dllreg.exe"

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 5 11/11/2003

Conclusion Conclusion (cont.) Conclusion (cont.)

ƒ Wow64 provides Win32 execution environment for 32 bit ƒ 32-bit processes can launch 64-bit applications using ƒ The existing security vulnerability will carry over to the 64- applications on 64-bit Windows. ShellExecute() or CreateProcess() functions. bit Windows system. Exploiting security vulnerabilities ƒ Wow64 registry redirection mechanism affects ƒ Viruses which assume optional header size to be 0xe0 will usually requires specific memory address and the exploitable HKLM\Software tree. 32-bit programs registered in the run most probably not infect or will corrupt PE+ executables on memory address will most likely be different between 32-bit keys under HKLM\Software registry tree will not run during infection and 64-bit Windows. boot. ƒ Viruses which insert themselves into hosts PE+ structure by ƒ Registry reflection mechanism will synchronize per machine means of adding a new section or by means of injecting its copy of HKEY_CLASSES_ROOT located in code inside already existing sections will not work due to the HKLM\Software\Classes tree between 64 and 32-bit registry 64 and 32-bit code mix-up. views. File extension association information affects both 64 ƒ Most of the 32 bit AV software shouldn’t have any problems and 32 bit registry views. dealing with 32 bit infections on 64-bit Windows.

End of Presentation

ƒ Questions?

Computer Associates Virus Information Center www.ca.com/virusinfo

© 2003 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks and logos referenced herein belong to their respective companies. 6