📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  Brainstorms - General  >>  Compiler and Linker Security Options

Topic created on: June 17, 2009 02:54 CDT by djnemo .

how can get Compiler and Linker Security Options from file?
for example: /SafeSEH ,/GS and other security options...

  frankboldewin     June 18, 2009 07:13.37 CDT
i wrote a small script for myself to find activated /GS switches per function in visual c files.
it is a IDAPython script.
nothing special, but it works for me. as i don't have VC2008 currently i haven't written a script for scanning for /SAFESEH yet.


import string, os, sys, glob
from idaapi import *

def main():

  ea=0
  FOUNDSECP=0
  
  autoWait()
  
  while (1):
    ea = FindBinary(ea, SEARCH_DOWN | SEARCH_NEXT | SEARCH_NOSHOW, "4E E6 40 BB")
    if ea == BADADDR:
      if FOUNDSECP==0:
        print "Haven't found a referenced security_cookie pattern! :("
      break
    else:
      SCOOKIEREF=DfirstB(ea)
      if SCOOKIEREF!=0xffffffff:
        if (GetMnem(SCOOKIEREF) == "cmp") & (GetOpnd(SCOOKIEREF,0) == "ecx"):
          CODEREF=RfirstB(SCOOKIEREF)
          if (GetFunctionName(CODEREF)==GetFunctionName(SCOOKIEREF)):
            CODEREF=RnextB(SCOOKIEREF,CODEREF)
          while (CODEREF!=0xffffffff):
            print "found reference at %08lx in function %s" % (CODEREF, GetFunctionName(CODEREF))
            FOUNDSECP=1
            CODEREF=RnextB(SCOOKIEREF,CODEREF)
      while (SCOOKIEREF!=0xffffffff):
        if (GetMnem(SCOOKIEREF) == "cmp") & (GetOpnd(SCOOKIEREF,0) == "ecx"):
           CODEREF=RfirstB(SCOOKIEREF)
           if (GetFunctionName(CODEREF)==GetFunctionName(SCOOKIEREF)):
             CODEREF=RnextB(SCOOKIEREF,CODEREF)
           while (CODEREF!=0xffffffff):
            print "found reference at %08lx in function %s" % (CODEREF, GetFunctionName(CODEREF))
            FOUNDSECP=1
            CODEREF=RnextB(SCOOKIEREF,CODEREF)
        SCOOKIEREF=DnextB(ea,SCOOKIEREF)
  
if __name__ == "__main__":
  main()

  jduck     June 19, 2009 13:46.36 CDT
> djnemo: how can get Compiler and Linker Security Options from file?
> for example: /SafeSEH ,/GS and other security options...

SafeSEH, ASLR, and some other things can be found by simply looking at parts of the PE file itself.  Perhaps someone will be kind enough to post some code to do it...

  igorsk     June 20, 2009 16:17.22 CDT
SafeSEH (and sometimes the cookie address) is available in the LOAD_CONFIG PE directory. pefile Python module can parse and display it. ASLR is identified by the flag 0x40 in DllCharacteristics field of the PE header.

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit