{"id":88372,"date":"2020-01-22T16:42:25","date_gmt":"2020-01-22T11:12:25","guid":{"rendered":"https:\/\/blogs.quickheal.com\/?p=88372"},"modified":"2023-09-11T13:31:26","modified_gmt":"2023-09-11T08:01:26","slug":"first-node-js-based-ransomware-nodera","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/first-node-js-based-ransomware-nodera\/","title":{"rendered":"First Node.js-based Ransomware : Nodera"},"content":{"rendered":"<p>Recently while threat hunting, Quick Heal Security Labs came across an unusual Node.js framework based on Nodera ransomware. The use of the Node.js framework is not seen commonly across malware families. However, the latest development by threat actors reveals nasty and one-of-its-kind ransomware being created, one that uses the Node.js framework, which enables it to infect Windows-based OS.<\/p>\n<p>Node.js is an open-source, cross-platform, JavaScript run-time environment that executes JavaScript code outside of a browser. It is built on the V8 JavaScript engine. V8 is Google\u2019s open-source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others.<strong><b>\u00a0<\/b><\/strong>It implements ECMAScript and WebAssembly, and runs on <a href=\"https:\/\/blogs.quickheal.com\/unable-shut-restart-windows-7-systems\/\">Windows 7<\/a> or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone or can be embedded into any C++ application.<\/p>\n<p>Interestingly, users can easily get infected by this Nodera ransomware while browsing online, either by clicking on a malicious HTA file or when served as a malvertisement.<\/p>\n<p><strong><b>Analysis Details :<\/b><\/strong><\/p>\n<p>The sample received in our lab was a VBS script that has multiple embedded js scripts. On execution, it creates a directory <em>\u201cGFp0JAk\u201d<\/em> at location <em>\u201c%userprofile%\\AppData\\Local\\\u201d<\/em>.<\/p>\n<p>It also creates a sub-directory <em>\u201cnode_modules\u201d<\/em> for storing Node.js libraries required to execute the JS payload. Finally, for the execution of those scripts, it requires <em>node.exe,<\/em> which will be downloaded from the below URL.<\/p>\n<p><em><u>https:\/\/nodejs.org\/download\/release\/latest-v8.x\/win-x86\/node.exe<\/u><\/em><\/p>\n<p>Downloaded node.exe is stored as <em>GFp0JAk.exe<\/em> at <em>\u201c%userprofile%\\AppData\\Local\\GFp0JAk\u201d.<\/em><\/p>\n<p>It further creates 3 different registry keys, <em>\u201cMicrosoft Office\u201d<\/em>,\u00a0<em>\u201cStartup\u201d, <\/em>and\u00a0<em>\u201cWindows\u201d<\/em> at <em>\u201cHKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\\u201d<\/em> to make its persistence in the system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-90044 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Registry-Entry-650x65.png\" alt=\"\" width=\"650\" height=\"65\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Registry-Entry-650x65.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Registry-Entry-300x30.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Registry-Entry-768x77.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Registry-Entry-789x79.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Registry-Entry.png 1495w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 1: Registry Entry<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>It then drops some required libraries such as fs.js,\u00a0graceful-fs.js,\u00a0legacy-streams.js,\u00a0package.json,\u00a0polyfills.js at <em>&#8220;%userprofile%\\AppData\\Local\\GFp0JAk\\node_modules\\\u201d<\/em> and also the malicious JS <em>\u201clLT8PCI.js\u201d<\/em> at <em>\u201c%userprofile%\\AppData\\Local\\GFp0JAk\\\u201d<\/em>.<\/p>\n<p>Once all required modules\u00a0are\u00a0in place, it checks for <em>\u201c%userprofile%\\AppData\\Local\\GFp0JAk\\GFp0JAk.exe\u201d<\/em>. If it is present, it will start executing the script by invoking<\/p>\n<p><em>oShell.Run(strExe &amp; &#8221; &#8221; &amp; outWorkingDir &amp; &#8220;\\&#8221; &amp; strEntPoint, 0, true)<\/em><\/p>\n<p>where <em>strExe\u00a0= \u201c%userprofile%\\AppData\\Local\\GFp0JAk\\GFp0JAk.exe\u201d <\/em><\/p>\n<p><em>outWorkingDir\u00a0= \u201d%userprofile%\\AppData\\Local\\GFp0JAk\\\u201d<\/em><\/p>\n<p><em>strEntPoint\u00a0=\u00a0\u201c%userprofile%\\AppData\\Local\\GFp0JAk\\lLT8PCI.js\u201d <\/em><\/p>\n<p>The actual payload is the \u201clLT8PCI.js\u201d script which performs all ransomware related activities.<\/p>\n<p>In this script, for every user-defined function, the author has used Async-Await Generators and Promises. These two are the most powerful concepts of the Node.js framework. Defining any function prefix with Async keywords allows synchronously writing asynchronous code. The return value from the asynchronous function is called the promise, which checks for the completion status of a given function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-90045 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key-650x284.png\" alt=\"\" width=\"650\" height=\"284\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key-650x284.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key-300x131.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key-768x335.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key-789x344.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Initialization-of-variables-and-Public-key.png 1059w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 2: Initialization of variables and Public key<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>JS script starts with the initialization of some variables like \u201cbitcoinAddress\u201d and its price. \u00a0Also, it embeds the RSA public key of 4096 bit in PEM format, as shown in Fig 2.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-90046 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Functions-used-in-script-650x381.png\" alt=\"\" width=\"650\" height=\"381\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Functions-used-in-script-650x381.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Functions-used-in-script-300x176.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Functions-used-in-script-768x450.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Functions-used-in-script-789x462.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Functions-used-in-script.png 1033w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 3: Functions used in the script<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>Initially, it checks for admin rights in <em>&#8220;%WinDir%&#8221;<\/em> by trying to create a file with name format <em>{randomname_of_len_4}.{randomname_of_len_2}<\/em>. \u201cgenerateKey\u201d function is used to generate random file name and extension.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-90047 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension-650x52.png\" alt=\"\" width=\"650\" height=\"52\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension-650x52.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension-300x24.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension-768x61.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension-789x63.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Generate-file-name-and-extension.png 1114w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 4: Generate file name and extension<\/em><\/p>\n<p>Next, it invokes the scan function, which enumerates all the drives present in the system and creates a list. Only for the <em>&#8220;C:&#8221;<\/em> drive it has made some exclusion. It considers only the directories which contain user-specific files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-90048 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Targeted-Directories-650x209.png\" alt=\"\" width=\"650\" height=\"209\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Targeted-Directories-650x209.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Targeted-Directories-300x96.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Targeted-Directories-768x247.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Targeted-Directories-789x254.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Targeted-Directories.png 1113w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 5: Targeted Directories<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>It will generate a file with the name <em>\u201c{randomname_of_len_6}.key\u201d,<\/em> which is used to store RSA encrypted AES-256 key. The AES key is generated by using the \u201cgenerateKey\u201d function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-90049 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/All-Modules-650x249.png\" alt=\"\" width=\"650\" height=\"249\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/All-Modules-650x249.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/All-Modules-300x115.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/All-Modules-768x294.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/All-Modules.png 778w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 6: All Modules<\/em><\/p>\n<p>Before encrypting the files, it kills the process as shown in the below fig and deletes volume shadow copy.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-90050 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Process-Killing.png\" alt=\"\" width=\"492\" height=\"219\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Process-Killing.png 492w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Process-Killing-300x134.png 300w\" sizes=\"(max-width: 492px) 100vw, 492px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 7: Process Killing<\/em><\/p>\n<p>After encrypting a file, it appends the extension <em>\u201c.encrypted\u201d<\/em>.<\/p>\n<p>Then it drops two files :<\/p>\n<p><em>&#8220;%userprofile%\\AppData\\Local\\GFp0JAk\\\u201cHow-to-buy-bitcoins.html\u201d <\/em><\/p>\n<p><em>\u201c%userprofile%\\Desktop\\Decrypt-your-files.bat\u201d. <\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-90051 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html-650x288.png\" alt=\"\" width=\"650\" height=\"288\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html-650x288.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html-300x133.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html-768x340.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html-789x350.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Ransom-Note-How-to-buy-bitcoins.html.png 1250w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 8: Ransom Note \u2013 How-to-buy-bitcoins.html<\/em><\/p>\n<p>The HTML file is a ransomware note and batch file containing the command to execute the same JS script with the parameter \u201cdecryptStatic\u201d, which invokes the decryption routine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-90052 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/01\/Encrypted-Files-650x318.png\" alt=\"\" width=\"650\" height=\"318\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Encrypted-Files-650x318.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Encrypted-Files-300x147.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/01\/Encrypted-Files.png 695w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p style=\"text-align: center;\"><em>Fig 9: Encrypted Files<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>This ransomware seems to be in the development phase and has some flaws, as mentioned below:<\/p>\n<ol>\n<li>It mentions the RSA public key of the 2048 bit in the ransom note, although the public key embedded in the script is 4096 bits.<\/li>\n<li>Hard code destruction time of Private Key \u201cMarch 1 2018\u201d.<\/li>\n<li>There is no communication channel mentioned in the ransom note to receive the private key.<\/li>\n<\/ol>\n<p>Although it seems to be written by an amateur developer, it is an interesting work, and the probability of it becoming popular in the future is quite high.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><b>How Quick Heal protects its users from such attacks :<\/b><\/strong><\/p>\n<p>Quick Heal products are built with the following multi-layered security that helps counter such attacks.<\/p>\n<ol>\n<li><b><\/b><strong><b>Anti-Ransomware<\/b><\/strong><\/li>\n<\/ol>\n<p>Specially designed to counter ransomware attacks. This feature detects ransomware by tracking its execution sequence.<\/p>\n<ol start=\"2\">\n<li><b><\/b><strong><b>Firewall<\/b><\/strong><\/li>\n<\/ol>\n<p>Blocks malicious attempts to breach network connections.<\/p>\n<ol start=\"3\">\n<li><b><\/b><strong><b>IDS\/IPS<\/b><\/strong><\/li>\n<\/ol>\n<p>Detects RDP brute force attempts and blocks the remote attacker IP for a defined period.<\/p>\n<ol start=\"4\">\n<li><strong><b> Virus Protection<\/b><\/strong><\/li>\n<\/ol>\n<p>Online virus protection service detects the known variants of the ransomware.<\/p>\n<ol start=\"5\">\n<li><strong><b> Behaviour-based Detection System<\/b><\/strong><\/li>\n<\/ol>\n<p>Tracks the activity of executable files and blocks malicious files.<\/p>\n<ol start=\"6\">\n<li><strong><b> Back-up and Restore<\/b><\/strong><\/li>\n<\/ol>\n<p>Helps you take regular backups of your data and restore it whenever needed.<\/p>\n<p><strong><b>Io<\/b><\/strong><strong><b>C<\/b><\/strong><strong><b>s\u00a0<\/b><\/strong><strong><b>:<\/b><\/strong><\/p>\n<p>7265C1FB74EB9EA3CD98358475620CE54B9033421BA042957135BDEFD078B366 53A95C9126BE8262AFB0821DA4D7137E6C8A4D9B363F91298249CA134D394BF4<\/p>\n<p><strong><b>Detection name :<\/b><\/strong><\/p>\n<p>VBS.NoderaRansom.36592<\/p>\n<p>JS.NoderaRansom.36593<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently while threat hunting, Quick Heal Security Labs came across an unusual Node.js framework based on Nodera ransomware. The use of the Node.js framework is not seen commonly across malware families. However, the latest development by threat actors reveals nasty and one-of-its-kind ransomware being created, one that uses the Node.js framework, which enables it to [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":88375,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1671,910],"tags":[1701,1700,1699,1698,50],"class_list":["post-88372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-encryption","category-ransomware","tag-encrypted","tag-btc","tag-microsoft-windows","tag-nodejs","tag-ransomware"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88372"}],"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\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=88372"}],"version-history":[{"count":7,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88372\/revisions"}],"predecessor-version":[{"id":92081,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88372\/revisions\/92081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/88375"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=88372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=88372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=88372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}