FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Windows/.NET
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
October 18, 2004
Protecting RAM Secrets with Address Windowing Extensions

Jason Coombs
By letting you manage physical memory directly in your code, AWE can prevent Windows from swapping sensitive data from RAM to pagefile
Protecting RAM Secrets with Address Windowing Extensions

The Virtual Memory Manager (VMM) in Windows does not allow programs to lock user memory in order to prevent that memory from being swapped out to disk. This limitation, not present in other operating systems, has caused numerous security problems with encryption keys, passwords, and other sensitive information leaking from RAM to hard disk automatically under Microsoft Windows.

As demonstrated in my previous column ("Beware of File-Slack Attacks http://www.ddj.com/documents/ddj041006sec/), anything written to hard disk temporarily can be recovered with relative ease. The system virtual-memory-paging swap file can be resized manually, or Windows may resize it as needed. When the pagefile grows in size, there will not be any sensitive data stored in unallocated clusters on the drive, but that does not mean the sensitive data cannot be accessed.

Powering down a Windows box and removing the drive that contains a pagefile allows unrestricted access to its contents. A drive sector editor or other forensic tool can read directly from the sectors and clusters that belong to the system pagefile. Or, the pagefile may shrink when a reboot occurs, exposing formerly allocated clusters from the pagefile as unallocated clusters that can then easily be carved from the drive.

The only way to prevent Windows from swapping data from RAM to pagefile is to manage physical memory directly in your code. Windows 2000 introduced an API for doing just this, known as Address Windowing Extensions (AWE). The primary purpose of AWE is to remove the 4-GB physical memory limit of a 32-bit software architecture by enabling code to allocate large chunks of physical memory and then map access to the physical memory into a window of virtual memory that is 32-bit addressable. This is similar to working with memory-mapped files that are larger than the available physical memory in a computer, except there is no disk I/O involved.

The MSDN Library contains documentation for the AWE support functions: http://msdn.microsoft.com/library/en-us/memory/base/address_windowing_extensions.asp

Sample code for making use of AWE can also be found in an October 1999 MSJ article written by Jeffrey Richter: http://www.microsoft.com/msj/1099/win32/win321099.aspx

Special privileges are required in order for a user account other than System to use AWE. By default, no user, not even Administrator, is granted the necessary privilege. The "Lock Pages in Memory" user right can be assigned by using Group Policy Editor (gpedit.msc), which hosts the Group Policy MMC snap-in.

Windows XP Home does not support Policies or User Rights, but it should be possible to grant the "Lock Pages in Memory" privilege with a hack to the HKLM\SECURITY Registry hive if support under Windows XP is critical for your secure application.


Jason Coombs is Director of Forensic Services for PivX Solutions Inc. (NASDAQ OTCBB: PIVX), a provider of security solutions, computer forensics, and expert witness services. Reach him at jcoombs@PivX.com.


TOP 5 ARTICLES
No Top Articles.
DR. DOBB'S CAREER CENTER
Looking for a new job? open | close
Search jobs on Dr. Dobb's TechCareers
Function:

Keyword(s):

State:  
  • Post Your Resume
  • Employers Area
  • News & Features
  • Blogs & Forums
  • Career Resources

    Browse By:
    Location | Employer | City
  • Most Recent Posts:



    MICROSITES
    FEATURED TOPIC

    ADDITIONAL TOPICS

    INFO-LINK



     




    Techweb
    Informationweek Business Technology Network
    InformationweekInformationweek 500Informationweek 500 ConferenceInformationweek AnalyticsInformationweek Events
    Informationweek MagazineGlobal CIOIWK Government ITbMightyByte and SwitchDark Reading
    Digital LibraryIntelligent EnterpriseInternet EvolutionNetwork ComputingPlug Into The CloudDr. DobbsContentinople
    space
    TechWeb Events Network
    InteropVoiceConWeb 2.0 ExpoWeb 2.0 SummitEnterprise 2.0Mobile Business ExpoNoJitter
    Black HatGTECEnergy CampCloud ConnectGov 2.0 ExpoGov 2.0 Summit
    space
    Light Reading Communications Network
    Light ReadingLight Reading AsiaUnstrungCable Digital NewsInternet EvolutionPyramid Research
    Heavy ReadingLight Reading LiveLight Reading InsiderEthrnet ExpoTelco TVTower Technology Summit
    space
    Financial Technology Network
    Advanced TradingBank Systems and TechnologyInsurance and TechnologyWall Street and TechnologyAccelerating WallstreetBST SummitBuyside Trading SummitIT Summit
    space
    Microsoft Technology Network
    MSDNTechNetTotal IT ProTotal Dev ProNET Total Dev Pro CommunitySQL Total Dev Pro Community
    space