Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 2008

Vista and Server 2008 Malware Protection Gems

Use DEP and ASLR to protect yourself against buffer overrun-based attacks
RSS
Subscribe to Windows IT Pro | See More Windows OSs Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Note that you can also use the same boot.ini /NoExecute= switch with other values to turn DEP on and to set the DEP protection level. Table 1 shows all the / NoExecute values.

The boot.ini file is available only on XP and Windows 2003, and you can edit it using Notepad or going to the Startup and Recovery section in System properties.

On Vista and Server 2008, the boot.ini has been replaced by the Boot Configuration Data (BCD) file. To edit the BCD file, Microsoft provides a command-line utility called bcdedit.exe.

When you run bcdedit without switches, it shows your current boot configuration. Figure 4 shows the result of running bcdedit on a Vista system. Note the last line that holds the nx configuration OptIn. To change the nx configuration to alwaysoff, you would run the following bcdedit command:

 bcdedit /set nx alwaysoff

The values specified in Table 1 for the boot.ini /NoExecute= switch are also available for the BCD nx option.

For more information about Microsoft DEP and how to configure it, consult the Microsoft article at support.microsoft.com/kb/875352/en-us.

Address Space Layout Randomization
Another technique often used by bufferoverrun– based malware is to inject a system memory path that points to the location of an important system DLL into another program’s buffer. The malware then tricks the program into calling that particular system file to let the malware leverage the system DLL’s services without being detected.

This type of buffer-overrun attack is relatively easy to carry out if the OS always loads certain system DLLs on the exact same memory location. On XP, for example, the memory locations of system DLLs are always identical— they vary only slightly depending on the service pack status of the system. The new Vista and Server 2008 ASLR feature makes it harder for malware to leverage a system DLL’s services by randomizing DLL’s memory location. Unlike DEP, ASLR isn’t available on earlier Windows versions.

Each time a Vista and Server 2008 system reboots, ASLR randomly assigns system code (basically system DLLs and executables) to different memory locations. This means that the system code’s entry points (the addresses the malware would use to call on the service of a particular piece of system code) are in unpredictable locations. In Vista and Server 2008, a DLL or executable can be loaded into any of 256 locations. This means that an attacker has a 1/256 chance of getting the address right. As such, ASLR also makes it harder for hackers to write repeatable code such as worms that target identical system resources on many different systems.

You can observe the effect of ASLR by using the SysInternals Process Explorer tool, which you can download at www.microsoft.com/technet/sysinternals/utilities/processexplorer.mspx. To use the tool, start Process Explorer and ensure that you have selected the Show Lower Pane option in the View menu.

Then select the explorer.exe process in the upper pane and check the base address of the ntdll. dll in the base column in the lower pane. (If you don’t see the base column you can add it by using the View / Select Columns… menu option—the Base column can be added from the DLL tab.)

Write down the base address, then reboot your system. On an XP system, the base address for ntdll. dll remains identical after a system reboot (XP doesn’t support ASLR). On a Vista system, the base address is different after a system reboot (because Vista supports ASLR).

Figure 5 shows the Process Explorer interface and the base address for the ntdll.dll DLL. Table 2 shows the base addresses I found for the ntdll.dll and user32.dll DLLs when running Process Explorer on an XP SP2 system and on a Vista system.

Continue on Page 4

   Previous  1  2  [3]  4  Next 


Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

How can I stop and start services from the command line?

...

Where is Microsoft NetMeeting in Windows XP?

...


Related Articles What You Need to Know About How Windows Server 2008 Developed

Buffer-Overflow Attacks Explained

Burned by the CodeRed Worm

Buffer Overflows Leave You Vulnerable to Attacks

Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Configuration Manager SP1 and R2 Overview

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing