{"id":874,"date":"2025-04-17T02:56:43","date_gmt":"2025-04-17T02:56:43","guid":{"rendered":"https:\/\/malwrforensics.com\/en\/?p=874"},"modified":"2025-04-17T02:56:43","modified_gmt":"2025-04-17T02:56:43","slug":"demystify-golang-malware-how-to-recognize-bishop-foxs-sliver","status":"publish","type":"post","link":"https:\/\/malwrforensics.com\/en\/2025\/04\/17\/demystify-golang-malware-how-to-recognize-bishop-foxs-sliver\/","title":{"rendered":"Demystify golang malware &#8211; how to recognize Bishop Fox&#8217;s Sliver"},"content":{"rendered":"\n<p>In this blog post we&#8217;ll look into how we can do a quick analysis of a <a href=\"https:\/\/go.dev\/dl\/\">golang<\/a> binary. You can download the sample from <a href=\"https:\/\/app.any.run\/tasks\/23ce00f1-206d-4bb2-8f27-48b607b56b6c\">here<\/a> (thanks to Any.Run). I&#8217;ll only use two tools today (<a href=\"https:\/\/www.farmanager.com\/\">Far Manager<\/a> and Hiew), but you can use any file viewer\/editor you want (Notepad works too).<\/p>\n\n\n\n<p>First, let&#8217;s have a look at the PE header of a golang windows executable. From the start we can tell it&#8217;s a golang binary. The &#8220;Go build ID&#8221; (embedded into the compiled binary by the <code>go build<\/code> tool) is pretty obvious.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"902\" height=\"328\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_view.png\" alt=\"\" class=\"wp-image-875\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_view.png 902w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_view-300x109.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_view-768x279.png 768w\" sizes=\"auto, (max-width: 902px) 100vw, 902px\" \/><\/figure>\n\n\n\n<p>Let&#8217;s look now at the PE sections.<\/p>\n\n\n\n<p>An interesting one is the <code>.data<\/code> section. Here I&#8217;ve used Hiew to locate the start offset and view the content.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"313\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section.png\" alt=\"\" class=\"wp-image-876\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section.png 742w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section-300x127.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p>This section is interesting because it contains build information, which sometimes can give us a hint of what we&#8217;re dealing with.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"663\" height=\"230\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section1.png\" alt=\"\" class=\"wp-image-877\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section1.png 663w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section1-300x104.png 300w\" sizes=\"auto, (max-width: 663px) 100vw, 663px\" \/><\/figure>\n\n\n\n<p>The highlighted part tells us that we&#8217;re dealing with <a href=\"https:\/\/github.com\/BishopFox\/sliver\">sliver<\/a>. <\/p>\n\n\n\n<p>For a definitive answer, let&#8217;s see if we can analyze the other sections. The only problem is that they look something like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"456\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section3.png\" alt=\"\" class=\"wp-image-878\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section3.png 958w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section3-300x143.png 300w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/PE_header_data_section3-768x366.png 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/figure>\n\n\n\n<p>The first hint is the <code>ZLIB<\/code> string at the beginning of the section. If we look at the following bytes, we&#8217;ll stumble upon the <code>78 01<\/code> value (in other files this may be different). A zlib stream starting with <code>78 01<\/code> indicates that the data is compressed using the deflate method with a 32K window size and the fastest compression level. If you want to know more about ZLIB, here is the <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc1950#page-4\">RFC<\/a>.<\/p>\n\n\n\n<p>What we need to do now is to remove everything from the beginning of the file until <code>78 01<\/code>. Once we have that, we just need to run this python <a href=\"https:\/\/github.com\/asaygo\/toolbox\/blob\/main\/extract_zlib_stream.py\">script<\/a> to extract the compressed data. If you want to inspect all the compressed sections, you need to follow the steps outlined above for every compressed stream.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"432\" height=\"90\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/run_zlib_extract_tool.png\" alt=\"\" class=\"wp-image-879\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/run_zlib_extract_tool.png 432w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/run_zlib_extract_tool-300x63.png 300w\" sizes=\"auto, (max-width: 432px) 100vw, 432px\" \/><\/figure>\n\n\n\n<p>Once we&#8217;re able to inspect the &#8220;real&#8221; data, we can say for sure that we&#8217;re dealing with Sliver. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"717\" height=\"231\" src=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/sliver_implant.png\" alt=\"\" class=\"wp-image-880\" srcset=\"https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/sliver_implant.png 717w, https:\/\/malwrforensics.com\/en\/wp-content\/uploads\/2025\/04\/sliver_implant-300x97.png 300w\" sizes=\"auto, (max-width: 717px) 100vw, 717px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post we&#8217;ll look into how we can do a quick analysis of a golang binary. You can download the sample from here (thanks to Any.Run). I&#8217;ll only use two tools today (Far Manager and Hiew), but you can use any file viewer\/editor you want (Notepad works too). First, let&#8217;s have a look [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[144,18,38,143],"class_list":["post-874","post","type-post","status-publish","format-standard","hentry","category-security","tag-any-run","tag-malware","tag-reverse-engineering","tag-sliver"],"blocksy_meta":[],"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>In this blog post we&#8217;ll look into how we can do a quick analysis of a golang binary. You can download the sample from here (thanks to Any.Run). I&#8217;ll only use two tools today (Far Manager and Hiew), but you can use any file viewer\/editor you want (Notepad works too). First, let&#8217;s have a look at the PE header of a golang windows executable. From the start we can tell it&#8217;s a golang binary. The &#8220;Go build ID&#8221; (embedded into the compiled binary by the go build tool) is pretty obvious. Let&#8217;s look now at the PE sections. An interesting&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/malwrforensics.com\/en\/category\/security\/\" rel=\"category tag\">Security<\/a>","author_info_v2":{"name":"malwrforensics","url":"https:\/\/malwrforensics.com\/en\/author\/u_malwrforensics\/"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/comments?post=874"}],"version-history":[{"count":1,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/874\/revisions"}],"predecessor-version":[{"id":881,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/posts\/874\/revisions\/881"}],"wp:attachment":[{"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/media?parent=874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/categories?post=874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/malwrforensics.com\/en\/wp-json\/wp\/v2\/tags?post=874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}