Author Topic: (ARTeam)All You Need To Know About PE Files  (Read 1845 times)

0 Members and 1 Guest are viewing this topic.

Offline bubzuru

  • Knight
  • **
  • Posts: 395
  • Cookies: 21
  • everything is contained in the data
    • View Profile
    • New School Tools
(ARTeam)All You Need To Know About PE Files
« on: August 30, 2012, 06:26:33 pm »
i didnt know where to put this, the info is usefull to hackers aswell as RE's (move if needed)

This tutorial aims to collate information from a variety of sources and present it in a way which is accessible to beginners. Although detailed in parts, it is oriented towards reverse code engineering and superfluous information has been omitted. You will see I have borrowed heavily from various published works and all authors are remembered with gratitude in the reference section at the end.
PE is the native Win32 file format. Every win32 executable (except VxDs and 16-bit DLLs) uses PE file format. 32bit DLLs, COM files, OCX controls, Control Panel Applets (.CPL files) and .NET executables are all PE format. Even NT's kernel mode drivers use PE file format.
Why do we need to know about it? 2 main reasons. Adding code to executables (e.g. keygen injection or adding functionality) and manually unpacking executables. With respect to the latter, most shareware nowadays comes "packed" in order to reduce size and to provide an added layer of protection.
In a packed executable, the import tables are usually destroyed and data is often encrypted. The packer inserts code to unpack the file in memory upon execution, and then jumps to the original entry point of the file (where the original program actually starts executing). If we manage to dump this memory region after the packer finished unpacking the executable, we still need to fix the sections and import tables before our app will run. How will we do that if we don’t even know what the PE format is?
The example executable I have used throughout this text is BASECALC.exe, a very useful app from fravia's site for calculating and converting decimal, hex, binary and octal. It is coded in Borland Delphi 2.0 which makes it ideal as an example to illustrate how Borland compilers leave the OriginalFirstThunks null (more on this later).

Download Attached
« Last Edit: August 30, 2012, 06:29:46 pm by bubzuru »
Damm it feels good to be gangsta
http://bubzuru.comule.com

Offline Ghastly

  • Serf
  • *
  • Posts: 23
  • Cookies: 0
    • View Profile
Re: (ARTeam)All You Need To Know About PE Files
« Reply #1 on: August 31, 2012, 01:13:00 am »
Thanks mate, looks good.