Information Security ˗ˋˏ ♡ ˎˊ˗

Security/Reversing

[PE 파일] 분석 - PEtest.exe (with PEview)

토오쓰 2020. 4. 10. 00:09

직접 EXE파일 만들어서 peview.exe로 분석해보기

 

 

 

1. PEtest.exe라는 프로그램 만들기

 

 

참고

https://t-okk.tistory.com/32?category=819930

 

Reversing 실습 - 기본 디버깅

1. 기본 디버깅: 프로그램 시작 주소 및 main 함수 확인 - Hello World!라는 프로그램 만들기 Ollydbg(v1.1)로 열어서 확인 Entry Point(윈도우 실행파일의 코드 시작점): 0040126F - Ollydbg에서 F7, F8, F9를..

t-okk.tistory.com

 

 

 

2. Binary File

2.1 IMAGE_DOS_HEADER

 

winnt.h [IMAGE_DOS_HEADER]

주요 정보

e_magic: 4D 5A(MZ), PE 파일 구조

e_lfanew: (00001000) IMAGE_NT_HEADER 시작주소

 

 

 

2.2 DOS Stud Code

This program cannot be run in DOS mode

 

 

 

2.3 NT_Header

 

2.3.1 signature: 4byte 공간공간 PE구조 파일 명시

 

2.3.2 File_Header

Machine(CPU): 0x014 c-Intel CPU 호환

섹션의 개수: 0x0005

Time Data: 0x5E8F2376→1586439030(=2020년 4월 9일 13시 30분 30초)

Pointer To Symbol Table, Number of Symbols: 0으로 패딩

Size Of Optional Header: 0xE0(32bit)

Characteristics: 파일형식 정보, OR 연산

 

winnt.h(Characteristics)

 

2.3.3 Optional_Header

 

이름

의미

0x10B

Magic

Optional Header 32

0xE00

Size Of Code

코드영역(.text)의 크기

0x127A

Address Of Entry Point

프로그램 시작되는 코드의 주소

0x1000

Base Of Code

코드 영역이 시작되는 상대 주소(RVA)

0x400000

Image Base

PE 파일이

0x1000

Section Alignment

메모리에서 섹션의 최소 단위

0x200

File Alignment

파일에서 섹션의 최소 단위

0x6000

Size Of Image

PE 파일이 메모리에 로딩될 때 전체 크기

0x400

Size Of Header

모든 헤더의 크기

0x0003

Sub System

3(CUI)

0x10

Number of RvaAndSizes

Data Directory의 구조체 멤버 개수

 

 

2.4 Section_Header(. text)