Deok9_PE Structure

Similar documents
목 차 1. 개요 2. PE(Portable Executable) 이란? 3. IMAGE_DOS_HEADER 4. IMAGE_NT_HEADER 1) IMAGE_FILE_HEADER 2) IMAGE_OPTIONAL_HEADER 3) IMAGE_DATA_DIRECTORY

Deok9_Exploit Technique

<4D F736F F D20B0ADB5BFC7F65FB1E2BCFAB9AEBCAD5F4645B1B8C1B620B1E2BCFAB9AEBCAD5F66726F6D E6B5F66696E F2E646F63>

목차 ⓵ VA and RVA 4p. ⓶ RVA to RAW 5p. ⓷ PE 7p. PE의개념. PE Header가생기는과정. PE의필요성. ⓷ DOS Header 8p. e_magic e_lfanew ⓸ DOS Stub 9p. 1

< C6520B1B8C1B6BFCD20BEF0C6D0C5B7C0C720BFF8B8AE2E687770>

연재순서 실행파읷속으로 필자소개 싞영짂 웰비아닶컴에서보안프로그래머로읷하고있다. 시스템프로그래밍에관심이많으며다수의 PC 보안프로그램개발에참여했다. 현재데브피아 Visual C++ 섹션시

Win32 실행파일 (PE) 의구조 Windows 운영체제실행파일의구조에대하여알아보자 Kali-KM

Microsoft Word - PE_structure.docx

PCServerMgmt7

SRC PLUS 제어기 MANUAL

목차 1. 제품 소개 특징 개요 Function table 기능 소개 Copy Compare Copy & Compare Erase

1

hlogin2

Microsoft PowerPoint - o8.pptx

강의10

SMB_ICMP_UDP(huichang).PDF

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

초보자를 위한 C++

악성코드분석을위한 실행압축 해제기법 1. 개요 이제목을보고 실행압축이뭐야? 하는이도있을테고, 실행하면자동으로압축이풀리는 ZIP 파일과비슷한거아냐? 하고떠올리는이도있을것이다. 그러나여기서설명하는실행압축은그대상이다르다. 흔히말하는 ZIP, RAR처럼데이터들을하나로묶어놓는압

IDA 5.x Manual hwp

05Àå

The_IDA_Pro_Book

PowerPoint 프레젠테이션

PowerPoint Presentation

인켈(국문)pdf.pdf

vm-웨어-앞부속



hlogin7

다음 사항을 꼭 확인하세요! 도움말 안내 - 본 도움말에는 iodd2511 조작방법 및 활용법이 적혀 있습니다. - 본 제품 사용 전에 안전을 위한 주의사항 을 반드시 숙지하십시오. - 문제가 발생하면 문제해결 을 참조하십시오. 중요한 Data 는 항상 백업 하십시오.

untitled

FD¾ØÅÍÇÁ¶óÀÌÁî(Àå¹Ù²Þ)-ÀÛ¾÷Áß

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

Microsoft Word - PE Infection ? How to Inject a dll.doc

PRO1_09E [읽기 전용]

제목을 입력하세요.

GNU/Linux 1, GNU/Linux MS-DOS LOADLIN DOS-MBR LILO DOS-MBR LILO... 6

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

안전을 위한 주의사항 제품을 올바르게 사용하여 위험이나 재산상의 피해를 미리 막기 위한 내용이므로 반드시 지켜 주시기 바랍니다. 2 경고 설치 관련 지시사항을 위반했을 때 심각한 상해가 발생하거나 사망에 이를 가능성이 있는 경우 설치하기 전에 반드시 본 기기의 전원을

PowerPoint 프레젠테이션

알아 둘 사항 아이오드 제조사는 본 기기에 하드디스크를 포함하여 출고하지 않습니다. 따라서 하드디스크에 문제가 발생할 경우, 구매처 또는 해당 하드디스크 서비 스센터에 문의 하시기 바랍니다. 정해진 용도 외의 사용으로 발생한 문제에 대해서, 당사는 어떠한 책임도 지지

Orcad Capture 9.x

디지털포렌식학회 논문양식

INTRO Basic architecture of modern computers Basic and most used assembly instructions on x86 Installing an assembly compiler and RE tools Practice co

Solaris Express Developer Edition

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

MPLAB C18 C

DE1-SoC Board

Remote UI Guide

DocsPin_Korean.pages

01-OOPConcepts(2).PDF


chapter1,2.doc

