1 00:00:00,000 --> 00:00:10,320 Malware analysis is a vital process in cyber security that involves dissecting and understanding 2 00:00:10,320 --> 00:00:12,920 malicious software. 3 00:00:12,920 --> 00:00:18,960 The primary goal is to determine how malware operates, what system it targets and what 4 00:00:18,960 --> 00:00:21,480 kind of damage it can inflict. 5 00:00:21,480 --> 00:00:26,960 By closely studying malware samples, cyber security experts gain valuable insights into 6 00:00:26,960 --> 00:00:32,240 the structure, functionality and its origin. 7 00:00:32,240 --> 00:00:37,800 This knowledge allows them to build stronger defense mechanisms, create detection signatures 8 00:00:37,800 --> 00:00:41,840 and respond more effectively to the incidents. 9 00:00:41,840 --> 00:00:46,720 In today's threat landscape, where cyber attacks are becoming more sophisticated, malware 10 00:00:46,720 --> 00:00:51,520 analysis is crucial for staying one step ahead of the attackers. 11 00:00:51,520 --> 00:00:56,240 There are several types of malware analysis, it's offering a unique perspective on how 12 00:00:56,240 --> 00:00:58,800 the malware functions. 13 00:00:58,800 --> 00:01:04,880 Static analysis for instance involves inspecting the malware's code without running it. 14 00:01:04,880 --> 00:01:11,160 This approach helps identify hidden commands, embedded URLs, encryption routines and suspicious 15 00:01:11,160 --> 00:01:17,400 functions, all without the risk of executing potentially harmful code. 16 00:01:17,400 --> 00:01:23,120 So we open the malware without executing, this is static analysis. 17 00:01:23,120 --> 00:01:28,600 Experts often use those tools like disassemblers and decompilers to reverse engineering the 18 00:01:28,600 --> 00:01:34,840 binaries, make it easy to uncover what the malware is programmed. 19 00:01:34,840 --> 00:01:41,120 Dynamic and behavioral analysis takes more hands-on approach. 20 00:01:41,120 --> 00:01:47,560 Dynamic analysis involves running the malware in a safe and isolated environment, usually 21 00:01:47,560 --> 00:01:52,880 a sandbox or virtual machine, to observe its behavior in real time. 22 00:01:52,880 --> 00:02:00,160 This allows analysts to see how the malware interacts with the system files, network resources 23 00:02:00,160 --> 00:02:02,440 and other software. 24 00:02:02,440 --> 00:02:10,360 Behavioral analysis complements this by focusing on the impact malware has during the execution. 25 00:02:10,360 --> 00:02:12,160 Does it slow down the system? 26 00:02:12,160 --> 00:02:14,480 Does it modify or delete files? 27 00:02:14,480 --> 00:02:16,720 Does it connect to unknown servers? 28 00:02:16,720 --> 00:02:22,800 By examining such actions, analysts can better understand the threat. 29 00:02:22,800 --> 00:02:29,720 Develop strategies to detect and neutralize similar behavior in the future. 30 00:02:29,720 --> 00:02:35,360 Malware comes in many forms, it's crafted with a unique objective, whether it's stealing 31 00:02:35,360 --> 00:02:41,720 data, disrupting normal operations, damaging systems or gaining unauthorized access. 32 00:02:41,720 --> 00:02:47,440 Recognizing these different types of malware is essential for cybersecurity professionals 33 00:02:47,440 --> 00:02:54,240 and users alike as it allows for quicker identification and a more effective response. 34 00:02:54,240 --> 00:02:59,640 By understanding how its category behaves, organizations can implement target security 35 00:02:59,640 --> 00:03:02,760 measures and better protect their digital assets. 36 00:03:02,760 --> 00:03:04,920 Let's start with the viruses. 37 00:03:04,920 --> 00:03:10,600 These are among the oldest forms of malware and typically attach themselves to legitimate 38 00:03:10,600 --> 00:03:12,800 programs or files. 39 00:03:12,800 --> 00:03:18,880 As a user unknowingly executes the infected file, the virus becomes active, replicates and 40 00:03:18,880 --> 00:03:22,120 spreads to the other files or systems. 41 00:03:22,120 --> 00:03:28,640 The damage caused by viruses can be arranged from corrupted files or data loss to complete 42 00:03:28,640 --> 00:03:30,200 system failure. 43 00:03:30,200 --> 00:03:36,600 Importantly, viruses often require user interaction, such as clicking on a malicious link or 44 00:03:36,600 --> 00:03:41,600 opening an email attachment to begin the destructive cycle. 45 00:03:41,600 --> 00:03:43,080 Last we have worms. 46 00:03:43,080 --> 00:03:49,520 Unlike viruses, worms can propagate on their own without any user interaction. 47 00:03:49,520 --> 00:03:55,720 They exploit vulnerabilities in operating systems or software to spread across the networks 48 00:03:55,720 --> 00:03:58,040 often at high speed. 49 00:03:58,040 --> 00:04:03,560 This can lead to severe consequences, such as network slowdowns, denial of service 50 00:04:03,560 --> 00:04:09,600 conditions and mass infection, across devices in a short amount of time. 51 00:04:09,600 --> 00:04:15,400 Trojan horses, on the other hand, disguise themselves as legitimate software or files 52 00:04:15,400 --> 00:04:18,120 to trick users into installing them. 53 00:04:18,120 --> 00:04:24,200 Once inside the system, they open the door for attackers to steal sensitive information, 54 00:04:24,200 --> 00:04:28,760 manipulate system settings or even take full remote control. 55 00:04:28,760 --> 00:04:35,760 Lastly, ransomware is one of the most financially damaging types and most well 56 00:04:35,760 --> 00:04:40,120 spread on the latest years. 57 00:04:40,120 --> 00:04:46,160 It encrypts user files or system files and locks their system and demands a ransom 58 00:04:46,160 --> 00:04:51,720 payment, usually in Bitcoin, in exchange for restoring the access. 59 00:04:51,720 --> 00:05:01,040 These attacks can paralyze individuals, businesses and even critical infrastructures, encrypting 60 00:05:01,040 --> 00:05:06,520 the confidential data, the important data of the systems, making the ransomware the most 61 00:05:06,520 --> 00:05:12,080 feared threats in the cybersecurity landscape today. 62 00:05:12,080 --> 00:05:18,520 Beyond the most common normal types, there are several other dangerous forms that operate 63 00:05:18,520 --> 00:05:23,360 more covertly but can be still just as damaging. 64 00:05:23,360 --> 00:05:29,880 These include spyware, adware, root kits, bots and key loggers, of which pose serious 65 00:05:29,880 --> 00:05:35,240 risks to users and organizations by stealing the data, hijacking the systems or acting as 66 00:05:35,240 --> 00:05:38,800 entry points for further compromise. 67 00:05:38,800 --> 00:05:45,000 Spyware is a particularly invasive form of malware that secretly monitors user activity 68 00:05:45,000 --> 00:05:47,120 without their knowledge. 69 00:05:47,120 --> 00:05:52,520 Once installed, it can track everything from keystrokes to browsing history, capturing 70 00:05:52,520 --> 00:05:58,160 personal information like passwords, banking details and login credentials. 71 00:05:58,160 --> 00:06:03,160 This data is often transmitted back to the cyber criminals for exploitation or sale on 72 00:06:03,160 --> 00:06:05,160 the dark web. 73 00:06:05,160 --> 00:06:11,080 Adware, while sometimes classified as less severe, can still pose a significant threat. 74 00:06:11,080 --> 00:06:17,480 Its main function is to bombard users with unwanted advertisements, pop-ups, banners 75 00:06:17,480 --> 00:06:19,040 and redirects. 76 00:06:19,040 --> 00:06:26,040 However, adware frequently tracks user behavior to serve targeted ads and may open the door 77 00:06:26,040 --> 00:06:30,160 for more malicious threats to enter the system. 78 00:06:30,160 --> 00:06:32,840 Even more dangerous are rootkits. 79 00:06:32,840 --> 00:06:38,680 These are stealthy pieces of malware designed to gain and maintain privileged access to 80 00:06:38,680 --> 00:06:41,720 a system while hiding their presence. 81 00:06:41,720 --> 00:06:48,020 Rootkits can disable security tools and create backdoors, making them incredibly 82 00:06:48,020 --> 00:06:50,760 hard to detect and remove. 83 00:06:50,760 --> 00:06:54,120 Lastly, we have bots and key loggers. 84 00:06:54,120 --> 00:06:59,800 A bot is a device infected and remotely controlled by an attacker. 85 00:06:59,800 --> 00:07:04,800 When linked with other compromised systems, it becomes a part of a botnet, which can 86 00:07:04,800 --> 00:07:10,640 be used for large-scale operations like spam campaigns or distributed denial-of-service 87 00:07:10,640 --> 00:07:12,640 DDoS attacks. 88 00:07:12,640 --> 00:07:19,160 Meanwhile, key loggers operate silently in the background, recording every keystroke 89 00:07:19,160 --> 00:07:21,840 typed on an infected machine. 90 00:07:21,840 --> 00:07:27,680 This allows attackers to collect sensitive data such as passwords, credit card numbers 91 00:07:27,680 --> 00:07:31,040 and confidential communications. 92 00:07:31,040 --> 00:07:35,560 Understanding these forms of malware is essential for building strong defensive strategies 93 00:07:35,560 --> 00:07:39,840 and maintaining the system integrity. 94 00:07:39,840 --> 00:07:44,960 Malware analysis is a complex and technical process that requires a use of specialized 95 00:07:44,960 --> 00:07:45,960 tools. 96 00:07:45,960 --> 00:07:51,520 These tools play a critical role in helping analysts understand the structure, behavior 97 00:07:51,600 --> 00:07:54,600 and impact of malicious software. 98 00:07:54,600 --> 00:08:00,760 Whether the goal is to reverse engineer the code or observe how malware behaves in a 99 00:08:00,760 --> 00:08:05,280 controlled environment, having the right tools makes the process more efficient and 100 00:08:05,280 --> 00:08:06,280 accurate. 101 00:08:06,280 --> 00:08:11,520 Let's take a look at some of the most widely used and effective tools in the field. 102 00:08:11,520 --> 00:08:16,280 One of the leading tools in malware analysis today is Ghidra. 103 00:08:16,280 --> 00:08:22,440 Developed by the National Security Agency, the NSA, Ghidra is a powerful open-source 104 00:08:22,440 --> 00:08:27,880 reverse engineering tool designed to analyze compiled code. 105 00:08:27,880 --> 00:08:35,040 It supports a broad range of architectures and executable formats, making it suitable 106 00:08:35,040 --> 00:08:37,840 for analyzing diverse types of malware. 107 00:08:37,840 --> 00:08:43,160 With features like disassembly, decompilation and integrated debugging, 108 00:08:43,160 --> 00:08:50,880 Ghidra allows analysts to work within an intuitive interface while performing both static 109 00:08:50,880 --> 00:08:54,160 and dynamic analysis. 110 00:08:54,160 --> 00:09:00,480 Its collaborative features and the extensibility also make it a favorite among security 111 00:09:00,480 --> 00:09:02,280 researchers. 112 00:09:02,280 --> 00:09:09,600 Another widely respected tool is called IDA Pro, or the IDA Free, is a commercial 113 00:09:09,600 --> 00:09:16,200 disassembler and debugger often considered the gold standard in reverse engineering. 114 00:09:16,200 --> 00:09:23,120 IDA transforms complex machine code into human readable assembly, giving analysts 115 00:09:23,120 --> 00:09:26,840 deep visibility into how malware functions. 116 00:09:26,840 --> 00:09:33,400 It also includes debugging capabilities that let researchers interact with and monitor 117 00:09:33,400 --> 00:09:35,880 the malware in real time. 118 00:09:35,880 --> 00:09:43,520 For static analysis of Windows malware specifically, PE Studio is a go-to solution. 119 00:09:43,520 --> 00:09:53,800 This tool examines Portable Executables, that's why PE came in the name, without executing 120 00:09:53,800 --> 00:09:54,800 them. 121 00:09:54,800 --> 00:10:00,160 So it's a static analysis offering insights into suspicious elements such as section 122 00:10:00,160 --> 00:10:06,000 names, imported functions, dependencies and embedded resources. 123 00:10:06,000 --> 00:10:13,160 PE Studio is especially useful for quickly flagging red flags and identifying 124 00:10:13,160 --> 00:10:18,600 potentially malicious behavior within the Windows binaries. 125 00:10:18,600 --> 00:10:20,840 So let's see some other tools. 126 00:10:20,840 --> 00:10:27,480 Cuckoo Sandbox is a powerful automated malware analysis system that enables researchers 127 00:10:27,480 --> 00:10:32,240 to execute suspicious files within a secure isolated environment. 128 00:10:32,240 --> 00:10:38,120 This tool provides deep insights into the behavior of potentially harmful software by 129 00:10:38,120 --> 00:10:44,040 monitoring and reporting on file system activity, network communications and system 130 00:10:44,040 --> 00:10:45,040 calls. 131 00:10:45,040 --> 00:10:51,560 It's especially effective for dynamic analysis, allowing analysts to gather how newly 132 00:10:51,560 --> 00:10:55,720 discovered or unknown malware operates in real time. 133 00:10:55,720 --> 00:11:02,440 We have seen Ghidra by using Ghidra to decompile the code, the uncover a hidden function that 134 00:11:02,440 --> 00:11:07,240 establishes a connection to a remote server and launches a command line interface, for 135 00:11:07,240 --> 00:11:08,240 example. 136 00:11:08,240 --> 00:11:14,460 IDA, we have seen that also it's for carefully inspecting the code, the analyst 137 00:11:14,460 --> 00:11:19,400 identifies the algorithms that has been used and the functions. 138 00:11:19,960 --> 00:11:27,280 PE Studio, quickly it's very good for executable files to analyze and returning to 139 00:11:27,280 --> 00:11:32,200 Cuckoo Sandbox, consider a situation for example where a security analyst receives 140 00:11:32,200 --> 00:11:37,000 warnings about malicious email attachments, they employ Cuckoo, let's say Cuckoo 141 00:11:37,000 --> 00:11:39,000 Sandbox to safely execute. 142 00:11:39,000 --> 00:11:45,800 So it's about execution, it actually executes the malicious payload in a safe environment 143 00:11:45,800 --> 00:11:49,320 and monitors the files in the virtual environment. 144 00:11:49,320 --> 00:11:53,960 The results reveal that the attachments attempt to download multiple malicious 145 00:11:53,960 --> 00:11:58,360 components, including a key logger and a remote access tool. 146 00:11:58,360 --> 00:12:03,560 Armed with this intelligence, the team swiftly quarantines the affected 147 00:12:03,560 --> 00:12:07,800 machines and implements a targeted patch to safeguard the network for 148 00:12:07,800 --> 00:12:10,800 similar threats. 149 00:12:10,800 --> 00:12:15,640 Another important tool is called the VirusTotal for static analysis, so again 150 00:12:15,640 --> 00:12:21,400 we'll try to find out most of the behavior, the malicious behavior that the file is, 151 00:12:21,400 --> 00:12:24,280 along with other information. 152 00:12:24,280 --> 00:12:29,960 It's a tool, it's a web component tool, it's easy to upload and load the 153 00:12:29,960 --> 00:12:34,600 binaries and see if it's malicious, so it's a very good starting point. 154 00:12:35,480 --> 00:12:39,800 However, if you want to do more static analysis, you have to do the 155 00:12:39,880 --> 00:12:46,840 decompile and go with IDA or a PE Studio in order to find out more information. 156 00:12:46,840 --> 00:12:51,960 Static analysis overall is a fundamental technique in malware analysis that allows 157 00:12:51,960 --> 00:12:57,160 to examine the internal structure and characteristics of a file 158 00:12:57,160 --> 00:13:00,760 without the risk of executing, so that's the difference between static 159 00:13:00,760 --> 00:13:03,880 analysis and dynamic analysis. 160 00:13:03,880 --> 00:13:08,600 The malware code, the behavior patterns, the potential impact, all of them 161 00:13:08,600 --> 00:13:14,440 can be seen in the static analysis, however in dynamic analysis 162 00:13:14,440 --> 00:13:20,760 the execution will be done and we can be identified better and more securely 163 00:13:20,760 --> 00:13:23,560 what is happening on the background. 164 00:13:23,560 --> 00:13:28,040 One of the most common static analysis practices is verifying the file 165 00:13:28,040 --> 00:13:36,280 hash values such as md5 or sha256, so VirusTotal or other 166 00:13:36,280 --> 00:13:42,040 antiviruses, first they see the hash value of the malware and if this 167 00:13:42,040 --> 00:13:47,000 hash value is similar to whatever on the libraries on the database has been in 168 00:13:47,000 --> 00:13:50,760 the past, then they classify that this is a virus. 169 00:13:50,760 --> 00:13:55,400 These cryptographic fingerprints serve as unique identifiers for files and 170 00:13:55,400 --> 00:14:00,520 are especially useful when checking if a file has already been catalogued 171 00:14:00,520 --> 00:14:04,600 on a malware database. For instance, using a simple command 172 00:14:04,600 --> 00:14:12,840 like sha256sum and then the file or md5sum and the file in Linux terminal 173 00:14:12,840 --> 00:14:16,360 you can generate a hash value of this file. 174 00:14:16,360 --> 00:14:20,440 This can be then cross-referenced with normal malware repositories to 175 00:14:20,440 --> 00:14:23,640 determine if the file has been recognized 176 00:14:23,640 --> 00:14:28,920 malicious signature. This hash comparison technique not only speeds up 177 00:14:28,920 --> 00:14:33,240 initial triage but also helps ensure consistency across 178 00:14:33,240 --> 00:14:39,000 investigations. If a match is found the analyst may quickly access 179 00:14:39,000 --> 00:14:44,360 prior analysis reports, remediation guidance or indicators of compromise, 180 00:14:44,360 --> 00:14:49,320 all of them together automatically because has been recorded in the past. 181 00:14:49,320 --> 00:14:56,280 Even if no match is found the hash value still serves as a reliable 182 00:14:56,280 --> 00:15:02,040 reference point for future tracking. As the first step in static analysis 183 00:15:02,040 --> 00:15:06,360 generating and checking hashes lays the groundwork for deeper 184 00:15:06,360 --> 00:15:10,520 code level investigation using tools like PE Studio, 185 00:15:10,520 --> 00:15:14,840 Ghidra or IDA. 186 00:15:15,000 --> 00:15:19,240 Another essential static analysis technique involves inspecting strings 187 00:15:19,240 --> 00:15:23,080 inside the binary using the strings command. 188 00:15:23,080 --> 00:15:27,000 This tool extracts all printable ASCII 189 00:15:27,000 --> 00:15:31,400 and Unicode text found within a malware sample 190 00:15:31,480 --> 00:15:36,440 offering a non-intrusive way to gather clues about its inner workings. 191 00:15:36,440 --> 00:15:42,360 The output often reveals hard-coded URLs, IP addresses, suspicious 192 00:15:42,360 --> 00:15:46,920 commands, error commands, error messages or even 193 00:15:46,920 --> 00:15:51,000 embedded credentials, information that can hint 194 00:15:51,000 --> 00:15:55,800 at that malware purpose or point to its command and control infrastructure. 195 00:15:55,800 --> 00:16:01,000 So more information about how this malware interacts with other 196 00:16:01,000 --> 00:16:06,840 systems or functions. For example, by running strings, the command 197 00:16:06,840 --> 00:16:10,440 strings and then the malware sample or a binary file, 198 00:16:10,440 --> 00:16:16,920 an analyst might uncover entries like www, maliciousdomain.com, 199 00:16:16,920 --> 00:16:20,680 bitcoinaddress.com or whatever, 200 00:16:20,760 --> 00:16:26,760 admin password credentials, connect to the server like a function 201 00:16:26,760 --> 00:16:33,400 that connects to a server or infiltrate or set up an open window 202 00:16:33,400 --> 00:16:37,880 which suggests attempts of unauthorized access or remote communication. 203 00:16:37,880 --> 00:16:44,840 So readable strings, ASCII text can be present a lot of information 204 00:16:44,840 --> 00:16:49,080 about the binary. Equally important is the analysis of 205 00:16:49,080 --> 00:16:54,440 file headers which provides deeper insight into the executable structure 206 00:16:54,440 --> 00:16:59,560 and behavior for Windows malware. Tools like PE Studio 207 00:16:59,560 --> 00:17:05,240 offers an intuitive interface to examine the portable execution 208 00:17:05,240 --> 00:17:09,080 format, highlighting anomalies in sections, imports, 209 00:17:09,080 --> 00:17:13,560 exports and other critical attributes. There is another tool called 210 00:17:13,560 --> 00:17:17,000 Dependency Walker that you can retrieve actually the 211 00:17:17,000 --> 00:17:20,920 dependencies of the malware of the binary 212 00:17:20,920 --> 00:17:26,440 with other functions and so on. On Unix or Linux systems, utilities like 213 00:17:26,440 --> 00:17:32,200 objdump, object dump can be used also to extract and review header 214 00:17:32,200 --> 00:17:35,480 information such as the program's entry point, 215 00:17:35,480 --> 00:17:41,320 section layout and linked binaries. These details not only help in 216 00:17:41,320 --> 00:17:44,360 identifying the malware's target platform and 217 00:17:44,360 --> 00:17:47,960 capabilities but also serve as indicators of 218 00:17:47,960 --> 00:17:51,640 obfuscation or patching techniques used to evade 219 00:17:51,640 --> 00:17:58,360 to evade the detection. To begin analyzing a suspicious executable 220 00:17:58,360 --> 00:18:03,560 we open the file in PE Studio. This tool provides a quick overview of the 221 00:18:03,560 --> 00:18:08,600 file structure including its section names, imported libraries 222 00:18:08,600 --> 00:18:13,000 and other key metadata. For instance, typical imports 223 00:18:13,000 --> 00:18:20,680 might include kernel32.dll or user32.dll and common sections like 224 00:18:20,680 --> 00:18:26,600 .text, .data and .rdata offer insights into where code and data 225 00:18:26,600 --> 00:18:30,280 reside within the binary. For Linux binaries, similar 226 00:18:30,280 --> 00:18:34,600 information can be retrieved using the object dump command, 227 00:18:34,600 --> 00:18:40,280 executing objdump minus x and then the file, 228 00:18:40,280 --> 00:18:43,720 reveals the binary headers and structural properties, 229 00:18:43,720 --> 00:18:49,560 offering a comparable view into how the file is constructed at a lower level. 230 00:18:49,560 --> 00:18:55,720 Next we move to disassembling the code using tools like Ghidra or IDA. 231 00:18:55,720 --> 00:18:59,960 Disassembly is a critical step in understanding how the malware's 232 00:18:59,960 --> 00:19:06,040 software behaves as it translates raw machine code into human readable 233 00:19:06,040 --> 00:19:11,080 assembly instructions. This allows analysts to trace 234 00:19:11,080 --> 00:19:17,000 execution flow, examine function logic and detect malicious behaviors embedded 235 00:19:17,000 --> 00:19:20,600 in the code. With Ghidra we simply open the malware 236 00:19:20,600 --> 00:19:24,440 sample and the tool automatically disassembles the binary, 237 00:19:24,440 --> 00:19:27,400 presenting the assembly instructions alongside 238 00:19:27,400 --> 00:19:31,000 a user-friendly interface for navigation and 239 00:19:31,080 --> 00:19:36,440 annotation. Similarly, in IDA, loading the executable 240 00:19:36,440 --> 00:19:42,840 initiates an in-depth analysis that produces an interactive disassembly flow, 241 00:19:42,840 --> 00:19:46,680 highlighting functions, control structures and code 242 00:19:46,680 --> 00:19:50,600 references of the binary. A typical disassembled 243 00:19:50,600 --> 00:19:54,200 output might include instructions such as 244 00:19:54,200 --> 00:20:00,920 MOV EAX, EBX, followed by a CALL in a hexadecimal 245 00:20:00,920 --> 00:20:08,920 system or a decimal, showing how data is moved and which functions are invoked. 246 00:20:08,920 --> 00:20:13,240 Clues that can help reverse engineers to understand 247 00:20:13,240 --> 00:20:17,080 the intent and capabilities of the malware. 248 00:20:17,080 --> 00:20:23,320 To start analyzing a malware sample we open in PE Studio as an alternative. 249 00:20:23,320 --> 00:20:26,440 Once the file is loaded the tool immediately 250 00:20:26,440 --> 00:20:29,880 presents a detailed view of the executables metadata. 251 00:20:29,880 --> 00:20:34,920 This includes structural elements like section names, imported libraries 252 00:20:34,920 --> 00:20:39,160 and indicators of potential malicious behaviors such as whether the file is 253 00:20:39,160 --> 00:20:43,800 packed or uses suspicious API functions. 254 00:20:43,800 --> 00:20:50,120 Pay special attention to unusual imports, especially networking 255 00:20:50,120 --> 00:20:54,760 libraries. This may suggest that the malware is designed to communicate with 256 00:20:54,760 --> 00:21:00,200 another remote server, a hallmark of a command and control activity. 257 00:21:00,200 --> 00:21:04,840 In addition to structural analysis we can extract human readable content 258 00:21:04,840 --> 00:21:08,760 from the malware using the strings utility as we explained. 259 00:21:08,760 --> 00:21:12,600 This tool scans the binary for ASCII or Unicode 260 00:21:12,600 --> 00:21:17,880 text which can include hardcoded URLs, IP addresses, credentials or error 261 00:21:17,880 --> 00:21:21,800 messages. These strings often provide critical clues 262 00:21:21,800 --> 00:21:26,120 about the malware's behavior, infrastructure or purpose. 263 00:21:26,120 --> 00:21:29,640 The command is simple you run as strings and then the binary 264 00:21:29,640 --> 00:21:33,320 and then for example the output by reveal something like 265 00:21:33,320 --> 00:21:39,160 a URL or a password equals to something, telephone numbers, 266 00:21:39,160 --> 00:21:43,640 bitcoin wallets or whatever. Such discoveries can 267 00:21:43,640 --> 00:21:46,760 lead to identifying a command and control server or 268 00:21:46,760 --> 00:21:51,640 understanding how the malware attempts to authenticate or propagate. 269 00:21:51,640 --> 00:21:55,880 Together all of them tools like PE studio, strings 270 00:21:55,880 --> 00:21:59,320 and the others offer a fast and effective first look 271 00:21:59,320 --> 00:22:03,160 into an unknown binary, laying the foundation for 272 00:22:03,160 --> 00:22:10,360 deeper static or dynamic analysis. Dynamic analysis is an essential step 273 00:22:10,360 --> 00:22:15,080 in the malware investigation process, providing real-time insights into how 274 00:22:15,160 --> 00:22:20,760 a special file behaves when executed. Unlike static analysis which 275 00:22:20,760 --> 00:22:26,360 inspects a file without running it, dynamic analysis allows analysts to 276 00:22:26,360 --> 00:22:31,400 observe the malware's behavior as it interacts with the operating system, 277 00:22:31,400 --> 00:22:35,720 file system, network and other system resources. 278 00:22:35,720 --> 00:22:39,560 This type of analysis can uncover hidden actions 279 00:22:39,560 --> 00:22:43,000 such as attempts to alter system files, 280 00:22:43,000 --> 00:22:48,120 initiate network communications or even establish factors for remote control, 281 00:22:48,120 --> 00:22:53,320 helping investigators the full scope of the threat to understand it. 282 00:22:53,320 --> 00:22:58,520 Setting up a full control environment for dynamic analysis is crucial for 283 00:22:58,520 --> 00:23:02,360 ensuring that the malware does not cause any damage to the primary system 284 00:23:02,360 --> 00:23:07,160 or spread to the other devices. One of the most effective ways to 285 00:23:07,160 --> 00:23:11,400 accomplish this is by using a virtual machine, a VM. 286 00:23:11,480 --> 00:23:16,600 A VM provides an isolated environment in which malware can be executed safely, 287 00:23:16,600 --> 00:23:19,960 allowing analysts to observe its behavior 288 00:23:19,960 --> 00:23:23,320 without risking the integrity of the host machine. 289 00:23:23,320 --> 00:23:29,080 VirtualBox or VMware are common used platforms for creating VMs. 290 00:23:29,080 --> 00:23:35,560 In Linux there is KVM and they allow researchers to create a sandbox 291 00:23:35,560 --> 00:23:39,800 environment with a specified operating system that closely mirrors 292 00:23:39,800 --> 00:23:45,960 to the target it by the machine. By doing so researchers can run the malware 293 00:23:45,960 --> 00:23:50,120 in a controlled setting simulating the environment where the attack is likely 294 00:23:50,120 --> 00:23:56,040 to occur, for example a Windows 7, a Windows 10 or a Windows 11 system. 295 00:23:56,040 --> 00:23:59,800 To ensure that the malware remains contained and that does not spread to 296 00:23:59,800 --> 00:24:04,200 the other machines or system it's important to configure 297 00:24:04,200 --> 00:24:07,960 the network settings of the VM for isolation, to not 298 00:24:07,960 --> 00:24:12,840 have it as a bridge mode. Also it's better to have the latest addition 299 00:24:12,840 --> 00:24:15,960 of VirtualBox just in case because there are 300 00:24:15,960 --> 00:24:20,920 vulnerabilities in the older versions and isolation might break. 301 00:24:20,920 --> 00:24:26,280 This can be achieved by setting up the VM with the host only adapter 302 00:24:26,280 --> 00:24:30,440 or internal network configuration on the network interfaces 303 00:24:30,440 --> 00:24:34,680 which connects the VM from the external internet while still allowing 304 00:24:34,680 --> 00:24:37,960 interaction between the virtual machine and the host. 305 00:24:37,960 --> 00:24:42,360 This setup prevents the malware from communicating with external servers 306 00:24:42,360 --> 00:24:47,160 or the local machine or exfiltrating sensitive data while still allowing 307 00:24:47,160 --> 00:24:51,320 the malware to execute and perform it's intended actions within 308 00:24:51,320 --> 00:24:55,960 the isolated environment. This ensures that analysts can observe 309 00:24:55,960 --> 00:25:00,600 the full extent of the malware behavior including the network 310 00:25:00,600 --> 00:25:04,520 requests. They might use also Wireshark in order to 311 00:25:04,520 --> 00:25:09,640 investigate network requests that the malware does in other systems. 312 00:25:09,640 --> 00:25:15,000 System file modifications and other potential harmful actions 313 00:25:15,000 --> 00:25:19,800 all while keeping the actual system safe from compromise. 314 00:25:19,800 --> 00:25:23,800 In addition to setting up the isolated VM environment it's crucial to 315 00:25:23,800 --> 00:25:27,160 employ monitoring tools to track the malware's activity 316 00:25:27,160 --> 00:25:32,280 as we told Wireshark. Tools like the Wireshark can be used to capture the 317 00:25:32,280 --> 00:25:36,760 network traffic while Process Explorer or a Procmon 318 00:25:36,760 --> 00:25:41,800 from Sysinternals can provide visibility into the processes and file system 319 00:25:41,800 --> 00:25:46,280 activity initiated by the malware. These tools allow 320 00:25:46,280 --> 00:25:49,800 analysts to identify Indicators of Compromise 321 00:25:49,800 --> 00:25:53,560 or as we call it IOCs which are very important 322 00:25:53,560 --> 00:25:58,280 for threat intelligence such as unexpected network connections 323 00:25:58,280 --> 00:26:02,920 or suspicious file modifications giving them a deeper understanding of the 324 00:26:02,920 --> 00:26:06,840 malware capabilities and objectives. By combining 325 00:26:06,840 --> 00:26:11,400 dynamic analysis with a secure isolated setup 326 00:26:11,400 --> 00:26:15,000 cybersecurity professionals can identify the full range of 327 00:26:15,000 --> 00:26:19,160 malware behavior and develop appropriate counter measures or 328 00:26:19,160 --> 00:26:25,880 analyze or finding any kill chain of the malware 329 00:26:25,880 --> 00:26:32,280 or kill switch to disable the malware if it's possible. 330 00:26:32,280 --> 00:26:37,400 So in dynamic analysis one as the malware sample is executed within a 331 00:26:37,400 --> 00:26:41,560 virtual machine it's critical to monitor the system changes to understand 332 00:26:41,560 --> 00:26:45,560 the impact of the malware on the environment. 333 00:26:45,560 --> 00:26:49,400 These changes can include file system modifications 334 00:26:49,400 --> 00:26:55,080 such as the creation or deletion of files, registry edits such as added or 335 00:26:55,080 --> 00:27:00,920 altered keys and values and broader system configuration changes that 336 00:27:00,920 --> 00:27:04,920 might indicate persistence or privilege escalation. 337 00:27:04,920 --> 00:27:08,840 To capture this activity in real time we can use Procmon 338 00:27:08,840 --> 00:27:13,000 short process for a Process Monitor. This 339 00:27:13,000 --> 00:27:20,200 powerful tool from Sysinternals allows us to track low-level system events 340 00:27:20,200 --> 00:27:23,880 including file access, registry modifications 341 00:27:23,880 --> 00:27:27,960 and the process operations all of which are essential for analyzing the 342 00:27:27,960 --> 00:27:31,560 malware behavior. To run Procmon and log these events 343 00:27:31,560 --> 00:27:35,800 to a file we can use the command Procmon 344 00:27:35,800 --> 00:27:41,080 -BackingFile and then the log file. As the malware runs Procmon captures a 345 00:27:41,080 --> 00:27:45,080 live stream of system activities for example under the file system 346 00:27:45,080 --> 00:27:50,520 activity we might see indicators like CreateFile 347 00:27:50,520 --> 00:27:54,360 and a path name, WriteFile and a path name. 348 00:27:54,360 --> 00:28:01,400 This means that this binary creates a file or writes a 349 00:28:01,400 --> 00:28:05,640 file and so on. For registry changes you might 350 00:28:05,640 --> 00:28:08,680 observe a RegSetValue and then the 351 00:28:08,680 --> 00:28:14,040 path name of the registry value. These types of entries such as the malware is 352 00:28:14,040 --> 00:28:17,800 not only writing new files but also attempting to establish 353 00:28:17,800 --> 00:28:22,440 persistence by modifying startup registry keys. 354 00:28:22,440 --> 00:28:28,120 You can see it's changing the registry value on Microsoft Windows 355 00:28:28,120 --> 00:28:33,400 CurrentVersion slash Run where where you put slash Run it's like 356 00:28:33,400 --> 00:28:37,160 automatically running on the start when the windows start. 357 00:28:37,240 --> 00:28:42,440 Identifying such behavior helps analysts understand the full life cycle of the 358 00:28:42,440 --> 00:28:48,280 malware including how it embeds itself within the system. 359 00:28:48,280 --> 00:28:52,680 In dynamic analysis by observing the network behavior of the malware 360 00:28:52,680 --> 00:28:55,800 analysts can detect malicious communications 361 00:28:55,800 --> 00:28:59,960 uncover the malware's objectives and gather evidence to help stop 362 00:28:59,960 --> 00:29:04,040 further attacks. Wireshark is one of the most widely used 363 00:29:04,040 --> 00:29:08,680 tools for this task. It allows security analysts to capture and 364 00:29:08,680 --> 00:29:13,160 inspect real-time network traffic. By setting up Wireshark within a 365 00:29:13,160 --> 00:29:17,560 virtual machine that's isolated from the host and external networks 366 00:29:17,560 --> 00:29:22,200 analysts can track all network interactions initiated by the malware 367 00:29:22,200 --> 00:29:25,240 without the risk of spreading in other systems. 368 00:29:25,240 --> 00:29:30,600 Once Wireshark is running analysts begin to capture the session on the VM 369 00:29:30,600 --> 00:29:34,840 the virtual network interface isolating it from the internet. 370 00:29:34,840 --> 00:29:39,400 The tool captures all packets sent and received by the VM 371 00:29:39,400 --> 00:29:43,160 including any malicious requests to external servers. 372 00:29:43,160 --> 00:29:46,840 For example if the malware tries to download additional payloads 373 00:29:46,840 --> 00:29:52,120 or upload stolen data these HTTP requests or other network protocols 374 00:29:52,120 --> 00:29:57,240 will appear in Wireshark's capture logs. The captured data might show 375 00:29:57,240 --> 00:30:03,720 things like GET malicious payload or POST methods post upload data 376 00:30:03,720 --> 00:30:06,600 indicating the malware is fetching additional code 377 00:30:06,600 --> 00:30:12,120 or sending out stolen information. By analyzing the captured network traffic 378 00:30:12,120 --> 00:30:16,440 analysts can identify patterns which is very important including the 379 00:30:16,440 --> 00:30:19,800 domains IP addresses that the malware is 380 00:30:19,800 --> 00:30:24,600 connecting and communication protocols that were used by the malware. 381 00:30:24,600 --> 00:30:28,520 These indicators can be used to block future connections to the command and 382 00:30:28,520 --> 00:30:31,800 control server using a firewall for example 383 00:30:31,800 --> 00:30:36,440 prevent further data exfiltration and assist in identifying 384 00:30:36,440 --> 00:30:41,160 other compromised systems. This network monitoring is essential and very 385 00:30:41,160 --> 00:30:44,840 important for gaining a comprehensive understanding 386 00:30:44,840 --> 00:30:49,160 of the malware network behavior during the execution 387 00:30:49,160 --> 00:30:52,920 and for helping to prevent future infections. 388 00:30:52,920 --> 00:30:57,400 So as we can see dynamic malware analysis is a crucial 389 00:30:57,400 --> 00:31:01,800 process that allows analysts to observe a suspicious file the behavior in 390 00:31:01,800 --> 00:31:05,720 real time. Cuckoo Sandbox provides a controlled and 391 00:31:05,720 --> 00:31:09,480 isolated environment like an automated way to do the dynamic 392 00:31:09,480 --> 00:31:13,080 analysis to safely execute malware 393 00:31:13,080 --> 00:31:17,080 samples ensuring that they can be studied without causing harm to the 394 00:31:17,080 --> 00:31:19,640 system. To get started you first need to 395 00:31:19,640 --> 00:31:24,840 set up a Cuckoo Sandbox this involves installing Cuckoo on your 396 00:31:24,840 --> 00:31:30,280 machine or another machine or a VM and configuring within a 397 00:31:30,280 --> 00:31:33,720 virtual environment like a VirtualBox or VMware. 398 00:31:33,720 --> 00:31:37,960 The malware would be executed inside the VM which is an isolated system that 399 00:31:37,960 --> 00:31:44,120 mimics the target operating system. This VM is connected to Cuckoo allowing 400 00:31:44,120 --> 00:31:48,680 the tool to monitor the malware behavior and actions during the execution. 401 00:31:48,680 --> 00:31:53,080 Next the malware sample is uploaded into the Cuckoo interface. 402 00:31:53,080 --> 00:31:56,600 Cuckoo then takes a snapshot of the VM environment 403 00:31:56,600 --> 00:32:01,080 providing a clean starting point for the analysis. 404 00:32:01,080 --> 00:32:05,480 Once the malware begins to execution Cuckoo Sandbox continuously monitors a 405 00:32:05,480 --> 00:32:08,840 variety of key actions to track the malware behavior 406 00:32:08,840 --> 00:32:13,800 just like you do manually using Wireshark. The first area of monitoring 407 00:32:13,800 --> 00:32:19,160 is file system changes. Cuckoo tracks any new files, modifications or 408 00:32:19,160 --> 00:32:23,800 deletions that the malware attempts. This can indicate if the malware is trying 409 00:32:23,800 --> 00:32:28,520 to install additional components or delete important system files. 410 00:32:28,520 --> 00:32:33,160 For windows-based malware Cuckoo also tracks registry changes. 411 00:32:33,160 --> 00:32:39,000 It looks for any new registry entries or modifications made by the malware. 412 00:32:39,000 --> 00:32:42,360 These changes are often made to ensure the malware 413 00:32:42,360 --> 00:32:46,920 persists are loaded across reboots or is able for example to launch 414 00:32:46,920 --> 00:32:51,240 automatically when the system starts. It can be also to 415 00:32:51,240 --> 00:32:55,400 disable the firewall or disable the defender changing the registry value 416 00:32:55,400 --> 00:32:59,080 for example. Another key aspect of monitoring is 417 00:32:59,080 --> 00:33:03,320 process activity. Cuckoo Sandbox keeps an eye on the 418 00:33:03,320 --> 00:33:08,920 processes running like Procmon in the VM checking for any new processes 419 00:33:09,000 --> 00:33:13,160 initiated by the malware. This could be an indication that malware 420 00:33:13,160 --> 00:33:19,560 is attempting to run additional malicious code or carry out harmful actions. 421 00:33:19,560 --> 00:33:23,000 Perhaps the most critical aspect of dynamic analysis 422 00:33:23,000 --> 00:33:27,240 is the network activity that we mentioned before. Cuckoo monitors any 423 00:33:27,240 --> 00:33:30,600 outbound connections the malware attempts to 424 00:33:30,600 --> 00:33:34,200 establish, especially command and control servers. 425 00:33:34,200 --> 00:33:37,640 This can reveal whether the malware is trying to communicate 426 00:33:37,640 --> 00:33:41,800 with remote servers, exfiltrate data or download 427 00:33:41,800 --> 00:33:46,680 additional malicious payloads. Once the malware has finished executing 428 00:33:46,680 --> 00:33:51,480 Cuckoo generates a detailed report. This report includes all the tracked 429 00:33:51,480 --> 00:33:55,640 activities providing analysts with valuable insights into the malware 430 00:33:55,640 --> 00:33:59,400 behavior and helping them develop defenses or 431 00:33:59,400 --> 00:34:05,080 understand malware better in order to prevent future attacks. 432 00:34:05,080 --> 00:34:08,600 When executing malware sampling Cuckoo Sandbox one of the most 433 00:34:08,600 --> 00:34:12,520 insightful aspects of the analysis is the ability to observe 434 00:34:12,520 --> 00:34:16,680 file system changes and network activity in a controlled isolated 435 00:34:16,680 --> 00:34:20,360 environment. Cuckoo acts as an automated 436 00:34:20,360 --> 00:34:24,040 sandbox that monitors the behavior of the malware in 437 00:34:24,040 --> 00:34:27,800 real time allowing analysts to understand its full scope without 438 00:34:27,800 --> 00:34:31,960 compromising the system. The key component of this 439 00:34:31,960 --> 00:34:37,080 behavioral analysis is identifying how the malware interacts with the 440 00:34:37,080 --> 00:34:41,160 file system. Cuckoo provides detailed logs or newly 441 00:34:41,160 --> 00:34:46,680 created, modified or deleted files. For example, when malware is executed 442 00:34:46,680 --> 00:34:49,640 it might create new files such as configuration files, 443 00:34:49,640 --> 00:34:53,880 dropped payloads or temporary logged files. 444 00:34:53,880 --> 00:34:58,120 These new files can serve different purposes some maybe necessary for 445 00:34:58,120 --> 00:35:01,160 maintaining persistence while others might contain stolen 446 00:35:01,160 --> 00:35:05,800 data or command instructions. In addition to file creation, malware 447 00:35:05,800 --> 00:35:11,160 often modifies existing system files. This can include replacing or altering 448 00:35:11,160 --> 00:35:15,720 legitimate executables with malicious versions, a common tactic 449 00:35:15,720 --> 00:35:20,600 used to hijack system functionality. For instance, Cuckoo might report that the 450 00:35:20,600 --> 00:35:25,800 core system executable like cmd.exe 451 00:35:25,800 --> 00:35:29,960 has been altered an indication that the malware is attempting to subvert 452 00:35:29,960 --> 00:35:34,760 or gain control of built-in Windows utilities like the command line. 453 00:35:34,760 --> 00:35:38,520 Modifications like these are strong indicators of compromise 454 00:35:38,520 --> 00:35:41,800 and may suggest an attempt to escalate privileges or evade 455 00:35:41,800 --> 00:35:46,200 detection. The third common behavior is file deletion. 456 00:35:46,200 --> 00:35:51,320 Malware may delete specific system or log files to hide this activity, 457 00:35:51,320 --> 00:35:54,680 remove evidence or disable security software. 458 00:35:54,680 --> 00:35:58,520 This tactic helps ensure its activity, 459 00:35:58,600 --> 00:36:03,000 remove evidence or disable the software. 460 00:36:03,000 --> 00:36:07,640 These malicious actions remain undetected for as long as possible. 461 00:36:07,640 --> 00:36:12,840 Tracking such deletions through the sandbox reporting system 462 00:36:12,840 --> 00:36:17,160 can be vital for forensic reconstruction and if these 463 00:36:17,160 --> 00:36:22,680 logs and files are deleted the infection timeline might be lost. 464 00:36:22,680 --> 00:36:26,520 Here is a simplified example from a Cuckoo report. 465 00:36:26,520 --> 00:36:31,880 It's creating files so the malware is creating a malicious file.exe 466 00:36:31,880 --> 00:36:35,320 and when malicious payload.dll, of course these 467 00:36:35,320 --> 00:36:39,560 are just examples. The normal files will have a generic name like 468 00:36:39,560 --> 00:36:45,480 chrome.exe or firefox.exe or whatever but it's normal. 469 00:36:45,480 --> 00:36:49,320 It's modified the file cmd suspected of being 470 00:36:49,320 --> 00:36:54,040 hijacked. By analyzing the changes security analysts can map out the 471 00:36:54,040 --> 00:36:57,800 malware behavior. The indicators of compromise 472 00:36:57,800 --> 00:37:02,360 at this case are the behavior that we saw before. 473 00:37:02,360 --> 00:37:07,320 In combination with file system analysis the sandbox tracks the network 474 00:37:07,320 --> 00:37:10,600 communications and provides all the details to the 475 00:37:10,600 --> 00:37:15,240 analysts. Monitoring the network requests provides further evidence of 476 00:37:15,240 --> 00:37:18,440 the malware intended capabilities and it's important 477 00:37:18,440 --> 00:37:23,960 to combine every data together and extract the indicators of compromise. 478 00:37:24,920 --> 00:37:30,200 So YARA is a powerful tool used for identifying and detecting malware by 479 00:37:30,200 --> 00:37:34,120 creating custom rules that focus on specific patterns. 480 00:37:34,120 --> 00:37:37,960 These patterns can include file signatures, byte sequences or 481 00:37:37,960 --> 00:37:40,680 regular expressions which makes YARA and the 482 00:37:40,680 --> 00:37:43,960 indispensable tool in analyzing suspicious files 483 00:37:43,960 --> 00:37:48,360 and conducting thorough threat hunting. It's particularly valuable for 484 00:37:48,360 --> 00:37:51,800 researchers and responders engaged in real-time malware 485 00:37:51,800 --> 00:37:55,960 investigations as it allows for precise and effective 486 00:37:55,960 --> 00:38:01,880 identifications of malicious files. One of the YARA's key strategies lies in the 487 00:38:01,880 --> 00:38:06,200 signature-based detection where rules are created based on 488 00:38:06,200 --> 00:38:10,600 well-known malware signatures meaning byte sequences 489 00:38:10,600 --> 00:38:14,840 or strings that point to the presence of malicious content. 490 00:38:14,840 --> 00:38:19,000 These patterns can be symboled like a particular sequence of bytes 491 00:38:19,000 --> 00:38:24,440 found in a piece of malware or more complex combination of patterns. 492 00:38:24,440 --> 00:38:29,960 By using these rules analysts can quickly identify malware that matches 493 00:38:29,960 --> 00:38:35,000 specific known signatures, aiding in swift detection. 494 00:38:35,000 --> 00:38:38,680 In addition to its signature-based detection capabilities YARA offers 495 00:38:38,680 --> 00:38:43,960 remarkable flexibility. Users can customize their rules 496 00:38:43,960 --> 00:38:49,160 by leveraging logical operators, regular expressions and specific 497 00:38:49,160 --> 00:38:53,080 conditions. This allows analysts to create rules 498 00:38:53,080 --> 00:38:56,920 that can detect even the most complex and evolving threats 499 00:38:56,920 --> 00:39:02,520 such as polymorphic malware that alters its code to avoid detection. 500 00:39:02,520 --> 00:39:05,800 YARA's flexibility ensures it can adapt 501 00:39:05,800 --> 00:39:12,280 to new and emerging threats make it a go-to tool for security professionals. 502 00:39:12,280 --> 00:39:18,040 Another significant advantage of YARA is its cross-platform support. 503 00:39:18,040 --> 00:39:22,520 The tool can be used on Linux, Windows or Mac OS 504 00:39:22,520 --> 00:39:27,480 making it versatile for security teams working across different operating 505 00:39:27,480 --> 00:39:31,880 systems. Whether you're analyzing Windows-based executables, 506 00:39:31,880 --> 00:39:36,760 PDF files, documents, Linux malware samples or 507 00:39:36,760 --> 00:39:40,280 investigating network traffic on a Mac OS system 508 00:39:40,280 --> 00:39:44,520 YARA provides a consistent and efficient solution for detecting threats 509 00:39:44,520 --> 00:39:50,120 regardless the environment and the file type. YARA is also highly efficient in 510 00:39:50,120 --> 00:39:54,440 terms of malware identification. It can scan a variety of data sources 511 00:39:54,440 --> 00:39:59,000 including any file, memory dumps, network traffic 512 00:39:59,000 --> 00:40:03,320 to identify malicious patterns. This versatility ensures that it can be 513 00:40:03,320 --> 00:40:07,000 used in various stages of an attack to detect malware 514 00:40:07,000 --> 00:40:12,760 before, during or after the execution, providing an essential tool for monitoring 515 00:40:12,760 --> 00:40:16,840 and mitigating threats across a wide range of attack vectors. 516 00:40:16,840 --> 00:40:20,360 A typical YARA rule consists of several components. 517 00:40:20,360 --> 00:40:24,440 The rule name serves as a unique identifier for each rule 518 00:40:24,440 --> 00:40:29,960 making it easy to reference and apply. The meta information provides 519 00:40:29,960 --> 00:40:33,720 additional context such as a description, author 520 00:40:33,720 --> 00:40:38,280 and the date of creation which helps with rule management. 521 00:40:38,280 --> 00:40:43,240 The string section is where analysts define the specific patterns that 522 00:40:43,240 --> 00:40:48,040 the rule will search for in a file according to the string. 523 00:40:48,040 --> 00:40:51,960 These patterns could be byte sequences also 524 00:40:51,960 --> 00:40:56,840 along with text strings or regular expressions that can indicate 525 00:40:56,840 --> 00:41:01,320 malicious activity. Finally the condition section 526 00:41:01,320 --> 00:41:06,600 defines the logic that determines when the rule should be triggered. 527 00:41:06,600 --> 00:41:11,480 It may specify that certain patterns must appear together 528 00:41:11,480 --> 00:41:15,960 or that specific strings must be found in a file 529 00:41:15,960 --> 00:41:21,400 for the rule to match so having multiple logical controls 530 00:41:21,400 --> 00:41:25,400 and configurations in order to identify 531 00:41:25,480 --> 00:41:28,200 the malware. 532 00:41:28,440 --> 00:41:32,840 YARA is a highly effective tool for automated malware detection especially 533 00:41:32,840 --> 00:41:38,440 when dealing with large volume of files. This is crucial during incident 534 00:41:38,440 --> 00:41:41,480 response where time is for the essence and manual 535 00:41:41,480 --> 00:41:47,160 inspection would be impractical. By creating custom rules tailored to 536 00:41:47,160 --> 00:41:52,200 specific threats, YARA rules allows security teams 537 00:41:52,280 --> 00:41:55,880 to automate the scanning of file set directories, streamlining the 538 00:41:55,880 --> 00:42:01,560 identification of malicious files. This capability helps to quickly 539 00:42:01,560 --> 00:42:05,240 pinpoint suspicious files or artifacts that could indicate a malware 540 00:42:05,240 --> 00:42:09,000 infection, making the YARA rules invaluable 541 00:42:09,000 --> 00:42:13,640 tool in real-time threat detection systems. In addition to file-based 542 00:42:13,640 --> 00:42:18,600 scanning, YARA is also a key tool in memory forensics. 543 00:42:18,600 --> 00:42:22,760 Malware often resides in memory rather than the file system 544 00:42:22,760 --> 00:42:27,000 making it harder to detect using traditional methods. 545 00:42:27,000 --> 00:42:31,320 YARA can scan memory dumps to identify malicious code, 546 00:42:31,320 --> 00:42:36,920 running in volatile memory, allowing analysts to detect threats that might 547 00:42:36,920 --> 00:42:41,720 not appear on the hard drive. Memory forensics is particularly 548 00:42:41,720 --> 00:42:46,360 important in cases of advanced malware that employs techniques like 549 00:42:46,360 --> 00:42:50,680 file-less attacks where no files are dropped onto the disk. 550 00:42:50,680 --> 00:42:55,720 By leveraging YARA rules, analysts can uncover hidden threats in the system's 551 00:42:55,720 --> 00:43:00,760 memory providing an additional layer of detection and mitigation. 552 00:43:00,760 --> 00:43:05,640 Another powerful use of YARA is in performing file integrity checks. 553 00:43:05,640 --> 00:43:09,080 This is especially useful in environments where files may be 554 00:43:09,080 --> 00:43:13,400 altered or replaced by malware to hide its presence or maintain 555 00:43:13,400 --> 00:43:19,160 persistence on the system. YARA can be used to compare files against 556 00:43:19,160 --> 00:43:24,040 known malicious patterns ensuring that the files have not been modified 557 00:43:24,040 --> 00:43:31,720 in ways against the infection. This would be 558 00:43:31,720 --> 00:43:37,480 provide the infection values. This can help detect unauthorized changes to 559 00:43:37,480 --> 00:43:41,080 system files, configuration files or executables 560 00:43:41,080 --> 00:43:45,160 for identifying compromised systems. By continuously 561 00:43:45,160 --> 00:43:49,800 running YARA rules in the background, security teams can maintain a proactive 562 00:43:49,800 --> 00:43:54,200 defense against malware that tries to stealthily 563 00:43:54,200 --> 00:44:01,240 alter or replace legitimate files. In this YARA rule, the meta section provides 564 00:44:01,240 --> 00:44:06,120 essential metadata about the rule. This includes a description that explains 565 00:44:06,120 --> 00:44:09,800 the rule's purpose, for example detects malware 566 00:44:09,880 --> 00:44:15,080 based on known pattern, helping anyone reviewing the rule quickly understand 567 00:44:15,080 --> 00:44:19,640 its function. The author field tells us who created 568 00:44:19,640 --> 00:44:24,600 the rule. In this case, security analyst is a specific 569 00:44:24,600 --> 00:44:29,160 name, for example, and the date indicates where the rule was created, 570 00:44:29,160 --> 00:44:33,880 the date of the rule creation. This meta information is vital 571 00:44:33,880 --> 00:44:38,120 for maintaining organized and well documented rules in any malware 572 00:44:38,120 --> 00:44:42,760 detection system. Moving on the string section, this is where the actual 573 00:44:42,760 --> 00:44:46,280 patterns that will be searched for in the files are 574 00:44:46,280 --> 00:44:49,560 defined. There are two patterns in this rule, 575 00:44:49,560 --> 00:44:56,120 malicious string, a variable that has as a value the text the string malware. 576 00:44:56,120 --> 00:44:59,320 In nocase, this pattern looks for the string malware 577 00:44:59,320 --> 00:45:04,040 in any case, whether it's upper or lower case due to the nocase 578 00:45:04,040 --> 00:45:09,800 modifier. So nocase provides this modification. This ensures that even if 579 00:45:09,800 --> 00:45:13,800 the malware author changes the case of the word malware, 580 00:45:13,800 --> 00:45:18,840 the rule will still detect it because it's upper case or lower case. 581 00:45:18,840 --> 00:45:26,440 Suspicious bytes, this includes a string line of bytes. 582 00:45:26,440 --> 00:45:31,160 Here we define a byte sequence that represents a known signature 583 00:45:31,160 --> 00:45:35,960 or characteristic part of the malware's code. The sequence 584 00:45:35,960 --> 00:45:43,240 E8000000 could represent an instruction of part of the malware's code. 585 00:45:43,240 --> 00:45:50,600 The sequence E800 could represent an instruction of the malware, 586 00:45:50,600 --> 00:45:55,240 which is something that can be identified as typical of this 587 00:45:55,240 --> 00:46:00,920 type of malware. Of course, this can also identify other software that relates 588 00:46:00,920 --> 00:46:06,600 and has the specific code as well. Finally, in the condition section, 589 00:46:06,600 --> 00:46:11,160 the rule specifies the logic for when the pattern should trigger a match. 590 00:46:11,160 --> 00:46:14,360 In this case, the rule will trigger if either 591 00:46:14,360 --> 00:46:19,720 of the defined patterns is found. It will look for the malicious string 592 00:46:19,720 --> 00:46:23,480 OR with the condition OR the suspicious byte 593 00:46:23,480 --> 00:46:27,480 in the scanned file. Of course, this logic could be 594 00:46:27,480 --> 00:46:32,200 the logic control AND or a combination of them. 595 00:46:32,200 --> 00:46:39,240 If either pattern is detected, it's a signal that the file may be malicious 596 00:46:39,240 --> 00:46:44,280 and warrants further investigation. 597 00:46:44,280 --> 00:46:48,760 In step two, scanning files with YARA allows us to actively search for 598 00:46:48,760 --> 00:46:52,360 specific patterns defined in our custom YARA rules. 599 00:46:52,360 --> 00:46:57,240 This step is essential for automating the process of malware detection. 600 00:46:57,240 --> 00:47:02,280 Once you have written a YARA rule, you can use it to scan files for any matches. 601 00:47:02,280 --> 00:47:07,480 The first method involves scanning a single file. To do this, you would use a 602 00:47:07,480 --> 00:47:11,400 command YARA, which is the command of the tool, 603 00:47:11,400 --> 00:47:14,920 suspicious_malware, which is the file that we want to scan, 604 00:47:14,920 --> 00:47:21,560 rule.yar, suspicious_file.exe. In this command, 605 00:47:21,560 --> 00:47:25,880 suspicious_malware represents the name of the rule we've created 606 00:47:25,880 --> 00:47:30,440 and the rule.yar is the rule file that holds the patterns we're looking for, 607 00:47:30,440 --> 00:47:36,520 like specific strings or byte sequences. The suspicious_file.exe is the file we 608 00:47:36,520 --> 00:47:41,080 are checking for those patterns. When you run this command, YARA will analyze 609 00:47:41,080 --> 00:47:47,320 the file and return an output if any of the patterns in the rule is found. 610 00:47:47,320 --> 00:47:50,600 For instance, if the file matches one of the 611 00:47:50,600 --> 00:47:54,280 defined patterns, the output might look like this. 612 00:47:54,280 --> 00:48:03,960 This means that the file contains a pattern such as the word 613 00:48:03,960 --> 00:48:08,920 malware or the suspicious byte sequence triggering the YARA rule. 614 00:48:08,920 --> 00:48:12,840 For larger case scans, where we need to check multiple files, 615 00:48:12,840 --> 00:48:17,080 you can use the -r option to scan an entire 616 00:48:17,080 --> 00:48:22,600 direct directory recursively. So -r means recursively. 617 00:48:22,600 --> 00:48:25,800 This would be done with the command YARA -r, 618 00:48:25,800 --> 00:48:31,640 suspicious_malware, rule.yar and then the path of the directory that we want to scan. 619 00:48:31,640 --> 00:48:35,720 The -r instructs YARA to search not only for a specific 620 00:48:35,720 --> 00:48:40,440 directory but also any type of directories within the directory. 621 00:48:40,440 --> 00:48:44,840 If YARA finds a match for any of the files within the directory, 622 00:48:44,840 --> 00:48:50,280 it will again show the rule name and the path of the matching file. 623 00:48:50,280 --> 00:48:56,280 Of course, we can load multiple YARA rules together in multiple files 624 00:48:56,280 --> 00:49:01,640 and each combination will be provided separately. 625 00:49:01,640 --> 00:49:06,040 YARA offers advanced features that significantly enhance its malware 626 00:49:06,040 --> 00:49:10,440 detection capabilities, making it a powerful tool for more 627 00:49:10,440 --> 00:49:14,040 refined analysis. One of the features is the ability 628 00:49:14,040 --> 00:49:19,160 to use regular expressions, regex, which provides flexible and powerful 629 00:49:19,240 --> 00:49:23,240 pattern matching. By using regular expressions, 630 00:49:23,240 --> 00:49:29,160 analysts can define complex patterns that go beyond simple string matches. 631 00:49:29,160 --> 00:49:33,480 For example, you can create a rule that matches any string starting with 632 00:49:33,480 --> 00:49:41,720 malware, the word malware, followed by one or more digits, regardless of the case. 633 00:49:41,720 --> 00:49:45,880 This ability to use regex allows for a more dynamic 634 00:49:45,880 --> 00:49:51,000 and broad search, which is especially useful when malware samples may vary in 635 00:49:51,000 --> 00:49:54,680 naming conventions or other characteristics but still 636 00:49:54,680 --> 00:49:59,480 follow a recognizable pattern. Another advanced feature in YARA 637 00:49:59,480 --> 00:50:04,440 is the use of logical operators to combine multiple conditions in a single 638 00:50:04,440 --> 00:50:08,440 rule. This gives analysts the flexibility to create 639 00:50:08,440 --> 00:50:13,480 highly specific rules. For instance, you can create a rule 640 00:50:13,480 --> 00:50:17,800 that only triggers if both the string suspicious and the string 641 00:50:17,800 --> 00:50:23,080 malware are found in the same file. By combining conditions with logical 642 00:50:23,080 --> 00:50:28,040 operators like logical conditions AND or OR or NOT, 643 00:50:28,040 --> 00:50:33,400 you can fine tune your searches to minimize false positives and increase 644 00:50:33,400 --> 00:50:37,560 detection precision. This makes YARA more versatile and 645 00:50:37,560 --> 00:50:41,640 allows analysts to refine their malware detection strategies. 646 00:50:41,640 --> 00:50:45,480 Lastly, YARA allows you to define the rules based 647 00:50:45,480 --> 00:50:50,200 on file properties such as the size or the metadata. 648 00:50:50,200 --> 00:50:54,120 For example, you can create a rule that checks if the file size 649 00:50:54,120 --> 00:50:59,080 is greater than one megabyte, which could be useful for detecting malware 650 00:50:59,080 --> 00:51:03,560 that is packed with large files or is typically larger than normal 651 00:51:03,560 --> 00:51:06,840 application files. Additionally, you can create 652 00:51:06,840 --> 00:51:11,160 rules based on other properties like the creation date or 653 00:51:11,160 --> 00:51:16,120 modification date. These file type property based rules enhance 654 00:51:16,120 --> 00:51:21,240 YARA utility by allowing analysts to target certain types of 655 00:51:21,240 --> 00:51:25,480 files or characteristics that are commonly seen with specific 656 00:51:25,480 --> 00:51:30,920 types of malware and leave the other files alone.