• Unit 42
  • New OS X Ransomware KeRanger Infected Transmission BitTorrent Client Installer

New OS X Ransomware KeRanger Infected Transmission BitTorrent Client Installer


Category: Unit 42

Tags: , ,

On March 4, we detected that the Transmission BitTorrent client installer for OS X was infected with ransomware, just a few hours after installers were initially posted. We have named this Ransomware “KeRanger.” The only previous ransomware for OS X we are aware of is FileCoder, discovered by Kaspersky Lab in 2014. As FileCoder was incomplete at the time of its discovery, we believe KeRanger is the first fully functional ransomware seen on the OS X platform.

Attackers infected two installers of Transmission version 2.90 with KeRanger on the morning of March 4. When we identified the issue, the infected DMG files were still available for downloading from the Transmission site (hxxps://download.transmissionbt.com/files/Transmission-2.90[.]dmg) Transmission is an open source project. It’s possible that Transmission’s official website was compromised and the files were replaced by re-compiled malicious versions, but we can’t confirm how this infection occurred.


Figure 1 KeRanger hosted in Transmission’s official website

The KeRanger application was signed with a valid Mac app development certificate; therefore, it was able to bypass Apple’s Gatekeeper protection. If a user installs the infected apps, an embedded executable file is run on the system. KeRanger then waits for for three days before connecting with command and control (C2) servers over the Tor anonymizer network. The malware then begins encrypting certain types of document and data files on the system. After completing the encryption process, KeRanger demands that victims pay one bitcoin (about $400) to a specific address to retrieve their files. Additionally, KeRanger appears to still be under active development and it seems the malware is also attempting to encrypt Time Machine backup files to prevent victims from recovering their back-up data.

Palo Alto Networks reported the ransomware issue to the Transmission Project and to Apple on March 4. Apple has since revoked the abused certificate and updated XProtect antivirus signature, and Transmission Project has removed the malicious installers from its website. Palo Alto Networks has also updated URL filtering and Threat Prevention to stop KeRanger from impacting systems.

Technical Analysis

The two KeRanger infected Transmission installers were signed with a legitimate certificate issued by Apple. The developer listed this certificate is a Turkish company with the ID Z7276PX673, which was different from the developer ID used to sign previous versions of the Transmission installer. In the code signing information, we found that these installers were generated and signed on the morning of March 4.



Figure 2 Code signing information of KeRanger

The KeRanger infected Transmission installers include an extra file named General.rtf in the Transmission.app/Contents/Resources directory. It uses an icon that looks like a normal RTF file but is actually a Mach-O format executable file packed with UPX 3.91. When users click these infected apps, their bundle executable Transmission.app/Content/MacOS/Transmission will copy this General.rtf file to ~/Library/kernel_service and execute this “kernel_service” before any user interface appearing.


Figure 3 The malicious executable pretends to be an RTF document


Figure 4 KeRanger executes the extra General.rtf file

After unpacking the General.rtf with UPX, we determined that its main behavior is to encrypt the user’s files and hold them for ransom.

The first time it executes, KeRanger will create three files “.kernel_pid”, “.kernel_time” and “.kernel_complete” under ~/Library directory and write the current time to “.kernel_time”. It will then sleep for three days. Note that, in a different sample of KeRanger we discovered, the malware also sleeps for three days, but also makes requests to the C2 server every five minutes.


Figure 5 KeRanger sleeps for three days before fully executing

The General.rtf will collect infected Mac’s model name and UUID, upload the information to one of its C2 servers. These servers’ domains are all sub-domains of onion[.]link or onion[.]nu, two domains that host servers only accessible over the Tor network.

The executable will keep trying to connect with the C2 server until it respond with two lines of encoded data. After decoding these two lines using Base64, the first line contains an RSA public key and the second line is written to files named “README_FOR_DECRYPT.txt.”


Figure 6 Connect with C2 server and get instructions

When we were analyzing the samples, the C2 server returned the data for the README_FOR_DECRYPT.txt shown in following picture. It asks victims to pay exactly one bitcoin (currently around $400) through a specific Tor network website to decrypt the files. The website will then guide victims to buy a bitcoin from somewhere else and transfer to the attacker at the address of “1PGAUBqHNcwSHYKnpHgzCrPkyxNxvsmEof”.


Figure 7 README file ask victim to pay Bitcoin


Figure 8 Tor website to transfer bitcoin and get decryption pack

After connecting to the C2 server and retrieving an encryption key, the executable will traverse the “/Users” and “/Volumes” directories, encrypt all files under “/Users”, and encrypt all files under “/Volumes” which have certain file extensions.

There are 300 different extensions specified by the malware, including:

  • Documents: .doc, .docx, .docm, .dot, .dotm, .ppt, .pptx, .pptm, .pot, .potx, .potm, .pps, .ppsm, .ppsx, .xls, .xlsx, .xlsm, .xlt, .xltm, .xltx, .txt, .csv, .rtf, .tex
  • Images: .jpg, .jpeg,
  • Audio and video: .mp3, .mp4, .avi, .mpg, .wav, .flac
  • Archives: .zip, .rar., .tar, .gzip
  • Source code: .cpp, .asp, .csh, .class, .java, .lua
  • Database: .db, .sql
  • Email: .eml
  • Certificate: .pem


Figure 9 Encrypt all files under “/Users” and all specific files under “/Volumes”

KeRanger statically linked an open source encryption library named mbed TLS (formerly PolarSSL).

As KeRanger encrypts each file (i.e. Test.docx) starts by creating an encrypted version that uses the .encrypted extension (i.e. Test.docx.encrypted.) To encrypt each file, KeRanger starts by generating a random number (RN) and encrypts the RN with the RSA key retrieved from the C2 server using the RSA algorithm. It then stores the encrypted RN at the beginning of resulting file. Next, it will generate an Initialization Vector (IV) using the original file’s contents and store the IV inside the resulting file. After that, it will mix the RN and the IV to generate an AES encryption key. Finally, it will use this AES key to the contents of the original file and write all encrypted data to the result file.

fig10Figure 10 Encrypt each file’s content by AES

In addition to this behavior, it seems like KeRanger is still under development. There are some apparent functions named “_create_tcp_socket”, “_execute_cmd” and “_encrypt_timemachine”. Some of them have been finished but are not used in current samples. Our analysis suggests the attacker may be trying to develop backdoor functionality and encrypt Time Machine backup files as well. If these backup files are encrypted, victims would not be able to recover their damaged files using Time Machine.


Figure 11 Function “_encrypt_timemachine” is implemented but not used yet


We reported the issue to the Transmission Project and to Apple immediately after we identified it. Apple has since revoked the abused certificate, and Gatekeeper will now block the malicious installers. Apple has also updated XProtect signatures to cover the family, and the signature has been automatically updated to all Mac computers now. As of March 5, Transmission Project has removed the malicious installers from its website.

We have also updated URL filtering and Threat Prevention to stop KeRanger from impacting Palo Alto Networks customers.

How to Protect Yourself

Users who have directly downloaded Transmission installer from official website after 11:00am PST, March 4, 2016 and before 7:00pm PST, March 5, 2016, may be been infected by KeRanger. If the Transmission installer was downloaded earlier or downloaded from any third party websites, we also suggest users perform the following security checks. Users of older versions of Transmission do not appear to be affected as of now.

We suggest users take the following steps to identify and remove KeRanger holds their files for ransom:

  1. Using either Terminal or Finder, check whether /Applications/Transmission.app/Contents/Resources/ General.rtf or /Volumes/Transmission/Transmission.app/Contents/Resources/ General.rtf exist. If any of these exist, the Transmission application is infected and we suggest deleting this version of Transmission.
  2. Using “Activity Monitor” preinstalled in OS X, check whether any process named “kernel_service” is running. If so, double check the process, choose the “Open Files and Ports” and check whether there is a file name like “/Users/<username>/Library/kernel_service” (Figure 12). If so, the process is KeRanger’s main process. We suggest terminating it with “Quit -> Force Quit”.
  3. After these steps, we also recommend users check whether the files “.kernel_pid”, “.kernel_time”, “.kernel_complete” or “kernel_service” existing in ~/Library directory. If so, you should delete them.


Figure 12 The malicious “kernel_service” process

Since Apple has revoked the abused certificate and has updated XProtect signatures, if a user tries to open a known infected version of Transmission, a warning dialog will be shown that states “Transmission.app will damage your computer. You should move it to the Trash.” Or “Transmission can’t be opened. You should eject the disk image.” In any case if you see these warnings, we suggest to follow Apple’s instruction to avoid being affected.


Figure 13 OS X system prevent user to open the infected installer


We greatly thank Yi Ren, Yuchen Zhou, Jack Wang, Jun Wang from Palo Alto Networks for helping to analyze KeRanger and protect our customers in a timely fashion. Thanks to Richard Wartell, Ryan Olson and Chad Berndtson from Palo Alto Networks for their assistance during the analysis and reporting.


Samples of Ransomware.OSX.KeRanger
d1ac55a4e610380f0ab239fcc1c5f5a42722e8ee1554cba8074bbae4a5f6dbe1 Transmission-2.90.dmg
e3ad733cea9eba29e86610050c1a15592e6c77820927b9edeb77310975393574 Transmission
31b6adb633cff2a0f34cefd2a218097f3a9a8176c9363cc70fe41fe02af810b9 General.rtf
d7d765b1ddd235a57a2d13bd065f293a7469594c7e13ea7700e55501206a09b5 Transmission
ddc3dbee2a8ea9d8ed93f0843400653a89350612f2914868485476a847c6484a Transmission
6061a554f5997a43c91f49f8aaf40c80a3f547fc6187bee57cd5573641fcf153 General.rtf



  1. Arya A says:

    Thank you guys so SO much. I really appreciate the fast and speedy method you reported this.

  2. Thank You says:

    Thanks for the clear and detailed article!

  3. Thank you for the timely and informative post!

  4. R. Michael Plappert says:

    I really want to thank U guys for keeping your sharp eyes open to protect us, the people, and catch the bad guys.
    Greetings from Vienna, Austria

  5. ben says:

    Thanks a heap team!

  6. Lasse says:

    Thank’s a lot !!!

    Greetings from ChiangMai, Thailand

  7. user says:

    This is why Transmission is the only viable and respectable bittorrent project out there. Thanks so much to everyone’s hard work on this amazing example of the power of open source.

  8. Riccardo Bartoli says:

    Good job!

  9. Chris says:

    Thank you so much guys. Luckily i wasnt infected but its nice to be sure !

  10. Thanks for the informative post. Luckily I was not infected myself, but it’s good that both the teams at Apple and Transmission are already on it with a fix.

  11. Jose says:


    Saludos desde Barcelona (Spain)

  12. Esteban says:

    Wow! wonderful job, thanks for the help!

    Greetings from Italy.

  13. Jose Magalhaes says:

    Thank you for your excellent work!

    Greetings from Portugal.

  14. Axton says:

    Wow that’s crazy !
    Thanks !
    Greetings from Paris !

  15. Luis says:

    Thank you very much for your effort guys. you are heroes

  16. Bjarke B Rubeksen says:

    Love the software and I intend to still use tranmission. But we just got our Mac infected and all images, video’s etc. gone. Luckily we always have a backup. Great job on finding it our so fast, and really interesting article.

  17. random says:

    great analysis! May your service be rewarded appropriately

  18. Astounded says:

    Definitely need to give the right props here.
    Not only was the detection, analyzation and mitigation all sound, you also put the black-hats to shame by picking apart their every move like that, without even a shred of ego to boot.
    Fantastic job all of you. The future of anonymity would be terrifying if it weren’t for heroes like you.

  19. JM says:

    Thank you so much for putting this together and giving us a really comprehensive understanding of it and how to check/protect ourselves. You folks are incredible 🙂

  20. Grateful but concerned says:

    Well done gents, you saved my day at least.

  21. John Sawyer says:

    It should be noted that the the normal OS X process “kernel_task” should not be mistaken for the KeRanger process “kernel_service”.

  22. j says:

    a very well written piece of article 🙂

  23. James Ostin says:

    Wow! This is the second time when transmission was infected with malware. No guarantee this won’t happen again. have switched to Folx by Eltima right after 1st transmission attack, happy with it

  24. Bewatermyfriend says:

    Hi there,

    Thank you for your article. I was affected by this malware and your article helped me to rid it.

    I wonder whether there is any version of transmission that would you reccomend and that you think it is not affected by KeRanger or similar intruders. Any suggestions for future downloads?

    Many thanks

  25. Claud Xiao says:

    Any newer version (>2.90) of Transmission that was directly downloaded from its official website should be safe to use. Please avoid downloading it from any other third party website.

  26. Umberto says:

    Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Get updates on Unit 42

Sign up to receive the latest news, cyber threat intelligence and research from Unit 42

Follow us on