오브의 빛나는 별

2부 13장 PE File Format(실습1)-32bits 본문

리버싱

2부 13장 PE File Format(실습1)-32bits

오브의 별 2022. 5. 14. 18:25
반응형

안녕하세요, 오브입니다.

오늘은 이전에 했던 PE File Format을 실제로 알아보겠습니다. zoom.exe 파일의 PE 파일을 분석할 것이고 IMAGE_DOS_HEADER, Dos Stub, lMAGE_ NT_HEADERS, IMAGE_SECTION_HEADER.text를 차례로 알아보겠습니다.

https://staraube.tistory.com/51?category=548043 

 

2부 13장 PE File Format(1)

안녕하세요, 오브입니다. 오늘은 PE 파일의 기본구조와 VA, RVA에 대해 알아보겠습니다. PE File Format 13.1. 소개 PE 파일: Windows 운영체제에서 사용되는 실행 파일 형식. 기존 UNIX에서 사용되는 COFF 기

staraube.tistory.com

https://staraube.tistory.com/52?category=548043 

 

2부 13장 PE File Format(2)

안녕하세요, 오브입니다. 오늘은 PE 헤더의 많은 구조체 중 DOS Header와 DOS Stub에 대해 알아보겠습니다. https://staraube.tistory.com/51?category=548043 2부 13장 PE File Format(1) 안녕하세요, 오브입니다..

staraube.tistory.com

https://staraube.tistory.com/53?category=548043 

 

2부 13장 PE File Format(3)

안녕하세요, 오브입니다. 오늘은 NT Header에 대해 알아보겠습니다. https://staraube.tistory.com/51?category=548043 2부 13장 PE File Format(1) 안녕하세요, 오브입니다. 오늘은 PE 파일의 기본구조와 VA, RVA..

staraube.tistory.com

https://staraube.tistory.com/54?category=548043 

 

2부 13장 PE File Format(4)

안녕하세요, 오브입니다. 오늘은 NT Header의 Optional Header에 대해 알아보겠습니다. https://staraube.tistory.com/51?category=548043 2부 13장 PE File Format(1) 안녕하세요, 오브입니다. 오늘은 PE 파일의..

staraube.tistory.com

https://staraube.tistory.com/55

 

2부 13장 PE File Format(5)

안녕하세요, 오브입니다. 오늘은 섹션 헤더에 대해 살펴보겠습니다. https://staraube.tistory.com/51?category=548043 2부 13장 PE File Format(1) 안녕하세요, 오브입니다. 오늘은 PE 파일의 기본구조와 VA, RVA..

staraube.tistory.com

 


 

실습을 하기에 앞서 Hex Editor와 PE View를 다운로드하겠습니다.

 

Hex Editor 설치

1. Hex Editor 사이트에 들어가서 아래의 파일 다운로드

https://mh-nexus.de/en/hxd/

 

HxD - Freeware Hex Editor and Disk Editor | mh-nexus

HxD - Freeware Hex Editor and Disk Editor HxD is a carefully designed and fast hex editor which, additionally to raw disk editing and modifying of main memory (RAM), handles files of any size. The easy to use interface offers features such as searching and

mh-nexus.de

2. HxDSetup.zip 파일 압축 풀어주기

3. HxDSetup.exe 클릭

4. 설치 언어 선택

5. 다음을 누른 후 사용권 계약에 동의

6. 설치 위치 선택

7. 추가 작업 선택 후 설치하기

 

PE View 설치

1. PE View 사이트에 들어가서 아래의 파일 다운로드

http://wjradburn.com/software/

 

WJR Software - PEview (PE/COFF file viewer),...

Utilities (for use with Windows® XP operating system or later) PEview provides a quick and easy way to view the structure and content of 32-bit Portable Executable (PE) and Component Object File Format (COFF) files. This PE/COFF file viewer displays heade

wjradburn.com

2. PEview.zip 압축 풀어주기

3. PEview.exe 클릭

 

PE 파일 실습(32bit)
  • 분석 파일
파일명 구분
zoom.exe 32bit

 

  • 분석 방법
    • PEview로 zoom.exe 파일 열고 분석
    • 가독성을 위해 HxD로 zoom.exe 파일을 열어 사진 캡쳐

 

1. IMAGE_DOS_HEADER

