{"id":7904,"date":"2017-06-09T07:40:03","date_gmt":"2017-06-09T15:40:03","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2017\/06\/09\/news-1685\/"},"modified":"2017-06-09T07:40:03","modified_gmt":"2017-06-09T15:40:03","slug":"news-1685","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2017\/06\/09\/news-1685\/","title":{"rendered":"MacRansom: Offered as Ransomware as a Service"},"content":{"rendered":"<p><strong>Credit to Author: Rommel Joven and Wayne Chin Yick Low| Date: Fri, 09 Jun 2017 15:21:09 +0000<\/strong><\/p>\n<div class=\"entry\">\n<p>&nbsp;<\/p>\n<p>Many Mac OS users might assume that their computer is exempt&nbsp;from things like ransomware attacks and think that their system is somehow essentially &ldquo;secure.&rdquo;&nbsp;It is true that it&rsquo;s less likely for a Mac OS user to be attacked or infected by malware&nbsp;than a Windows user, but this has nothing to do with the level of vulnerability in the operating system. It is largely caused by the fact that over 90% of personal computers run on Microsoft Windows and only around 6% on&nbsp;Apple Mac OS.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac1.png\" style=\"width: 435px; height: 296px;\" \/><\/p>\n<p align=\"center\">Figure 1: Market share for desktop OS (reference: <a href=\"https:\/\/www.netmarketshare.com\/operating-system-market-share.aspx?qprid=10&amp;qpcustomd=0\">NetMarketShare<\/a>)<\/p>\n<h1>MacRansom Portal<\/h1>\n<p>Just recently, we here at FortiGuard Labs&nbsp;discovered a Ransomware-as-a-service (RaaS) that uses a web portal hosted in a&nbsp;TOR network which has become a trend nowadays. However, in this case it was rather interesting to see cybercriminals attack an operating system other than Windows. And this could be the first time to see RaaS&nbsp;that targets Mac OS.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/MAc2.png\" style=\"width: 660px; height: 493px;\" \/><\/p>\n<p align=\"center\">Figure 2: TOR portal of MacRansom<\/p>\n<p>This&nbsp;MacRansom variant is&nbsp;not readily available through&nbsp;the portal. It is necessary&nbsp;to contact the author directly to build the ransomware. At first, we thought of it as a scam since there was no sample but to verify this we dropped the author an email and unexpectedly received&nbsp;a response.<\/p>\n<p>&nbsp;<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac3.png\" style=\"width: 798px; height: 302px;\" \/><\/p>\n<p align=\"center\">Figure 3: About Us<\/p>\n<p>On our&nbsp;first email inquiring about the ransomware, we stated our&nbsp;requirements outlined by the author, such as the bitcoin amount for the target to pay, the date when to trigger the ransomware, and if it was to be&nbsp;&nbsp;executable when someone plugs a USB drive.<\/p>\n<p>We sent the email around 11AM (GMT+8) and received&nbsp;the first response was around 9PM that same day.<\/p>\n<p><em>Response 1: (9PM)<\/em><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac4.png\" style=\"width: 940px; height: 74px;\" \/><\/p>\n<p>Agreeing on June 1<sup>st<\/sup> as the trigger date,&nbsp;and giving my bitcoin address, the author gladly sent the sample.<\/p>\n<p><em>Response 2: (11AM)<\/em><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/mac5.png\" style=\"width: 940px; height: 188px;\" \/><\/p>\n<p>Since the author&nbsp;replied quite promptly to us, we tried to dig deeper by asking&nbsp;more about the ransomware:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac6.png\" style=\"width: 940px; height: 159px;\" \/><\/p>\n<p><em>Response 3: (12 AM)<\/em><\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac7.png\" style=\"width: 940px; height: 64px;\" \/><\/p>\n<p>Observing the time of the responses, it gave us a hint that the author might be in a different time zone since the reply came&nbsp;back late at night (which could be morning for them). Also, on the first response the author&nbsp;said &ldquo;<em>June 1<sup>st<\/sup> midnight on your local time<\/em>&rdquo;. They may have noticed the time difference when we emailed them.<\/p>\n<p>To verify the geolocation of the malware author(s) of this ransomware, we took a look at the original STMP header and found that the time zone they are in is GMT &ndash; 4.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/mac8.png\" style=\"width: 658px; height: 146px;\" \/><\/p>\n<p align=\"center\">Figure 4: SMTP header<\/p>\n<h1>Behavioural Analysis<\/h1>\n<p>Next, we began to examine the malware itself.&nbsp;Below are the features that the author claimed for the ransomware. We take a look at the code to&nbsp;see if it conformed&nbsp;with these features.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/mac9.png\" style=\"width: 848px; height: 283px;\" \/><\/p>\n<p align=\"center\">Figure 5: MacRansom Features<\/p>\n<p>Running the MacRansom sample, a prompt showed up stating the program is from an unidentified developer. So as long as users don&rsquo;t open suspicious files from unknown developers, they are safe. Clicking <em>Open<\/em> gives permission for the ransomware to run.<\/p>\n<p align=\"center\">&nbsp;<\/p>\n<h2>Anti-analysis<\/h2>\n<p>The first thing the ransomware does is to check if the sample is being run in a non-Mac environment or if it is being debugged. If these conditions are not met, the ransomware terminates.<\/p>\n<p>It calls the <tt>ptrace<\/tt> or process trace command with the argument <tt>PT_DENY_ATTACH <\/tt>to check and see if the&nbsp;ransomware is attached to a debugger.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/mac10.png\" style=\"width: 787px; height: 66px;\" \/><\/p>\n<p align=\"center\">Figure 6: Ptrace command<\/p>\n<p>Second, by using the <tt>sysctl hw.model<\/tt> command it checks the machine model and compares it to &ldquo;Mac&rdquo; string.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/Mac11.png\" style=\"width: 598px; height: 225px;\" \/><\/p>\n<p align=\"center\">Figure 7: Model check<\/p>\n<p>Lastly, it checks if the machine has two CPU&rsquo;s.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/mac12.png\" style=\"width: 625px; height: 267px;\" \/><\/p>\n<p align=\"center\">Figure 8: Check for logical CPUs<\/p>\n<p align=\"center\">&nbsp;<\/p>\n<h2>Launch Point<\/h2>\n<p>Once it has passed its initial checks, the&nbsp;ransomware creates a launch point in <tt>~\/LaunchAgent\/com.apple.finder.plist.<\/tt>&nbsp;The filename intentionally imitates a legitimate file in Mac OS to lessen suspicion of malicious activities. This launch point allows MacRansom to run at every start up and ensure that it encrypts on the specified <tt>trigger time<\/tt>.<\/p>\n<p>Contents of <tt>com.apple.finder<\/tt>:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/code.png\" style=\"width: 585px; height: 250px;\" \/><\/p>\n<p>The original executable is then copied to <tt>~\/Library\/.FS_Store.<\/tt>&nbsp;Again the filename is very similar to a legitimate file. After the file is copied, the time date stamp is changed by using the command <tt>touch -ct 201606071012 &#39;%s&#39;<\/tt>. The manipulation of the&nbsp;time date stamp is commonly used to confuse investigators when it comes to digital forensics.<\/p>\n<p>The ransomware then uses <tt>launchctl <\/tt>to load the created <tt>com.apple.finder.plist<\/tt>.<\/p>\n<p>&nbsp;<\/p>\n<h2>Encryption<\/h2>\n<p>As mentioned, the encryption has a <tt>trigger time<\/tt>, which is set by the author. For our case, it was&nbsp;at June 1<sup>st<\/sup>&nbsp;2017 at&nbsp;12am. The ransomware terminates if the date is before this.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/mac13.png\" style=\"width: 744px; height: 210px;\" \/><\/p>\n<p align=\"center\">Figure 9: Trigger time check<\/p>\n<p>If the <tt>trigger time<\/tt> is met, the ransomware starts to enumerate the targeted files by using the command shown below. This is an unusual way for a ransomware to enumerate files&nbsp;but is still&nbsp;effective since most ransomware traverses directories and includes a list of targeted extensions to encrypt.<\/p>\n<p>%s &ndash; is the file path of the ransomware<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/graph.png\" style=\"width: 657px; height: 174px;\" \/>&nbsp;<\/p>\n<p align=\"center\">Figure 10: File enumeration<\/p>\n<p>The ransomware only encrypts a maximum of 128 files, returned by the command stated above.<\/p>\n<p>As with other crypto-ransomware, the encryption algorithm is the core component that&nbsp;we spent most of our analysis time on. Our goal was&nbsp;to find any RSA-crypto routine, however this piece of crypto-ransomware is not as sophisticated as other OSX crypto-ransomware that have been previously disclosed. It uses a symmetric encryption with a hardcoded key to hijack the victim&rsquo;s files. There are two sets of symmetric keys used by the ransomware:<\/p>\n<ul>\n<li>ReadmeKey: 0x3127DE5F0F9BA796<\/li>\n<li><!-- -->TargetFileKey: 0x39A622DDB50B49E9<!-- width=\"453\" height=\"602\" src=\"file:\/\/localhost\/Users\/John\/Library\/Caches\/TemporaryItems\/msoclip\/0\/clip_image029.png\" alt=\"Description: C:UsersRommelJAppDataRoamingSkyperommel.joven17media_messagingmedia_cache_v3^B13C6C2DE7231AA538433E855F23A6496F32CA509D479414E4^pimgpsh_fullsize_distr.png\" \/--><\/li>\n<\/ul>\n<p>The <tt>ReadmeKey<\/tt>&nbsp;is used to decrypt ._README_ file that contains the ransom notes and instructions, while the <tt>TargetFileKey<\/tt> is used to encrypt and decrypt the victim&rsquo;s files.<\/p>\n<p>A remarkable thing we observed when reverse-engineering the encryption\/decryption algorithm is that the <tt>TargetFileKey<\/tt> is permuted with a random generated number. &nbsp;In other words, the encrypted files can no longer be decrypted once the malware has terminated &ndash; the <tt>TargetFileKey<\/tt> will be freed from program&rsquo;s memory and hence it becomes more challenging to create a decryptor or recovery tool to restore the encrypted files. Moreover, it doesn&rsquo;t have any function to communicate with any C&amp;C server for the <tt>TargetFileKey<\/tt> meaning there is no readily available copy of the key to decrypt the files. However, it is still technically possible to recover the&nbsp;<tt>TargetFileKey<\/tt>. One of the known techniques is to use a brute-force attack. It&nbsp;should not take very long for a modern CPU to brute-force an&nbsp;8-byte long key when the same key is used to encrypt known files with predictable file&rsquo;s contents.<\/p>\n<p>Nevertheless, we are still skeptical of&nbsp;the author&rsquo;s claim to be able to decrypt the hijacked files, even assuming&nbsp;that the victims sent the author&nbsp;an unknown random file, as shown in Figure 12 &quot;Ransom Note,&quot; which is not entirely true.<\/p>\n<p>Pseudo code for the encryption process is as follows:<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/mac15.png\" style=\"width: 903px; height: 1200px;\" \/><\/p>\n<p align=\"center\">Figure 11: Encryption Routine<\/p>\n<p>After successfully encrypting the targeted files, it encrypts both <tt>com.apple.finder.plist<\/tt> and the original executable. It changes the Time Date Stamp and then deletes them. This is done by the author so that even if recovery tools are used to get the ransomware artifacts, the files will be next to meaningless.<\/p>\n<p>The ransomware demands&nbsp;0.25 bitcoin (around USD ~700) and requires the victim to contact <tt>getwindows@protonmail.com<\/tt> for decryption.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/mac16.png\" style=\"width: 790px; height: 494px;\" \/><\/p>\n<p align=\"center\">Figure 12: Ransom Note<\/p>\n<h2>Conclusion<\/h2>\n<p>It is not every day that we see new ransomware specifically targeting Mac OS platform. Even if it is far inferior from most current&nbsp;ransomware targeting Windows, it doesn&rsquo;t fail to encrypt victim&rsquo;s files or&nbsp;prevent&nbsp;access to important files, thereby causing real damage.<\/p>\n<p>Last but not the least,&nbsp;this MacRansom variant is potentially being brewed by copycats as we saw quite a lot of similar code&nbsp;and ideas taken from previous OSX ransomware. Even though it utilizes anti-analysis tricks, which differs from&nbsp;previous OSX ransomware, these are well-known techniques widely deployed by many malware authors. MacRansom is yet another example of the prevalence of the&nbsp;ransomware threat,&nbsp;regardless of the OS platform being run. There are no perfect mitigations against ransomware. However, the impact can be minimized by doing regular backups of&nbsp;important files and being cautious when&nbsp;opening files from unidentified sources or developers.<\/p>\n<p>&nbsp;<\/p>\n<h2>-= FortiGuard Lion Team =-<\/h2>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Appendix<\/p>\n<p>Samples:<\/p>\n<p>a729d54da58ca605411d39bf5598a60d2de0657c81df971daab5def90444bcc3 &ndash; Zip<\/p>\n<p>Detected as OSX\/MacRansom.A!tr<\/p>\n<p>617f7301fd67e8b5d8ad42d4e94e02cb313fe5ad51770ef93323c6115e52fe98 &ndash; Mach-O file<\/p>\n<p>Dropped files:<\/p>\n<p>~\/LaunchAgent\/com.apple.finder.plist<\/p>\n<p>~\/Library\/.FS_Store<\/p>\n<p>&nbsp;<\/p>\n<p>FAQ from the MacRansom portal:<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Macransom2\/mac17.png\" style=\"width: 776px; height: 772px;\" \/><\/p>\n<p><!--![endif]----><\/p>\n<\/div<br \/><a href=\"https:\/\/blog.fortinet.com\/2017\/06\/09\/macransom-offered-as-ransomware-as-a-service\" target=\"bwo\" >https:\/\/blog.fortinet.com\/feed<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/images\/Financial\/Macransom\/Mac1.png\"\/><\/p>\n<p><strong>Credit to Author: Rommel Joven and Wayne Chin Yick Low| Date: Fri, 09 Jun 2017 15:21:09 +0000<\/strong><\/p>\n<p>Just recently, we discovered a Ransomware-as-a-service (Raas) that uses a web portal hosted in TOR network which has become a trend nowadays. It is rather interesting to see cybercriminals attack a different operating system other than Windows. And this could be the first time to see Raas that target Mac OS.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10424,10378],"tags":[],"class_list":["post-7904","post","type-post","status-publish","format-standard","hentry","category-fortinet","category-security"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/7904","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=7904"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/7904\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=7904"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=7904"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=7904"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}