PRO1_02E [읽기 전용]

MAX+plus II Getting Started - 무작정따라하기

Poison null byte Excuse the ads! We need some help to keep our site up. List 1 Conditions 2 Exploit plan 2.1 chunksize(p)!= prev_size (next_chunk(p) 3

ETL_project_best_practice1.ppt

CD-RW_Advanced.PDF

1217 WebTrafMon II

AGENDA 모바일 산업의 환경변화 모바일 클라우드 서비스의 등장 모바일 클라우드 서비스 융합사례

R50_51_kor_ch1

1. GigE Camera Interface를 위한 최소 PC 사양 CPU : Intel Core 2 Duo, 2.4GHz이상 RAM : 2GB 이상 LANcard : Intel PRO/1000xT 이상 VGA : PCI x 16, VRAM DDR2 RAM 256MB

휠세미나3 ver0.4

Microsoft Word - 과목1.Reverse Engineering.doc

Microsoft Word doc

Chap7.PDF

ODS-FM1

2004 IRISPen 사용자 설명서-본문-용지크기 조정-폰트포함.PDF

No Slide Title

untitled

1. 개요 악성코드는여러분류로나누어볼수가있다. 이중일반사용자의입장에서 악성코드 라는단어보다친숙한 바이러스 가있다. 사실필자도보안을공부하기이전에는 악성코드 라는단어는아예들어보지못했고, 대신 바이러스 라는단어로모든악성코드를지칭했었다. 바이러스는악성코드분류의한종류로 스스로를

#KM-235(110222)

목차 BUG offline replicator 에서유효하지않은로그를읽을경우비정상종료할수있다... 3 BUG 각 partition 이서로다른 tablespace 를가지고, column type 이 CLOB 이며, 해당 table 을 truncate

Copyright 2012, Oracle and/or its affiliates. All rights reserved.,.,,,,,,,,,,,,.,...,. U.S. GOVERNMENT END USERS. Oracle programs, including any oper

APOGEE Insight_KR_Base_3P11

#KM-340BL

untitled

02 C h a p t e r Java

Windows 네트워크 사용 설명서

No

#KLZ-371(PB)

Chap06(Interprocess Communication).PDF

PowerPoint 프레젠테이션

Microsoft PowerPoint - ch07.ppt

<353420B1C7B9CCB6F52DC1F5B0ADC7F6BDC7C0BB20C0CCBFEBC7D120BEC6B5BFB1B3C0B0C7C1B7CEB1D7B7A52E687770>

Scalable Network-based Buffer Overflow Attack Detection

리뉴얼 xtremI 최종 softcopy

Dialog Box 실행파일을 Web에 포함시키는 방법

Interstage5 SOAP서비스 설정 가이드

디지털포렌식학회 논문양식

2011년 10월 초판 c 2011 Sony Corporation. All rights reserved. 서면 허가 없이 전체 또는 일부를 복제하는 것을 금합니다. 기능 및 규격은 통보 없이 변경될 수 있습니다. Sony와 Sony 로고는 Sony의 상표입니다. G L

1

Chapter11OSPF

AVG PC TuneUp User Manual

목 차

#KM560

(72) 발명자 서진교 경기 용인시 수지구 풍덕천2동 1167 진산마을 삼성5차아파트526동 1004호 조필제 경기 용인시 풍덕천동 유스빌 401호 - 2 -

¨ìÃÊÁ¡2

PowerPoint 프레젠테이션

Transcription:

PE Structure CodeEngn Co-Administrator!!! and Team Sur3x5F Member Nick : Deok9 E-mail : DDeok9@gmail.com HomePage : http://deok9.sur3x5f.org Twitter :@DDeok9 1. PE << Contents >> 1) PE? 2) PE 3) PE Utility 2. PE Header 1) IMAGE_DOS_HEADER DOS Stub 2) IMAGE_NT_HEADERS 3) IMAGE_SECTION_HEADER 3. Code & Data Section 1) Basic 2) Code Section 3) Data Section! 1! Copyright 2011 Deok9 All rights Reserved

1. PE 1) PE? Portable Executable, Platform Win32 OS System. File, PE File Load VMM ( Virtual Memory Manager ) Page File, PE File Page File Mapping. WinNT.H Header File PE Image. [ 1-1 - 1 ] PE File Format! 2! Copyright 2011 Deok9 All rights Reserved

