Binary art
         Byte-ing the PE that fails you




   Ange Albertini      3rd November 2012
http://corkami.com    Lucerne, Switzerland
agenda
what's a PE?
  the problem, and my approach
overview of the PE format
classic tricks
new tricks




                                 © ID software
Portable Executable
based on

Common Object File Format
PEuniversal
Windows binary
            since 1993
pe101.corkami.com
the problem...
aka “the gentle guide to standard PEs”
CVE-2012-2273

version_mini



               ibkernel
normal
...and my approach
block by block
a complete executable
pe.corkami.com
PE                             DLL
...
call [API]                   API: …
…                                ret

         Imports   Exports
maxsecXP




65535sects
1 ≤ FileAlignment == SectionAlignment ≤ 800




                                        nosection*
tiny*
foldedhdr
ctxt*
★New★ tricks
mini
normal64
dllnomain*
dd OriginalFirstThunk
dd TimeDateStamp
dd ForwarderChain
----------------------------
dd Name
dd FirstThunk




                               imports_virtdesc
corkamix
seh_change64
fakerelocs




             ibreloc
reloccrypt
reloccrypt
reloccrypt
maxvals
hdrcode
traceless
PE    .NET

  ...     ...
imports   ...
  ...     ...
  ...     ...
  ...     ...
  ...   relocs
  ...     ...
  ...     ...
  ...     ...
  ...     ...
  ...     ...
  ...     ...
  ...     ...
  ...     ...
  ...    CLR
  ...     ...




                 tinynet
quine
corkamix
Conclusion
Conclusion
●   the Windows executable format is complex
●   mostly covered, but many little traps
    ●   new discoveries every day :(




    http://pe101.corkami.com
    http://pe.corkami.com
Questions?
Thanks to
              Fabian Sauter, Peter Ferrie, ‫وليد عصر‬
Bernhard Treutwein, Costin Ionescu, Deroko, Ivanlef0u, Kris Kaspersky, Moritz Kroll, Thomas Siebert,
Tomislav Peričin, Kris McConkey, Lyr1k, Gunther, Sergey Bratus, frank2, Ero Carrera, Jindřich Kubec, Lord
Noteworthy, Mohab Ali, Ashutosh Mehra, Gynvael Coldwind, Nicolas Ruff, Aurélien Lebrun, Daniel
Plohmann, Gorka Ramírez, 최진영 , Adam Błaszczyk, 板橋一正 , Gil Dabah, Juriaan Bremer, Bruce Dang,
Mateusz Jurczyk, Markus Hinderhofer, Sebastian Biallas, Igor Skochinsky, Ильфак Гильфанов, Alex
Ionescu, Alexander Sotirov, Cathal Mullaney
Thank YOU!
  Ange Albertini @gmail.com
   @ange4771
      http://corkami.com
exe2pe, dosZMXP
aa86drop.com
Binary art - Byte-ing the PE that fails you (live version)
Binary art - Byte-ing the PE that fails you (live version)

Binary art - Byte-ing the PE that fails you (live version)