{"id":85748,"date":"2018-02-08T12:23:36","date_gmt":"2018-02-08T06:53:36","guid":{"rendered":"https:\/\/blogs_admin.quickheal.com\/?p=85748"},"modified":"2018-02-08T17:32:36","modified_gmt":"2018-02-08T12:02:36","slug":"runner-key-component-samsam-ransomware-campaign","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/runner-key-component-samsam-ransomware-campaign\/","title":{"rendered":"The Runner: a key component of the SamSam ransomware campaign &#8211; An analysis by Quick Heal Security Labs"},"content":{"rendered":"<p>In Jan 2018, Greenfield, Indiana-based Hancock Health (healthcare network) was attacked by SamSam ransomware. It encrypted the files containing patients\u2019 data which disrupted their critical services. Even though SamSam is not a new ransomware, it has evolved over a period of time. We had observed its first variant in Feb 2016 that used the RSA algorithm to encrypt targeted users\u2019 files. However, this time, we have observed a significant change in the way this ransomware was launched. The major difference between the old and new variants is the use of the executable &#8216;runner.exe&#8217; \u2013 it decrypts the &#8216;.stubbin&#8217; extension file and executes the decrypted content. The result of the decryption is a SamSam ransomware file.<\/p>\n<p>Fig 1 below depicts the attack chain of the current SamSam ransomware campaign.<\/p>\n<figure id=\"attachment_85754\" aria-describedby=\"caption-attachment-85754\" style=\"width: 367px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85754\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-1.-SamSam-Ransomware-attack-chain-1.jpg\" alt=\"\" width=\"367\" height=\"416\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-1.-SamSam-Ransomware-attack-chain-1.jpg 367w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-1.-SamSam-Ransomware-attack-chain-1-265x300.jpg 265w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-1.-SamSam-Ransomware-attack-chain-1-344x390.jpg 344w\" sizes=\"(max-width: 367px) 100vw, 367px\" \/><figcaption id=\"caption-attachment-85754\" class=\"wp-caption-text\">Fig 1. SamSam Ransomware attack chain<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>The technique of deployment makes the \u2018Runner\u2019 a key component in the SamSam ransomware campaign. However, we are not aware of the source of infection for &#8216;runner.exe&#8217;. In this post, we will be taking a deeper look into &#8216;runner.exe&#8217; \u2013 a key component of this campaign.<\/p>\n<p><strong>The Runner<\/strong><\/p>\n<p>We have seen different variants of \u2018runner.exe\u2019 in the last few months. With every variant, we noticed a change in the number of arguments passed to &#8216;runner.exe&#8217;. The first argument is used as a password to decrypt the &#8216;.stubbin&#8217; file and the remaining arguments are passed to decrypt the payload which is the SamSam ransomware.<\/p>\n<figure id=\"attachment_85750\" aria-describedby=\"caption-attachment-85750\" style=\"width: 690px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85750\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-2.-Execution-sequence-of-the-Runner.jpg\" alt=\"\" width=\"690\" height=\"413\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-2.-Execution-sequence-of-the-Runner.jpg 690w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-2.-Execution-sequence-of-the-Runner-300x180.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-2.-Execution-sequence-of-the-Runner-650x390.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-2.-Execution-sequence-of-the-Runner-250x150.jpg 250w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><figcaption id=\"caption-attachment-85750\" class=\"wp-caption-text\">Fig 2. Execution sequence of the Runner<\/figcaption><\/figure>\n<p>Let\u2019s look at the details of the .NET compiled executable (runner.exe) of the variant with three command line arguments.<\/p>\n<figure id=\"attachment_85755\" aria-describedby=\"caption-attachment-85755\" style=\"width: 988px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85755\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code-.jpg\" alt=\"\" width=\"988\" height=\"340\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code-.jpg 988w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code--300x103.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code--768x264.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code--650x224.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-3.-Execution-sequence-code--789x272.jpg 789w\" sizes=\"(max-width: 988px) 100vw, 988px\" \/><figcaption id=\"caption-attachment-85755\" class=\"wp-caption-text\">Fig 3. Execution sequence code<\/figcaption><\/figure>\n<p>\u2018Runner.exe\u2019 searches for files with the \u2018.stubbin\u2019 extension in its current working directory. The first file found is the desired encrypted file. It then copies the content of the file into an array (arg_4E_0) and deletes the original \u2018.stubbin\u2019 file. The array of encrypted bytes and the first argument from the command line (password) is passed to the &#8216;Decrypt&#8217; function. The Runner then loads the decrypted bytes into the memory and executes it by passing its remaining command-line arguments as the input.<\/p>\n<p><strong>Decryption of &#8216;.stubbin&#8217; file<\/strong><\/p>\n<p>\u2018Runner.exe\u2019 uses the Rijndael algorithm to decrypt the bytes passed as Cipher data. This is a symmetric key cryptographic algorithm. Here, it uses a 32 bytes key and 16 bytes of Initialization Vector (IV) to decrypt the \u2018.stubbin\u2019 file.<\/p>\n<p>Figure 4 below shows the generation of key and IV using password.<\/p>\n<figure id=\"attachment_85756\" aria-describedby=\"caption-attachment-85756\" style=\"width: 662px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85756\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-4-.IV-and-Key-generation-.jpg\" alt=\"\" width=\"662\" height=\"214\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-4-.IV-and-Key-generation-.jpg 662w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-4-.IV-and-Key-generation--300x97.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-4-.IV-and-Key-generation--650x210.jpg 650w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><figcaption id=\"caption-attachment-85756\" class=\"wp-caption-text\">Fig 4 .IV and Key generation<\/figcaption><\/figure>\n<p>&#8216;PasswordDeriveBytes&#8217; class is used to generate a key and IV. It is a pre-defined .NET constructor which takes a password and salt as an input to generate a key. Salt is a random data used as an additional input to a function that \u201chashes\u201d the password and used to make a common password uncommon.<\/p>\n<p>Fig 5 below shows the decryption routine which decrypts the SamSam ransomware file.<\/p>\n<figure id=\"attachment_85757\" aria-describedby=\"caption-attachment-85757\" style=\"width: 756px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85757\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-5-.Decryption-routine-of-core-.stubbin-file-.jpg\" alt=\"\" width=\"756\" height=\"138\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-5-.Decryption-routine-of-core-.stubbin-file-.jpg 756w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-5-.Decryption-routine-of-core-.stubbin-file--300x55.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-5-.Decryption-routine-of-core-.stubbin-file--650x119.jpg 650w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><figcaption id=\"caption-attachment-85757\" class=\"wp-caption-text\">Fig 5 .Decryption routine of core .stubbin file<\/figcaption><\/figure>\n<p>&#8216;CryptoStream&#8217; constructor and Rijndael decryptor are used for cryptographic operations which are performed on CipherData. Using IV, the key to Rijndael algorithm on Cipher data will result in the ransomware payload.<\/p>\n<p><strong>The runner variants<\/strong><\/p>\n<p>In the oldest version of SamSam ransomware, no &#8216;runner.exe&#8217; was observed. Only the payload got executed with an RSA symmetric key as a command-line argument. But, the latest variant uses &#8216;runner.exe&#8217; with 4 arguments.<\/p>\n<p>Fig 6 below shows the difference between the arguments passed in different variants of &#8216;runner.exe&#8217;.<\/p>\n<figure id=\"attachment_85758\" aria-describedby=\"caption-attachment-85758\" style=\"width: 557px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85758\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-6-.Variants-of-runner.exe_.jpg\" alt=\"\" width=\"557\" height=\"171\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-6-.Variants-of-runner.exe_.jpg 557w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-6-.Variants-of-runner.exe_-300x92.jpg 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><figcaption id=\"caption-attachment-85758\" class=\"wp-caption-text\">Fig 6 .Variants of &#8216;runner.exe&#8217;<\/figcaption><\/figure>\n<p>We are also observing a few variants using obfuscation in their code and function names.<\/p>\n<figure id=\"attachment_85759\" aria-describedby=\"caption-attachment-85759\" style=\"width: 815px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-85759\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_.jpg\" alt=\"\" width=\"815\" height=\"241\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_.jpg 815w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_-300x89.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_-768x227.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_-650x192.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/02\/Fig-7-.Obfuscation-in-runner.exe_-789x233.jpg 789w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><figcaption id=\"caption-attachment-85759\" class=\"wp-caption-text\">Fig 7 .Obfuscation in &#8216;runner.exe&#8217;<\/figcaption><\/figure>\n<p>The deployment techniques used in the SamSam ransomware campaign makes the retrieval of the core ransomware difficult. It thus hinders the process of providing static detections on the SamSam ransomware file. A timedatestamp trait in the variants depicts the arrival of fresh variants of &#8216;runner.exe&#8217; every month. So, in the coming days, we may see new variants with more obfuscation and with some advanced functionalities.<\/p>\n<p><strong>Indicator of compromise<\/strong><\/p>\n<p>D8469E625AE90AB64D4AEF0B63F42150<\/p>\n<p>7A25B0D43047552CBDAD17CFB488317D<\/p>\n<p>038FB413F51B0AB7EB088E0F3EA7BE90<\/p>\n<p>A82DB52BC6F1E5477EB1809CD5F23489<\/p>\n<p>Subject Matter Experts<\/p>\n<p>Dhwanit Shrivastava, Yogesh Bane | Quick Heal Security Labs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Jan 2018, Greenfield, Indiana-based Hancock Health (healthcare network) was attacked by SamSam ransomware. It encrypted the files containing patients\u2019 data which disrupted their critical services. Even though SamSam is not a new ransomware, it has evolved over a period of time. We had observed its first variant in Feb 2016 that used the RSA [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":85763,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,910,5],"tags":[49,50,1581],"class_list":["post-85748","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-malware","category-ransomware","category-security","tag-malware","tag-ransomware","tag-samsam"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/85748"}],"collection":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=85748"}],"version-history":[{"count":5,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/85748\/revisions"}],"predecessor-version":[{"id":85766,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/85748\/revisions\/85766"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/85763"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=85748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=85748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=85748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}