{"id":8510,"date":"2023-05-12T22:50:39","date_gmt":"2023-05-12T22:50:39","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=8510"},"modified":"2023-05-12T22:50:39","modified_gmt":"2023-05-12T22:50:39","slug":"da-lil-world-of-dll-exports-and-entry-points-part-6","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2023\/05\/12\/da-lil-world-of-dll-exports-and-entry-points-part-6\/","title":{"rendered":"Da Li\u2019L World of DLL Exports and Entry Points, Part 6"},"content":{"rendered":"\n<p>I love looking at clusters of files, because it&#8217;s the easiest way to find patterns. In the <a href=\"https:\/\/www.hexacorn.com\/blog\/2022\/07\/01\/da-lil-world-of-dll-exports-and-entry-points-part-5\/\">last part<\/a> of this series I focused on Nullsoft installers (DLLs!) only, and today, I will use the very same idea to describe clusters of DLL families I have generated from a very large corpora of clean samples (collected over last decade, or so). <\/p>\n\n\n\n<p>What makes a summary like this interesting?<\/p>\n\n\n\n<p>Some malware families like to &#8217;emulate&#8217; real software. They imitate clean .exe and .dll files by copypasteing their lists of imports, exports, internal strings, but then adding an extra import or export here and there; some go as far as to integrate their malicious code with the existing source code. So, the compiled embedded malicious code occupies like 5-10% of the actual binary, and the rest is all nice and dandy code &#8216;borrowed&#8217; from some open source project. Detecting a malicious code inside such binaries is not trivial, but one thing that sometimes gives the badness away is that extra export. So, this post is about these extra exports&#8230;<\/p>\n\n\n\n<p>The most popular exports combo in my sampleset is this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">148199<br>DllCanUnloadNow<br>DllGetClassObject<br>DllRegisterServer<br>DllUnregisterServer<\/pre>\n\n\n\n<p>No surprises here, it&#8217;s your traditional COM library at work. <\/p>\n\n\n\n<p>The next two are variants of the above, but including an extra export:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">27741\nDllCanUnloadNow\nDllGetClassObject\nDllInstall\nDllRegisterServer\nDllUnregisterServer\n\n24647\nDllCanUnloadNow\nDllGetClassObject\nDllMain\nDllRegisterServer\nDllUnregisterServer<\/pre>\n\n\n\n<p>Now you know where it&#8217;s heading&#8230; <\/p>\n\n\n\n<p>When you analyze a DLL, and it includes all the export functions from the sets above, BUT then export some additional functions, these functions are definitely of interest. This doesn&#8217;t mean all DLLs that export these &#8216;default&#8217; sets + something extra that I am highlighting as &#8216;functions of interest&#8217; are malicious. It&#8217;s just an easy win to focus on these extra exported functions first, even if just to discover that a legitimate programmer of a legitimate DLL was overzealous in over-exporting functions&#8230;<\/p>\n\n\n\n<p>Here&#8217;s an example of a legitimate set with these &#8216;extras&#8217;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">2019<br>DeferredDeleteW<br>DllCanUnloadNow<br>DllGetClassObject<br>DllInstall<br>DllRegisterServer<br>DllUnregisterServer<br>InstallPackagesManagedW<br>InstallPackagesW<br>ReinstallPackageW<br>ResumeAsyncW<br>ResumeW<br>UninstallPackageW<\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1464<br>DllCanUnloadNow<br>DllGetClassForm<br>DllGetClassInfo<br>DllGetClassObject<br>DllGetInterface<\/pre>\n\n\n\n<p>Secondly, many of traditional DLL exports are _not_ meant to be executed from the likes of rundll32.exe. <\/p>\n\n\n\n<p>What does it mean? <\/p>\n\n\n\n<p>These popular DLL Export combos give you a list of functions that, if seen being invoked via command line, are most likely an indicator of something &#8216;funny&#8217; going on. This is because these functions are (normally) not designed to be <a href=\"http:\/\/vbnet.mvps.org\/code\/system\/rundll32.htm\">rundll32-friendly<\/a> and are meant to be accessed programmatically only. There are exceptions, of course&#8230;. f.ex. tailored DllInstall is sometimes invoked by legitimate software and via rundll32.exe, but the main message here is that if you see rundll32.exe executing one of the non-rundll32-exe friendly functions, you better start investigating&#8230; <\/p>\n\n\n\n<p>Last, but not least &#8212; remember that <a href=\"https:\/\/www.hexacorn.com\/blog\/2020\/04\/03\/da-lil-world-of-dll-exports-and-entry-points-part-4\/\">DLLs exporting via ordinals<\/a> is a thing too, so keep this in mind during your analysis&#8230;.<\/p>\n\n\n\n<p>So, what other &#8216;healthy&#8217; combos we can see out there?<\/p>\n\n\n\n<ul><li>QT Plug-ins export these two functions:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">1847<br>qt_plugin_instance<br>qt_plugin_query_metadata<\/pre>\n\n\n\n<ul><li>Gnome&#8217;s GEGL modules export these 2 functions (I have not seen <a href=\"https:\/\/gitlab.gnome.org\/GNOME\/gegl\/-\/blob\/master\/operations\/transform\/module.h\">transform_module_get_module<\/a> being exported):<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">1612\ngegl_module_query\ngegl_module_register<\/pre>\n\n\n\n<ul><li>NVIDIA Stereo API DLLs:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">1582<br>GetStereoApi<\/pre>\n\n\n\n<p>There are many other combos like this, but in today&#8217;s era of AI knowing-it-all, ask your nearest chatGPT for the full list, mine is most likely already quite obsolete \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love looking at clusters of files, because it&#8217;s the easiest way to find patterns. In the last part of this series I focused on Nullsoft installers (DLLs!) only, and today, I will use the very same idea to describe &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2023\/05\/12\/da-lil-world-of-dll-exports-and-entry-points-part-6\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[53,109],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8510"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=8510"}],"version-history":[{"count":1,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8510\/revisions"}],"predecessor-version":[{"id":8512,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8510\/revisions\/8512"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=8510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=8510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=8510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}