Extracting Ransomware's Keys by Utilizing Memory
Total Page:16
File Type:pdf, Size:1020Kb
EXTRACTING RANSOMWARE’S KEYS BY UTILIZING MEMORY FORENSICS By Pranshu Bajpai A DISSERTATION Submitted to Michigan State University in partial fulfillment of the requirements for the degree of Computer Science – Doctor of Philosophy 2020 ABSTRACT EXTRACTING RANSOMWARE’S KEYS BY UTILIZING MEMORY FORENSICS By Pranshu Bajpai Ransomware continues to evolve and has established itself as the cyber weapon-of-choice for the financially motivated cybercriminals. The current state of ransomware threats necessi- tates the deployment of defense-in-depth strategies. Particularly, more response and recovery solutions are required to thwart ransomware in the late stages of the attack. To that end, we introduce pickpocket which exploits a side-channel vulnerability in ransomware: in- memory key exposure during encryption. Perpetrators do not control the host performing the encryption and thus this “white box” system affords access to the decryption keys by facilitating an in-memory attack on ransomware. Since it is these keys that are ransomed, the user’s ability to extract the keys cripples the attack. Such key extraction is the only recourse in the frequent scenario where both intrusion prevention and backups have failed. The novelty of pickpocket is the extraction of cryptographic material from system memory during the process of malicious encryption. The primary insight of this work is that con- ventional implementations of cryptographic algorithms deployed by ransomware are highly vulnerable when a hostile entity controls the execution environment. Our work differs from existing solutions in that we provide response and recovery when all existing solutions have failed, that is, we provide the last line of defense. By providing access to the decryption keys, we remove ransomware’s leverage over the victim by enabling an alternative path to file restoration and thus eliminate the requirement of paying the ransom. Copyright by PRANSHU BAJPAI 2020 ACKNOWLEDGEMENTS I have been privileged to have Dr. Richard J. Enbody as my advisor during this PhD. His constant support and guidance has played an instrumental role in shaping my doctoral stud- ies. In addition to our discussions concerning academic research, I have enjoyed numerous conversations with him on a wide array of subjects and learned something new every time. Through passive observation of his managerial style, I have realized the significance of being kind, patient, and generous towards students, subordinates, and people in general. I am grateful to Dr. Aditya K. Sood for introducing me to Dr. Enbody. I would like to thank the members of my PhD committee, Dr. Arun A. Ross, Dr. Abdol Esfahanian, and Dr. Thomas J. Holt, for the helpful feedback, comments, and discussions throughout the pursuit of my PhD. I am grateful towards the information security team at Michigan State University for hosting me for three consecutive summers as an intern. I would like to thank Tyler Olsen and Rob McCurdy for their interest and support throughout my work. I would like to thank Adam Lewis and Ronnie Flathers at Motorola Solutions Inc. for their strong support and encouragement during my summer internship as part of the Security Architecture Team. Particularly, thank you Adam for continually reminding me of the positive practical impact of this work. I also wish to thank Dr. Arun A. Ross and Dr. Betty HC Cheng for the lively and enjoyable classroom experience. I would like to thank Michigan State University and its community of students, faculty, researchers, and staff for welcoming me and supporting me every day throughout these years. Finally, and most importantly, I would like to thank my mother, Dr. Rashmi Vajpayee, for instilling in me the deep desire to excel in my pursuits. It is from her that I have learned the significance of perseverance and tenacity in life. iv TABLE OF CONTENTS LIST OF TABLES ................................... ix LIST OF FIGURES ................................... x LIST OF ALGORITHMS ................................ xii CHAPTER 1 INTRODUCTION ........................... 1 1.1 Thesis statement . 2 1.2 Contributions . 3 CHAPTER 2 BACKGROUND ............................ 5 2.1 Introduction . 5 2.2 The state-of-the-art in existing solutions . 5 2.2.1 Backup solutions . 6 2.2.2 Static-signature-based solutions . 7 2.2.3 Dynamic-behavior-based solutions . 7 2.2.3.1 File-access-patterns-based approaches . 8 2.2.3.2 Honeyfile-based approaches . 8 2.2.3.3 Machine-learning-based approaches . 9 2.2.4 User-training-oriented solutions . 10 2.2.5 Vulnerability management solutions . 10 2.2.6 Cryptography-oriented solutions . 11 2.3 Comparative analysis of existing solutions . 12 2.4 Summary . 15 CHAPTER 3 KEY MANAGEMENT IN RANSOMWARE .............. 17 3.1 Introduction . 17 3.2 Cryptography basics revisited . 18 3.2.1 Symmetric key . 19 3.2.2 Asymmetric key . 19 3.2.3 Hybrid of Symmetric and Asymmetric . 20 3.3 Types of key management in ransomware . 21 3.3.1 No key or no encryption . 22 3.3.2 Decryption essentials in user domain . 23 3.3.2.1 Decryption essentials on host machine . 23 3.3.2.2 Decryption essentials distributed among peers . 24 3.3.3 Decryption essentials in attacker domain . 25 3.3.3.1 Decryption essentials on a C&C server: single encryption . 25 3.3.3.2 Decryption essentials on a C&C server: hybrid encryption . 28 3.4 Empirical study of key generation strategies in ransomware . 30 3.4.1 Classification of key generation in ransomware . 31 3.4.1.1 Static asymmetric key . 32 v 3.4.1.2 Dynamically-generated asymmetric key . 32 3.4.1.3 Static symmetric key . 33 3.4.1.4 Dynamically generated symmetric key . 36 3.4.1.5 Using standard encryption algorithms embedded within . 39 3.4.1.6 Derivation from password string . 40 3.4.1.7 Deploying a network key . 42 3.4.2 Experimental results . 43 3.4.3 Pseudo code of ransomware deploying hybrid cryptosystem in Win- dows context . 47 3.5 Key-management-based taxonomy for ransomware . 49 3.5.1 Category 1 . 50 3.5.2 Category 2 . 51 3.5.3 Category 3 . 52 3.5.4 Category 4 . 53 3.5.5 Category 5 . 53 3.5.6 Category 6 . 54 3.5.7 Classification Results . 55 3.6 Novel characteristics observed in modern ransomware . 59 3.6.1 Bundled cryptojacking routines . 60 3.6.2 Deploying elliptic curve cryptography . 60 3.6.3 Explicit destruction of backups . 60 3.6.4 Dropping spyware . 60 3.6.5 Expanding to multiple attack vectors . 61 3.7 Summary . 61 CHAPTER 4 CONSTRAINTS ON MODERN RANSOMWARE ........... 63 4.1 Introduction . 63 4.2 Identifying the kill chain . 65 4.3 Proof of constraints . 66 4.4 Empirical evidence of constraints observed in ransomware . 71 4.4.1 Initial entry and execution . 71 4.4.2 Exclusive knowledge of the random integer . 72 4.4.2.1 RSA-based approach in ransomware . 73 4.4.2.2 ECIES-based approach in ransomware . 73 4.4.3 Exclusive knowledge of the encryption key . 74 4.4.4 File access and modification . 75 4.4.5 Denial of access to critical data . 76 4.4.6 Functional payment route . 76 4.5 Experimental results . 79 4.6 Summary . 82 CHAPTER 5 STATIC AND DYNAMIC ANALYSIS ................. 85 5.1 Introduction . 85 5.2 Static dissection of ransomware . 86 5.2.1 Delivery and preparation phase . 86 vi 5.2.2 Key generation phase . 87 5.2.3 File enumeration and encryption . 91 5.2.4 Post-encryption phase . 92 5.2.5 Experimental results . 95 5.3 Evaluating dynamic API calls in ransomware . 96 5.4 Ransomware’s dependence on API calls . 97 5.4.1 Process-oriented calls (POC) . 99 5.4.2 String-oriented calls (SOC) . 100 5.4.3 File-oriented calls (FOC) . 100 5.4.4 Crypt-oriented calls (COC) . 100 5.5 Extracting relevant API calls from ransomware . 101 5.5.1 Experimental results . 102 5.6 Summary . 106 CHAPTER 6 USING MEMORY FORENSICS FOR KEY EXTRACTION ..... 107 6.1 Introduction . 107 6.2 Background . 109 6.2.1 Attack vectors . 109 6.2.2 Encryption models . 109 6.2.3 Key generation . 110 6.2.4 Key persistence . 111 6.2.5 Key deletion . 112 6.3 Design . 114 6.3.1 Filesystem monitoring . 115 6.3.2 Key extraction from memory . 116 6.3.3 Key vault . 117 6.4 Implementation . 117 6.5 Evaluation . 119 6.5.1 True positives . 123 6.5.1.1 Successful extractions . 123 6.5.1.2 Failed extractions . 124 6.5.2 False positives . ..