2) PE (i) RVA ( Relative Virtual Address ) Memory PE Offset. ( ) = Image Load + Offset Image Load IMAGE_OPTIONAL_HEADER ImageBase Field (ii) Section Code.text Program Code Section Data.data Section.rdata Data Section (, C++ ) Import API.idata.didat Import DLL API, IAT Section Delay-Loading Import Data Section Export API.edata Export API Section ( DLL ) Resource.rsrc Window APP Resource Data Section.reloc Section ( DLL ) TLS.tls Thread Section Debugging.debug$P Compile Header OBJ Section (iii) VAS ( Virtual Address Space ) Process ( VAS ), VMM ( Virtual Memory Manager ). RAM, Default Windows System Disk Root Hard-disk File ( PageFile.sys ). Paging File Page. Page Paging File Mapping, Mapping Page COMMIT Page, File Paging File MMF.! 3! Copyright 2011 Deok9 All rights Reserved

3) PE Utility (i) DumpBin.exe [ 1-3 - 1 ] DumpBin.exe COFF PE Format, PE Format (ii) PEBrowse Professional Interactive [ 1-3 - 2 ] PEBrowse Professional Interactive GUI Debugging Tool! 4! Copyright 2011 Deok9 All rights Reserved

2. PE Header 1) IMAGE_DOS_HEADER DOS Stub DOS Stub 40 Byte IMAGE_DOS_HEADER Program Code. "This program cannot be run in DOS mode." 16 bit DOS Program. [ 2-1 - 1 ] IMAGE_DOS_HEADER DOS Stub [ 2-1 - 2 ] IMAGE_DOS_HEADER e_magic ASCII "MZ". ( DOS Mark Zbikowski ) e_lfanew PE File IMAGE_NT_HEADER Offset. PE File IMAGE_DOS_HEADER e_magic "MZ" e_lfanew File Pointer PE.! 5! Copyright 2011 Deok9 All rights Reserved

2) IMAGE_NT_HEADERS (i) DWORD Signature [ 2-2 - 1 ] IMAGE_NT_HEADERS [ 2-2 - 2 ] DWORD Signature PE File magic number, 4 Byte "PE\x00\x00". IMAGE_DOS_HEADER e_lfanew field Offset 4 Byte. (ii) IMAGE_FILE_HEADER [ 2-2 - 3 ] IMAGE_FILE_HEADER [ 2-2 - 4 ] IMAGE_FILE_HEADER WORD Machine : File CPU ID ( Intel 386 = 0x014c, Intel 64 = 0x0200 ) WORD NumberOfSections : File Section DWORD TimeDateStamp : 1970 1 1 File! 6! Copyright 2011 Deok9 All rights Reserved

DWORD PointerToSymbolTable, NumberOfSymbols : COFF Symbol Table File Offset Symbol ( Symbol ) WORD SizeOfOptionalHeader : IMAGE_OPTIONAL_HEADER Byte 32 bit 0xE0 ( 224 Byte ), 64 bit 0xF0 ( 240 Byte ) WORD Characteristics : PE File Flag MACRO ( IMAGE_FILE ~ ) _RELOCS_STRIPPED 0x0001 _EXECUTABLE_IMAGE 0x0002 File Image _LINE_NUMS_STRIPPED 0x0004 Line _LOCAL_SYMS_STRIPPED 0x0008 Local Symbol _AGGRESIVE_WS_TRIM 0x0010 OS WorkingSet _LARGE_ADDRESS_AWARE 0x0020 Application 2G _32BIT_MACHINE 0x0100 32 bit Word Machine _DEBUG_STRIPPED 0x0200 Debug.DBG File _REMOVABLE_RUN_FROM_SWAP _NET_RUN_FROM_SWAP 0x0400 0x0800 SWAP File Disk Copy Network SWAP File Disk Copy _DLL 0x2000 DLL File _UP_SYSTEM_ONLY 0x4000 Processor [ 2-2 - 1 ] PE (iii) IMAGE_OPTIONAL_HEADER [ 2-2 - 5 ] IMAGE_DATA_DIRECTORY IMAGE_OPTIONAL_HEADER! 7! Copyright 2011 Deok9 All rights Reserved

[ 2-2 - 6 ] IMAGE_OPTIONAL_HEADER 224 Byte, 96 Byte 36 Field 8 Byte IMAGE_DATA_DIRECTORY Entry 16 ( 128 Byte ). Field WORD Magic BYTE Major & Minor LinkerVersion DWORD SizeOfCode IMAGE_OPTIONAL_HEADER Signature 32 bit 0x010B, 64 bit 0x020B File Linker Version IMAGE_SCN_CNT_CODE Section! 8! Copyright 2011 Deok9 All rights Reserved

