Skip to content

Commit 42dcdc5

Browse files
committed
images fix
1 parent b7ed47e commit 42dcdc5

12 files changed

+7
-7
lines changed

content/posts/insideapefile.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Based on the forementioned information, we can state the following computation e
4040
## PE structure
4141
The structure which presents the fields and parts that a PE file contains can be seen in the following simplified picture:
4242

43-
![](/posts/insideapefile1/insideapefile1.png)
43+
![](/posts/insideapefile/insideapefile1.png)
4444

4545
Every one of these parts is called header, and each header is defined by a structure which holds relevant information about the PE file.
4646
Let's start breaking down each of these headers to get an idea of what they contain and what relation they have to each other.
@@ -76,12 +76,12 @@ A few examples of how the DOS Header can be utilized is:
7676
7777
We can view the DOS header struct of mspaint.exe by opening it in CFF Explorer:
7878
79-
![](/posts/insideapefile1/insideapefile2.png)
79+
![](/posts/insideapefile/insideapefile2.png)
8080
8181
We can verify our claims about the e_magic being 0x5A4D and e_lfanew being at offset 0x3C.
8282
Also, we can see that the e_lfanew is a raw address to NT Header, as the PE[e_lfanew] = PE[0x3C] = 0xFB. If we view the offset of the NT Header at CFF explorer, we will evaluate this claim:
8383
84-
![](/posts/insideapefile1/insideapefile3.png)
84+
![](/posts/insideapefile/insideapefile3.png)
8585
8686
### DOS Stub
8787
Before proceeding to the NT Header, let's first talk about DOS Stub. This stub is next to the DOS header and is not really relevant. It contains the popular message "This program cannot be run in DOS mode" which has remained over the years. The string can of course be modified at compile time. To clarify, this is not a header, but just a part of a PE file containing the prementioned string.
@@ -137,7 +137,7 @@ The most important members of this struct are:
137137
- SizeOfOptionalHeader: This contains the size of the OptionalHeader.
138138

139139
We can view the Characteristics of our PE by clicking on the corresponding field inside CFF Explorer:
140-
![](/posts/insideapefile1/insideapefile4.png)
140+
![](/posts/insideapefile/insideapefile4.png)
141141

142142
### OptionalHeader
143143
This header is very important for the execution of a PE file. The word 'Optional' might be misleading. It is named that way because some files (specifically, object files) do not have it.
@@ -191,7 +191,7 @@ The optional header contains a ton of information that can be used. Below are so
191191

192192
We can again view the mentioned fields with the help of CFF Explorer:
193193

194-
![](/posts/insideapefile1/insideapefile5.png)
194+
![](/posts/insideapefile/insideapefile5.png)
195195

196196
Having loaded the NT Header, we can parse the Optional Header and get some information regarding the PE. Some examples are:
197197
```c
@@ -232,7 +232,7 @@ A specific data directory can be accessed using its index in the array:
232232
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 // COM Runtime descriptor
233233
```
234234
And through CFF Explorer:
235-
![](/posts/insideapefile1/insideapefile6.png)
235+
![](/posts/insideapefile/insideapefile6.png)
236236
237237
We could also view this inside the winnt.h header file inside a visual studio project.
238238
The following two sections will mention two of the most important data directories, the Export Directory and Import Address Table.
@@ -256,7 +256,7 @@ The following are the most important PE sections and are present in nearly every
256256
257257
Each PE section has an associated IMAGE_SECTION_HEADER data structure that provides essential information about that section. These structures are stored beneath the NT headers in a PE file and are arranged sequentially, with each structure representing a different section:
258258
259-
![](/posts/insideapefile1/insideapefile7.png)
259+
![](/posts/insideapefile/insideapefile7.png)
260260
261261
The IMAGE_SECTION_HEADER structure is as follows:
262262
```c
2.74 MB
Binary file not shown.
4.62 MB
Loading
371 KB
Loading
346 KB
Loading

static/img/codegif.gif

1.18 MB
Loading
296 KB
Loading
374 KB
Loading

static/img/sisiphus.jpeg

30.3 KB
Loading

static/img/sisiphus.jpg

30.3 KB
Loading

0 commit comments

Comments
 (0)