{"id":76504,"date":"2013-08-05T18:14:18","date_gmt":"2013-08-05T12:44:18","guid":{"rendered":"https:\/\/blogs.quickheal.com\/?p=76504"},"modified":"2013-08-05T18:14:18","modified_gmt":"2013-08-05T12:44:18","slug":"worm-gamarue-what-it-is-and-how-does-it-evolve","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/worm-gamarue-what-it-is-and-how-does-it-evolve\/","title":{"rendered":"Worm.Gamarue \u2013 What it is and How does it Evolve?"},"content":{"rendered":"<p>Another popular malware whose mode of transport is removable drives, is known as worm.gamarue. This malware is also designed to communicate with a remote server to report its infection and download arbitrary files. These downloaded files are detected as <b>Worm.Gamarue.B<\/b> by Quick Heal.<\/p>\n<p><b><span style=\"text-decoration: underline\">Primary Analysis:<\/span><\/b><\/p>\n<p>When USB drive shortcut is opened, .dll file which is present in the same directory (root directory), is executed. It is also used to update <b>Thumbs.db<\/b> present in the same directory, if internet connection is available. <b>Thumbs.db,<\/b> in turn, is used to create <b>TrustedInstaller.exe<\/b>.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Snapshot_of_infected_removal_drive.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76520 aligncenter\" alt=\"Snapshot_of_infected_removal_drive\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Snapshot_of_infected_removal_drive-300x120.png\" width=\"300\" height=\"120\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.1: Snapshot of infected removable drive<\/b><\/p>\n<p>This <b>TrustedInstaller.exe<\/b> is dropped in a new directory in the root drive. Newly created directory would be named as either C:temp or C:MSI .<\/p>\n<p><b><span style=\"text-decoration: underline\">Components Used for Malware Execution:<\/span><\/b><\/p>\n<p><b>\u00a0Clean File Scenario:<\/b><\/p>\n<p><b>1. USB Drive (.lnk)<\/b>: Removable drive shortcut icon to open respective drive.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Clean_drive_shortcut_icon.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-76545 aligncenter\" alt=\"Clean_drive_shortcut_icon\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Clean_drive_shortcut_icon.png\" width=\"113\" height=\"112\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.2: Clean drive shortcut icon<\/b><\/p>\n<p><b>2<\/b>. <b>desktop.ini<\/b>: This is a hidden file used to customize and adjust settings for the Windows folders in which it is present.<\/p>\n<p><b>3<\/b>. <b>Thumbs.db<\/b>: Thumbs.db files are stored in each directory that contains thumbnails on Windows systems. These files are created locally among the images, preventing system wide use of the data.<\/p>\n<p><b>Our Case:<\/b><\/p>\n<p><strong>1<\/strong>. <strong>USB Drive (.lnk):<\/strong> This is a removable drive shortcut. If you notice, the \u201cinfected drive shortcut icon\u201d displays a specific size (to misguide the user), whereas, the \u201cclean drive shortcut icon\u201d does not.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Infected_drive_shortcut_icon.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-76546 aligncenter\" alt=\"Infected_drive_shortcut_icon\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Infected_drive_shortcut_icon.png\" width=\"155\" height=\"52\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.3: Infected drive shortcut icon<\/b><\/p>\n<p>When the user clicks this icon in order to explore its contents, at the back end it executes <b>*.dll<\/b> file present in the root of removable drive, by executing the command which can be as follows:<\/p>\n<p><i>\u201c<b>%homedrive%WINDOWSSystem32rundll32.exe _WHVX.nil, rundll32<\/b>\u201d <\/i><\/p>\n<p>Here,<\/p>\n<p><i>%homedrive%WINDOWSSystem32rundll32.exe &#8211; <\/i>is<i> a<\/i> command used to execute the .dll file.<\/p>\n<p><i>_WHVX.nil &#8211; is <\/i>the name of .dll file which varies.<\/p>\n<p><i>Rundll32 &#8211; <\/i>is the<i> <\/i>name of the export function in above .dll file.<\/p>\n<p><strong>2<\/strong>. <b>*.dll<\/b>: It is used to decrypt code in Destop.ini and execute the decrypted code.<\/p>\n<p><strong> 3<\/strong>. <b>Desktop.ini<\/b>: The code contained in desktop.ini first tries to download an updated copy of Thumbs.db, replacing the existing file in the USB drive if internet connection is available.<\/p>\n<p><strong>4<\/strong>. <b>Thumbs.db<\/b>: This is actually an encrypted PE file, which upon decryption, gets copied into TrustedInstaller.exe.<\/p>\n<p><b><span style=\"text-decoration: underline\">Evolution &amp; Modification:<\/span><\/b><\/p>\n<p>*.dll uses desktop.ini to download TrustedInstaller.exe.<\/p>\n<p><b><i>EVOLUTION STAGE 1<\/i><\/b><\/p>\n<p>Initially *.dll &amp; desktop.ini file used to be readable.<\/p>\n<p>Desktop.ini was present in Unicode form.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_1_desktop_ini_file.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76521 aligncenter\" alt=\"Stage_1_desktop_ini_file\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_1_desktop_ini_file-300x223.png\" width=\"300\" height=\"223\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.4: Stage 1 <i>desktop.ini<\/i> file<\/b><\/p>\n<p><b><i>EVOLUTION STAGE 2<\/i><\/b><\/p>\n<p>Later, Dependency information in *.dll &amp; downloaded information in desktop.ini became encrypted.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_2_dll_file.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76522 aligncenter\" alt=\"Stage_2_dll_file\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_2_dll_file-300x208.png\" width=\"300\" height=\"208\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.5: Stage 2 <i>dll<\/i> file<\/b><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_2_desktop_ini_file.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76523 aligncenter\" alt=\"Stage_2_desktop_ini_file\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_2_desktop_ini_file-300x255.png\" width=\"300\" height=\"255\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.6: Stage 2 <i>desktop.ini<\/i> file<\/b><\/p>\n<p><b><i>EVOLUTION STAGE 3<\/i><\/b><\/p>\n<p><b>\u00a0<\/b>Earlier files (desktop.ini &amp; .dll) were obscured so that decryption could not be easily traced.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_3_dll_file.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76524 aligncenter\" alt=\"Stage_3_dll_file\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_3_dll_file-300x109.png\" width=\"300\" height=\"109\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.7: Stage 3<i> dll <\/i>file<\/b><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_3_desktop_ini_file.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76525 aligncenter\" alt=\"Stage_3_desktop_ini_file\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Stage_3_desktop_ini_file-300x255.png\" width=\"300\" height=\"255\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.8: Stage 3 <i>desktop.ini <\/i>file<\/b><\/p>\n<p><b><span style=\"text-decoration: underline\">Technical Details:<\/span><\/b><\/p>\n<p><b>Dll file<\/b> is executed with the help of <b>rundll32.exe<\/b><\/p>\n<p><strong>1<\/strong><i>. Shellexecute<\/i> is used to open desktop.ini file by passing its handle.<\/p>\n<p><strong>2<\/strong>. This desktop.ini file is read in memory for further process.<\/p>\n<p><strong>3<\/strong>. This desktop.ini is decrypted if it is in encrypted form using decryption loop which is present in .dll file.<\/p>\n<p><strong>4<\/strong>. Desktop.ini contains the code to check internet connection status. Depending on the connection status, it will either download latest thumbs.db or use currently present thumbs.db. This thumbs.db contains TrustedInstaller.exe in encrypted form. Domains from which the file is downloaded may change.<\/p>\n<p>We have gone through various domains from where it is downloaded. Some of the domains are as follows:<\/p>\n<p>hxxp:\/\/sobea.in<br \/>\nhxxp:\/\/m.deltaheavy.ru<br \/>\nhxxp:\/\/suckmycocklameavindustry.in<br \/>\nhxxp:\/\/thesecond.in<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Contents_of_desktop_ini_file_after_decryption.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76528 aligncenter\" alt=\"Contents_of_desktop_ini_file_after_decryption\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Contents_of_desktop_ini_file_after_decryption-300x173.png\" width=\"300\" height=\"173\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.9: Contents of destop.ini After Decryption<\/b><\/p>\n<p><strong>1<\/strong>. This Thumbs.db is in turn decrypted &amp; copied to a newly created folder (C:temp or C:MSI<span style=\"text-decoration: underline\">)<\/span> in the root directory as TrustedInstaller.exe.<\/p>\n<p><strong>2<\/strong>. TrustedInstaller.exe is used to infect removable drive. Removable drive contains shortcut &amp; its (removable drive) contents are put into folder which has hidden property enabled.<\/p>\n<p><strong>3<\/strong>. On opening this shortcut, it runs a .dll file at back end &amp; opens a hidden folder, so that the user finds contents of the drive without knowing that the malicious file has already been executed.<\/p>\n<p><strong>4<\/strong>. This dropped <b>TrustedInstaller.exe,<\/b> when runs, performs the following actions:<\/p>\n<p><strong>a)<\/strong> Drops another component of Worm.Gamarue.<\/p>\n<p><strong>b)<\/strong> Writes encrypted data to the following registry entry:<\/p>\n<p><i>HKCUSOFTWAREe_magic<\/i><\/p>\n<p>[The binary written to HKCUSOFTWAREe_magic is another encrypted version of the <b>TrustedInstaller.exe<\/b> component, which is subsequently used to infect more removable drives.]<\/p>\n<p><strong>c)<\/strong> Writes data into the following registry entry:<\/p>\n<p><i>HKLMSOFTWAREMicrosoft022FF03<\/i><\/p>\n<p>The data written to the registry entry HKLMSOFTWAREMicrosoft022FF03 is interesting, as it contains what looks like a ZIP header at the start, but is not actually a ZIP archive.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Compressed_Header_written_in_registry.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76526 aligncenter\" alt=\"Compressed_Header_written_in_registry\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Compressed_Header_written_in_registry-300x25.png\" width=\"300\" height=\"25\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.10: Compressed <\/b><b>Header written to the registry entry HKLMSOFTWAREMicrosoft022FF03<\/b><\/p>\n<p>The data is encrypted; after decryption it turns out to be a compressed executable code.<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Decompressed_Header_from_registry.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-76527 aligncenter\" alt=\"Decompressed_Header_from_registry\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2013\/08\/Decompressed_Header_from_registry-300x40.png\" width=\"300\" height=\"40\" \/><\/a><\/p>\n<p style=\"text-align: center\"><b>Fig.11: Header Contents after decompression<\/b><\/p>\n<p><strong>1<\/strong>. Dropped file from TrustedInstaller.exe runs the system file <b>%System%wuauclt.exe<\/b> and injects code into that process. This injected code reads the data from the registry entry <b>HKLMSOFTWAREMicrosoft022FF03<\/b>, decrypts it using a 32-byte key stored within the code, and decompresses it using the widely available aPLib compression library.<\/p>\n<p><strong>2<\/strong>. The result is the worm&#8217;s spreading component: A DLL which checks for removable drives and infects them. <b>At<\/b> <b>no point is this component written to disk, <\/b>which makes it difficult to remove the infection.<\/p>\n<p><strong>3<\/strong>. Coming to the end of the cycle, if a removable drive is found, it is infected\/re-infected with the encrypted data read from the registry entry <i>HKCUSOFTWAREe_magic<\/i> and written to the file &#8220;<b>Thumbs.db<\/b>&#8220;, and the flat binary file with 32bit code is written to &#8220;<b>desktop.ini<\/b>&#8220;, together with the loader <b>DLL<\/b> and <b>a shortcut<\/b>.<\/p>\n<p>Every time a malware or its strain gets detected, it evolves and steps up its game. And this process continues. We will keep you posted as we come up with further findings on such malwares and others.<\/p>\n<p><b>Blog post acknowledgment <\/b>&#8211;<b> <\/b>Quick Heal Threat Research and Response Team.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another popular malware whose mode of transport is removable drives, is known as worm.gamarue. This malware is also designed to communicate with a remote server to report its infection and download arbitrary files. These downloaded files are detected as Worm.Gamarue.B by Quick Heal. Primary Analysis: When USB drive shortcut is opened, .dll file which is [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[1312,1313,487],"class_list":["post-76504","post","type-post","status-publish","format-standard","hentry","category-malware","tag-malware-evolution","tag-removable-drives","tag-worm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/76504"}],"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\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=76504"}],"version-history":[{"count":0,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/76504\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=76504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=76504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=76504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}