Field DWORD SizeOfInitializedData DWORD SizeOfUninitializedData DWORD AddressOfEntryPoint DWORD BaseOfCode DWORD BaseOfData DWORD ImageBase DWORD SectionAlignment DWORD FileAlignment WORD Major & Minor OperatingSystemVersion WORD Major & Minor ImageVersion WORD Major & Minor SubsystemVersion DWORD Win32VersionValue DWORD SizeOfImage DWORD SizeOfHeaders IMAGE_SCN_CNT_ INITIALIZED_DATA Section ( File ) IMAGE_SCN_CNT_ UNINITIALIZED_DATA Section Data Section 0 Set Loader.text Section Memory Load, Code Section RVA PE Header Data Section Memory Load, Data Byte RVA PE Mapping Intel Window Memory Page 4K 0x1000, File Alignment PE Section Disk Sector File OS Version User Version File Subsystem Version 0 PE Memory Load SectionAlignment Field. Header, Section Table Byte FileAlignment DWORD CheckSum IMAGE CheckSum ( ) WORD Subsystem File ( CUI : 3, GUI : 2 )! 9! Copyright 2011 Deok9 All rights Reserved

Field WORD DllChracteristics DWORD SizeOfStackReserve/ Commit & SizeOfHeapReserve/ Commit DWORD LoaderFlags DWORD NumberOfRvaAndSizes DLL Flag Default Stack Heap Reserve 0x00100000 Commit 0x00001000 Debugging 0 Set IMAGE_DATA_DIRECTORY 16 0x00000010 [ 2-2 - 2 ] IMAGE_OPTIONAL_HEADER Field IMAGE_DATA_DIRECTORY 128 Byte ( 8 * 16 ), 16 IMAGE_OPTIONAL_HEADER NumberOfRvaAndSizes. Entry ( Index 15 ) 0 15. [ 2-2 - 7 ] IMAGE_DATA_DIRECTORY [ 2-2 - 8 ] IMAGE_DATA_DIRECTORY VirtualAddress Size Index Section Block RVA. Index. Entry Index ( ~. ) _EXPORT 0 IMAGE_EXPORT_DIRECTORY _IMPORT 1 IMAGE_IMPORT_DIRECTORY! 10! Copyright 2011 Deok9 All rights Reserved

Entry Index ( ~. ) _RESOURCE 2 IMAGE_RESOURCE_DIRECTORY _EXCEPTION 3 IMAGE_RUNTIME_FUCTION_ENTRY _SECURITY 4 WIN_CERTIFICATE _BASERELOC 5 _DEBUG 6 IMAGE_DEBUG_DIRECTORY _ARCHITECTURE 7 IMAGE_ARCHITECTURE_HEADER _GLOBALPTR 8 GP RVA IA-64. _TLS 9 Thread Local Storage Section _LOAD_CONFIG 10 IMAGE_LOAD_CONFIG_DIRECTORY _BOUND_IMPORT 11 DLL Binding. _IAT 12 IAT _DELAY_IMPORT 13 ImgDelayDescr _COM_DESCRIPTOR 14.NET DLL [ 2-2 - 3 ] IMAGE_DATA_DIRECTORY Index! 11! Copyright 2011 Deok9 All rights Reserved

3) IMAGE_SECTION_HEADER [ 2-3 - 1 ] IMAGE_SECTION_HEADER [ 2-3 - 2 ] IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER IMAGE_FILE_HEADER NumberOfSections Field. Field BYTE Name [IMAGE_SIZEOF_SHORT_NAME] DWORD PhysicalAddress or Virtual Address Section ASCII 8 Byte PE Code Data Byte! 12! Copyright 2011 Deok9 All rights Reserved

Field DWORD VirtualAddress DWORD SizeOfRawData DWORD PointerToRawData DWORD PointerToRelocations DWORD PointerToLinenumbers WORD NumberOfRelocations WORD NumberOfLinenumbers DWORD Characteristics Memory Section Mics.VirtualSize Field File Alignment Round-up Section PE File File Offset, File Alignment File Offset COFF Style Line File Offset IMAGE_RELOCATION IMAGE_LINENUMBER Section Flag IMAGE_SCN Flag [ 2-3 - 1 ] IMAGE_SECTION_HEADER Field PE File Section, PointerToRawData File Offset SizeOfRawData Byte Section. Mapping RVA VirtualAddress, Mapping Pointer VirtualAddress IMAGE_OPTIONAL_HEADER ImageBase Field. Mapping Section Memory VirtualSize.! 13! Copyright 2011 Deok9 All rights Reserved

