{"id":87189,"date":"2018-12-18T18:14:21","date_gmt":"2018-12-18T12:44:21","guid":{"rendered":"https:\/\/blogs_admin.quickheal.com\/?p=87189"},"modified":"2023-09-25T18:38:45","modified_gmt":"2023-09-25T13:08:45","slug":"gandcrab-says-will-become-back-soon","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/gandcrab-says-will-become-back-soon\/","title":{"rendered":"GandCrab says, \u201cWe will become back very soon! ;)\u201d"},"content":{"rendered":"<p>GandCrab has been in the wild since the last week of January 2018. Over the period it kept learning from its mistakes and GandCrab&#8217;s agile development grabbed the attention of many security researchers. From moving its servers to Namecoin-powered Top Level Domain (.BIT TLD) servers after the first breach, then learning from silly mistakes of encryption and communication process sequence, it kept moving forward. As observed recently, after version 4.0, newer version 5.0 also has infected a large number of machines and has seen a number of variants till now.<\/p>\n<p>The version 5.0.9 was initially reported in the first week of December 2018, which has shown behavior similar to other GandCrab 5.0 versions. Although, to make sure that GandCrab does not become a memory before the new year starts, this version is showing message box \u2018We will become back very soon! ;)\u2019. From various indicators, we may say that the authors are Russian and are non-native English speakers resulting in this poor sentence formation. We may predict the correct message as \u2018We will come back very soon! ;)\u2019.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87190 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/1_GandCrab_PopUp.jpg\" alt=\"\" width=\"255\" height=\"109\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 1. Message Box<\/p>\n<p><strong><b>Infection Vector<\/b><\/strong><\/p>\n<p>GandCrab spreads through malicious mail campaigns containing malicious attachments or even through sextortion campaigns. Doc files are attached in mails with some genuine-looking file names and the user is forced to enable macros\/download plugin updates. This action results in the infection of GandCrab.<\/p>\n<p>Initially, it collects all data related to the user like username, computer name, workgroup, IP address, etc. This information is stored as \u2018PCData\u2019 in encrypted form and further used for identification of the machine.<\/p>\n<p>Before moving to the main execution part it checks for popular anti-virus services with all running processes.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87191 size-large\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services-650x176.jpg\" alt=\"\" width=\"650\" height=\"176\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services-650x176.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services-300x81.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services-768x207.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services-789x213.jpg 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/2_GandCrab_AV_Services.jpg 800w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 2. AV Processes List<\/p>\n<p>To know drives present on the machine, it checks every alphabet with the letter of the drive for drive enumeration. After collecting all the needed information related to the machine in PCData, it encrypts this information with the RC4 algorithm having IV string \u2018jopochlen\u2019. Further, this data is again converted to the base64 format and is attached in the <a href=\"https:\/\/blogs.quickheal.com\/activists-turn-hacktivists-new-ransomware-that-does-not-demand-money\/\">ransom<\/a> note under the PCData section.<\/p>\n<p>For extension, GandCrab has followed fixed-length random strings from the last two variants. This format is also continued for this version with up to 13 characters random length string.<\/p>\n<p><strong><b>Key Encryption<\/b><\/strong><\/p>\n<p>The main payload contains an RSA public key which is encrypted using salsa20 algorithm and this encrypted key is again XORed with byte key 5. After decrypting this key, it is then exported using the CryptExportKey function. The Salsa20 algorithm was originally developed by Daniel Bernstein (twitter handle:@hashbreaker). In this sample customized version of salsa20 is used. We can see the casual comment \u2018@hashbreaker Daniel J. Bernstein let\u2019s dance salsa &lt;3\u2019 in the file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87192 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/3_GandCrab_SALSA.png\" alt=\"\" width=\"459\" height=\"44\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/3_GandCrab_SALSA.png 459w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/3_GandCrab_SALSA-300x29.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 3. Salsa identifier.<\/p>\n<p>Two registry keys are created.<\/p>\n<p><em><i>SOFTWARE\/key__dats\/dats<\/i><\/em>\u00a0\u00a0\u00a0\u00a0(in previous version it was <em><i>SOFTWARE\/key__data\/data<\/i><\/em>) <em><i>SOFTWARE\/ext_data\/data<\/i><\/em><\/p>\n<p>The randomly generated extension which is appended to the encrypted file is stored in \u2018ext\u2019 value of the registry key:<\/p>\n<p><em><i>SOFTWARE\/ext_data\/data<\/i><\/em><\/p>\n<p>A new key pair of RSA-2048 is generated using Microsoft Enhanced Cryptographic Provider CryptoAPI CryptGenKey.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87193 size-large\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/5_GandCrab_RSA_Gen_Key-650x218.jpg\" alt=\"\" width=\"650\" height=\"218\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/5_GandCrab_RSA_Gen_Key-650x218.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/5_GandCrab_RSA_Gen_Key-300x100.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/5_GandCrab_RSA_Gen_Key.jpg 756w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 4. CryptGenKey RSA-2048<\/p>\n<p>RSA private key from this key pair is encrypted with SALSA20 algorithm. This public key and encrypted private key pair is stored in \u2018<em><i>SOFTWARE\/key__dats\/dats\u2019<\/i><\/em>\u00a0registry with values public and private. The Salsa20 key used for this is again encrypted with RSA public key which was restored from the file itself.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/4_GandCrab_Key_Encryption_Flow.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87204 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/4_GandCrab_Key_Encryption_Flow.gif\" alt=\"\" width=\"800\" height=\"450\" \/><\/a>Fig. 5. Key Encryption And Storage<\/p>\n<p>An encrypted ransom note is stored in the .data section of payload. This note is then decrypted by XORing bytes with 0x10. This ransom note is dropped with a name format: \u2018extension_name-DECRYPT.txt\u2019.<\/p>\n<p><strong><b>File Encryption<\/b><\/strong><\/p>\n<p>Before starting file encryption it terminates a few important processes which might be using files like documents, excel sheets or databases. This is done to confirm that no file in use is left without encryption.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87194 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/6_GandCrab_Process_List.png\" alt=\"\" width=\"283\" height=\"535\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/6_GandCrab_Process_List.png 283w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/6_GandCrab_Process_List-159x300.png 159w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/6_GandCrab_Process_List-206x390.png 206w\" sizes=\"(max-width: 283px) 100vw, 283px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 6. List of Processes to Terminate<\/p>\n<p>Also, list of all extensions which will be encrypted is present in the file. While carrying out encryption, GandCrab avoids a few important directories like Program Files, Windows, TOR(required to contact malware authors),etc. Also few files like boot.in, ntuser.dat are excluded from encryption.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87195 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1.jpg\" alt=\"\" width=\"1276\" height=\"413\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1.jpg 1276w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1-300x97.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1-768x249.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1-650x210.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/7_GandCrab_Encrypted_Hex_1-789x255.jpg 789w\" sizes=\"(max-width: 1276px) 100vw, 1276px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 7. Encrypt File Structure<\/p>\n<p>While encrypting, the entire file is encrypted with Salsa20. The Salsa20 key is generated with CryptGenRandom and it is different for each file. The Salsa20 key used for encryption is again encrypted with locally generated RSA public key.<\/p>\n<p>After all files are encrypted, it tries to connect over 100 domains. Looking at the hostnames, it is clear that these are genuine websites and are compromised somehow. For formation of compromised URLs, it retrieves domain name from the list, then appends it with one of the 7 predefined strings. Again this is appended with second string chosen from other 8 predefined strings\u00a0(images, image, pictures, graphic, assets, pics, imgs, tmp). Finally, the string is concatenated with randomly generated image name and one extension chosen from the list of 4(jpg, gif, png, bmp).<\/p>\n<p>For example: <u>https:\/\/[Genuine<\/u>\u00a0domain name]\/content\/graphic\/dekakadake.jpg<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87196 size-large\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/8_GandCrab_UrlFormation-650x316.jpg\" alt=\"\" width=\"650\" height=\"316\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/8_GandCrab_UrlFormation-650x316.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/8_GandCrab_UrlFormation-300x146.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/8_GandCrab_UrlFormation.jpg 719w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 8. URL Formation<\/p>\n<p>After retrieving the whole URL, it sends encrypted user information stored in PCData to host.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87197 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest.jpg\" alt=\"\" width=\"868\" height=\"252\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest.jpg 868w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest-300x87.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest-768x223.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest-650x189.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/9_GandCrab_HttpSendRequest-789x229.jpg 789w\" sizes=\"(max-width: 868px) 100vw, 868px\" \/><\/p>\n<p style=\"text-align: center;\">Fig. 9. HttpSendRequest<\/p>\n<p><strong><b>Ransom Note<\/b><\/strong><\/p>\n<p><strong><b>\u00a0<\/b><\/strong>Ransom note for GandCrab v5.0.9 looks like<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-87198 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote.jpg\" alt=\"\" width=\"1040\" height=\"585\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote.jpg 1040w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote-300x169.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote-768x432.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote-650x366.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2018\/12\/10_GandCrab_RansomNote-789x444.jpg 789w\" sizes=\"(max-width: 1040px) 100vw, 1040px\" \/><\/p>\n<p><strong><b>Conclusion<\/b><\/strong><\/p>\n<p>GandCrab has shown modular approach from start and has evolved over time.<\/p>\n<p>Few key features can be:<\/p>\n<ul>\n<li>Checking for running popular AV services<\/li>\n<li>Termination of Applications to encrypt all files<\/li>\n<li>Using salsa for better performance still using RSA 2048<\/li>\n<li>Using Compromised sites for communication<\/li>\n<\/ul>\n<p>It\u2019s messagebox shown at the start indicates\u00a0its next bigger release of a new variant. So we have to be on our toes to combat against it.<\/p>\n<p><strong><b>IOC<\/b><\/strong><\/p>\n<p>44C289E415E4C12B883003082194D76C<\/p>\n<p><strong>Subject Matter Expert:<\/strong><\/p>\n<p>Jayesh B. Kulkarni\u00a0| Quick Heal Security Labs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GandCrab has been in the wild since the last week of January 2018. Over the period it kept learning from its mistakes and GandCrab&#8217;s agile development grabbed the attention of many security researchers. From moving its servers to Namecoin-powered Top Level Domain (.BIT TLD) servers after the first breach, then learning from silly mistakes of [&hellip;]<\/p>\n","protected":false},"author":47,"featured_media":87207,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[133,24,910,5,293],"tags":[1646,1647,1642,1645,1644],"class_list":["post-87189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hacker","category-malware","category-ransomware","category-security","category-spam","tag-gandcrab","tag-jopochlen","tag-lets-dance-salsa","tag-rsa-2048","tag-salsa20"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/87189"}],"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\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=87189"}],"version-history":[{"count":15,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/87189\/revisions"}],"predecessor-version":[{"id":92102,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/87189\/revisions\/92102"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/87207"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=87189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=87189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=87189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}