Didier Stevens

Tuesday 20 November 2007

Quickpost: Another Funny Vista Trick with ASLR

Filed under: Hacking,Quickpost — Didier Stevens @ 8:06

Dave Maynor’s Vista ASLR tricks post got me thinking. And today, after some inspiring presentations at TechEd last week, I took the time to do some testing. Set the appropriate bit (0×4000) in the DLL Characteristics field of the PE header, and you turn on ASLR for your program of choice. So clearing the bit will disable ASLR, but will Windows File Protection prevent you from changing the program? I didn’t think it would, because you’re only touching the PE Header, which is not protected by the Authenticode signature.

Turns out it does work: you can disable ASLR for a given program, like Internet Explorer. And WFP will not restore the file. But for another reason than I thought: with Vista, WFP is actually called Windows Resource Protection. And it works differently: files are protected by Security Descriptors, and are not replaced automatically when deleted or modified. So the neat trick of deleting a system-file in Windows XP (like utilman.exe) only to see it reappear a couple of seconds later, doesn’t work anymore with Vista. Change the Security Descriptor of the file in Vista (taking ownership and giving you delete rights), delete the file, and it’s gone. No more resurrection.

If you want to play with the ASLR toggle, you can use stud_pe to edit the PE Header and Process Explorer to test it.

So why would you disable ASLR? I don’t know, I just think it’s a funny trick ;-) . But maybe you got an idea? Let me know, post a comment.


Quickpost info

5 Comments »

  1. Hi didier.
    Yoy have an excelent blog!
    Any executable can decide to participate in ASLR by setting bit 0×40 in the field DLL CHARACTERISTICS. You have a document write by the symantec team submitted in the blackhat 2007.
    The thing is that any user with admin privileges, can disable this feature, making it easier an attack code execution for the executable.
    Its a funny trick!!

    http://www.blackhat.com/presentations/bh-dc-07/Whitehouse/Paper/bh-dc-07-Whitehouse-WP.pdf

    Sorry for my English…. Spanglish its better for me…. :)
    regards

    Comment by Juanillo — Sunday 25 November 2007 @ 14:58

  2. >I didn’t think it would, because you’re only touching the PE Header, which is not protected by the Authenticode signature.

    That’s the most retarded thing I read in a long time. Of course the signature covers the header, moron. Hey, what do I know, the PE header “only” contains such irrelevant, purely advisory fields as the entry point offset, and it would take all of 10 minutes to check that flipping the DLL characteristics bit does indeed invalidate the signature anyway. BUT WHAT THE BLEEP DO I KNOW, I’m not a card-carrying IT Security Professional !

    The sheer stupidity of certain statements just jumps at your face, screaming

    Comment by KJK::Hyperion — Monday 26 November 2007 @ 13:38

  3. Is this part of your therapy?

    Comment by Didier Stevens — Tuesday 27 November 2007 @ 8:58

  4. I’m sorry, I had a bad day.

    Comment by KJK::Hyperion — Thursday 29 November 2007 @ 10:22

  5. Disabling ASLR is good for debugging, let’s say debugging windows DLLs (for ex. cracking).

    I would suggest to create a simple DOS program that changes the bit.. let’s say “no_aslr.exe”
    Boot from a USB Pen Drive with NTFS4DOS 1.9 Personal (it’s free and allows u read/write NTFS part.)
    Use “no_aslr.exe file.dll” with any file.
    Modifying files while in DOS do not affect the security permissions.

    Comment by Luciano Aibar — Monday 21 April 2008 @ 7:23


RSS feed for comments on this post. TrackBack URI

Leave a Reply (comments are moderated)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 198 other followers

%d bloggers like this: