Overlays

During an investigation of a large PE file, analysis tools identified that a significant part of the file was made up of an “overlay”. I could not find a lot of information about overlays so I researched and have documented my findings here.

What is an overlay?

In simple terms, an overlay is additional data added to the end of a PE file. Many common PE analysis tools will show the presence of an overlay and provide varying levels of detail.

Figure 1 – Overlay structure

The PE section of the sample is a complete executable. However when the file is loaded into memory the overlay is not mapped.

Analysis

The sample analysed was obtained from VirusTotal:

1000f3f1280e5b2998c5c1550077779542372201ceaff72ee74cdd4d04f72940

Figure 2 – VirusTotal description of sample

The file is 89.62 MB and has been identified as a PE32 executable. We can also see that the file has been identified as malicious by several vendors (21/68 at time of writing). Opening the file in DiE (Detect it Easy) the presence of an overlay can be seen (red arrow)

Figure 3 – DiE Scan of original sample

DiE has detected the the overlay is also itself a PE file and the green arrow shows that the overlay also contains an overlay. Things are starting to get a little Inception!

Looking at the memory map section we see from the size column that the Overlay section is the largest. The Address column shows the address in memory that the various sections would be mapped to. Note no entry for the Overlay section meaning it does not get mapped into memory.

Figure 4 – DiE Memory Map

If we select the overlay section we can see the hex dump at that memory location and it shows MZ, the start of a DOS header. This agrees with the automated analysis shown above.

Figure 5 – Overlay hex code

We can dump the overlay section and save to disk…

Figure 6 – DiE dump section to file

Analysing the dumped file in DiE we can see the this file does contain an overlay. It also shows the the PE32 at the start of of this dumped file is a DLL – see red box below.

Figure 7 – DiE Scan of overlay #1

If this process is continued it will be seen that apart from the original PE32 executable file at the start of the original sample there are 5 DLL files contained in layered overlay sections and a final section identified as “binary” data.

DiE includes an Extractor facility which allows all files to be extracted and dumped to disk in a single step. The result is shown below. The binary data section has been extracted as a 7-Zip file. The format of the naming for the extracted files is:

<SHA256 hash of original sample>.<offset>_<size>.<extension>

Figure 8 – DiE Files to be extracted
Figure 9 – Extracted files
File (offset)SHA256VT Score
00257b15fd51f056f2f5be8a580d7cfc40850310fd9dfefd8078b9e37336da11261/70
002a61c8a1443d68e263069da2f397dc56c886d4b8279de986ff068ece4488cc5c085bb00/70
002ea2005ffff4590ff56fbb7edf5537e57b72d29fb1cd353f62c7cef15cea73b292b3350/70
002ef780a1443d68e263069da2f397dc56c886d4b8279de986ff068ece4488cc5c085bb00/70
002f7600b90bfb7e6d3a41b04940c323d12896660107f432e536aa6783d57f7d7a2459f0n/a
002fc9b0a1443d68e263069da2f397dc56c886d4b8279de986ff068ece4488cc5c085bb00/70
003062003a1cf719eef260d92924790b34a6b206e79e72f4d10fd192aa47943d39bf6334n/a
0030b5fca1443d68e263069da2f397dc56c886d4b8279de986ff068ece4488cc5c085bb00/70
00315000e21da2260d39fc919af3731256277652d3bfc9620ebc4046016ce341a546763en/a
0031a4cca1443d68e263069da2f397dc56c886d4b8279de986ff068ece4488cc5c085bb00/70
00323e00d4282c9805e7ff97a7bebcbbed608d7daa3dc4c72354690ba94b6855507285490/70
003548607bf45759e510c502e3b4f132c35252c3ed16ad03776f92c8bde66b7b98c2c55d0/70

Conclusion

Using basic analysis tools we can see and extract complex multi-layered overlay structures. The sample examined here appears to show a suspicious PE executable file with low detection (1/70) and 5 DLL files embedded in the overlay. It is likely that the DLL files are included to support the operation of the executable.

The purpose of the large binary file is not known at this time. It is not a 7-Zip file and does not deflate. My hope is to return to this and add a supplementary blog at some stage.

David

Scroll to Top