{"id":7593,"date":"2020-11-27T22:36:56","date_gmt":"2020-11-27T22:36:56","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=7593"},"modified":"2020-11-27T22:36:56","modified_gmt":"2020-11-27T22:36:56","slug":"re-sauce-part-3","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2020\/11\/27\/re-sauce-part-3\/","title":{"rendered":"Re-sauce, Part 3"},"content":{"rendered":"\n<p>I like extracting data from many samples because this way I often discover new things. Combing through a set of <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/sbscs\/application-manifests\">manifest<\/a> files I have extracted from a large sampleset of good samples was an interesting exercise and brought a few interesting findings.<\/p>\n\n\n\n<p>Manifest files I came across were saved as plain text, Unicode 16 LE, and utf8. Some were malformed, some used incorrect data, others included commented out manifest sections and sometimes the commented out parts would use HTML entities to represent opening and closing brackets. Quotation marks vs. apostrophes, boilerplate values (e.g. name = &#8220;CompanyName.ProductName.YourApplication&#8221;, name = &#8220;YourCompanyName.YourDivision.YourApp&#8221;, etc.), and typos (e.g. &#8220;schema-microsoft-com:asm.v3&#8221;, or &#8220;urn:schemas-microsoft.com:asm.v3&#8221;).<\/p>\n\n\n\n<p>I tried to see if I can find any publicKeyToken outliers &#8212; these are often used to reference a specific library version &#8211; the most popular being comctl32.dll v6.0 enabling visual styles back in the days when it still mattered (publicKeyToken=&#8221;6595b64144ccf1df&#8221;).<\/p>\n\n\n\n<p>Quick histogram of publicKeyToken values shows a small number of unique values, some of which are kinda questionable (e.g. empty, zeroed, or using a reference):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">publicKeyToken=\"6595b64144ccf1df\"<br>publicKeyToken=\"1fc8b3b9a1e18e3b\"<br>publicKeyToken=\"000000000000000\"<br>publicKeyToken=\"02ad33b422233ae3\"<br>publicKeyToken=\"73A0BB510A53FB51\"<br>publicKeyToken=\"31BF3856AD364E35\"<br>publicKeyToken=\"0000000000000000\"<br>publicKeyToken=\"dfbe2673baf698eb\"<br>publicKeyToken=\"6595B64144CCF1DF\"<br>publicKeyToken=\"89845dcd8080cc91\"<br>publicKeyToken=\"13acf979d16e8a17\"<br>publicKeyToken=\"b03f5f7f11d50a3a\"<br>publicKeyToken=\"B03F5F7F11D50A3A\"<br>publicKeyToken=\"$(Build.WindowsPublicKeyToken)\"<br>publicKeyToken=\"5a496c7842cd4787\"<br>publicKeyToken=\"296da4bedbebef8f\"<br>publicKeyToken=\"df38d5d136a3092e\"<br>publicKeyToken=\"\"<br>publicKeyToken=\"fcc99ee6193ebbca\"<br>publicKeyToken=\"b77a5c561934e089\"<br>publicKeyToken=\"81e233547d425e6b\"<br>publicKeyToken=\"6bd6b9abf345378f\"<br>publicKeyToken=\"C7153A0601FA8C89\"<br>publicKeyToken=\"7a259a25b8d448e5\"<br>publicKeyToken=\"654bb64156ccf1af\"<br>publicKeyToken=\"40C4B6FC221F4138\"<br>publicKeyToken=\"31bf3856ad364e35\"<br>publicKeyToken=\"1fc8b3b9a1e18e3c\"<br>publicKeyToken=\"02d1dcd786c7c243\"<br>publicKeyToken=\"f92d94485545da78\"<br>publicKeyToken=\"a03853097df2bf0c\"<br>publicKeyToken=\"A2625990D5DC0167\"<br>publicKeyToken=\"71E9BCE111E9429C\"<br>publicKeyToken=\"669E0DDF0BB1AA2A\"<br>publicKeyToken=\"5120E14C03D0593C\"<br>publicKeyToken=\"47D0C84D0EBB13E5\"<br>publicKeyToken=\"4267b751a96a28a1\"<br>publicKeyToken=\"30AD4FE6B2A6AEED\"<\/pre>\n\n\n\n<p>Another statistic I was interested in was requestedExecutionLevel, but it didn&#8217;t bring anything interesting:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">level=\"asInvoker\"<br>level=\"highestAvailable\"<br>level=\"leastPrivilege\"<br>level=\"requireAdministrator\"<\/pre>\n\n\n\n<p>Looking at processorArchitecture we get:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$(build.processorArchitecture)\n*\nAMD64\nAmd64\nIA64\nMSIL\nSXS_PROCESSOR_ARCHITECTURE\nX64\nX86\namd64\narm\nia64\nmsil\nx64\nx86<\/pre>\n\n\n\n<p>For uiAccess:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&amp;quot;false&amp;quot;\nFALSE\nFalse\nTRUE\nTrue\nfalse\ntrue\ntrue|false<\/pre>\n\n\n\n<p>Another target of these analysis were URIs. These constantly <a href=\"https:\/\/www.hexacorn.com\/blog\/2020\/11\/15\/when-good-urls-are-bad-for-business\/\">pop up<\/a> during memdump analysis and knowing a list of clean ones can save us some time. Here&#8217;s a list I extracted (including these prefixed with &#8216;urn&#8217;):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/blogs.msdn.com\/b\/chuckw\/archive\/2013\/09\/10\/manifest-madness.aspx\nhttp:\/\/ipmsg.org\/tools\/fastcopy.html\nhttp:\/\/ltsc.ieee.org\/xsd\/LOM\nhttp:\/\/manifests.microsoft.com\/win\/2004\/08\/windows\/events\nhttp:\/\/mozilla.org\/MPL\/2.0\/.\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/aa374191\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/aa374191(VS.85).aspx\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/aa965884%28v=vs.85%29.aspx\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/dd371711\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/hh848036\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/hh848036(v=vs.85).aspx\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/ms633543.aspx\nhttp:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/dn302074%28v=vs.85%29.aspx\nhttp:\/\/msdn.microsoft.com\/windowsvista\/prodinfo\/what\/security\/default.aspx?pull=\/library\/en-us\/dnlong\/html\/AccProtVista.asp\nhttp:\/\/opensource.org\/licenses\/cpl.php\nhttp:\/\/opensource.org\/licenses\/cpl1.0.php\nhttp:\/\/schemas.microsoft.com\/SMI\/2005\/WindowsSettings\nhttp:\/\/schemas.microsoft.com\/SMI\/2010\/WindowsSettings\nhttp:\/\/schemas.microsoft.com\/SMI\/2011\/WindowsSettings\nhttp:\/\/schemas.microsoft.com\/SMI\/2016\/WindowsSettings\nhttp:\/\/schemas.microsoft.com\/SMI\/2017\/WindowsSettings\nhttp:\/\/schemas.microsoft.com\/win\/2004\/08\/events\nhttp:\/\/social.msdn.microsoft.com\/Forums\/en\/winformssetup\/thread\/7787c8b9-18c3-4135-bd8a-2802eba98e3c\nhttp:\/\/www.adlnet.org\/xsd\/adlcp_v1p3\nhttp:\/\/www.apache.org\/licenses\/LICENSE-2.0\nhttp:\/\/www.imsglobal.org\/xsd\/imscp_v1p1\nhttp:\/\/www.w3.org\/2000\/09\/xmldsig#\nhttp:\/\/www.w3.org\/2000\/09\/xmldsig#sha1\nhttp:\/\/www.w3.org\/2001\/XMLSchema\nhttp:\/\/www.w3.org\/2001\/XMLSchema-instance\nhttp:\/\/yourserver\/iis_auth.asp?debug=1\nurn:0073chemas-microsoft-com:asm.v3\nurn:schemas-microsoft-com:asm.v1\nurn:schemas-microsoft-com:asm.v2\nurn:schemas-microsoft-com:asm.v3\nurn:schemas-microsoft-com:clickonce.v1\nurn:schemas-microsoft-com:clickonce.v2\nurn:schemas-microsoft-com:compatability.v1\nurn:schemas-microsoft-com:HashTransforms.Identity\nurn:schemas-microsoft-com:HashTransforms.ManifestInvariant<\/pre>\n\n\n\n<p>Finally, attributes (note, some may only exist within comments, that is, between &lt;!&#8211;&#8230;-> not the actual manifest XML):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">name<br>iid<br>version<br>clsid<br>progid<br>hash<br>description<br>proxyStubClsid32<br>tlbid<br>Id<br>numMethods<br>publicKeyToken<br>task<br>message<br>language<br>value<br>xmlns<br>processorArchitecture<br>uiAccess<br>level<br>type<br>class<br>file<br>standalone<br>inType<br>encoding<br>mask<br>flags<br>manifestVersion<br>threadingModel<br>keywords<br>size<br>chid<br>runtimeVersion<br>guid<br>xmlns:asmv3<br>company<br>optional<br>outType<br>helpdir<br>xmlns:co.v2<br>copyright<br>allowDelayedBinding<br>opcode<br>xmlns:asmv2<br>length<br>xmlns:ms_asmv3<br>buildType<br>hashalg<br>parameters<br>xmlns:adlcp<br>xsi:schemaLocation<br>xmlns:cmp<br>culture<br>xmlns:ms_asmv1<br>profile<br>xmlns:ms_windowsSettings<br>xmlns:xsi<br>baseInterface<br>majorVersion<br>face<br>xmlns:xsd<br>miscStatusContent<br>resourceFileName<br>xmlns:asmv1<br>isolation<br>dependencyType<br>servicePackMajor<br>xmlns:co.v1<br>channel<br>xmlns:lom<br>assemblyname<br>xmlns:ms_asmv2<br>messageFileName<br>xmlns:ms_compatibility<br>template<br>xmlns:mssv2<br>minorVersion<br>miscStatus<br>enabled<br>asmv2:product<br>product<\/pre>\n\n\n\n<p>And last, but not least&#8230; this classic <a href=\"https:\/\/www.exploit-db.com\/docs\/english\/13140-api-interception-via-dll-redirection.pdf\">paper<\/a> [PDF warning] from 2006 on manifest file abuse was yet another reason I looked at manifest files <em>en masse<\/em>. I speculated that maybe, maybe, maybe, maybe there are some signed executables that take advantage of manifest&#8217; file tag as described in the document:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2020\/11\/manifest_file.png\"><img decoding=\"async\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2020\/11\/manifest_file.png\" alt=\"\" class=\"wp-image-7600\" width=\"500\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2020\/11\/manifest_file.png 815w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2020\/11\/manifest_file-300x85.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2020\/11\/manifest_file-768x217.png 768w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/figure>\n\n\n\n<p>and inadvertently may become a vehicle for a &#8216;by design&#8217; manifest-based DLL side-loading. The scenario would play like this: you run a signed executable that uses a manifest leveraging the <em>file<\/em> tag and you provide it the malicious DLL named as the manifest expects and place it in a current directory. Should work?<\/p>\n\n\n\n<p>After grepping the manifest files for &lt;file tag I found quite a few of them. So many that I can&#8217;t paste it here. But you can view them <a href=\"https:\/\/hexacorn.com\/d\/manifest_file.txt\">here<\/a>.<\/p>\n\n\n\n<p>What&#8217;s next? Obviously, more research.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like extracting data from many samples because this way I often discover new things. Combing through a set of manifest files I have extracted from a large sampleset of good samples was an interesting exercise and brought a few &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2020\/11\/27\/re-sauce-part-3\/\">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,39,57,21,19],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7593"}],"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=7593"}],"version-history":[{"count":3,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7593\/revisions"}],"predecessor-version":[{"id":7601,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/7593\/revisions\/7601"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=7593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=7593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=7593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}