[00:00.000 --> 00:03.820] Okay, good morning, everyone, and welcome to Recon Village again. Thanks for everyone who [00:03.820 --> 00:09.560] managed to come all the way over to Planet Hollywood again. I know we're in kind of the [00:09.560 --> 00:13.980] furthest realms of all of the hotels, so I do really appreciate you coming over here. We have [00:13.980 --> 00:17.900] got another jam-packed day, so if you were here yesterday, thanks very much for coming back. [00:17.980 --> 00:22.140] We have got a comprehensive talk to start the day, so I will get straight over to the boys [00:22.140 --> 00:28.760] to hand over. The title is on the screen, Hacked to Basics. If you did not catch Anthony and Jake [00:28.760 --> 00:35.600] yesterday, they were over in the Flamingo with a workshop, so if you did not catch them there, [00:35.600 --> 00:39.740] they will probably continue what they are doing here. They've got a wealth of experience between [00:39.740 --> 00:43.640] the two of them, and this is certainly not their first DEF CON, so without further ado, [00:43.640 --> 00:46.320] I will pass over to them right now. Thanks very much, guys. [00:47.340 --> 00:56.460] All right, so let's get started. This is Hacked to Basics, adapting exploit frameworks to evade [00:56.460 --> 01:03.640] Microsoft ATP. Like they said, I'm Anthony. I go by Coin. My background is electrical [01:03.640 --> 01:09.140] engineering. This is the second DEF CON now that I've spoken at. I'm a lock-picking [01:09.140 --> 01:14.140] hobbyist. I've done a lot of work in Bluetooth over the years, and especially working at... [01:15.280 --> 01:25.500] Uh-oh. We're good? Okay. All right. Is that better? Perfect. All right. [01:25.500 --> 01:30.060] So wireless security really is my passion, so I do a lot of work in wireless security and [01:30.060 --> 01:37.300] embedded systems. Yeah, and then I'm Jake Krasnov. I go by Hubble. I started off doing satellite [01:37.300 --> 01:42.220] engineering stuff, and then when I was in the military in a previous life, they actually [01:42.220 --> 01:46.920] started me in cyber kind of not by choice, but it ended up being a great thing, and I really [01:46.920 --> 01:52.980] enjoyed it. After that, I kind of went into a red team role for a little while, and now I do [01:52.980 --> 01:57.320] embedded security architecture stuff, and it's been pretty fun so far. [01:58.280 --> 02:02.920] So just a quick overview of what we're going to be going over. We're going to introduce [02:02.920 --> 02:07.000] Empire real quick, just in case some people in the room aren't familiar with it, and go over [02:07.000 --> 02:12.140] some of the current shortfalls, demonstrate how to employ some recon against an organization, [02:12.140 --> 02:16.580] and not just the organization, but also researching what kind of software and stuff [02:16.580 --> 02:21.060] they're running, if you're lucky enough to get that kind of information. Show how to weaponize [02:21.060 --> 02:27.800] Microsoft Azure with some interesting information we found about Outlook 365 and Azure, and how [02:27.800 --> 02:33.520] they overlap over each other, and then deploying that attack, a spear phishing attack with [02:33.520 --> 02:40.560] Outlook and Microsoft Word. So why are we here? For this assessment, we purposely chose to use [02:40.560 --> 02:45.140] an older framework like Empire, because we think a lot of people in the red team space are [02:45.140 --> 02:50.000] kind of obsessed with the newest shiny toy, and as soon as you see any hint of something being [02:50.000 --> 02:54.780] flagged or caught, they're like, oh, that tool's burned, and move on to the next thing. And [02:54.780 --> 02:58.320] that's not really true. Like, a lot of these older frameworks still work with very minor [02:58.320 --> 03:03.720] adjustments to them, and still bypass, like, even advanced, like, intrusion detection systems [03:03.720 --> 03:08.760] and stuff like that. And you don't need to use C sharp or those new hotness things to, to get [03:08.760 --> 03:13.400] past these things. Just show, share experiences from the attacking, like, a robust network. [03:14.660 --> 03:19.960] This assessment, it was just the two of us kind of working out of our houses against, [03:19.960 --> 03:24.700] like, some fairly large companies, or, you know, technology employed by fairly large [03:24.700 --> 03:31.220] companies like Dark Trace, Mimecast, like, Microsoft ATP, and things like that. And then [03:31.220 --> 03:36.360] Anthony's going to go do the quick overview for Empire real quick. So we chose Empire as our [03:36.360 --> 03:41.060] post-exploitation framework. I'm sure a lot of people are pretty familiar with it. It's been [03:41.060 --> 03:45.780] out for a little while. Came out back at B-Sides back in 2015. If you're not aware, [03:45.780 --> 03:49.760] however, it's no longer being maintained as of two weeks ago. So we really did choose an [03:49.760 --> 03:53.560] out-of-date framework for our assessment. It has a lot of things built into it that makes it [03:53.560 --> 03:57.760] really easy for us. So the adaptability for the modules, as well as the encrypted C2 [03:57.760 --> 04:02.140] channel. Maybe you're wondering why we're still choosing PowerShell. Well, you have full [04:02.140 --> 04:09.040] .NET access, direct access to the Win32 API. You can operate completely in memory. It's [04:09.040 --> 04:12.920] installed by default on Windows. And most of your network admins are still running this. So [04:12.920 --> 04:19.160] with our hopes, for our assessment, was the network admin had PowerShell enabled. For [04:19.160 --> 04:23.940] Empire, for its payloads, it typically does multi-stages for its payload. So you [04:23.940 --> 04:27.680] originally have your initial payload that goes out and then it goes in steps to deploy its [04:27.680 --> 04:33.320] full framework and it operates completely in memory. Some of the big shortfalls for Empire [04:33.320 --> 04:38.780] that we found, once again, it's relatively old in terms of hacking. So 2015 is an old [04:38.780 --> 04:44.780] framework. Many of the modules and signatures built into it have already been flagged, which [04:44.780 --> 04:48.740] is a big issue for us if we don't want to go detected. And then it's no longer being [04:48.740 --> 04:51.180] maintained. So we're going to have to make all the changes ourselves. We want to keep [04:51.180 --> 04:57.980] moving forward. Our initial plan moving in, you can see there's us. We wanted to use a cloud [04:57.980 --> 05:04.720] infrastructure to set up our listener. We wanted to then move into the network, going [05:04.720 --> 05:08.640] through their firewall. We knew they were running dark trace, so we wanted to evade that [05:08.640 --> 05:13.560] and we wanted to deliver our payload through Outlook, probably using a macro of some sort [05:13.560 --> 05:17.100] and embed it into a word doc. So that was our initial plan moving forward into our [05:17.100 --> 05:22.580] assessment. So we did, as we started with our recon, we knew who it was. We have a couple [05:22.580 --> 05:27.040] choices on how you want to conduct your recon. You can be asked, you can get paid, or you [05:27.040 --> 05:31.400] can be upset with them. For us, we weren't getting paid and we weren't upset, so we were [05:31.400 --> 05:37.720] asked to do this assessment. We did some scans on their servers to figure out what's going [05:37.720 --> 05:42.220] on. They moved pretty much everything into a cloud infrastructure, but we did find a lot of [05:42.220 --> 05:47.080] personal information on their website, which we found really useful. So for their [05:47.080 --> 05:52.100] organization, this is the financial advisor union. I'm not giving away the real information [05:52.100 --> 05:56.120] of this company. That was the one thing they asked us not to do, was to talk about them [05:56.120 --> 06:01.460] specifically. So, we're going to be targeting one person, specifically Kevin for now. So [06:01.460 --> 06:04.440] we're going to go over Kevin and look at some of the information that they have on the [06:04.440 --> 06:11.200] website about him that we might find really good for us. So, we can derive a lot of [06:11.200 --> 06:15.760] information from just his profile. We found that they have phone numbers for these [06:15.760 --> 06:20.580] employees on their website. They have email addresses, they have work addresses, as well as [06:20.580 --> 06:28.480] social media accounts, as well as personal or professional certifications. Pretty much 90% [06:28.480 --> 06:33.060] of all the employees at this place had the same professional certification, and we [06:33.060 --> 06:38.260] thought that, hey, maybe we can use this professional certification as a way to convince [06:38.260 --> 06:41.880] people to maybe check out some of the stuff that we're going to send to them for our [06:41.880 --> 06:48.400] spear-phishing attack. So we did a little bit more research looking into CFP. They had a [06:48.400 --> 06:54.360] whole website dedicated to it. It's a certification specifically for financial professionals, [06:54.360 --> 06:58.500] and most of the people in our private organization held the certification. So we went [06:58.500 --> 07:02.420] some more searching on their website. They have a lot of functionality built to it, [07:02.420 --> 07:07.140] specifically if you're searching for a financial advisor that you want to hire, you can put in [07:07.140 --> 07:12.120] their information, and it will pop back a bunch of stuff for them. So you can see here, I [07:12.120 --> 07:17.160] can enter just their name, and it will give me a search result back on these people. So [07:17.160 --> 07:22.080] looking up Kevin, I can search Kevin now. I can find his work address, which I already had [07:22.080 --> 07:28.260] before, as well as company. Hopefully it's the right Kevin. Disciplinary history, as well [07:28.260 --> 07:32.340] as bankruptcy. So now that I have all of this information, as well as some other [07:32.340 --> 07:35.800] information we gathered from a social media account, we can now start targeting these [07:35.800 --> 07:46.540] people specifically. So then we also started researching some of the software we knew [07:46.540 --> 07:51.560] they were running on their network. They want us to run this largely as a black box test. [07:51.760 --> 07:54.840] They didn't really tell us where their servers were, what the IP address is, or anything [07:54.840 --> 07:59.060] like that. Really the only thing they told us was that they were running dark trace, [07:59.060 --> 08:02.780] because it was kind of the new toy they had gotten there, and they were kind of proud [08:02.780 --> 08:05.520] they were running it. So we went and did a bunch of research on it, because we didn't [08:05.520 --> 08:10.780] really know exactly what it was at the time. It turns out it's kind of a next gen intrusion [08:10.780 --> 08:15.880] detection system that's using like AI and machine learning to do like network baselining [08:15.880 --> 08:21.500] where they're looking for is the website that someone is going to an unusual one, people [08:21.500 --> 08:27.080] don't normally go to that one. What are the network baselines in terms of when are users [08:27.080 --> 08:32.400] specifically normally on the network, like what hours, and how much data are they transferring [08:32.400 --> 08:37.760] day to day, and that kind of stuff. It also uses J3 signatures, which we'll talk about a [08:37.760 --> 08:43.920] little more in a second. So we actually, doing this, found an article about dark trace, [08:43.920 --> 08:49.000] specifically hunting empire, on using these J3 signatures, which are a way of [08:49.000 --> 08:53.040] fingerprinting like TLS handshakes without needing to be able to decrypt encrypted [08:53.440 --> 08:56.620] traffic. But it was really convenient, because they were talking about hunting empire, and [08:56.620 --> 09:01.020] at the bottom of their article, they actually gave a bunch of caveats about how you can go [09:01.020 --> 09:07.640] through and change your J3 signature so it doesn't match anymore. And so after that, we [09:07.640 --> 09:13.180] started researching office 365, because we knew they were running outlook as well, just [09:13.180 --> 09:17.860] based on some of the emails that had gone back and forth between them, or between us. And [09:17.860 --> 09:22.660] it turns out that if you start looking at the office 365 end points, there's a web API [09:22.660 --> 09:26.380] where they say, they give all the IP addresses that have to be whitelisted through your [09:26.380 --> 09:30.920] firewall and that kind of stuff, so the office 365 will work. And we go look up the [09:30.920 --> 09:38.980] Azure IP spaces as well, they actually overlap pretty significantly for quite a number of [09:38.980 --> 09:44.620] places. Like specifically, like the 52108 slash 16 subnet, almost half of that entire [09:44.620 --> 09:51.520] subnet was contained inside the Azure space as well. And like just up there is an example [09:51.520 --> 09:57.000] of the Asia Southeast region, all those addresses up there are actually inside of the [09:57.000 --> 10:03.260] office 365 whitelisted space as well. So what we wanted to do was kind of weaponize Azure [10:03.260 --> 10:08.480] to try and get inside that common IP space. Unfortunately, we weren't able to do that. We [10:08.480 --> 10:13.500] tried for about a week, like getting new IP addresses over and over again to try and get [10:13.500 --> 10:18.480] inside there. We got really close, and the IP addresses do shift slightly, that's why the [10:18.480 --> 10:23.980] API exists, so they can update, as they update them, they can, they can, sorry, [10:23.980 --> 10:29.140] organizations can update their whitelists as well. And so we were hoping that maybe being [10:29.140 --> 10:34.040] really close, our IP space had been contained in there at one point. So we went ahead and [10:34.040 --> 10:39.120] used that, and then Azure actually already has a Kali image uploaded there, and you can just [10:39.120 --> 10:43.140] stand up a server with Kali on it really easily. Their Kali is a little weird for some [10:43.140 --> 10:48.660] reason, like the commands don't run as like root by default, and we had a hard time [10:48.660 --> 10:52.680] installing PowerShell and stuff on it, so it's a little weird, but it does have all the [10:52.680 --> 10:58.180] tools and everything you need to stand it up. One thing we did learn, you can't pay for [10:58.180 --> 11:06.120] Microsoft Azure using gift cards, so don't try that. They ban gift cards completely. So our [11:06.120 --> 11:11.600] new plan was to, you know, use Azure as our cloud space to try and make it not look like a [11:12.800 --> 11:18.000] outlier end point when we did have callbacks from our targets, and hopefully DarkTrace had [11:18.000 --> 11:27.540] seen our IP address before, and we just wouldn't get flagged at all. So we went through also [11:27.540 --> 11:34.400] and made a bunch of updates to Empire like we talked about. So the master branch is out of [11:34.400 --> 11:37.840] date, like the master branch is really old, it hasn't had any updates pushed to it in like [11:37.840 --> 11:44.500] two or three years, so like invoke obfuscation has issues, PS inject is broken because of [11:45.100 --> 11:49.140] Microsoft updated the way some of the commandlets work in PowerShell, so you have to [11:49.140 --> 11:53.600] update those. They fixed a lot of that in their dev branch, if you go to it and download the [11:53.600 --> 11:56.880] dev branch specifically, a lot of those things have been corrected, but the main branch [11:56.880 --> 12:01.820] still doesn't really work, and you will get caught because it's so well known for, across [12:01.820 --> 12:07.820] like multiple IDSs and that kind of stuff. So what we had to fix, like I said, they [12:07.820 --> 12:12.000] updated a lot of the stuff like Mimikatz and invoke obfuscation to the latest versions [12:12.000 --> 12:17.020] inside of the dev branch, but we also went through and modified our JA3 signatures, [12:17.020 --> 12:22.300] fixed the default launch commands inside of there because they were tacking on an extra [12:23.800 --> 12:27.780] launcher that was actually breaking it a little bit, and then we updated the AMSI [12:28.260 --> 12:33.060] bypasses to have our own little flavor just to change the signature up a little bit, and [12:33.060 --> 12:37.000] there was a bug in the HTTP listener that actually caused a signature that AMSI was [12:37.000 --> 12:44.540] using to flag our scripts as well. So this just shows like what our JA3, what our TLS [12:44.540 --> 12:50.840] handshake looked like initially. The JA3 signature is hashing a bunch of fields in your [12:51.440 --> 12:55.400] TLS handshake, and the easiest one to change is that cipher suite that I have in that red [12:55.400 --> 13:00.400] box, you can go in and make some very complicated changes to your code. So it just [13:00.400 --> 13:06.480] takes adding this single line inside of your HTTP server on the Python web server and your [13:06.480 --> 13:11.280] JA3 signature changes completely, as well as just a single line inside of our PowerShell [13:11.280 --> 13:18.140] agent to change the JA3 signature there. So invoke obfuscation, like I said, is probably [13:18.140 --> 13:22.960] the most common issue reported on the Empire project. There's just hundreds of people [13:22.960 --> 13:28.280] saying like, oh, obfuscation is broken. It's not really broken. The default command is just [13:28.280 --> 13:32.920] not set up properly. And the dev branch fixed some of those, but some of them also still [13:32.920 --> 13:37.120] have like broken commands in them. But you can just update that command in that field where I [13:37.120 --> 13:43.360] have it running, using the obfuscate command. But if you just go to the token all one, [13:43.360 --> 13:49.920] which is the default invoke obfuscation, it doesn't use a truly random obfuscation set up. [13:49.920 --> 13:54.560] It uses a semi-random. And it's been run so many times and used, even if you use that [13:54.560 --> 13:58.680] token all one to obfuscate your payload, the signature gets flagged. Just all of the [13:58.680 --> 14:04.780] variations of that obfuscation have been seen. So if you use a custom order, like as you can [14:04.780 --> 14:07.980] see, it might be a little hard to read up there, but if you use a custom order of commands for [14:08.560 --> 14:13.700] invoke obfuscation, your payloads will still get passed most AVs when they do like file [14:13.700 --> 14:21.480] scanning and that kind of stuff. And then the default PowerShell launcher actually had a [14:21.480 --> 14:27.340] couple issues in it as well. The first one was the ANSI bypass they were using. They were [14:27.340 --> 14:34.860] using the bypass published by Matt Graber and it doesn't have any obfuscation in it. So the [14:35.440 --> 14:39.980] default, it was published in 2016, so it's been seen a lot and gets flagged. But it takes, [14:39.980 --> 14:44.380] again, it takes some very simple changes. All you have to do is concatenate the ANSI [14:44.380 --> 14:48.780] utils to break it apart so that signature is not there and the ANSI in it failed and the [14:48.780 --> 14:54.400] bypass will go through. So it takes like 30 seconds to update it. And then there was a bug [14:54.400 --> 14:58.460] in the code which was really interesting because even after we fixed that, the ANSI [14:58.460 --> 15:03.080] bypass from being flagged, we were still getting picked up and we couldn't figure out for a [15:03.080 --> 15:07.560] long time why we were getting picked up. And it turned out there was a bug in the code [15:07.560 --> 15:14.520] that was adding this headers.add user agent command twice in there and ANSI evaluates [15:14.520 --> 15:19.040] script box as a whole in context and that repeated command was enough to create a [15:19.040 --> 15:23.800] signature for AV to start flagging on it. So you remove that command being repeated twice [15:23.800 --> 15:28.940] and now our payload works, gets past defender out of the box without needing to run like [15:28.940 --> 15:38.530] invoke obfuscation and that kind of stuff on it. All right, so how do we convince our users [15:38.530 --> 15:43.810] now to click on our payload, launch it, and that way we get a callback out of their network. [15:43.870 --> 15:47.550] So we need to build a believable word doc because that's what we're going to employ. We [15:47.550 --> 15:50.950] chose word doc because it would probably be the easiest for us. We're going to embed our [15:50.950 --> 15:56.370] payload with visual basic into that word doc. We got to send that convincing email to [15:56.370 --> 16:01.670] hopefully get past junk mail and then hope that the user clicks on the email and opens the [16:01.670 --> 16:08.410] word doc and enables the macro. So we got a lot of stuff. So first we just go to the web [16:08.410 --> 16:12.410] page, pretty easy. We're going to grab the header, throw that on our word doc, try to make [16:12.410 --> 16:16.670] it as convincing as possible. Go back to Kevin, we're going to grab all that personal [16:16.670 --> 16:20.770] information that we had earlier and we're going to start adding it into our word doc just [16:20.770 --> 16:27.070] like this. Now, this alone is not going to be able to get us to get them to open, or not just [16:27.070 --> 16:31.970] open the word doc, but enable macros. Because the only way to make changes to our word doc [16:31.970 --> 16:36.550] is to enable macros. So we're going to purposely embed bad information in there. So when [16:36.550 --> 16:41.770] they look at this, they're going to be like, oh look, my information's not quite right. And [16:41.770 --> 16:45.810] in our email that we send out, we're going to try to get them to open and be like, hey, our, [16:46.230 --> 16:50.750] our database is being updated and you need to update this form and then send it in. So as [16:50.750 --> 16:53.270] they go through and add all that stuff in, they're going to have to go back and make edits [16:53.270 --> 16:58.510] to make sure it's correct. They send out a lot of newsletters and surveys all the time. I [16:58.510 --> 17:02.750] signed up for their stuff to kind of do some recon on that. And this is some of the stuff [17:02.750 --> 17:07.010] that would pop out of there. So they'd ask, what other certifications do you have? You know, [17:07.010 --> 17:10.950] how long have you been doing your job? And then what kind of education do you have? So we [17:10.950 --> 17:15.510] took that as well, threw it in there just to add a little bit more noise into our word doc. And [17:15.510 --> 17:19.630] then finally, after we put all the information in there, we wanted to kind of give some [17:19.630 --> 17:24.050] feedback to the user. So we put a submit button in there. So when they click on it, it [17:24.050 --> 17:28.010] actually doesn't do anything. All it does is gives them say, hey, look, your form was sent. [17:28.010 --> 17:31.230] But at least that way when they put in all their information, they hit a button. They get [17:31.230 --> 17:37.230] that good feeling that at least they accomplished something. We're going to take our [17:37.230 --> 17:41.050] AMSI, or our Empire payload that we made earlier, we're going to embed it into our [17:41.050 --> 17:45.650] Microsoft macro-enabled document. So we're going to send that using an email that we [17:45.650 --> 17:50.690] built. This email is pretty much pulled almost exactly from a newsletter that they sent [17:50.690 --> 17:56.830] out. So we pulled, we reformatted exactly like that, telling them, hey, guess what, our [17:56.830 --> 18:00.590] system is being updated. If you want to maintain your membership, you got to go in, update [18:00.590 --> 18:05.730] your information, hit submit, and then your account won't be suspended. We try to make it [18:05.730 --> 18:09.450] as urgent as possible so that way hopefully they'll be able to submit that form. [18:09.450 --> 18:15.370] Just a quick interjection. When you're making the Microsoft documents, word if you try to [18:15.370 --> 18:21.370] save with the current format like the 2013 format and earlier, it forces you to add, save [18:21.370 --> 18:26.990] as a macro-enabled document so it has a dot doc M at the end. If you save it as a 2007 [18:26.990 --> 18:33.150] form, it still just says the dot doc. So you don't show up as having a macro-enabled [18:33.150 --> 18:36.370] document if you save it as an older format rather than the new format. [18:37.390 --> 18:43.790] And a lot of e-mail services will filter out the dot doc M one, so it's good to make sure [18:43.790 --> 18:47.690] that we're keeping it so that way it gets through with the, kind of to maximize our [18:47.690 --> 18:52.770] chances. So now that we have our document, our e-mail, everything is ready to go, we're [18:52.770 --> 18:57.530] going to run a test using an e-mail account that we own to make sure that this all works. [18:57.530 --> 19:00.670] So we didn't want to just throw it out there in the wild and hope that it works. We wanted [19:00.670 --> 19:06.170] to do kind of a trial run. So we launch it, we get a call back, we're really [19:06.170 --> 19:10.030] excited, we're really happy, and then we stop and think for a minute and be like, wait, we [19:10.030 --> 19:15.550] sent the e-mail, however we never opened it, why am I getting a call back? So that's a bit [19:15.550 --> 19:20.110] of a problem. So we're looking here, we have our call back, we're a little confused, and [19:20.110 --> 19:24.470] then we look at the name, we're like, Sarah Sims. Yeah, I'm not Sarah, he's not Sarah, who [19:24.470 --> 19:29.610] the hell is this person and why do they have my malware? So there, what turns out is [19:29.610 --> 19:35.910] that our attack failed and we're not sure why. So, you know, being crafty as we were, [19:35.910 --> 19:40.710] we decided, why don't we just send a bunch of payloads now, get all these call backs and [19:40.710 --> 19:45.170] hopefully we can figure out what's going on. And it turns out this original plan that we [19:45.170 --> 19:50.390] came up with for launching everything into their network, it's not going to work. It turns [19:50.390 --> 19:57.510] out that Microsoft has built now ATP processes that they have in place into their regular [19:57.510 --> 20:02.970] non-ATP accounts. That adds a sandbox, so all these e-mails that you send out now, [20:02.970 --> 20:07.530] Microsoft is taking them, putting them into a sandbox environment and checking them to see [20:07.530 --> 20:12.070] if they execute or have any call backs out of them. So this is happening, there's no [20:12.070 --> 20:16.190] documentation at all on this, so just so you're aware, all your e-mails are being scanned [20:16.190 --> 20:23.720] by Microsoft. Big surprise. Yeah, so a sandbox, just real quick, it could be anything [20:23.720 --> 20:27.220] from where you're isolating an individual process to running like an entire virtual [20:27.220 --> 20:31.880] machine to analyze the behavior of an attachment or a piece of malware if you're doing [20:32.640 --> 20:38.680] analysis on your own. So when they start using these for the e-mails, it's because it's way [20:38.680 --> 20:44.280] easier to do behavioral analysis than try and create every single signature, well, easier is [20:44.280 --> 20:48.220] not the right word, but it's a more reliable way because you still have to do, if you're [20:48.220 --> 20:53.180] launching a payload, you still have to have things like your C2 callback, you're launching [20:53.180 --> 20:57.680] new processes and things like that, so the behavioral analysis is a more reliable way than [20:57.680 --> 21:02.760] using signatures. So they started using those, but we couldn't, like Anthony said, we [21:02.760 --> 21:09.240] couldn't find any documentation that Outlook was using sandboxes by default on all [21:09.240 --> 21:14.180] accounts, whether or not they were ATP or just plain old, like you signed up and used a [21:14.180 --> 21:19.480] free one. So what we did was we started, we decided that if we're getting all these [21:19.480 --> 21:23.260] callbacks, maybe we can use that to figure out what's going on because we tried using [21:23.260 --> 21:26.360] standard sandbox evasion techniques like launching the payload once the document was [21:26.360 --> 21:32.000] closed out, doing some time waiting, not very long, just like a minute or two, doing some [21:32.000 --> 21:37.080] time waiting, and doing like user inputs, like it won't launch unless there's some user [21:37.080 --> 21:41.580] inputs, and the sandbox was actually doing user inputs and that kind of stuff. It's a [21:41.580 --> 21:45.860] pretty advanced sandbox environment, so it was a little more difficult than we were [21:45.860 --> 21:50.540] expecting to evade it. So we wanted to try and enumerate the sandbox environment to see if [21:50.540 --> 21:54.080] there was any, we could get any information back that was a reliable indicator that we were [21:54.080 --> 22:00.480] in that sandbox. So our first attempt was just a super lazy, we sent an enumeration thing [22:00.480 --> 22:04.960] that made a text file and tried to copy it directly back to our server, and the sandbox did [22:04.960 --> 22:08.380] not like it when we tried to copy a file off, so it just killed our connection immediately, we [22:08.380 --> 22:15.920] didn't even get a full callback that time. So we ended up changing the second stage of the [22:15.920 --> 22:24.660] empire payload to enumerate the host, looking for things like identification numbers, disk [22:24.660 --> 22:30.180] size, RAM, that kind of stuff to see if the physical configuration of the sandbox was the [22:30.180 --> 22:36.220] same every time. And it turned out that it was. So every time you ran, you got the same [22:36.220 --> 22:40.440] serial number back or identification number, the same number of cores and the same disk [22:40.440 --> 22:44.940] size every time, even though the IP addresses, the domain names, the user names, all of that [22:44.940 --> 22:50.660] stuff was changing every time, the physical indicators were exactly the same every time. So [22:50.660 --> 22:56.560] we were able to build that, build that look, that check into our payload, and it immediately [22:56.560 --> 23:01.520] went through the sandbox without any issues from that point forward every single time. And we [23:01.520 --> 23:05.940] actually reported this to Microsoft saying like, hey, it's probably not a good idea that your [23:05.940 --> 23:12.600] sandbox allows the C2 server to connect. It ended up being fixed in about July, but as far as [23:12.600 --> 23:16.120] we can tell, it wasn't intentional because they hadn't gotten back to us. And the email they [23:16.120 --> 23:21.020] did send back to us said, we verified your issues, but we're not going to do anything about [23:21.020 --> 23:27.260] it. We might fix it in the future. And so now we're going to go ahead and try and launch the [23:27.260 --> 23:34.320] attack again now that we've identified that sandbox. So launching the attack, now that we [23:34.320 --> 23:38.160] have all the information, at least we think we had all the information, we launched our [23:38.160 --> 23:45.000] attack. We made it through the sandbox. Congratulations. However, for some reason, you [23:45.000 --> 23:52.680] know, no one is totally clicking our totally legit phishing campaign. Can't imagine why. Come [23:52.680 --> 23:57.640] to find out that our really great phishing campaign that we came up with doesn't work [23:57.640 --> 24:06.000] because since we're doing a black box test, they're employing minecast. So all their emails [24:06.000 --> 24:11.060] are being placed into kind of a locker and the users have to manually pull them out to [24:11.060 --> 24:17.200] actually view them. So this organization ran a spear phishing kind of assessment earlier in [24:17.200 --> 24:22.900] the year to kind of see how their users were doing. And we found out at that point that less [24:22.900 --> 24:27.240] than 2 percent of their users were clicking these kind of emails anyway. So our chances were [24:27.240 --> 24:32.300] pretty slim to start off with anyway. So that was great for them. It was really bad for us [24:32.300 --> 24:38.440] however. So we went in, we talked to the network admin and he said, sure, you know what, I [24:38.440 --> 24:42.560] have a computer laying around. I'll execute this payload on my computer to see if dark trace [24:42.560 --> 24:46.320] is working. Because that's really what the whole intent was behind this. So he goes, he [24:46.320 --> 24:52.180] clicks on it. It works. We get a call back. We think everything is great. Come to find out [24:52.180 --> 24:57.580] the network taps were misconfigured at this location. So they spent all this money setting [24:57.580 --> 25:04.520] up an IDS, an IPS and they misconfigured the entire thing. So that kind of sucked for them. So [25:05.000 --> 25:09.380] we asked nicely again. He went to another location that they knew was actually properly [25:09.380 --> 25:15.460] configured. And they launched it from there and we did get a call back again. So you can see [25:15.460 --> 25:20.200] there we blocked out all their personal information. We got a call back out of there with [25:20.200 --> 25:25.960] dark trace actually properly running. So our entire attack was completely successful. [25:26.560 --> 25:36.320] So we were successful in getting our C2 traffic not seen. We weren't really able to lateral [25:36.320 --> 25:42.020] partly because the scope of our agreement for the assessment was that we couldn't drop [25:42.020 --> 25:47.180] anything to disk. Which really limited our ability to like elevate our permissions and that [25:47.180 --> 25:50.020] kind of stuff. Because they didn't want us dropping any DLLs. They wanted to be able to just [25:50.020 --> 25:54.820] hit the power button on the computer and it would go back to where it was. So that limited [25:54.820 --> 25:59.320] us a lot. So we started getting noisier and noisier just from the single host that we had to [25:59.320 --> 26:03.880] try and enumerate it and that kind of the network and that kind of stuff. And dark trace [26:03.880 --> 26:09.140] did eventually when we started doing like full network scans that's a flag on the computer. [26:09.140 --> 26:14.760] But dark trace has a second component that you can buy called antigena. Which is a [26:14.760 --> 26:20.000] intrusion prevention system. It's supposed to be an automated system for if it sees bad [26:20.000 --> 26:23.440] actors to isolate that connection and cut it off and like isolate that computer. And even [26:23.440 --> 26:27.440] though we were getting, we had some alerts triggered, it never isolated us. So we were able [26:27.440 --> 26:34.260] to pull like a whole bunch of information off of the shared drives. Enumerate their network [26:34.260 --> 26:40.700] and we found like a computer, they found like a windows 2003 server on their network. So [26:40.700 --> 26:45.940] that kind of stuff. So it was, the attack was successful in terms of getting our C2 traffic [26:45.940 --> 26:50.660] passed. But we weren't really able to lateral because of the scope we had. And just also we [26:50.660 --> 26:55.200] hadn't entirely fixed some of the issues with like PS and jet getting flagged and stuff in [26:55.200 --> 27:00.700] empire at that point. We managed to fix those a little later. So the lessons learned, like [27:00.700 --> 27:05.620] the older frameworks are still viable. We had a next gen IDS and a lot of stuff that's [27:05.620 --> 27:12.100] supposed to be doing all this network baselining and using these weak indicators of [27:12.100 --> 27:17.520] compromise that when put all together are able to produce like strong indicators and like [27:17.520 --> 27:23.320] really effective analysis of the network. But we were using an outdated framework and we [27:23.320 --> 27:28.820] were still able to get past it with relatively minor changes in the code base. And then [27:29.720 --> 27:33.700] avoiding windows defender and amsy is not that hard, at least when you understand how they [27:33.700 --> 27:39.840] work. You actually see a lot of things online about old techniques for bypassing defender and [27:39.840 --> 27:43.860] amsy that people are like, oh, these don't work anymore because it was flagged in this new [27:43.860 --> 27:49.320] update or something like that. And really, they just don't understand why amsy is flagging on [27:49.320 --> 27:54.480] it. And it takes only a few strings being concatenated to make those techniques still [27:54.480 --> 28:01.960] work. And then phishing just overall is still one of the most common, is the most common way [28:01.960 --> 28:07.840] of delivering malware. But the click rates across like organizations like across the [28:07.840 --> 28:11.920] country, if you look at the Verizon wireless report that came out, the click rates are [28:11.920 --> 28:18.000] getting really low, like less than 5% in most companies, which is really great. It's great that [28:18.000 --> 28:23.520] we're finally getting to that point with things like mime cast stuff helping a lot. And [28:23.520 --> 28:28.920] then Microsoft is rolling out more and more mitigations and that's also really great too. [28:28.920 --> 28:31.980] Their response to us, we would have liked to see them say that they were going to address [28:31.980 --> 28:37.020] some of the issues with the sandbox, but we understand really why or we understand that [28:37.020 --> 28:39.820] they can't change everything like instantaneously. So hopefully they address that in [28:39.820 --> 28:47.200] the future. And just non-ATP accounts are getting better too. You guys got any questions for [28:47.200 --> 29:03.130] us? Sure. Sir, you with the hat. So what was happening was we would get a connection back for [29:03.130 --> 29:07.930] like two to three minutes and then it would cut off. And it was the same time every time. [29:07.930 --> 29:10.870] And when we looked up the IP addresses we were getting back, they were all registered to [29:10.870 --> 29:16.350] Microsoft. So we were able to look up those IP addresses and after we got four or five of [29:16.350 --> 29:21.190] them back and it kept detonating and they were all kind of in the same IP space and they [29:21.190 --> 29:29.270] were all registered to Microsoft. So we were able to do that. The question was how were we [29:29.270 --> 29:34.250] able to tell that we were in a sandbox prior to, without being told that when there was no [29:34.250 --> 29:51.460] documentation on it. So any other questions? Yes, sir. So the question was are there any [29:51.460 --> 29:57.320] more advertisers that are using sandboxes that aren't advertised. We are not aware of any. [29:58.160 --> 30:03.380] We haven't, I haven't been able to determine, Google rolled out sandboxes for G suite but I [30:03.380 --> 30:06.800] haven't been able to determine if they are being used on just standard Gmail accounts or [30:06.800 --> 30:12.100] not. I haven't seen anything that indicates that they are. Because like all of our payloads [30:12.100 --> 30:15.800] were going, like we were having the issue with the outlook. Our payload was still going [30:15.800 --> 30:20.700] through on Gmail because we tested on that to see if it was some other issue. It didn't get [30:20.700 --> 30:25.680] detonated there. So we're not, they were all making it through. So I'm not aware of anyone [30:25.680 --> 30:34.720] else putting unadvertised sandboxes in yet. Cool. Any other questions? Cool. Thanks, guys. [30:34.820 --> 30:35.760] I appreciate it.