{"id":84476,"date":"2017-06-30T17:24:55","date_gmt":"2017-06-30T11:54:55","guid":{"rendered":"https:\/\/blogs_admin.quickheal.com\/?p=84476"},"modified":"2017-06-30T17:28:09","modified_gmt":"2017-06-30T11:58:09","slug":"technical-analysis-recent-petya-ransomware-attack","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/technical-analysis-recent-petya-ransomware-attack\/","title":{"rendered":"A technical analysis of the recent Petya ransomware attack"},"content":{"rendered":"<p>Earlier this week, a new variant of Petya Ransomware was spotted which was creating havoc all over Europe as well as major parts of Asia including India. The major target for Petya has been Ukraine as its major banks and also the power services were hit by the attack.<\/p>\n<p>It\u2019s a new version of the old Petya ransomware which was spotted back in 2016. The new variant seems to have hit the world with a bang and is following the Wannacry propagation technique.<\/p>\n<p>This new version of Petya is more dangerous than other ransomware in a way that it doesn&#8217;t just encrypt user\u2019s data, it also encrypts master file table (<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365230(v=vs.85).aspx\">MFT<\/a>) &amp; overwrites the Master boot record (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Master_boot_record\">MBR<\/a>). Let\u2019s take a look at the details of this attack.<\/p>\n<p><strong>Petya Ransomware<\/strong><\/p>\n<p>The ransomware upon execution drops two components. Both the components are present in the resource section of the ransomware binary in a compressed form.<\/p>\n<p><strong>Dropped components<\/strong><\/p>\n<table style=\"height: 188px\" width=\"956\">\n<tbody>\n<tr>\n<td width=\"205\">Component<\/td>\n<td width=\"363\">Description<\/td>\n<\/tr>\n<tr>\n<td width=\"205\">c:\\windows\\dllhost.dat<\/td>\n<td width=\"363\">PSEXEC utility from Sysinternals toolkit<\/td>\n<\/tr>\n<tr>\n<td width=\"205\">%TEMP%\\&lt;random name&gt;.tmp<\/td>\n<td width=\"363\">Custom built password dumper tool similar as Mimikatz<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center\">Fig 1. Dropped components of Petya ransomware<\/p>\n<p>The ransomware acquires required privileges and steals the credentials of active sessions using a custom built password dumper tool similar to Mimikatz.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84477 aligncenter\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-1.jpg\" alt=\"petya-analysis-1\" width=\"453\" height=\"254\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-1.jpg 453w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-1-300x168.jpg 300w\" sizes=\"(max-width: 453px) 100vw, 453px\" \/><\/p>\n<p style=\"text-align: center\">Fig 2. Acquires required privileges<\/p>\n<p>The first method used for spreading is exploiting the vulnerability reported in <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/security\/ms17-010.aspx\">MS17-010<\/a> security bulletin. The exploit \u2019ETERNALBLUE\u2019 is fired on unpatched machines. If SMB vulnerability is patched then it uses PSEXEC and WMIC technique as described below for the propagation on the network. It scans the local network for \u2018admin$\u2019, shares and copies itself across the network. It also executes the newly copied malware binary remotely using PSEXEC as shown below.<\/p>\n<figure id=\"attachment_84478\" aria-describedby=\"caption-attachment-84478\" style=\"width: 667px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-84478 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-2.jpg\" alt=\"Fig 3. Acquires required privileges \" width=\"667\" height=\"608\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-2.jpg 667w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-2-300x273.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-2-428x390.jpg 428w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><figcaption id=\"caption-attachment-84478\" class=\"wp-caption-text\">Fig 3. Ransomware propagation using PSEXEC<\/figcaption><\/figure>\n<p>One more method for remote process execution used by the ransomware is using Windows Management Instrumentation Command-line (WMIC) for executing the ransomware remotely with stolen credentials. The command used for WMIC is shown in the below code snippet.<\/p>\n<figure id=\"attachment_84479\" aria-describedby=\"caption-attachment-84479\" style=\"width: 842px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84479\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3.jpg\" alt=\"Fig 4. Ransomware propagation using WMIC\" width=\"842\" height=\"276\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3.jpg 842w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3-300x98.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3-768x252.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3-650x213.jpg 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-3-789x259.jpg 789w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><figcaption id=\"caption-attachment-84479\" class=\"wp-caption-text\">Fig 4. Ransomware propagation using WMIC<\/figcaption><\/figure>\n<p>Where \u201c%ws\u201d is wide string for the current machine name and the user credentials.<\/p>\n<p><strong>Encryption<\/strong><\/p>\n<p>The ransomware writes its own malicious code to the master boot record (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Master_boot_record\">MBR<\/a>) and encrypts <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365230(v=vs.85).aspx\">MFT<\/a>. Below code snippet shows how it writes to MBR.<\/p>\n<figure id=\"attachment_84480\" aria-describedby=\"caption-attachment-84480\" style=\"width: 674px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84480\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-4.jpg\" alt=\"Fig 5. Ransomware writes to MBR and encrypts MFT\" width=\"674\" height=\"350\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-4.jpg 674w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-4-300x156.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-4-650x338.jpg 650w\" sizes=\"(max-width: 674px) 100vw, 674px\" \/><figcaption id=\"caption-attachment-84480\" class=\"wp-caption-text\">Fig 5. Ransomware writes to MBR and encrypts MFT<\/figcaption><\/figure>\n<p>Once MBR is infected, it schedules a restart of the computer after 10 to 60 minutes from current time. For restarting, it uses \u2018shutdown.exe\u2019 in combination with service creation or \u2018at\u2019 command.<\/p>\n<figure id=\"attachment_84481\" aria-describedby=\"caption-attachment-84481\" style=\"width: 758px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84481\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-5.jpg\" alt=\"Fig 5. The ransomware schedules a restart of affected system\" width=\"758\" height=\"519\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-5.jpg 758w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-5-300x205.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-5-570x390.jpg 570w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-5-229x158.jpg 229w\" sizes=\"(max-width: 758px) 100vw, 758px\" \/><figcaption id=\"caption-attachment-84481\" class=\"wp-caption-text\">Fig 6. The ransomware schedules a restart of affected system<\/figcaption><\/figure>\n<p>Once the affected system restarts, the ransomware displays a CHKDSK message and continues encryption in the background as shown below.<\/p>\n<figure id=\"attachment_84482\" aria-describedby=\"caption-attachment-84482\" style=\"width: 709px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84482\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-6.jpg\" alt=\"Fig 6. CHKDSK message after restart\" width=\"709\" height=\"252\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-6.jpg 709w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-6-300x107.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-6-650x231.jpg 650w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><figcaption id=\"caption-attachment-84482\" class=\"wp-caption-text\">Fig 7. CHKDSK message after restart<\/figcaption><\/figure>\n<p>The ransomware encrypts following types of files present on the system<\/p>\n<table style=\"height: 422px\" width=\"1027\">\n<tbody>\n<tr>\n<td width=\"64\">.3ds<\/td>\n<td width=\"64\">.7z<\/td>\n<td width=\"64\">.accdb<\/td>\n<td width=\"64\">.ai<\/td>\n<td width=\"64\">.asp<\/td>\n<td width=\"64\">.a<\/td>\n<td width=\"64\">spx<\/td>\n<td width=\"64\">.avhd<\/td>\n<td width=\"64\">.back<\/td>\n<td width=\"64\">.bak<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.c<\/td>\n<td width=\"64\">.cfg<\/td>\n<td width=\"64\">.conf<\/td>\n<td width=\"64\">.cpp<\/td>\n<td width=\"64\">.cs<\/td>\n<td width=\"64\">.ctl<\/td>\n<td width=\"64\">.dbf<\/td>\n<td width=\"64\">.disk<\/td>\n<td width=\"64\">.djvu<\/td>\n<td width=\"64\">.doc<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.docx<\/td>\n<td width=\"64\">.dwg<\/td>\n<td width=\"64\">.eml<\/td>\n<td width=\"64\">.fdb<\/td>\n<td width=\"64\">.gz<\/td>\n<td width=\"64\">.h<\/td>\n<td width=\"64\">.hdd.<\/td>\n<td width=\"64\">dbx<\/td>\n<td width=\"64\">.mail<\/td>\n<td width=\"64\">.mdb<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.msg<\/td>\n<td width=\"64\">.nrg<\/td>\n<td width=\"64\">.ora<\/td>\n<td width=\"64\">.ost<\/td>\n<td width=\"64\">.ova<\/td>\n<td width=\"64\">.ovf<\/td>\n<td width=\"64\">.pdf<\/td>\n<td width=\"64\">.php<\/td>\n<td width=\"64\">.pmf<\/td>\n<td width=\"64\">.ppt<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.pptx<\/td>\n<td width=\"64\">.pst<\/td>\n<td width=\"64\">.pvi<\/td>\n<td width=\"64\">.py<\/td>\n<td width=\"64\">.pyc<\/td>\n<td width=\"64\">.rar<\/td>\n<td width=\"64\">.rtf<\/td>\n<td width=\"64\">.sln<\/td>\n<td width=\"64\">.sql<\/td>\n<td width=\"64\">.tar<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.vbox<\/td>\n<td width=\"64\">.vbs<\/td>\n<td width=\"64\">.vcb<\/td>\n<td width=\"64\">.vdi<\/td>\n<td width=\"64\">.vfd<\/td>\n<td width=\"64\">.vmc<\/td>\n<td width=\"64\">.vmdk<\/td>\n<td width=\"64\">.vmsd<\/td>\n<td width=\"64\">.vmx<\/td>\n<td width=\"64\">.vsdx<\/td>\n<\/tr>\n<tr>\n<td width=\"64\">.vsv<\/td>\n<td width=\"64\">.work<\/td>\n<td width=\"64\">.xls<\/td>\n<td width=\"64\">.xlsx<\/td>\n<td width=\"64\">.xvd<\/td>\n<td width=\"64\">.zip<\/td>\n<td width=\"64\"><\/td>\n<td width=\"64\"><\/td>\n<td width=\"64\"><\/td>\n<td width=\"64\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: center\">Fig 8. File extension list<\/p>\n<p>The files are encrypted with AES-128 algorithm. One AES key is used to encrypt files of one drive only. The AES-128 key used for file encryption is further encrypted with RSA-2048 encryption algorithm. The public key used for RSA is present in binary itself in base64 encoded form.<\/p>\n<p>Upon the complete execution, the below ransom screen is displayed.<\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_84483\" aria-describedby=\"caption-attachment-84483\" style=\"width: 780px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84483\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-7.jpg\" alt=\"Fig 8. Petya ransom screen\" width=\"780\" height=\"462\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-7.jpg 780w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-7-300x178.jpg 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-7-768x455.jpg 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-7-650x385.jpg 650w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><figcaption id=\"caption-attachment-84483\" class=\"wp-caption-text\">Fig 9. Petya ransom screen<\/figcaption><\/figure>\n<p><strong>Quick Heal Detection<\/strong><\/p>\n<figure id=\"attachment_84484\" aria-describedby=\"caption-attachment-84484\" style=\"width: 294px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-84484 size-full\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-QH1.jpg\" alt=\"Fig 8. Prompt by Quick Heal Virus Protection\" width=\"294\" height=\"155\" \/><figcaption id=\"caption-attachment-84484\" class=\"wp-caption-text\">Fig 10. Prompt by Quick Heal Virus Protection<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_84485\" aria-describedby=\"caption-attachment-84485\" style=\"width: 467px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-84485\" src=\"https:\/\/blogs_admin.quickheal.com\/wp-content\/uploads\/2017\/06\/Petya-Analysis-QH2.jpg.png\" alt=\"Fig 9. Prompt by Quick Heal Behavior Detection System\" width=\"467\" height=\"273\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-QH2.jpg.png 467w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2017\/06\/Petya-Analysis-QH2.jpg-300x175.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><figcaption id=\"caption-attachment-84485\" class=\"wp-caption-text\">Fig 11. Prompt by Quick Heal Behavior Detection System<\/figcaption><\/figure>\n<p><strong>Quick Heal users are protected from the Petya ransomware attack.<\/strong><\/p>\n<p><strong>Indicators of compromise:<\/strong><\/p>\n<p>71B6A493388E7D0B40C83CE903BC6B04<br \/>\nE285B6CE047015943E685E6638BD837E<br \/>\nc:\\windows\\dllhost.dat<br \/>\nc:\\windows\\perfc.dat<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>Also Read<\/strong><\/p>\n<p><a href=\"https:\/\/blogs.quickheal.com\/petya-ransomware-affecting-users-globally-things-can\/\">https:\/\/blogs.quickheal.com\/petya-ransomware-affecting-users-globally-things-can\/<\/a><br \/>\n<a href=\"https:\/\/blogs.quickheal.com\/wannacrys-never-say-die-attitude-keeps-going\/\">https:\/\/blogs.quickheal.com\/wannacrys-never-say-die-attitude-keeps-going\/<\/a><br \/>\n<a href=\"https:\/\/blogs.quickheal.com\/ms17-010-windows-smb-server-exploitation-leads-ransomware-outbreak\/\">https:\/\/blogs.quickheal.com\/ms17-010-windows-smb-server-exploitation-leads-ransomware-outbreak\/<\/a><br \/>\n<a href=\"https:\/\/blogs.quickheal.com\/wannacry-ransomware-creating-havoc-worldwide-exploiting-patched-windows-exploit\/\">https:\/\/blogs.quickheal.com\/wannacry-ransomware-creating-havoc-worldwide-exploiting-patched-windows-exploit\/<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Acknowledgment<\/strong><\/p>\n<p>Subject Matter Expert:<\/p>\n<ul>\n<li>Prakash Galande<\/li>\n<li>Tejas Girme<\/li>\n<li>Shriram G. Munde<\/li>\n<li>Shantanu A. Vichare.<\/li>\n<\/ul>\n<p>&#8211; Quick Heal Security Labs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier this week, a new variant of Petya Ransomware was spotted which was creating havoc all over Europe as well as major parts of Asia including India. The major target for Petya has been Ukraine as its major banks and also the power services were hit by the attack. It\u2019s a new version of the [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":84464,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[910,5],"tags":[1471,1448],"class_list":["post-84476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ransomware","category-security","tag-petya-ransomware","tag-wannacry-ransomware"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/84476"}],"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\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=84476"}],"version-history":[{"count":3,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/84476\/revisions"}],"predecessor-version":[{"id":84488,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/84476\/revisions\/84488"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/84464"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=84476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=84476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=84476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}