{"id":49783,"date":"2017-07-03T11:49:32","date_gmt":"2017-07-03T06:19:32","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/blog\/?p=49783"},"modified":"2024-04-03T13:22:11","modified_gmt":"2024-04-03T07:52:11","slug":"notpetya-technical-analysis","status":"publish","type":"post","link":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/","title":{"rendered":"NotPetya Technical Analysis"},"content":{"rendered":"<p style=\"text-align: center\"><a ref=\"magnificPopup\" href=\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/notpetya-technical-analysis.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-49785\" src=\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/notpetya-technical-analysis.jpg\" alt=\"\" width=\"370\" height=\"208\" srcset=\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/notpetya-technical-analysis.jpg 370w, https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/notpetya-technical-analysis-300x169.jpg 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/a><\/p>\n<h1>NotPetya Technical Analysis<\/h1>\n<p>NotPetya (or \u201cNyetna\u201d as it has also been named) spreads to other systems on the network without use of the ETERNALBLUE\/ETERNALROMANCE SMBv1 exploits. (Although the code contains the ability to spread by this exploit as well, so patching is still imperative).<\/p>\n<p>The malware harvests SMB and user credentials from the infected host and uses those credentials to connect to other systems on the network, propagating the malware. Therefore, it potentially only takes one infected machine in an organization to take down all systems in the network. In this post, we will go more into depth on the functionality and destructive capabilities of NotPetya.<\/p>\n<h3>Disk Destruction &#8211; NotPetya Technical Analysis<\/h3>\n<p>Although initially labeled as ransomware due to the ransom message that is displayed after infection, it appears now that NotPetya functions more as a destructive wiper-like tool than actual ransomware.<\/p>\n<p>Initially, analysis showed many similarities with Petya ransomware samples from 2016, but further research indicated the malware had been modified to cause data destruction. NotPetya overwrites sectors of the physical hard drive and C: volume, but does not contain the ability to restore the files, rendering recovery impossible even if the ransom is paid.<\/p>\n<p>Using the Windows API DeviceIoControl, the malware is able to obtain direct read and write access to the physical hard drive, without interaction with the operating system (provided it has the proper administrative permissions).<\/p>\n<p>This allows the code to determine the number of disks and partitions on the system, unmount a mounted volume (even if in use), and determine the drive geometry for the drives on the system (i.e., the number of sectors, bytes per sector, etc.). The malware uses this access to destroy data critical to the operating system. NotPetya also has the ability to replace the OS bootloader with custom code embedded in the binary.<\/p>\n<h3>NotPetya \u201cVaccine\u201d or \u201cKill Switch\u201d &#8211; NotPetya Technical Analysis<\/h3>\n<p>NotPetya contains a check upon initial execution that attempts to determine whether the victim system has already been infected. It has been stated that creating a file named \u201cperfc\u201d or \u201cperfc.dat\u201d in the root of the hard drive will cause the malware to halt execution, touting this as a \u201cvaccine\u201d or \u201ckill switch\u201d to prevent the spread of the malware.<\/p>\n<p>However, while the original name of the file was \u201cperfc.dat\u201d and so this check will work successfully to prevent execution of this variant, a simple file name change will render this protection useless.<\/p>\n<h3>NotPetya Analysis and Techniques<\/h3>\n<p>The analyzed samples of NotPetya are 32-bit Windows DLLs with an original file name of \u201cperfc.dat.\u201d Although the initial infection vector has not been confirmed, there is evidence that the updater process of the Ukrainian tax software MEDoc was responsible for execution of some of the initial infections.<\/p>\n<p>As noted before, although the malware can utilize the SMBv1 exploit to spread to unpatched machines, it also contains other propagation techniques capable of infecting even patched machines. This is critical to note, as means that just one infected system on a network can spread across the enterprise. The methods of propagation discussed below are as follows:<\/p>\n<p>Exploitation of machines vulnerable to the ETERNALBLUE\/ETERNALROMANCE SMVv1 exploit<br \/>\nUsing harvested credentials from the victim system to infect systems on the network by logging into SMB (any version) shares on the remote system<\/p>\n<p>Unlike Windows executables, DLLs such as the NotPetya sample contain \u201cexport functions\u201d that are called by external programs to execute functionality. These export functions are contained in a table within the DLL that lists the functions by name and \u201cordinal\u201d number.<\/p>\n<p>DLLs have a default export function, but in the case of perfc.dat, a call to this function will not execute the malware. Instead, the perfc.1 function must be called by ordinal rather than name, as seen below. Malware often employs this technique to hinder analysis efforts.<\/p>\n<p>C:\\Windows\\System32\\rundll32.exe &#8220;C:\\Windows\\perfc.dat&#8221;,#1<\/p>\n<p>Upon initial execution, perfc.dat performs a check for the following privileges of the running process.<\/p>\n<p>The malware sets a global flag that indicates which of these privileges are owned by the process. The privileges granted determine the path of code execution as it relates to the propagation, encryption, and wiping methodologies employed.<\/p>\n<p>After checking for privileges, the malware then enumerates all running processes on the victim, looking for three specific antivirus products: Kaspersky, Symantec, and Norton Security. The executable names are encrypted using a custom XOR algorithm.<\/p>\n<p>The result of this check determines the execution path of the malware during propagation to remote systems. The results from both the privilege check and the AV check are stored in bitmasked global variables for reference throughout the program. The flags indicating whether Kaspersky, Symantec, or Norton are running.<\/p>\n<p>After this flag value is set, the malware can determine which antivirus is installed by performing a bitwise AND operation on the flag with a constant. This method of \u201cbitmasking\u201d allows the malware to store multiple values in a single variable. For more information on this technique and how it is used by NotPetya, see the \u201cBitmasking\u201d section at the end of this post.<\/p>\n<p>The malware then checks privileges and performs the following if SeDebugPrivilege is granted:<\/p>\n<ul>\n<li>Checks for the existence of \u201cperfc.dat\u201d on the system<br \/>\nIf the file exists, the malware exists (see \u201cNotPetya Vaccine or Kill Switch\u201d section above)<br \/>\nIf not, the malware copies itself onto the victim\u2019s hard drive<\/li>\n<li>Opens a handle to the raw logical volume \\.\\C:<\/li>\n<li>Retrieves the drive geometry (bytes per sector, number of sectors, etc.)<\/li>\n<li>Overwrites sectors at the beginning of the volume<\/li>\n<li>Checks to see if Kaspersky flag is set and attempts to overwrite the MBR with a custom bootloader. If Kaspersky is not running and the MBR overwrite fails, the malware obtains a handle to the first physical drive (\\.\\PhysicalDrive0) and again retrieves the geometry.<\/li>\n<li>It then forcibly dismounts the volume and overwrites sectors on the drive<\/li>\n<\/ul>\n<p>After the above actions have been attempted, NotPetya creates a task to perform a shutdown after a calculated amount of time<\/p>\n<p>If the process has all three privileges described above and the OS version is Vista\/2008\/7 or greater, a scheduled task will be created and configured to run under the \u201cSYSTEM\u201d account<br \/>\nIf the system is running an older version of Windows (such as XP), the malware uses the built-in \u201cAT\u201d command to schedule the shutdown<\/p>\n<p>Depending on the system architecture, either the 32- or 64-bit version of the credential harvester is inflated and written to a pseudo-randomly named file in %TEMP%. NotPetya then creates a named pipe and executes the temp file, using the pipe to retrieve credentials from the harvester. These credential harvester binaries have been reported as modified versions of the tool \u201cmimikatz,\u201d although this has not been verified as of the time this report was written.<\/p>\n<p>&nbsp;<\/p>\n<p class=\"VSKILLbodytext\">Students or Professionals engaged in cyber security, can use the below links to be updated on Security related issues<\/p>\n<ul>\n<li class=\"VSKILLbodytext\"><a href=\"http:\/\/vskills.in\/certification\/tutorial\/legal\/cyber-security-certification\/\">Tutorials for Cyber Security<\/a><\/li>\n<li class=\"VSKILLbodytext\"><a href=\"http:\/\/www.vskills.in\/practice\/quiz\/cyber-security\">Practice Test on Cuber Security to assess your knowledge<\/a><\/li>\n<li class=\"VSKILLbodytext\"><a href=\"https:\/\/www.vskills.in\/certification\/security\/cyber-security-certification\">Certification Course on Cyber Security<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>NotPetya Technical Analysis NotPetya (or \u201cNyetna\u201d as it has also been named) spreads to other systems on the network without use of the ETERNALBLUE\/ETERNALROMANCE SMBv1 exploits. (Although the code contains the ability to spread by this exploit as well, so patching is still imperative). The malware harvests SMB and user credentials from the infected host&#8230;<\/p>\n","protected":false},"author":1,"featured_media":51570,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[1556],"tags":[919,6808,6800,980],"class_list":["post-49783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security-2","tag-cyber-security","tag-notpetya-technical-analysis","tag-ransomware","tag-security"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>NotPetya Technical Analysis<\/title>\n<meta name=\"description\" content=\"NotPetya Technical Analysis\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"NotPetya Technical Analysis\" \/>\n<meta property=\"og:description\" content=\"NotPetya Technical Analysis\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/\" \/>\n<meta property=\"og:site_name\" content=\"Vskills Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-03T06:19:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-03T07:52:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"teamvskills\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"teamvskills\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/\",\"name\":\"NotPetya Technical Analysis\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif\",\"datePublished\":\"2017-07-03T06:19:32+00:00\",\"dateModified\":\"2024-04-03T07:52:11+00:00\",\"author\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/db89ed45879ddc5d130a8aae4309d90a\"},\"description\":\"NotPetya Technical Analysis\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage\",\"url\":\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif\",\"width\":750,\"height\":400,\"caption\":\"NotPetya Technical Analysis\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"NotPetya Technical Analysis\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/blog\/\",\"name\":\"Vskills Blog\",\"description\":\"Vskills - A Initiative in Assessment to Enhance Employability\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/db89ed45879ddc5d130a8aae4309d90a\",\"name\":\"teamvskills\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b622f2772f7029565ef961f615b0727ed219929be1c95fa7aeda53560feec085?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b622f2772f7029565ef961f615b0727ed219929be1c95fa7aeda53560feec085?s=96&d=mm&r=g\",\"caption\":\"teamvskills\"},\"url\":\"https:\/\/www.vskills.in\/certification\/blog\/author\/teamvskills\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"NotPetya Technical Analysis","description":"NotPetya Technical Analysis","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/","og_locale":"en_US","og_type":"article","og_title":"NotPetya Technical Analysis","og_description":"NotPetya Technical Analysis","og_url":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/","og_site_name":"Vskills Blog","article_publisher":"https:\/\/www.facebook.com\/vskills.in","article_published_time":"2017-07-03T06:19:32+00:00","article_modified_time":"2024-04-03T07:52:11+00:00","og_image":[{"width":750,"height":400,"url":"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif","type":"image\/gif"}],"author":"teamvskills","twitter_misc":{"Written by":"teamvskills","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/","url":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/","name":"NotPetya Technical Analysis","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif","datePublished":"2017-07-03T06:19:32+00:00","dateModified":"2024-04-03T07:52:11+00:00","author":{"@id":"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/db89ed45879ddc5d130a8aae4309d90a"},"description":"NotPetya Technical Analysis","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#primaryimage","url":"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif","contentUrl":"https:\/\/www.vskills.in\/certification\/blog\/wp-content\/uploads\/2017\/07\/11_Technical-analysis.gif","width":750,"height":400,"caption":"NotPetya Technical Analysis"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/blog\/notpetya-technical-analysis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/blog\/"},{"@type":"ListItem","position":2,"name":"NotPetya Technical Analysis"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/blog\/#website","url":"https:\/\/www.vskills.in\/certification\/blog\/","name":"Vskills Blog","description":"Vskills - A Initiative in Assessment to Enhance Employability","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/db89ed45879ddc5d130a8aae4309d90a","name":"teamvskills","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b622f2772f7029565ef961f615b0727ed219929be1c95fa7aeda53560feec085?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b622f2772f7029565ef961f615b0727ed219929be1c95fa7aeda53560feec085?s=96&d=mm&r=g","caption":"teamvskills"},"url":"https:\/\/www.vskills.in\/certification\/blog\/author\/teamvskills\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/posts\/49783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/comments?post=49783"}],"version-history":[{"count":5,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/posts\/49783\/revisions"}],"predecessor-version":[{"id":74518,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/posts\/49783\/revisions\/74518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/media\/51570"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/media?parent=49783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/categories?post=49783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/blog\/wp-json\/wp\/v2\/tags?post=49783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}