{"id":8035,"date":"2022-03-13T01:02:46","date_gmt":"2022-03-13T01:02:46","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=8035"},"modified":"2022-03-13T01:02:46","modified_gmt":"2022-03-13T01:02:46","slug":"good-file-what-is-it-good-for-part-3","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2022\/03\/13\/good-file-what-is-it-good-for-part-3\/","title":{"rendered":"Good file\u2026 (What is it good for) Part 3"},"content":{"rendered":"\n<p>We have our <a href=\"https:\/\/www.hexacorn.com\/blog\/2022\/03\/04\/good-file-what-is-it-good-for-part-1\/\" data-type=\"post\" data-id=\"8014\">sampleset<\/a>. We have our <a href=\"https:\/\/www.hexacorn.com\/blog\/2022\/03\/11\/good-file-what-is-it-good-for-part-2\/\" data-type=\"post\" data-id=\"8024\">metadata<\/a>. <\/p>\n\n\n\n<p>What&#8217;s next?<\/p>\n\n\n\n<p>You can very quickly script searches that will look for specific files, or their properties. I mentioned section names, PDB paths, icons, but there is more.<\/p>\n\n\n\n<p>In my older blog <a href=\"https:\/\/www.hexacorn.com\/blog\/2020\/03\/14\/stackoverflown-in-practice\/\">post<\/a> I highlighted a presence of a copy&amp;paste crypto code block present in a number of &#8216;good&#8217; files I have looked at. The reason I recognized these samples is pretty simple: they used API calls that happen to be on the list of all APIs that are of my interest. <\/p>\n\n\n\n<p>So&#8230;<\/p>\n\n\n\n<p>Once you get your sampleset processed, generated its preliminary metadata, you can look at the properties extracted from the files and\/or either re-run some additional metadata collection tasks (often narrowed down to specific file types), and\/or &#8230; disassemble\/decompile these files for some quick code-based post-processing &amp; &#8230; quick wins. The above example is one of them.<\/p>\n\n\n\n<p>What these post-processing tasks could be?<\/p>\n\n\n\n<p>Running <a href=\"https:\/\/github.com\/VirusTotal\/yara\">yara<\/a>, <a href=\"https:\/\/github.com\/mandiant\/capa\">capa<\/a> is of course a &#8216;must-do&#8217; and it&#8217;s trivial. But that&#8217;s not everything. You can (and should) run instrumented <a href=\"https:\/\/social.msdn.microsoft.com\/Forums\/sqlserver\/en-US\/64aa964d-4a18-4de6-9808-196c4a874fb4\/comole-object-viewer?forum=vcgeneral\">oleview<\/a>, or <a href=\"http:\/\/www.benf.org\/other\/olewoo\/index.html\">olewoo<\/a> to extract additional OLE\/COM info from embedded type libraries. They not only give us info about unique GUIDs, but often point us to proprietary COM interfaces and methods of interest that could be used to do some &#8216;funny&#8217; stuff &#8211; think: file downloading, program execution, escalation of privileges, etc.<\/p>\n\n\n\n<p>The next targets are drivers &#8211; they themselves are of always of interest, because &#8216;who runs code in kernel &#8211; owns the box&#8217;. <a href=\"https:\/\/twitter.com\/hFireF0X\">@hFirefox<\/a> (Twitter account doesn&#8217;t exist anymore as of today) created a number of <a href=\"https:\/\/github.com\/hfiref0x\/KDU\">POCs<\/a> showing that legitimate, signed, yet vulnerable kernel drivers can be abused to deliver payloads of (user mode) choice. There is definitely more vulnerable drivers out there, and guess what&#8230; some basic kernel driver analysis can be also done statically. <\/p>\n\n\n\n<p>If you look at a number of them, you will start recognizing a lot of patterns. For instance, it&#8217;s not uncommon for kernel mode driver developers to include the whole list of debug messages that often help understanding the internals of their creations. To be precise&#8230; for instance, grepping for &#8216;IOCTL_&#8217; prefixed strings inside kernel drivers will give us a lot of hints with regards to what the driver does, and how it operates. And yes, it will give us names  of many IOCTLs as well!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/03\/ioctl_1.png\"><img decoding=\"async\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/03\/ioctl_1.png\" alt=\"\" class=\"wp-image-8036\" width=\"500\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/03\/ioctl_1.png 668w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2022\/03\/ioctl_1-300x75.png 300w\" sizes=\"(max-width: 668px) 100vw, 668px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>Yup.<\/p>\n\n\n\n<p>We can bulk analyze these.<\/p>\n\n\n\n<p>How?<\/p>\n\n\n\n<p>Yes, I will cover this soon \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We have our sampleset. We have our metadata. What&#8217;s next? You can very quickly script searches that will look for specific files, or their properties. I mentioned section names, PDB paths, icons, but there is more. In my older blog &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2022\/03\/13\/good-file-what-is-it-good-for-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":[90],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8035"}],"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=8035"}],"version-history":[{"count":1,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8035\/revisions"}],"predecessor-version":[{"id":8037,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8035\/revisions\/8037"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=8035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=8035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=8035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}