zoom.exe를 PEview로 열었을 때의 화면
zoom.exe의 IMAGE_DOS_HEADER

 

  • 위에 PEview를 바탕으로 zoom.exe의 PE 파일 분석

zoom.exe를 HxD로 열었을 때의 화면

Offset Value Data Description
0x0000 ~ 0x0001 e_magic 5A 4D Dos Signature(MZ)
0x003C ~ 0x003F e_Ifanew 00 00 01 20 IMEGE_NT_HEADERS 시작 위치

 

2. Dos Stub

zoom.exe의 Dos Stub

Offset Value Data Description
0x0040 ~ 0x00110F Dos Stub 0E ~ 00 “This program cannot be run in DOS mode” 문자열 존재

 

3. lMAGE_ NT_HEADERS

zoom.exe의 lMAGE_ NT_HEADERS

3-1. Signature

zoom.exe의 Signature

Offset Value Data Description
0x0120 ~ 0x0123 Signature 00 00 45 50 Signature(”PE”00)

3-2. IMAGE_FILE_HEADER

zoom.exe의 IMAGE_FILE_HEADER

Offset Value Data Description
0x0124 ~ 0x0125 Machine 01 4C I386 (32비트 Intel x86)
0x0126 ~ 0x0127 NumberOfSections 00 05 섹션의 개수가 5개
0x0128 ~ 0x012B TimeDateStamp 62 18 DD 71 2022-02-25 13:45:21 Unic Seconds(UTC)
0x0134 ~ 0x0135 SizeOfOptionalHeader 00 E0 Optional Header의 크기(10진수로 224)
0x0136 ~ 0x0137 Characteristics 01 02 파일의 속성
(0001 → IMAGE_FILE_RELOCS_STRIPPED
0002 → IMAGE_FILE_EXECUTABLE_IMAGES
0004 → IMAGE_FILE_LINE_NUMS_STRIPPED
0100 → IMAGE_FILE_32BIT_MACHINE)

3-3. IMAGE_OPTIONAL_HEADER

zoom.exe의 IMAGE_OPTIONAL_HEADER

Offset Value Data Description
0x0138 ~ 0x0139 Magic 01 0B IMAGE_NT_OPTIONAL_HDR32_MAGIC
0x0148 ~ 0x014B AddressOfEntryPoint 00 00 F7 C0 메모리 매핑된 후 코드 시작 주소
0x0154 ~ 0x0157 ImageBase 00 40 00 00 메모리에 로드되는 첫번째 주소
0x0158 ~ 0x015B SectionAlignment 00 00 10 00 메모리에서 섹션의 최소단위를 나타냄(1000)
0x015C ~ 0x015F FileAlignment 00 00 02 00 파일에서 섹션의 최소단위를 나타냄(0200)
0x0170~ 0x0173 SizeOfImage 00 04 80 00 PE 파일이 메모리에 로딩되었을 때의 전체 크기를 담음
0x0174 ~ 0x0177 SizeOfHeader 00 00 04 00 모든 헤더의 크기를 담음
0x017C ~ 0x017D Subsystem 00 02 Windows GUI
0x0194 ~ 0x0197 NumberOfRvaAndSize 00 00 00 10 DataDirectory 배열의 개수

 

4. IMAGE_SECTION_HEADER.text

zoom.exe의 IMAGE_SECTION_HEADER.text
zoom.exe의 IMAGE_SECTION_HEADER.text

Offset Value Data Description
0x0220 ~ 0x0223 VirtualSize BA 15 01 00 메모리에서 섹션이 차지하는 크기
0x0224~0x227 VirtualAddress(RVA) 00 10 00 00 메모리에서 섹션의 시작 주소(RVA)
0x0228~0x022B SizeOfRawData 00 16 01 00 파일에서 섹션이 차지하는 크기
0x022C~0x022F PointToRawData 00 04 00 00 파일에서 섹션의 시작 위치
0x023C~0x023F Characteristics 20 00 00 60 섹션의 속성(bit OR)
반응형

'리버싱' 카테고리의 다른 글

2부 13장 PE File Format(5)  (0) 2022.04.24
2부 13장 PE File Format(4)  (0) 2022.04.24
2부 13장 PE File Format(3)  (0) 2022.04.24
2부 13장 PE File Format(2)  (0) 2022.04.23
2부 13장 PE File Format(1)  (0) 2022.04.23