[00:00.000 --> 00:06.220] Okay, we're about time so thank you again for being here. Um, hopefully you've been [00:06.220 --> 00:11.220] enjoying DEF CON. Closing ceremonies will be soon here for the village. Later on you can [00:11.220 --> 00:15.900] go and head out to uh, closing ceremonies for DEF CON. If this is your first time, [00:15.900 --> 00:20.740] hopefully you had a good time. I hope that you made some friends and if you haven't, [00:20.740 --> 00:25.200] then please talk to the person next to you. They might uh, be into the same things that [00:25.200 --> 00:29.540] you are. Uh, and I really recommend you go to the closing ceremonies. It's always a lot [00:29.540 --> 00:32.780] of fun. Again, thank you for being here. Cheers. [00:34.860 --> 00:36.960] Round of applause. [00:40.500 --> 00:50.200] Alright, welcome. Uh, really cool way to finish up the day. Uh, understudy 77, he is uh, not [00:50.200 --> 00:56.220] only paranoid but he is actually a-paranoid. Like that's, that's in his title. How cool [00:56.220 --> 01:02.820] is that, right? So, um, he's a paranoid with Verizon. Um, head of security operations. [01:03.180 --> 01:09.080] Head of security operations. And um, he's going to talk, talk to you guys a little about [01:09.080 --> 01:18.440] uh, hold on. Okay, cool. Um, he's going to talk with you guys about uh, an introduction [01:18.440 --> 01:22.700] of malware RE, reverse engineering. If you haven't done it before, he and I were just [01:22.700 --> 01:28.940] talking. Um, this is a really cool talk because it's going to be an anybody can do malware [01:28.940 --> 01:33.480] reverse engineering kind of talk. So, really looking forward to this. Give him a hand. [01:40.350 --> 01:44.610] Uh, sorry just to interrupt. We just, we just, the open talk just ended so if you hear a [01:44.610 --> 01:48.750] little bit of noise it's because of that. So, why don't we just give him a good applause to [01:48.750 --> 01:53.490] everyone that participated in the open talk because they just completed. CTF is over. [01:53.490 --> 01:54.390] Sorry for that. [02:00.070 --> 02:05.970] So, I want to start off at the end of the weekend by asking, did everybody have a really [02:05.970 --> 02:14.190] good DEF CON and Hacker Summer Camp? All right. So, I've been here most of the weekend and [02:14.190 --> 02:17.870] I want to say two things. First off, I want a round of applause for all the volunteers [02:17.870 --> 02:22.450] and organizers of Blue Team Village. They kicked ass, did a really good job and a lot [02:22.450 --> 02:32.710] of work. And secondly to Open Sock. Um, it was an awesome CTF and I sat up here in the [02:32.710 --> 02:37.090] evening and watched them rebuild the whole thing because everybody killed it. So, they [02:37.090 --> 02:47.840] worked tirelessly. I'm sure they're all tired and somebody should buy them beer. So, [02:47.840 --> 02:52.180] let's do an introduction to malware analysis. Uh, I'll start with the introductions. I'm [02:52.180 --> 02:55.900] the head of the security operations center at Verizon Media. I was an IR and breach [02:55.900 --> 03:00.200] consultant once upon a time, slash threat hunter. Um, I'm probably a little bit rusty on [03:00.200 --> 03:04.240] this topic so don't hold anything too far against me. Management. Uh, and I'm pretty [03:04.240 --> 03:09.980] shitty at Twitter. Now, let's talk about what this is and what this isn't. Um, I have not [03:09.980 --> 03:13.740] done this every day in a little while. I love teaching this because every time I add [03:13.740 --> 03:17.780] something new and I get to do something new and learn something new. Um, there's a lot [03:17.780 --> 03:22.400] more tools and different things than what I'm going to be using. This is very much an [03:22.400 --> 03:29.540] introduction. Um, I built this specifically to lower the entry barrier and make the [03:29.540 --> 03:35.160] concept of analyzing malware seem not so difficult. So, some people may or may not be my [03:35.160 --> 03:39.200] target market and that's okay. But, I just want to make sure that I'm very clear about what [03:39.200 --> 03:43.920] this is going into it. So, we can talk a little bit about what tools we're going to be using [03:43.920 --> 03:49.520] primarily. I run Ubuntu 14.04 with Remnux. Remnux is an open source malware analysis [03:49.520 --> 03:55.360] distro. Oh, I should mention as well, photos are fine this way. Um, I wouldn't take them [03:55.360 --> 04:00.660] that way but I know that's a sensitive topic so I want everybody to know I don't care. Um, [04:00.660 --> 04:08.140] in Remnux we're going to use some tools like PDF ID, PDF parser, um, OLE tools and VMs. From [04:08.260 --> 04:12.480] a VM perspective we're going to be looking at things like Process Explorer, RegShot, Fiddler, [04:12.480 --> 04:17.380] Wireshark. Um, we're also going to kind of touch a little bit on Cuckoo Sandbox and how you [04:17.380 --> 04:23.160] can kind of automate some of this process that we're going to go over as well. So, let's set [04:23.160 --> 04:27.900] up the scenario. You are a security analyst for the Daily Bugle. You received an alert or [04:27.900 --> 04:34.060] notification about a suspicious email with an attachment. You got a copy of that attachment. So [04:34.060 --> 04:39.840] you have a PDF right now. So now we can jump right into it. Into the good part. By the way, [04:39.840 --> 04:44.460] this is all demo pretty much and I've prayed intensely to the demo gods that this is going to [04:44.460 --> 04:54.920] work out okay. So, we have a PDF right here. Here's our suspicious PDF. We can do a couple [04:54.920 --> 05:00.940] things to look into this. I like to start with PDF ID. Is this big enough? Can everybody read [05:00.940 --> 05:08.400] it? I tried to make the size really big. Great. So, I'm already in my directory and we can hit [05:08.400 --> 05:15.220] PDF ID and our file name. And we can see what's going on with this. So, if we look through [05:15.220 --> 05:19.620] this, this is going to tell us in the header what's there. So, this is going to tell us [05:20.420 --> 05:26.120] objects. This is going to tell us JavaScript. Importantly in this case, this is going to tell [05:26.120 --> 05:30.940] us that we have an embedded file. That's interesting. Why would you put a file inside your [05:30.940 --> 05:35.980] PDF? So, there's a couple different ways we can get it. We can go to a sandbox. We can open the [05:35.980 --> 05:40.500] PDF and we can get the file. Or we can use some other tools. But let's see if we can find out [05:40.500 --> 05:46.080] some more information about it first. So, I'm going to go ahead and clear this out. And then [05:46.080 --> 05:51.880] let's see what we can find out about that file. And let's start with the file name and see if [05:51.880 --> 06:05.720] we can find that. So, embedded files. Looks like a Word doc. 602803.doc. Also interesting. What [06:05.720 --> 06:12.960] can we find out about that file? Or general information about this PDF in general. Or more [06:12.960 --> 06:21.200] information about this PDF in general. And this is where the demo stuff happens. Because I [06:21.200 --> 06:27.480] forget to type things. So, we see that there's an embedded file. We can go through. There's [06:27.480 --> 06:34.240] the name. Some additional information. This will basically break down the whole PDF and give [06:34.240 --> 06:39.560] you general information from it. It's really useful. It's not as human readable as either of [06:39.560 --> 06:48.380] the other tools we just talked about, though. So, here's our who wrote and who made. So, now [06:48.380 --> 06:52.680] we need to get that. And preferably I think we'd like to get that in a safe way. Although I do [06:52.680 --> 06:57.180] like clicking on everything that I can click on. I find that that's one of my favorite things in [06:57.180 --> 07:04.640] this world to do. But we'll do it the safe way. So, we'll do detach again. We know there's only [07:04.640 --> 07:11.060] one file there. So, we can do save all. And then we can hit step one. So, if you take a look [07:11.060 --> 07:19.700] here, this is all laid out for ease of use in case something breaks. But if I run this and we [07:19.700 --> 07:25.700] take a look back there, we've now saved out our document. Easy. So, we've now successfully [07:25.700 --> 07:32.840] extracted a document from a PDF file. So, now we get into analysis of that document. There's no [07:32.840 --> 07:37.720] internet for this. Typically I would be on a VPN and online. But I don't really want to be [07:37.720 --> 07:44.060] executing live malware throughout this experience. So, I'm going to go ahead and I'm going to [07:44.060 --> 07:50.840] open up a VM. And we're going to start there. So, we will start with opening up this document [07:50.840 --> 08:00.800] and seeing what we see. Because I find that to be fun. So, if we take our doc, we move it over [08:00.800 --> 08:09.300] to our VM. We can run a couple things here. And we're going to talk more in-depthly about [08:09.300 --> 08:14.880] different tools as we get into the file analysis as well. So, as soon as this paces, this is [08:14.880 --> 08:24.580] the downside of live demos, right? I can start opening things though. For anybody [08:24.580 --> 08:31.780] unfamiliar, Fiddler is basically a web debugger. So, if I have, if I'm suspicious that web based [08:31.780 --> 08:34.740] call outs are going to happen or something of that nature and I'm not worried about just [08:34.740 --> 08:40.140] general TCP connections, I like to use Fiddler because it displays everything really nicely and [08:40.140 --> 08:53.970] very easily. So, I'm a big fan. We'll use Wireshark later as well. Come on. You know the [08:53.970 --> 09:01.370] really crappy part about this is I practiced this six times and had no issues. And now, [09:01.370 --> 09:29.090] everything wants to freeze. Cancel. Let's try that again. Hey, there we go. It's back. [09:38.410 --> 09:47.050] All right. So, we have a document. We have something capturing web traffic. And right now, [09:47.050 --> 09:52.610] we're going to get something capturing processes as well. For this, we'll use process [09:52.610 --> 09:59.710] explorer. Process explorer is essentially like task manager on steroids and will give you a lot [09:59.710 --> 10:11.790] more information. Yes. So, interesting thing. Process explorer is going to be pretty live. So, [10:11.790 --> 10:16.950] things are going to disappear. Things are going to go away. Where Fiddler is going to record. [10:17.010 --> 10:21.810] So, in this use case, I tend to always keep process explorer top so that I can pay attention [10:21.810 --> 10:26.970] to it quickly. And then I'll go back to and look at the network traffic afterward. So, as we [10:26.970 --> 10:34.630] open up this document, we can see here that there is a macro. We can also shrink this down so [10:34.630 --> 10:41.950] it's out of our way. And we can enable content because we like to live dangerously. So, we can [10:41.950 --> 10:49.270] see WinWord here. We can see PowerShell just popped up and did a lot of things. And now, it's [10:49.270 --> 10:55.830] gone. So, let's move over here and see what else happened. A lot of these are going to be [10:55.830 --> 11:03.590] Microsoft because I don't open Word that often. But I see a couple things that look kind of [11:03.590 --> 11:08.150] suspicious over here. They can't go anywhere. But that's not traffic I would expect. That's [11:08.150 --> 11:17.990] relatively suspicious. So, it's trying to get something. And if I expand this out a bit, we can [11:17.990 --> 11:22.470] go take a look and see if it did anything. Although, we probably won't see very much because [11:22.470 --> 11:30.190] it's not connected to the internet. Where are you? So, that's one way without network [11:30.190 --> 11:34.370] connection that we can get access to see this kind of stuff. So, here's something [11:34.370 --> 11:39.830] interesting. We see two URLs at least in this use case. It couldn't connect to one. It jumped [11:39.830 --> 11:46.150] to another. A lot of different pieces of malware will have multiple URLs built in. In the case [11:46.150 --> 11:51.030] of those multiple URLs, if you connect to the first one, meaning if the first time you run it, [11:51.030 --> 11:54.870] you're on a virtual machine that connects to the internet, you might never see the second [11:54.870 --> 12:03.010] piece. So, I tend to run everything first offline and then run online. I also tend to let a [12:03.010 --> 12:07.190] lot of this stuff sit for several hours to see if anything happens afterward. But in this [12:07.190 --> 12:12.650] case, I think there's an easier way to go through this data. So, we can go ahead and we can [12:12.650 --> 12:21.010] close out some of this stuff. We'll keep some of it open. And we can go back over here. So, [12:21.030 --> 12:26.770] there's a tool suite called OLE tools. Which basically will look at things and tell us what [12:26.770 --> 12:34.890] they are. In this case, we're going to use OLE VBA because we know there's visual basic. Step [12:34.890 --> 12:44.530] two. So, we know we have a macro user form one. It can auto exact document open. It may [12:44.530 --> 12:50.510] execute or may run an executable or a system command which it launched CMD. Hex encoded [12:50.510 --> 12:56.390] strings detected and executable file name being that it ran CMD. So, if we want to see [12:56.390 --> 13:07.950] more on this, hit D to decode. And again, pipe more. So, this is going to give us the full [13:07.950 --> 13:14.090] context around that. So, just from the beginning, we can see call command line, call [13:14.090 --> 13:19.670] PowerShell. No profile. So, it's going to ignore any built in PowerShell settings. Window [13:19.670 --> 13:23.850] style hidden. So, you're not going to see it run. Executable bypass. So, it's going to try to [13:23.850 --> 13:28.930] bypass execution policy that you have on your computer and run locally. And then we've got a [13:28.930 --> 13:36.950] whole bunch of other stuff going on here. Just numbers. And numbers and numbers and numbers. [13:36.950 --> 13:47.730] So, what that data ends up looking like is this. Not really super useful yet, right? So, we [13:47.730 --> 13:52.430] could probably assume that this entire section here is encoded. Actually, this entire section [13:52.430 --> 13:58.990] here is decimal encoded. Is anybody here or everybody here familiar with a tool called [13:58.990 --> 14:04.970] CyberChef? Great tool for this kind of stuff. Makes everything very fast. So, I can go in [14:04.970 --> 14:11.690] here. I can paste all that in. And I can go from decimal. Well, that didn't work. But [14:11.690 --> 14:16.710] everything is comma delimited. And you have to specify that. So, if I specify comma [14:16.710 --> 14:23.730] delimited, now we have a lot more information. So, we can see some stuff. But there's still a [14:23.730 --> 14:31.550] lot going on. So, I can see that there's an XOR key. This looks like byte string. Some pieces [14:31.550 --> 14:37.250] of URLs down there. But there's a lot going on with this. And this is kind of an interesting [14:37.250 --> 14:42.130] way to encode an additional layer. Basically, what they're doing is they're shifting numbers. [14:42.130 --> 14:48.890] So, like in URLs, they're saying 10, 1, 13. And that's taking this list here and counting [14:48.890 --> 14:58.650] from that list, that number. So, if we use that and take a look at that in another way, that's [14:58.650 --> 15:03.770] the wrong, oh, no, that's the right one. Because that's this. We can also see an executable [15:03.770 --> 15:09.290] down there. So, if we use that and we want to get rid of that, we'll use URLs as an example. [15:09.290 --> 15:13.110] So, I took each one of those URL pieces. I haven't found an automated way to do this, by [15:13.110 --> 15:16.450] the way. If anybody knows an automated way to do this, that would be great. Because manual [15:16.450 --> 15:25.770] takes some time. Count them from 0 up. So, 0 to 20. And then piece these together. 10, H, 1, [15:25.770 --> 15:32.570] TTP, and so on and so forth. And you now have three URLs. So, we saw two. We didn't see the [15:32.570 --> 15:37.850] third one. But we know that there's three hard-coded URLs in this sample. Or in this piece [15:37.850 --> 15:44.350] of code. If we deobfuscate the whole thing, it gets more interesting. So, we see our [15:44.350 --> 15:50.650] PowerShell. We see no profile. We see hidden. We see executable bypass. And now we start to [15:50.650 --> 15:55.030] get into some other interesting stuff. So, some variable calling. There's an XOR key in [15:55.030 --> 16:03.270] there for XOR encoding. Um, byte string link sets. Here's our URLs. And then we start to get [16:03.270 --> 16:14.440] into down here. So, write host URL. There's our file. That we're going to see. Here's our [16:14.440 --> 16:24.580] write. New object. Download file invoke URL. And then unXOR. And then write bytes unXOR and [16:24.580 --> 16:30.340] start said process. So, what that means, and this is a little bit out of scope of what I'm [16:30.340 --> 16:33.520] going to talk about throughout the whole thing. But it's worth mentioning. If I go to one of [16:33.520 --> 16:40.280] those URLs and I WGIT and I pull down that file, it's an incomplete file. It's an XOR file that [16:40.280 --> 16:47.260] needs to be unencoded again, which this script does. Um, I've already done that part. So, I [16:47.260 --> 16:57.340] already have the completed file. So, we can start talking about that completed file. So, now we [16:57.340 --> 17:03.160] get down to an EXE. So, we have an EXE. We can take a look at it. We're unsure. And now is [17:03.160 --> 17:09.440] where we get into running malicious files. So, same system. We're going to have process [17:09.440 --> 17:20.360] explorer up. In this case, we're going to use Wireshark. And I'm going to hide that off in the [17:20.360 --> 17:27.960] bottom. And we're going to use another tool called RegShot. So, RegShot will take two [17:27.960 --> 17:32.180] snapshots of your registry at different times. So, I click a button, it captures the entirety [17:32.180 --> 17:36.380] of my registry. I click another button, it captures the entirety of my registry again. And [17:36.380 --> 17:42.560] then compares the two files for any potential changes. So, we'll go ahead and pop that open. [17:43.060 --> 17:51.020] And we'll take our first shot. Now, none of this is an exact science. If you have any [17:51.020 --> 17:55.600] background processes running, things that can affect your registry, those things may come up [17:55.600 --> 18:00.360] as well. So, unless it's a completely clean system, you might run into some things. One of [18:00.360 --> 18:05.320] the reasons why I didn't restart this is so that it would be cleaner and all background [18:05.320 --> 18:11.120] processes would finish running. So, that I would get the best shot possible. So, now we [18:11.120 --> 18:19.670] will move over our file. We've got everything open. I want to make sure Process Explorer is [18:19.670 --> 18:28.990] front and center. And we'll run it. So, we see here it is. And it's making a call to SVCHost, [18:28.990 --> 18:35.450] which is Windows Service Host File. And now it's gone. But, SVCHost with that file still [18:35.450 --> 18:44.590] there. That's interesting. It's doing something. Do we have any network traffic? In this case, [18:44.590 --> 18:53.010] I'm just going to filter for TCP. And we have network traffic. Not much of any network traffic, [18:53.010 --> 18:57.370] because, again, not connected to the internet. But, that's an unexpected call. I don't know [18:57.370 --> 19:05.430] why my computer would be going to 199.36.194.27. So, we have network traffic, too. So, [19:06.010 --> 19:11.090] we have network traffic. We have a suspicious SVCHost running. We can take a look at the [19:11.090 --> 19:15.590] properties of that and kind of go through. We can continue to see the parent process here. We [19:15.590 --> 19:20.090] can continue to see what it's doing, what it looks like, if there's an auto start location, the [19:20.090 --> 19:25.070] command line that was run, where it's running from. Get performance graphs of how it's [19:25.070 --> 19:32.890] running. General performance of it. GPU graph. Threads that it's running and strings of that [19:32.890 --> 19:38.070] file. So, this is strings of the actual SVCHost. We can run strings of the specific file, as [19:38.070 --> 19:53.810] well, over here. Strings are... I don't know how to properly explain them. Step 8. Step 9. But, [19:53.810 --> 19:58.730] you can go through this and you can find some interesting things. So, going through this, a lot [19:58.730 --> 20:01.890] of it's going to seem a little bit out of place, but I might be able to find some interesting [20:01.890 --> 20:09.590] calls. And I know there's a couple interesting ones in here. So, I can see a couple things right [20:09.590 --> 20:15.850] through here. So, set class, registry, call message filter, some calls to some DLLs, [20:16.290 --> 20:20.890] initializations, all of these things are kind of the full word pieces of the pieces that I'm [20:20.890 --> 20:24.590] potentially interested in when I'm going through this. This might give me an idea of what the [20:24.590 --> 20:31.090] file does. Before I run it or after I run it or whenever. I'll get some idea. And if we look at [20:31.090 --> 20:45.600] the registry, some of that should match up. So, we'll go ahead and take our second shot. And [20:45.600 --> 20:55.060] then we'll compare. So, let's see. We added three keys. Google one, that's probably Google [20:55.840 --> 21:02.620] doing something. Microsoft tracing to SVC host, that's expected. We saw that file kind of [21:02.620 --> 21:08.380] launch from SVC host. So, we expect that. But now we know it's in registry. We have enable [21:08.380 --> 21:14.340] file tracing, enable console tracing. And again, this is very much a touch base on things. So, [21:14.340 --> 21:18.760] I'm not going to go into what every one of these things may mean. Just how to run it, how to find [21:18.760 --> 21:26.280] it, some things that might be concerning or interesting. So, file directory. Then we get into [21:26.280 --> 21:32.620] our modified values, which we're also going to get some stuff in here. I'm not as good at reading [21:32.620 --> 21:40.360] text as I used to be. So, looking for potential current versions of different file pieces, [21:40.360 --> 21:52.130] window placement, so on and so forth. So, we have network traffic. We have a rogue process that [21:52.130 --> 21:56.310] looks like a legitimate Windows process and we have registry files that have changed. So, [21:56.310 --> 21:59.990] there's a couple different ways that you can go about this. You can reimage a box like most [21:59.990 --> 22:05.450] places do or you can go kind of harp in on each one of those individual problems. Piece by [22:05.450 --> 22:15.030] piece. There's also a much easier way to do this, although I genuinely suggest that [22:15.030 --> 22:19.470] everybody kind of do it in an automated or in a manual fashion as they're learning this [22:19.470 --> 22:24.510] process. I also realize that I'm speeding through this really fast. So, I hope I'm not like [22:25.030 --> 22:33.210] blowing anything off. I tend to go a little quick. Speak louder? Sorry. Yeah, I was standing [22:33.210 --> 22:41.030] back there yesterday and I realized I couldn't hear much either. No problem. So, automated [22:41.030 --> 22:47.990] sandboxing. Is anybody not familiar? Familiar? We'll talk about it anyway. Everything here is [22:47.990 --> 22:51.110] free and open source. Everything that I'm using throughout the course of this is free and open [22:51.110 --> 22:55.970] source. So, you can do it at home. As we get into automated sandboxing, you can build this, set [22:55.970 --> 23:01.630] it up yourself. You need a VM, some scripts to point to it, things of that nature. And it's [23:02.030 --> 23:09.550] literally drag and drop. So, I can take this file, I can drag and drop it to submit and then I can [23:09.550 --> 23:13.630] tell it a whole bunch of things. Do I want it to connect to the internet? Yes, no. Do I want to [23:13.630 --> 23:18.130] give it a priority? What's the time out? So, how long do I want to let this run for? Now, [23:18.130 --> 23:22.370] again, one of the things I like about running something manually is I will let a file, if I'm [23:22.370 --> 23:26.530] doing an engagement or was doing an engagement, I would often let a file run for like 24 [23:26.530 --> 23:31.390] hours. See if it did anything else interesting in that time period. In this case, you're [23:31.390 --> 23:37.210] looking at 60 to 120. You can give it whatever set you want, but it might not get any more [23:37.210 --> 23:43.550] information. You can add remote control, enable injection, dump process memory, um, dump [23:43.550 --> 23:49.670] full memory, and a whole bunch of other options. There's also a wild amount of add-ons that [23:49.670 --> 23:55.910] exist for this tool. So, you can add just about everything you want. Now, that said, even [23:55.910 --> 24:01.150] though I'm going fast, if I run this right now, it'll take like 10 minutes probably to go [24:01.150 --> 24:05.310] through and boot. But I've already run it because, again, I'm terrified something's going to [24:05.310 --> 24:11.050] break. So, we can just look at the report. So, same file we looked at before, let's see if [24:11.050 --> 24:16.350] anything matches up. Cuckoo also adds a whole bunch of base signatures. So, it's looking for [24:16.350 --> 24:22.230] things that look suspicious, essentially. So, we can see a couple different things as we go [24:22.230 --> 24:28.290] through this. We can, I like to start with red. Red is bad. Yellow could be bad. Blue, maybe. [24:28.950 --> 24:35.430] Order of priority by color. Um, attempts to identify installed AV. It's looking for trend [24:35.430 --> 24:40.910] micro. Deletes its original binary from disk. We watched that happen. Collects information [24:40.910 --> 24:47.670] about some other installed applications. Queries details from the computer. So, you can get a [24:47.670 --> 24:53.590] lot of general information from this. Just from running something in a sandbox. You can also [24:53.590 --> 24:58.670] find about a bunch of them online. But full disclaimer, don't use like things that you're [24:58.670 --> 25:04.730] using for work and then upload them to some website. Um, unless where you work for is cool [25:04.730 --> 25:10.350] with that, then by all means. Um, and then here we see our IP address. Although, it does [25:10.350 --> 25:15.730] look like after six years that IP address has finally died. Um, the last time I did this a [25:15.730 --> 25:19.510] couple months ago, it wasn't dead. It was, everything was still completely live. And I was [25:19.510 --> 25:23.150] amazed by that because this is a six year old piece of malware. Proving that this stuff [25:23.150 --> 25:30.250] never really goes out of style. Like, it still exists and functions and runs. Um, it'll also [25:30.250 --> 25:34.630] give us any of the network connections, anything that we saw. Again, if your box isn't [25:34.630 --> 25:40.350] completely clean though, you will add in some extra things that could hurt. We can look at [25:40.350 --> 25:48.070] some static analysis of that file. So we can look at any compile time or PDB path. Any [25:48.070 --> 25:54.670] imports for DLLs, which we saw some of those when we went through strings. Any artifacts [25:54.670 --> 25:58.630] that were extracted during that time frame from that file. In this case, there were no [25:58.630 --> 26:04.530] other ones. Behavioral analysis. This shows us that process tree. The file itself goes [26:04.530 --> 26:13.290] to SVC host. Any network analysis that we have. So we can look at general host connections. [26:13.450 --> 26:17.010] You can also pivot to MOLOC. Good shout out to MOLOC, even though I'm not going to cover [26:17.010 --> 26:20.290] that because Verizon Media, the company that I work for, makes it and open sources it. So [26:20.290 --> 26:25.410] it's a good shout out. Um, but you can pivot right to MOLOC for full packet capture. It'll [26:25.410 --> 26:29.310] tell you about any files that potentially dropped. In this case, the dropped file was the file [26:29.310 --> 26:35.450] we looked at. Um, process memory. It'll pull as well. So any potential URLs that exist in [26:35.450 --> 26:41.650] process memory. Again, all of these might not be related to that file. Um, because this is [26:41.650 --> 26:49.120] not quite as clean as I would have liked it when I ran this sample. So you get a kind of a [26:49.120 --> 26:52.420] good idea of what you can look at from this perspective. And there's a lot of other tools [26:52.420 --> 26:57.220] too. Say you're not a Linux guy, you're a Windows guy. If I hop back into here, which is [26:57.220 --> 27:15.910] horribly, horribly infected, and I copy my file back in, there's a tool called, not that one, PE [27:15.910 --> 27:21.570] Studio. That's it. So PE Studio essentially does a lot of this from a straight RE [27:21.570 --> 27:26.570] perspective. So you can just drag and drop a file for analysis. It'll kick into analysis [27:26.570 --> 27:34.180] with said file. Um, it will connect to virus total and look for that hash and give you any [27:34.180 --> 27:37.260] indicators. If this thing did connect to virus total, it would light up like a Christmas [27:37.260 --> 27:42.960] tree. I think it's like 46 out of 64. Um, it'll give you any potential indicators based by [27:42.960 --> 27:48.220] severity. So installation of hooks, blacklisted libraries, different section names being [27:48.220 --> 27:53.000] blacklisted. Again, we see some of the same things that we saw from each investigation [27:53.000 --> 27:57.440] method and maybe a little bit more as we go through each one of these processes. Um, when [27:57.440 --> 28:01.640] you get into that, it'll tell you certain sections, um, string analysis and the strings [28:01.640 --> 28:06.120] that it found that were weird. So the string analysis that we did via command line, this [28:06.120 --> 28:12.240] does, and it'll call out the things that are blacklisted. So, there's our DLL calls. Very, [28:12.240 --> 28:17.960] very convenient tool, also free. Um, but has to be run on Windows, which means you have to [28:17.960 --> 28:21.880] drop it from Windows, so make sure it's on a box that you don't mind completely screwing [28:21.880 --> 28:29.540] over. So, that's about the course of the demo. So let's kind of loop back in and talk a little [28:29.540 --> 28:38.900] bit about this. So, as a security person, all of us blue team-ish, what can we do with the [28:38.900 --> 28:44.960] information that we got? So we have a file. We know the hash. We have endpoint detection [28:44.960 --> 28:49.380] software, we can block that hash. We can look for that hash across our network. We have [28:49.380 --> 28:53.200] call-outs in multiple areas. So we have the initial call-out from the document that [28:53.200 --> 28:57.740] downloads the file. We can use that to see if anybody else potentially downloaded the file. [28:58.240 --> 29:05.240] We can also use the actual call-out with the semantics cert, the IP call-out, to see if [29:05.240 --> 29:09.620] anything went wrong or if anybody is infected with that file. Just because it tried to [29:09.620 --> 29:13.400] download doesn't mean it's infected. Something could have stopped that. So we have a whole [29:13.400 --> 29:18.260] host of information that we can use in our environment, especially if this came in as an [29:18.260 --> 29:22.740] email, it probably went to more than one user. So we can take a whole host of all the [29:22.740 --> 29:27.040] information that we pulled and get an idea of what this looks like across the scope of our [29:27.040 --> 29:34.960] whole network. Which is super useful in any situation. So, I like to leave this kind of [29:34.960 --> 29:39.040] stuff in case anybody wants to take pictures of this kind of stuff. So we have different [29:39.040 --> 29:43.680] commands that were run, um, the very specific commands. I'll give everybody a minute on that [29:43.680 --> 29:56.620] one. Lot of phones up. Good. Good. I, I keep them up because then we have the picture slide [29:56.620 --> 30:01.920] which is links to all different kinds of tools. Virus total is an amazing tool for seeing [30:01.920 --> 30:06.980] what AV vendors know about different stuff. URL void and IP void, great for IP and URL [30:06.980 --> 30:13.040] reputation. Um, malware.com is a very similar to cuckoo online sandbox that you can upload [30:13.040 --> 30:18.300] stuff to. Then there's a bunch of different tips. Um, reverse engineering tips, a lot from [30:18.300 --> 30:23.220] Lenny Zeltzer who's fantastic at this. There's great sans courses on the topic and I [30:23.220 --> 30:27.460] personally love the malware analyst cookbook and practical reverse engineering. If this is [30:27.460 --> 30:32.000] something that you want to get into, these are some of my recommendations. The next [30:32.000 --> 30:38.480] recommendation page however is a little bit more dangerous. Links to live malware. And I, I [30:38.480 --> 30:45.280] say disclaimer right now, use those at your own risk. Um, I suggest having a separate box. [30:45.480 --> 30:51.000] This box is literally the user name is guest and the host name is like malware. There's no [30:51.000 --> 30:55.840] identifiable information to me on this box whatsoever. I've never logged into a personal [30:55.840 --> 31:00.180] account. I've never done any of that. But again, paranoid. Maybe you don't need to do quite [31:00.180 --> 31:06.360] that, but that's my thing. But there you have some links to live malware. End of speech. [31:06.360 --> 31:19.560] However, I do have stuff for the three best questions. If anybody has any. So why don't I use [31:19.560 --> 31:24.280] process hacker instead of sys internals? Probably just stuck in my ways and I don't do it [31:24.280 --> 31:37.450] every day anymore. So easier to use procmon to capture the log and then look through the [31:37.450 --> 31:42.250] processes afterward. And I agree, it's more time consuming and harder to show like this [31:42.250 --> 32:02.500] though. So, VM aware malware, what method would I use to test that? Right? If it won't run on a [32:02.500 --> 32:08.020] virtual machine. Um, so I not only have this box, I have a couple other hard boxes that I can [32:08.020 --> 32:14.900] use to test this stuff on. Um, and just a base image, like a base windows image wipe. Um, a lot [32:14.900 --> 32:18.400] of stuff will run in virtual machine and it's much easier to teach this because I have both [32:18.400 --> 32:23.380] tools in the same place. But I have another laptop specifically with wipeable images that I [32:23.380 --> 32:32.440] can use for anything that's VM aware. What's that? For the image wiping? It's some [32:32.440 --> 32:48.240] enterprise tool. So, how often do I see something new is the question. And admittedly I don't do [32:48.240 --> 32:55.180] this every day anymore. But I will say that when I did IR it was in waves. So, you would see [32:55.180 --> 33:00.540] essentially the same thing a lot for a little while and then something new a lot for a little [33:00.540 --> 33:05.640] while and then something new a lot for a little while. Um, crypto miners when I was rolling out [33:05.640 --> 33:11.020] of IR and into management were the big thing. And just personal opinion, if somebody is going [33:11.020 --> 33:15.360] to hit you with that, like that's, it couldn't be better than that. Like there's not a lot of [33:15.360 --> 33:20.360] damage there. But it's waves. But eventually, I just talked to one of my IR buddies who was [33:20.360 --> 33:24.540] here the other day and he said, uh, 10 years he's seen basically the same thing over and over [33:24.540 --> 33:41.560] again. It doesn't change that much. So, when it comes to malware that's reaching out to CNC, [33:41.560 --> 33:47.340] what do you use to spoof the connections? Typically, I don't. Um, I log into a VPN and I let [33:47.340 --> 33:51.740] it make connections. I think you get a much more full picture of what happens when you let [33:51.740 --> 34:11.150] communication happen. What's that? Why attach it to an email instead of Google docs? Oh, so why [34:11.150 --> 34:15.430] not, from an attack perspective, not upload the PDF to Google docs instead of attaching it to [34:15.430 --> 34:20.210] an email? And that happens a lot more now. But it was just a setup scenario to start the [34:20.210 --> 34:53.800] conversation. Oh, why didn't I just upload the PDF? I don't know. Go ahead. I have and I actually [34:53.800 --> 34:59.400] have a sample of it sitting on this box, too. Um, Emotet V4, actually, I believe. I worked a [34:59.400 --> 35:06.060] big case with that. Um, you find certain things. So, like, polymorphic malware, for anybody not [35:06.060 --> 35:10.600] familiar, is malware that can change enough to change its hash to make it harder to detect, [35:10.600 --> 35:15.920] essentially. Um, and a couple other attributes. So, Emotet V4 is a module-based piece of [35:15.920 --> 35:19.340] malware that can call out and download different things and it's constantly changing itself on [35:19.340 --> 35:24.920] the system. So, in one of the cases that I used for that, I found common identifiers of the [35:24.920 --> 35:33.560] type, which specifically in this case, it was unsigned binaries under or between 60 and 74 [35:33.560 --> 35:40.060] kilobytes. And I tracked it down that way and got probably 150 different hashes until we could [35:40.060 --> 36:04.550] get Navy Vendor to do stuff. You come here, you get a gift. Yeah. So, did you say static [36:04.550 --> 36:17.310] analysis to intent? Significantly more difficult, um, from that base analysis to go into intent. [36:17.310 --> 36:22.250] Um, you're starting to get into real serious reverse engineering to get down into the code of [36:22.250 --> 36:28.270] exactly what it does outside of what you see from a dynamic perspective. Um, however, I have [36:28.270 --> 36:32.870] found that in many cases, and this is just me, like, I'm a horrible reverse engineer, I'm not [36:32.870 --> 36:37.030] going to lie. Because when I did IR, no company wanted to pay for that. They just wanted to [36:37.030 --> 36:50.250] know how to find it, how to get rid of it, and make sure it was gone. So, I just run a base [36:50.250 --> 36:56.170] VM, but I'm also sitting on a Linux box and I'm only messing with executables in this case. So, [36:56.170 --> 37:12.600] I don't do any specific VM isolation for this. What do I use to find different variances other [37:12.600 --> 37:17.040] than registry keys of the same malware? That's really interesting. And a really good [37:17.040 --> 37:23.000] question. I actually have to think about that. Also, come up here. You get a thing. Um, I [37:23.000 --> 37:28.160] mean, registry keys not being the only method of persistence in general either. So, any [37:28.160 --> 37:32.420] general auto runs that potentially exist, or any other normal common persistence [37:32.420 --> 37:53.490] mechanisms, but man, you're really stumping me with that question. So, the risk of letting [37:53.490 --> 37:58.290] network connections happen and what kind of setup I have in a lab and or VPN to accept that [37:58.290 --> 38:04.190] risk. And I will start that with a story of the one time I forgot to turn on my VPN and [38:04.190 --> 38:08.490] executed something that was terrifying and I thought I was screwed. Like, I thought I was [38:08.490 --> 38:13.150] going to get owned after I executed this thing because I completely forgot to turn it on. I was [38:13.150 --> 38:21.230] terrified for at least a week or two. I never made that mistake again, though. So, and all the [38:21.230 --> 38:25.110] fake DNS and stuff is really good, too, but it doesn't necessarily give you the full [38:25.110 --> 38:29.510] picture. So, I used private internet access for a long time and I was pretty happy with it. I [38:29.510 --> 38:34.290] switched over to Nord recently and I'm pretty happy with that, too. Um, depending on what I [38:34.290 --> 38:39.730] look at, I usually run it on host system, not on VM, so that my host system's coming from that [38:39.730 --> 38:44.570] location. I have seen a little bit of malware that's like location specific, so if you VPN, [38:44.570 --> 38:50.270] it's not necessarily going to execute anyway. But again, few and far between. Um, I've been [38:50.270 --> 38:54.230] pretty happy with standard out of the box VPN service. I haven't had problems in the five or [38:54.230 --> 39:06.180] so years that I did this regularly. Uh, I, I don't mind sharing the slides. I have no problem [39:06.180 --> 39:17.040] with that. So, is there anywhere that I can share the slides? Perfect. It'll be on [39:17.040 --> 39:34.590] blueteamvillage.org. Oh, another one. Go ahead. So, without getting into any of the ones that I [39:34.590 --> 39:39.430] can't talk about, um, one of the most interesting ones I've ever seen from a commodity [39:39.430 --> 39:45.950] perspective was that Emotet v4 sample. Because the initial payload was not malicious at all. [39:46.150 --> 39:53.130] And then it would call out and download modules, including SMB spreaders, um, different [39:53.130 --> 39:57.650] ransomware and like banking Trojan stuff. It could install other malware and it changed like [39:57.650 --> 40:02.790] every five minutes. So, trying to get a handle and I watched it shut down a company in two [40:02.790 --> 40:08.510] hours. Like completely shut down a company in two hours. So, trying to get a handle on what [40:08.510 --> 40:15.070] that was to clean it up when it kept changing was one of the most fun and stressful weekends [40:15.070 --> 40:20.470] of my life. It was also one of, on my birthday weekend, which was wonderful because I was [40:20.470 --> 40:29.470] supposed to be on vacation. Anything else? If not, thank you very much for your time, [40:29.470 --> 40:29.870] everybody.