3. Code & Data Section 1) Basic Program Instance Memory 4. Program Code Code,, Data, Stack, Memory Heap Code PE Mapping.text Section, Data Mapping.data Section.rdata Section. PE.text Section.data &.rdata Section Memory Mapping Section Code Data. [ 3-1 - 1 ] Win32 Process PE Load 4G PE Mapping Reserve Mapping IMAGE_SECTION_HEADER VirtualAddress Field ( + RVA ) VirtualSize Field Commit Section Mapping Process Heap Thread Stack IMAGE_OPTIONAL_HEADER Field! 14! Copyright 2011 Deok9 All rights Reserved

2) Code Section (i).text Section IMAGE_SECTION_HEADER.text Entry Block, PE Code. Code. Thread, EIP. Code PE File.text Section PE File.text Section. [ 3-2 - 1 ].text Section IMAGE_SECTION_HEADER [ 3-2 - 2 ].text Section 0x204 4 Byte ( 0x00000400 ) PointerToRawData Field, PE File.text Section..text Section Code Assembly (ii) ( WinMain ) [ 3-2 - 3 ] WinMain hinstance Program Instance Handle, Process Resource. IMAGE_OPTIONAL_HEADER ImageBase Field EXE Default 0x00400000, DLL 0x00100000. IMAGE_OPTIONAL_HEADER AddressOfEntryPoint Field Loader, PE Memory Mapping Entry..! 15! Copyright 2011 Deok9 All rights Reserved

[ 3-2 - 4 ] IMAGE_OPTIONAL_HEADER [ 3-2 - 5 ] AddressOfEntryPoint PE Dump 0xF8 4Byte ( 0x00011181 ) AddressOfEntryPoint Field Memory Mapping 0x00411181. E9 4A 0B 00 00. Assemble 0xE9 : JMP 0x0B4A JMP, Memory Mapping JMP 00411CD0. Memory Mapping [ 3-2 - 6 ] 0x00411181 [ 3-2 - 7 ] 0x00411CD0 Main Thread 0x00411CD0 JMP WinMainCRTStartup, WinMain.! 16! Copyright 2011 Deok9 All rights Reserved

3) Data Section.data Section.rdata Section Data.bss ->.textbss Section..textbss Section Debugging mode. (i).data Section ( ) /.data Section Process Stack PE. [ 3-3 - 1 ].data Section IMAGE_SECTION_HEADER [ 3-3 - 2 ].data Section 0x254 4 Byte ( 0x00005E00 ) PointerToRawData Field, PE File.data Section, 0x520 4Byte ( 0x00000200 ) SizeOfRawData Field, Section PE File. VAS,. 0x00400000 ( Base Address ) + 0x00005E00 ( Data Section Offset ) + 0x00017000 ( VirtualAddress ) - 0x00005E00 ( PointerToRawData ) = 0x00417000 0x00400000 ( Base Address ) + 0x00005E18 ( Data Section Offset ) + 0x00017000 ( VirtualAddress ) - 0x00005E00 ( PointerToRawData ) = 0x00417018 Memory Mapping [ 3-3 - 3 ] 0x00417000! 17! Copyright 2011 Deok9 All rights Reserved

(ii).rdata Section ( ), Pointer, Runtime Library Error Message.rdata Section. [ 3-3 - 4 ].rdata Section IMAGE_SECTION_HEADER [ 3-3 - 5 ].rdata Section 0x22C 4 Byte ( 0x00004000 ) PointerToRawData Field, PE File.rdata Section, 0x228 4Byte ( 0x00001E00 ) SizeOfRawData Field, Section PE File. Characteristics Field ( 0x40000040 ).data Section 0xC0000040. VAS,. 0x00400000 ( Base Address ) + 0x00004730 ( Data Section Offset ) + 0x00015000 ( VirtualAddress ) - 0x00004000 ( PointerToRawData ) = 0x00415730 Memory Mapping [ 3-3 - 6 ] 0x00415730 Debug Section, DLL Export Section Section.rdata Section, Section.rdata Section.! 18! Copyright 2011 Deok9 All rights Reserved