I have a hexdump of a Windows binary and identified the COFF header in this executable by looking at the COFF offset:
0000080: 4550 0000 014c 0003 6ec8 3add 0000 0000
0000090: 0000 0000 00e0 010f 010b 0301 2000 0000
We can further verify this is the file header because of its 4 byte signature: 'PE'
followed by two NULL
bytes. Clearly, the format appears to be expressed in little endian because if we were to write PE explicitly, we would have the hex 50 45
.
If we look at the PE format specification and carry this observation though, the NumberOfSections
field (offset 2 bytes from the end of the signature that are skipped for the Machine
field), we determine there are 768 sections (03 00
in little endian). This contradicts the spec, stating that the Windows loader limits the number of sections to 96.
Furthermore, byte ordering in the Timestamp
field (next 4 bytes) seems odd because only the permutation 3add 6ec8
produces a Unix timestamp that is in the past.
Is there a more explicitly defined byte ordering that I'm missing? Why do the byte orderings between the fields seem inconsistent?