Taking Advantage of PE Metadata
Taking Advantage of PE Metadata
Daniel Lunghi
[email protected]
Trend Micro
1 Sample analysis
Four files were initially sent to us, and the code analysis showed that
a fifth file was involved:
— dlpumgr32.exe, a legitimate signed file that is part of the DESlock+
product
— DLPPREM32.DLL, a malicious DLL sideloaded [1] by dlpumgr32.exe
that loads and decodes DLPPREM32.bin
— DLPPREM32.bin, a shellcode that decompresses and loads a launcher
in memory
— data.res, an encrypted file decoded by the launcher that contains
two SysUpdate versions: one for a 32-bit architecture and another
for a 64-bit architecture
1. http://www.talent-jump.com/EN_index.html
2 Taking Advantage of PE Metadata
3 Pivoting on metadata
The two previously listed articles [14, 17] provided indicators of com-
promise (IOC) of old SysUpdate samples that we could retrieve. A quick
analysis showed that their loading process was quite similar, involving a
legitimate signed file loading a malicious DLL, which unpacks a binary
file in-memory. However, no launcher nor additional files were involved.
3.1 Filename
We noticed the sys.bin.url filename has been used in both cases.
This was our first pivot, and searching for this filename followed by relevant
4 Taking Advantage of PE Metadata
Fig. 3. Loading process of a SysUpdate sample found in Dell SecureWorks blog [17]
2. https://www.virustotal.com/gui/search/name:sys.bin.url/files
3. https://www.virustotal.com/gui/search/name:python33.hlp/files
4. https://www.virustotal.com/gui/search/name:PYTHON33.dllsize:100Kb-
NOTtag:corrupt/files
M. Lunghi 5
3.2 Imphash
“Imphash” or “Import hashing” is a method invented by FireEye and
published [11] in 2014. The general idea is that the Import Address Table
(IAT), which is built at compilation time, changes depending on which
order the functions are placed in the source code. Thus, when a significant
amount of functions are imported and called in a malware’s source code,
its IAT has a fingerprint unique enough to allow for correlations. Multiple
tools 5 exist to generate this hash. In our case, this method worked pretty
well on the malicious DLLs compiled by our threat actor. For example,
a search 6 query on the imphash 509a3352028077367321fbf20f39f6d9
returned three files related to Iron Tiger. Other platforms, such as Malware
Bazaar, allow for similar search queries 7 through their API.
It is also possible to build a Yara rule that matches on files with a
specific imphash:
import " pe "
rule s y s u p d a t e _ d l l _ i m p h a s h
{
meta :
author = " Daniel Lunghi "
d e s c r i p t i o n = " Matches Iron Tiger ’s SysUpdate DLLs from 2019 "
purpose = " Show an example of imphash Yara rule for SSTIC 2021
conference "
condition :
uint16 (0) ==0 x5a4d and // " MZ " header
pe . imphash () == " 509 a 3 3 5 2 0 2 8 0 7 7 3 6 7 3 2 1 f b f 2 0 f 3 9 f 6 d 9 "
}
the build number. Researchers have taken advantage [10] of this header
for the last couple of years, because it sometimes bring useful correla-
tions. The general idea is that a similar building environment should
produce a similar header, which could help finding binaries that have
been compiled in the same machine. Some public tools 8 generate a MD5
hash of the RICH header, which can then be used in a Yara rule, or in
malware repositories that support it. As an example, searching for the
hash 5503d2d1e505a487cbc37b6ed423081f in Virus Total returns three
files, which are all related to our threat actor.
The following Yara rule matches those samples:
import " pe "
import " hash "
rule s y s u p d a t e _ r i c h h e a d e r
{
meta :
author = " Daniel Lunghi "
d e s c r i p t i o n = " Matches Iron Tiger ’s SysUpdate DLLs from 2018 "
purpose = " Show an example of RICH header Yara rule for SSTIC
2021 conference "
condition :
uint16 (0) ==0 x5a4d and // " MZ " header
hash . md5 ( pe . r i c h _ s i g n a t u r e . c l e a r _ d a t a ) == " 5503
d2d1e505a487cbc37b6ed423081f "
}
by Palo Alto [16] was signed by a certificate stolen from the company
Kepware Technologies. Searching for its serial number 9 or thumbprint
10 in Virus Total returns six results, which are all related to the SysUp-
Note that the stolen certificate has been revoked by the certification
authority, so the malicious files’ signature is not valid anymore.
3.5 TLSH
Multiple “fuzzy hashing” algorithms exist that intend to match
similar files automatically. They usually split the original file in blocks of
variable length, and then make a hash of the different blocks. The most
popular fuzzy hashing algorithm is SSDeep. However, results on compiled
code are usually not good. Of all the fuzzy hashing algorithms that we
looked at, TLSH was the one that gave better results for correlation.
Results should still be taken with caution. As an example, TLSH hash
T112F21A0172A28477E1AE2A3424B592725D7F7C416AF040CB3F9916FA9FB16D0DA3C367
returned 223 results in Virus Total, and while many of them were
related to our threat actor, many of them were not, and simply
9. https://www.virustotal.com/gui/search/signature:
0D02F124C16496225706F4EDD38DA696/file
10. https://www.virustotal.com/gui/search/signature:
FA89C0CBFCE8D745EF3B2F72312077799E69DF72/files
8 Taking Advantage of PE Metadata
had a similar structure. On the other hand, searching for the hash
T17A634B327C97D8B7E1D97AB858A2DA12152F250059F588C9BF7043E70F2A6509E37F0E
returned only two results, and both were related to our threat actor. Note
that Malware Bazaar also allows to search for TLSH hash in its API 11 .
4 Conclusion
The goal of this short paper was to present some techniques that
defenders can leverage when investigating a breach to gather additional
information and IOC about the threat actor. It is complementary with the
talk [9] presented at SSTIC in 2020, this time focusing on PE metadata.
By using these techniques in a recent investigation, we started from a
single unknown sample and found more than thirty samples from the same
malware family, around 15 C&C IP addresses, multiple reports discussing
the same threat actor and detailing its targets and Tactics, Techniques and
Procedures (TTPs). It shows the importance of public research containing
IOC, which helped us to identify the malware family. We could also
compare our sample to previous versions of the same malware and spot
the structural changes.
We hope that by showing examples taken from a real case investigation,
it will help young researchers to apply these techniques to their own
investigations.
References
11. https://bazaar.abuse.ch/api/#tlsh
M. Lunghi 9