1 00:00:00,000 --> 00:00:03,000 Okay, good morning, everyone, and welcome to Recon Village again. 2 00:00:03,000 --> 00:00:07,200 Thanks for everyone who managed to come all the way over to Planet Hollywood again. 3 00:00:08,320 --> 00:00:13,680 I know we're in kind of the furthest realms of all of the hotels, so I do really appreciate you coming over here. 4 00:00:13,680 --> 00:00:17,900 We have got another jam-packed day, so if you were here yesterday, thanks very much for coming back. 5 00:00:17,980 --> 00:00:23,180 We have got a comprehensive talk to start the day, so I will get straight over to the boys to hand over. 6 00:00:23,320 --> 00:00:26,100 The title is on the screen, Hacked to Basics. 7 00:00:26,560 --> 00:00:38,440 If you did not catch Anthony and Jake yesterday, they were over in the Flamingo with a workshop, so if you did not catch them there, they will probably continue what they are doing here. 8 00:00:38,440 --> 00:00:45,160 They've got a wealth of experience between the two of them, and this is certainly not their first DEF CON, so without further ado, I will pass over to them right now. 9 00:00:45,160 --> 00:00:46,320 Thanks very much, guys. 10 00:00:47,340 --> 00:00:53,380 All right, so let's get started. 11 00:00:53,420 --> 00:00:58,080 This is Hacked to Basics, adapting exploit frameworks to evade Microsoft ATP. 12 00:00:58,900 --> 00:01:00,460 Like they said, I'm Anthony. 13 00:01:00,460 --> 00:01:01,580 I go by Coin. 14 00:01:01,580 --> 00:01:04,580 My background is electrical engineering. 15 00:01:04,980 --> 00:01:08,240 This is the second DEF CON now that I've spoken at. 16 00:01:08,240 --> 00:01:10,020 I'm a lock-picking hobbyist. 17 00:01:10,020 --> 00:01:14,140 I've done a lot of work in Bluetooth over the years, and especially working at... 18 00:01:15,280 --> 00:01:16,060 Uh-oh. 19 00:01:18,140 --> 00:01:19,360 We're good? 20 00:01:19,900 --> 00:01:20,740 Okay. 21 00:01:21,580 --> 00:01:22,380 All right. 22 00:01:22,380 --> 00:01:23,420 Is that better? 23 00:01:23,700 --> 00:01:24,740 Perfect. 24 00:01:24,760 --> 00:01:25,500 All right. 25 00:01:25,500 --> 00:01:31,180 So wireless security really is my passion, so I do a lot of work in wireless security and embedded systems. 26 00:01:32,240 --> 00:01:34,500 Yeah, and then I'm Jake Krasnov. 27 00:01:34,500 --> 00:01:35,540 I go by Hubble. 28 00:01:35,680 --> 00:01:47,740 I started off doing satellite engineering stuff, and then when I was in the military in a previous life, they actually started me in cyber kind of not by choice, but it ended up being a great thing, and I really enjoyed it. 29 00:01:48,100 --> 00:01:57,320 After that, I kind of went into a red team role for a little while, and now I do embedded security architecture stuff, and it's been pretty fun so far. 30 00:01:58,280 --> 00:02:01,500 So just a quick overview of what we're going to be going over. 31 00:02:01,620 --> 00:02:17,220 We're going to introduce Empire real quick, just in case some people in the room aren't familiar with it, and go over some of the current shortfalls, demonstrate how to employ some recon against an organization, and not just the organization, but also researching what kind of software and stuff they're running, 32 00:02:17,220 --> 00:02:19,740 if you're lucky enough to get that kind of information. 33 00:02:20,020 --> 00:02:35,720 Show how to weaponize Microsoft Azure with some interesting information we found about Outlook 365 and Azure, and how they overlap over each other, and then deploying that attack, a spear phishing attack with Outlook and Microsoft Word. 34 00:02:36,760 --> 00:02:37,620 So why are we here? 35 00:02:37,620 --> 00:02:50,980 For this assessment, we purposely chose to use an older framework like Empire, because we think a lot of people in the red team space are kind of obsessed with the newest shiny toy, and as soon as you see any hint of something being flagged or caught, 36 00:02:50,980 --> 00:02:53,620 they're like, oh, that tool's burned, and move on to the next thing. 37 00:02:54,380 --> 00:02:55,800 And that's not really true. 38 00:02:55,800 --> 00:03:04,880 Like, a lot of these older frameworks still work with very minor adjustments to them, and still bypass, like, even advanced, like, intrusion detection systems and stuff like that. 39 00:03:04,880 --> 00:03:09,460 And you don't need to use C sharp or those new hotness things to, to get past these things. 40 00:03:09,460 --> 00:03:13,400 Just show, share experiences from the attacking, like, a robust network. 41 00:03:14,660 --> 00:03:29,800 This assessment, it was just the two of us kind of working out of our houses against, like, some fairly large companies, or, you know, technology employed by fairly large companies like Dark Trace, Mimecast, like, Microsoft ATP, and things like that. 42 00:03:30,720 --> 00:03:34,320 And then Anthony's going to go do the quick overview for Empire real quick. 43 00:03:35,000 --> 00:03:38,080 So we chose Empire as our post-exploitation framework. 44 00:03:38,440 --> 00:03:40,700 I'm sure a lot of people are pretty familiar with it. 45 00:03:40,700 --> 00:03:42,120 It's been out for a little while. 46 00:03:42,300 --> 00:03:44,620 Came out back at B-Sides back in 2015. 47 00:03:45,000 --> 00:03:48,400 If you're not aware, however, it's no longer being maintained as of two weeks ago. 48 00:03:48,460 --> 00:03:51,740 So we really did choose an out-of-date framework for our assessment. 49 00:03:51,980 --> 00:03:54,660 It has a lot of things built into it that makes it really easy for us. 50 00:03:54,660 --> 00:03:58,480 So the adaptability for the modules, as well as the encrypted C2 channel. 51 00:03:59,080 --> 00:04:01,460 Maybe you're wondering why we're still choosing PowerShell. 52 00:04:01,460 --> 00:04:06,420 Well, you have full .NET access, direct access to the Win32 API. 53 00:04:06,680 --> 00:04:08,600 You can operate completely in memory. 54 00:04:08,760 --> 00:04:10,860 It's installed by default on Windows. 55 00:04:10,860 --> 00:04:12,820 And most of your network admins are still running this. 56 00:04:12,820 --> 00:04:17,460 So with our hopes, for our assessment, was the network admin had PowerShell enabled. 57 00:04:18,720 --> 00:04:23,720 For Empire, for its payloads, it typically does multi-stages for its payload. 58 00:04:23,720 --> 00:04:29,960 So you originally have your initial payload that goes out and then it goes in steps to deploy its full framework and it operates completely in memory. 59 00:04:31,360 --> 00:04:37,440 Some of the big shortfalls for Empire that we found, once again, it's relatively old in terms of hacking. 60 00:04:37,440 --> 00:04:39,480 So 2015 is an old framework. 61 00:04:40,040 --> 00:04:47,480 Many of the modules and signatures built into it have already been flagged, which is a big issue for us if we don't want to go detected. 62 00:04:47,880 --> 00:04:49,300 And then it's no longer being maintained. 63 00:04:49,300 --> 00:04:50,820 So we're going to have to make all the changes ourselves. 64 00:04:50,820 --> 00:04:52,120 We want to keep moving forward. 65 00:04:53,460 --> 00:04:56,960 Our initial plan moving in, you can see there's us. 66 00:04:56,960 --> 00:05:01,780 We wanted to use a cloud infrastructure to set up our listener. 67 00:05:02,060 --> 00:05:05,800 We wanted to then move into the network, going through their firewall. 68 00:05:05,920 --> 00:05:15,060 We knew they were running dark trace, so we wanted to evade that and we wanted to deliver our payload through Outlook, probably using a macro of some sort and embed it into a word doc. 69 00:05:15,060 --> 00:05:17,860 So that was our initial plan moving forward into our assessment. 70 00:05:18,600 --> 00:05:21,820 So we did, as we started with our recon, we knew who it was. 71 00:05:22,080 --> 00:05:24,820 We have a couple choices on how you want to conduct your recon. 72 00:05:25,040 --> 00:05:28,180 You can be asked, you can get paid, or you can be upset with them. 73 00:05:28,360 --> 00:05:32,540 For us, we weren't getting paid and we weren't upset, so we were asked to do this assessment. 74 00:05:34,460 --> 00:05:38,340 We did some scans on their servers to figure out what's going on. 75 00:05:38,340 --> 00:05:46,060 They moved pretty much everything into a cloud infrastructure, but we did find a lot of personal information on their website, which we found really useful. 76 00:05:46,560 --> 00:05:50,260 So for their organization, this is the financial advisor union. 77 00:05:50,600 --> 00:05:53,020 I'm not giving away the real information of this company. 78 00:05:53,020 --> 00:05:56,920 That was the one thing they asked us not to do, was to talk about them specifically. 79 00:05:57,200 --> 00:06:01,280 So, we're going to be targeting one person, specifically Kevin for now. 80 00:06:01,360 --> 00:06:08,060 So we're going to go over Kevin and look at some of the information that they have on the website about him that we might find really good for us. 81 00:06:09,380 --> 00:06:13,480 So, we can derive a lot of information from just his profile. 82 00:06:13,580 --> 00:06:17,140 We found that they have phone numbers for these employees on their website. 83 00:06:17,140 --> 00:06:26,800 They have email addresses, they have work addresses, as well as social media accounts, as well as personal or professional certifications. 84 00:06:27,060 --> 00:06:43,180 Pretty much 90% of all the employees at this place had the same professional certification, and we thought that, hey, maybe we can use this professional certification as a way to convince people to maybe check out some of the stuff that we're going to send to them for our spear-phishing attack. 85 00:06:44,180 --> 00:06:47,620 So we did a little bit more research looking into CFP. 86 00:06:47,620 --> 00:06:49,940 They had a whole website dedicated to it. 87 00:06:50,060 --> 00:06:57,600 It's a certification specifically for financial professionals, and most of the people in our private organization held the certification. 88 00:06:57,780 --> 00:07:00,040 So we went some more searching on their website. 89 00:07:00,280 --> 00:07:11,020 They have a lot of functionality built to it, specifically if you're searching for a financial advisor that you want to hire, you can put in their information, and it will pop back a bunch of stuff for them. 90 00:07:11,020 --> 00:07:17,080 So you can see here, I can enter just their name, and it will give me a search result back on these people. 91 00:07:17,080 --> 00:07:20,100 So looking up Kevin, I can search Kevin now. 92 00:07:20,160 --> 00:07:23,760 I can find his work address, which I already had before, as well as company. 93 00:07:24,380 --> 00:07:25,780 Hopefully it's the right Kevin. 94 00:07:26,880 --> 00:07:29,160 Disciplinary history, as well as bankruptcy. 95 00:07:29,780 --> 00:07:37,500 So now that I have all of this information, as well as some other information we gathered from a social media account, we can now start targeting these people specifically. 96 00:07:40,500 --> 00:07:48,120 So then we also started researching some of the software we knew they were running on their network. 97 00:07:48,120 --> 00:07:51,560 They want us to run this largely as a black box test. 98 00:07:51,760 --> 00:07:55,480 They didn't really tell us where their servers were, what the IP address is, or anything like that. 99 00:07:55,580 --> 00:08:03,880 Really the only thing they told us was that they were running dark trace, because it was kind of the new toy they had gotten there, and they were kind of proud they were running it. 100 00:08:03,940 --> 00:08:07,480 So we went and did a bunch of research on it, because we didn't really know exactly what it was at the time. 101 00:08:07,560 --> 00:08:23,140 It turns out it's kind of a next gen intrusion detection system that's using like AI and machine learning to do like network baselining where they're looking for is the website that someone is going to an unusual one, people don't normally go to that one. 102 00:08:23,360 --> 00:08:34,280 What are the network baselines in terms of when are users specifically normally on the network, like what hours, and how much data are they transferring day to day, and that kind of stuff. 103 00:08:34,280 --> 00:08:39,040 It also uses J3 signatures, which we'll talk about a little more in a second. 104 00:08:39,700 --> 00:08:53,040 So we actually, doing this, found an article about dark trace, specifically hunting empire, on using these J3 signatures, which are a way of fingerprinting like TLS handshakes without needing to be able to decrypt encrypted traffic. 105 00:08:53,440 --> 00:09:04,100 But it was really convenient, because they were talking about hunting empire, and at the bottom of their article, they actually gave a bunch of caveats about how you can go through and change your J3 signature so it doesn't match anymore. 106 00:09:05,760 --> 00:09:17,600 And so after that, we started researching office 365, because we knew they were running outlook as well, just based on some of the emails that had gone back and forth between them, or between us. 107 00:09:17,620 --> 00:09:29,540 And it turns out that if you start looking at the office 365 end points, there's a web API where they say, they give all the IP addresses that have to be whitelisted through your firewall and that kind of stuff, so the office 365 will work. 108 00:09:29,540 --> 00:09:39,740 And we go look up the Azure IP spaces as well, they actually overlap pretty significantly for quite a number of places. 109 00:09:40,040 --> 00:09:48,740 Like specifically, like the 52108 slash 16 subnet, almost half of that entire subnet was contained inside the Azure space as well. 110 00:09:49,300 --> 00:10:00,220 And like just up there is an example of the Asia Southeast region, all those addresses up there are actually inside of the office 365 whitelisted space as well. 111 00:10:00,900 --> 00:10:06,000 So what we wanted to do was kind of weaponize Azure to try and get inside that common IP space. 112 00:10:06,260 --> 00:10:08,420 Unfortunately, we weren't able to do that. 113 00:10:08,420 --> 00:10:14,280 We tried for about a week, like getting new IP addresses over and over again to try and get inside there. 114 00:10:14,280 --> 00:10:26,540 We got really close, and the IP addresses do shift slightly, that's why the API exists, so they can update, as they update them, they can, they can, sorry, organizations can update their whitelists as well. 115 00:10:26,780 --> 00:10:32,900 And so we were hoping that maybe being really close, our IP space had been contained in there at one point. 116 00:10:33,140 --> 00:10:41,940 So we went ahead and used that, and then Azure actually already has a Kali image uploaded there, and you can just stand up a server with Kali on it really easily. 117 00:10:41,940 --> 00:10:55,080 Their Kali is a little weird for some reason, like the commands don't run as like root by default, and we had a hard time installing PowerShell and stuff on it, so it's a little weird, but it does have all the tools and everything you need to stand it up. 118 00:10:55,260 --> 00:11:01,520 One thing we did learn, you can't pay for Microsoft Azure using gift cards, so don't try that. 119 00:11:01,520 --> 00:11:03,440 They ban gift cards completely. 120 00:11:05,400 --> 00:11:23,800 So our new plan was to, you know, use Azure as our cloud space to try and make it not look like a outlier end point when we did have callbacks from our targets, and hopefully DarkTrace had seen our IP address before, and we just wouldn't get flagged at all. 121 00:11:24,560 --> 00:11:30,840 So we went through also and made a bunch of updates to Empire like we talked about. 122 00:11:32,720 --> 00:11:48,840 So the master branch is out of date, like the master branch is really old, it hasn't had any updates pushed to it in like two or three years, so like invoke obfuscation has issues, PS inject is broken because of Microsoft updated the way some of the commandlets work in PowerShell, 123 00:11:48,840 --> 00:11:50,220 so you have to update those. 124 00:11:50,560 --> 00:12:05,120 They fixed a lot of that in their dev branch, if you go to it and download the dev branch specifically, a lot of those things have been corrected, but the main branch still doesn't really work, and you will get caught because it's so well known for, across like multiple IDSs and that kind of stuff. 125 00:12:05,980 --> 00:12:26,420 So what we had to fix, like I said, they updated a lot of the stuff like Mimikatz and invoke obfuscation to the latest versions inside of the dev branch, but we also went through and modified our JA3 signatures, fixed the default launch commands inside of there because they were tacking on an extra launcher that was actually breaking it a little bit, 126 00:12:26,420 --> 00:12:39,520 and then we updated the AMSI bypasses to have our own little flavor just to change the signature up a little bit, and there was a bug in the HTTP listener that actually caused a signature that AMSI was using to flag our scripts as well. 127 00:12:40,080 --> 00:12:46,300 So this just shows like what our JA3, what our TLS handshake looked like initially. 128 00:12:47,420 --> 00:12:59,800 The JA3 signature is hashing a bunch of fields in your TLS handshake, and the easiest one to change is that cipher suite that I have in that red box, you can go in and make some very complicated changes to your code. 129 00:12:59,920 --> 00:13:13,980 So it just takes adding this single line inside of your HTTP server on the Python web server and your JA3 signature changes completely, as well as just a single line inside of our PowerShell agent to change the JA3 signature there. 130 00:13:15,220 --> 00:13:21,520 So invoke obfuscation, like I said, is probably the most common issue reported on the Empire project. 131 00:13:21,520 --> 00:13:25,160 There's just hundreds of people saying like, oh, obfuscation is broken. 132 00:13:25,160 --> 00:13:26,660 It's not really broken. 133 00:13:26,740 --> 00:13:29,940 The default command is just not set up properly. 134 00:13:30,360 --> 00:13:34,560 And the dev branch fixed some of those, but some of them also still have like broken commands in them. 135 00:13:34,740 --> 00:13:39,680 But you can just update that command in that field where I have it running, using the obfuscate command. 136 00:13:40,820 --> 00:13:49,920 But if you just go to the token all one, which is the default invoke obfuscation, it doesn't use a truly random obfuscation set up. 137 00:13:49,920 --> 00:13:51,500 It uses a semi-random. 138 00:13:51,520 --> 00:13:57,680 And it's been run so many times and used, even if you use that token all one to obfuscate your payload, the signature gets flagged. 139 00:13:57,680 --> 00:14:01,240 Just all of the variations of that obfuscation have been seen. 140 00:14:01,460 --> 00:14:15,140 So if you use a custom order, like as you can see, it might be a little hard to read up there, but if you use a custom order of commands for invoke obfuscation, your payloads will still get passed most AVs when they do like file scanning and that kind of stuff. 141 00:14:17,180 --> 00:14:22,960 And then the default PowerShell launcher actually had a couple issues in it as well. 142 00:14:23,080 --> 00:14:26,320 The first one was the ANSI bypass they were using. 143 00:14:26,780 --> 00:14:34,000 They were using the bypass published by Matt Graber and it doesn't have any obfuscation in it. 144 00:14:34,320 --> 00:14:39,220 So the default, it was published in 2016, so it's been seen a lot and gets flagged. 145 00:14:39,320 --> 00:14:42,200 But it takes, again, it takes some very simple changes. 146 00:14:42,240 --> 00:14:49,960 All you have to do is concatenate the ANSI utils to break it apart so that signature is not there and the ANSI in it failed and the bypass will go through. 147 00:14:49,960 --> 00:14:52,580 So it takes like 30 seconds to update it. 148 00:14:53,600 --> 00:15:05,420 And then there was a bug in the code which was really interesting because even after we fixed that, the ANSI bypass from being flagged, we were still getting picked up and we couldn't figure out for a long time why we were getting picked up. 149 00:15:05,540 --> 00:15:21,320 And it turned out there was a bug in the code that was adding this headers.add user agent command twice in there and ANSI evaluates script box as a whole in context and that repeated command was enough to create a signature for AV to start flagging on it. 150 00:15:21,320 --> 00:15:31,640 So you remove that command being repeated twice and now our payload works, gets past defender out of the box without needing to run like invoke obfuscation and that kind of stuff on it. 151 00:15:36,510 --> 00:15:43,810 All right, so how do we convince our users now to click on our payload, launch it, and that way we get a callback out of their network. 152 00:15:43,870 --> 00:15:47,470 So we need to build a believable word doc because that's what we're going to employ. 153 00:15:47,470 --> 00:15:49,950 We chose word doc because it would probably be the easiest for us. 154 00:15:50,050 --> 00:15:54,410 We're going to embed our payload with visual basic into that word doc. 155 00:15:54,490 --> 00:16:04,830 We got to send that convincing email to hopefully get past junk mail and then hope that the user clicks on the email and opens the word doc and enables the macro. 156 00:16:04,830 --> 00:16:06,630 So we got a lot of stuff. 157 00:16:06,970 --> 00:16:09,770 So first we just go to the web page, pretty easy. 158 00:16:09,970 --> 00:16:13,930 We're going to grab the header, throw that on our word doc, try to make it as convincing as possible. 159 00:16:14,390 --> 00:16:21,590 Go back to Kevin, we're going to grab all that personal information that we had earlier and we're going to start adding it into our word doc just like this. 160 00:16:21,650 --> 00:16:29,530 Now, this alone is not going to be able to get us to get them to open, or not just open the word doc, but enable macros. 161 00:16:29,530 --> 00:16:33,570 Because the only way to make changes to our word doc is to enable macros. 162 00:16:33,590 --> 00:16:36,350 So we're going to purposely embed bad information in there. 163 00:16:36,350 --> 00:16:41,410 So when they look at this, they're going to be like, oh look, my information's not quite right. 164 00:16:41,610 --> 00:16:50,130 And in our email that we send out, we're going to try to get them to open and be like, hey, our, our database is being updated and you need to update this form and then send it in. 165 00:16:50,130 --> 00:16:54,530 So as they go through and add all that stuff in, they're going to have to go back and make edits to make sure it's correct. 166 00:16:55,290 --> 00:16:58,350 They send out a lot of newsletters and surveys all the time. 167 00:16:58,350 --> 00:17:00,990 I signed up for their stuff to kind of do some recon on that. 168 00:17:01,370 --> 00:17:03,710 And this is some of the stuff that would pop out of there. 169 00:17:03,710 --> 00:17:06,630 So they'd ask, what other certifications do you have? 170 00:17:06,770 --> 00:17:08,730 You know, how long have you been doing your job? 171 00:17:08,730 --> 00:17:10,230 And then what kind of education do you have? 172 00:17:10,230 --> 00:17:14,750 So we took that as well, threw it in there just to add a little bit more noise into our word doc. 173 00:17:15,230 --> 00:17:20,790 And then finally, after we put all the information in there, we wanted to kind of give some feedback to the user. 174 00:17:20,790 --> 00:17:22,350 So we put a submit button in there. 175 00:17:22,430 --> 00:17:25,470 So when they click on it, it actually doesn't do anything. 176 00:17:25,470 --> 00:17:28,010 All it does is gives them say, hey, look, your form was sent. 177 00:17:28,010 --> 00:17:31,030 But at least that way when they put in all their information, they hit a button. 178 00:17:31,030 --> 00:17:33,770 They get that good feeling that at least they accomplished something. 179 00:17:36,170 --> 00:17:43,370 We're going to take our AMSI, or our Empire payload that we made earlier, we're going to embed it into our Microsoft macro-enabled document. 180 00:17:43,450 --> 00:17:46,330 So we're going to send that using an email that we built. 181 00:17:46,470 --> 00:17:51,330 This email is pretty much pulled almost exactly from a newsletter that they sent out. 182 00:17:51,850 --> 00:17:57,870 So we pulled, we reformatted exactly like that, telling them, hey, guess what, our system is being updated. 183 00:17:57,870 --> 00:18:04,830 If you want to maintain your membership, you got to go in, update your information, hit submit, and then your account won't be suspended. 184 00:18:04,970 --> 00:18:09,450 We try to make it as urgent as possible so that way hopefully they'll be able to submit that form. 185 00:18:09,450 --> 00:18:11,610 Just a quick interjection. 186 00:18:11,610 --> 00:18:25,550 When you're making the Microsoft documents, word if you try to save with the current format like the 2013 format and earlier, it forces you to add, save as a macro-enabled document so it has a dot doc M at the end. 187 00:18:25,550 --> 00:18:30,450 If you save it as a 2007 form, it still just says the dot doc. 188 00:18:30,450 --> 00:18:36,370 So you don't show up as having a macro-enabled document if you save it as an older format rather than the new format. 189 00:18:37,390 --> 00:18:48,350 And a lot of e-mail services will filter out the dot doc M one, so it's good to make sure that we're keeping it so that way it gets through with the, kind of to maximize our chances. 190 00:18:48,950 --> 00:18:57,530 So now that we have our document, our e-mail, everything is ready to go, we're going to run a test using an e-mail account that we own to make sure that this all works. 191 00:18:57,530 --> 00:19:00,430 So we didn't want to just throw it out there in the wild and hope that it works. 192 00:19:00,430 --> 00:19:02,530 We wanted to do kind of a trial run. 193 00:19:02,670 --> 00:19:14,890 So we launch it, we get a call back, we're really excited, we're really happy, and then we stop and think for a minute and be like, wait, we sent the e-mail, however we never opened it, why am I getting a call back? 194 00:19:14,950 --> 00:19:16,390 So that's a bit of a problem. 195 00:19:16,570 --> 00:19:22,350 So we're looking here, we have our call back, we're a little confused, and then we look at the name, we're like, Sarah Sims. 196 00:19:22,430 --> 00:19:26,650 Yeah, I'm not Sarah, he's not Sarah, who the hell is this person and why do they have my malware? 197 00:19:26,990 --> 00:19:33,390 So there, what turns out is that our attack failed and we're not sure why. 198 00:19:33,670 --> 00:19:42,610 So, you know, being crafty as we were, we decided, why don't we just send a bunch of payloads now, get all these call backs and hopefully we can figure out what's going on. 199 00:19:43,290 --> 00:19:49,690 And it turns out this original plan that we came up with for launching everything into their network, it's not going to work. 200 00:19:49,710 --> 00:19:59,030 It turns out that Microsoft has built now ATP processes that they have in place into their regular non-ATP accounts. 201 00:19:59,230 --> 00:20:10,050 That adds a sandbox, so all these e-mails that you send out now, Microsoft is taking them, putting them into a sandbox environment and checking them to see if they execute or have any call backs out of them. 202 00:20:10,510 --> 00:20:17,090 So this is happening, there's no documentation at all on this, so just so you're aware, all your e-mails are being scanned by Microsoft. 203 00:20:17,150 --> 00:20:17,970 Big surprise. 204 00:20:20,860 --> 00:20:34,160 Yeah, so a sandbox, just real quick, it could be anything from where you're isolating an individual process to running like an entire virtual machine to analyze the behavior of an attachment or a piece of malware if you're doing analysis on your own. 205 00:20:34,920 --> 00:20:49,060 So when they start using these for the e-mails, it's because it's way easier to do behavioral analysis than try and create every single signature, well, easier is not the right word, but it's a more reliable way because you still have to do, if you're launching a payload, 206 00:20:49,060 --> 00:20:58,880 you still have to have things like your C2 callback, you're launching new processes and things like that, so the behavioral analysis is a more reliable way than using signatures. 207 00:20:59,060 --> 00:21:14,820 So they started using those, but we couldn't, like Anthony said, we couldn't find any documentation that Outlook was using sandboxes by default on all accounts, whether or not they were ATP or just plain old, like you signed up and used a free one. 208 00:21:15,080 --> 00:21:27,720 So what we did was we started, we decided that if we're getting all these callbacks , maybe we can use that to figure out what's going on because we tried using standard sandbox evasion techniques like launching the payload once the document was closed out, 209 00:21:27,720 --> 00:21:41,240 doing some time waiting, not very long, just like a minute or two, doing some time waiting, and doing like user inputs, like it won't launch unless there's some user inputs, and the sandbox was actually doing user inputs and that kind of stuff. 210 00:21:41,240 --> 00:21:46,880 It's a pretty advanced sandbox environment, so it was a little more difficult than we were expecting to evade it. 211 00:21:46,940 --> 00:21:55,220 So we wanted to try and enumerate the sandbox environment to see if there was any, we could get any information back that was a reliable indicator that we were in that sandbox. 212 00:21:55,460 --> 00:22:08,320 So our first attempt was just a super lazy, we sent an enumeration thing that made a text file and tried to copy it directly back to our server, and the sandbox did not like it when we tried to copy a file off, so it just killed our connection immediately, 213 00:22:08,320 --> 00:22:10,600 we didn't even get a full callback that time. 214 00:22:11,160 --> 00:22:31,660 So we ended up changing the second stage of the empire payload to enumerate the host, looking for things like identification numbers, disk size, RAM, that kind of stuff to see if the physical configuration of the sandbox was the same every time. 215 00:22:32,300 --> 00:22:34,160 And it turned out that it was. 216 00:22:34,160 --> 00:22:46,700 So every time you ran, you got the same serial number back or identification number, the same number of cores and the same disk size every time, even though the IP addresses, the domain names, the user names, all of that stuff was changing every time, 217 00:22:46,700 --> 00:22:49,980 the physical indicators were exactly the same every time. 218 00:22:50,540 --> 00:23:00,900 So we were able to build that, build that look, that check into our payload, and it immediately went through the sandbox without any issues from that point forward every single time. 219 00:23:01,120 --> 00:23:09,300 And we actually reported this to Microsoft saying like, hey, it's probably not a good idea that your sandbox allows the C2 server to connect. 220 00:23:09,700 --> 00:23:15,540 It ended up being fixed in about July, but as far as we can tell, it wasn't intentional because they hadn't gotten back to us. 221 00:23:15,540 --> 00:23:21,260 And the email they did send back to us said, we verified your issues, but we're not going to do anything about it. 222 00:23:21,260 --> 00:23:22,900 We might fix it in the future. 223 00:23:24,740 --> 00:23:29,540 And so now we're going to go ahead and try and launch the attack again now that we've identified that sandbox. 224 00:23:30,920 --> 00:23:39,040 So launching the attack, now that we have all the information, at least we think we had all the information, we launched our attack. 225 00:23:39,380 --> 00:23:41,140 We made it through the sandbox. 226 00:23:41,140 --> 00:23:42,040 Congratulations. 227 00:23:42,500 --> 00:23:50,500 However, for some reason, you know, no one is totally clicking our totally legit phishing campaign. 228 00:23:50,500 --> 00:23:52,000 Can't imagine why. 229 00:23:52,280 --> 00:24:04,820 Come to find out that our really great phishing campaign that we came up with doesn't work because since we're doing a black box test, they're employing minecast. 230 00:24:04,820 --> 00:24:12,180 So all their emails are being placed into kind of a locker and the users have to manually pull them out to actually view them. 231 00:24:12,240 --> 00:24:19,820 So this organization ran a spear phishing kind of assessment earlier in the year to kind of see how their users were doing. 232 00:24:19,980 --> 00:24:26,400 And we found out at that point that less than 2 percent of their users were clicking these kind of emails anyway. 233 00:24:26,500 --> 00:24:29,460 So our chances were pretty slim to start off with anyway. 234 00:24:29,900 --> 00:24:31,400 So that was great for them. 235 00:24:31,400 --> 00:24:33,040 It was really bad for us however. 236 00:24:33,300 --> 00:24:39,860 So we went in, we talked to the network admin and he said, sure, you know what, I have a computer laying around. 237 00:24:39,860 --> 00:24:42,980 I'll execute this payload on my computer to see if dark trace is working. 238 00:24:42,980 --> 00:24:45,260 Because that's really what the whole intent was behind this. 239 00:24:45,400 --> 00:24:47,420 So he goes, he clicks on it. 240 00:24:47,560 --> 00:24:48,560 It works. 241 00:24:48,560 --> 00:24:49,700 We get a call back. 242 00:24:49,700 --> 00:24:51,260 We think everything is great. 243 00:24:51,260 --> 00:24:55,280 Come to find out the network taps were misconfigured at this location. 244 00:24:55,400 --> 00:25:02,080 So they spent all this money setting up an IDS, an IPS and they misconfigured the entire thing. 245 00:25:02,080 --> 00:25:04,300 So that kind of sucked for them. 246 00:25:04,320 --> 00:25:06,540 So we asked nicely again. 247 00:25:06,540 --> 00:25:10,380 He went to another location that they knew was actually properly configured. 248 00:25:10,820 --> 00:25:14,460 And they launched it from there and we did get a call back again. 249 00:25:14,460 --> 00:25:17,720 So you can see there we blocked out all their personal information. 250 00:25:17,720 --> 00:25:22,380 We got a call back out of there with dark trace actually properly running. 251 00:25:22,480 --> 00:25:25,960 So our entire attack was completely successful. 252 00:25:26,560 --> 00:25:34,440 So we were successful in getting our C2 traffic not seen. 253 00:25:34,680 --> 00:25:43,200 We weren't really able to lateral partly because the scope of our agreement for the assessment was that we couldn't drop anything to disk. 254 00:25:43,200 --> 00:25:47,700 Which really limited our ability to like elevate our permissions and that kind of stuff. 255 00:25:47,700 --> 00:25:49,340 Because they didn't want us dropping any DLLs. 256 00:25:49,340 --> 00:25:52,840 They wanted to be able to just hit the power button on the computer and it would go back to where it was. 257 00:25:53,380 --> 00:25:56,160 So that limited us a lot. 258 00:25:56,160 --> 00:26:03,000 So we started getting noisier and noisier just from the single host that we had to try and enumerate it and that kind of the network and that kind of stuff. 259 00:26:03,240 --> 00:26:09,140 And dark trace did eventually when we started doing like full network scans that's a flag on the computer. 260 00:26:09,140 --> 00:26:12,900 But dark trace has a second component that you can buy called antigena. 261 00:26:12,900 --> 00:26:15,740 Which is a intrusion prevention system. 262 00:26:15,740 --> 00:26:23,140 It's supposed to be an automated system for if it sees bad actors to isolate that connection and cut it off and like isolate that computer. 263 00:26:23,200 --> 00:26:26,900 And even though we were getting, we had some alerts triggered, it never isolated us. 264 00:26:26,900 --> 00:26:31,980 So we were able to pull like a whole bunch of information off of the shared drives. 265 00:26:32,440 --> 00:26:39,400 Enumerate their network and we found like a computer, they found like a windows 2003 server on their network. 266 00:26:40,220 --> 00:26:41,740 So that kind of stuff. 267 00:26:41,740 --> 00:26:46,420 So it was, the attack was successful in terms of getting our C2 traffic passed. 268 00:26:46,420 --> 00:26:49,140 But we weren't really able to lateral because of the scope we had. 269 00:26:49,140 --> 00:26:56,020 And just also we hadn't entirely fixed some of the issues with like PS and jet getting flagged and stuff in empire at that point. 270 00:26:56,020 --> 00:26:57,980 We managed to fix those a little later. 271 00:26:59,480 --> 00:27:02,720 So the lessons learned, like the older frameworks are still viable. 272 00:27:02,720 --> 00:27:20,980 We had a next gen IDS and a lot of stuff that's supposed to be doing all this network baselining and using these weak indicators of compromise that when put all together are able to produce like strong indicators and like really effective analysis of the network. 273 00:27:21,640 --> 00:27:27,660 But we were using an outdated framework and we were still able to get past it with relatively minor changes in the code base. 274 00:27:28,340 --> 00:27:34,440 And then avoiding windows defender and amsy is not that hard, at least when you understand how they work. 275 00:27:35,000 --> 00:27:46,020 You actually see a lot of things online about old techniques for bypassing defender and amsy that people are like, oh, these don't work anymore because it was flagged in this new update or something like that. 276 00:27:46,080 --> 00:27:49,900 And really, they just don't understand why amsy is flagging on it. 277 00:27:49,900 --> 00:27:55,260 And it takes only a few strings being concatenated to make those techniques still work. 278 00:27:55,860 --> 00:28:03,060 And then phishing just overall is still one of the most common, is the most common way of delivering malware. 279 00:28:03,060 --> 00:28:17,240 But the click rates across like organizations like across the country, if you look at the Verizon wireless report that came out, the click rates are getting really low, like less than 5% in most companies, which is really great. 280 00:28:17,240 --> 00:28:22,580 It's great that we're finally getting to that point with things like mime cast stuff helping a lot. 281 00:28:23,340 --> 00:28:28,920 And then Microsoft is rolling out more and more mitigations and that's also really great too. 282 00:28:28,920 --> 00:28:38,860 Their response to us, we would have liked to see them say that they were going to address some of the issues with the sandbox, but we understand really why or we understand that they can't change everything like instantaneously. 283 00:28:38,860 --> 00:28:40,560 So hopefully they address that in the future. 284 00:28:41,960 --> 00:28:44,360 And just non-ATP accounts are getting better too. 285 00:28:46,000 --> 00:28:47,820 You guys got any questions for us? 286 00:28:48,680 --> 00:28:49,260 Sure. 287 00:28:50,460 --> 00:28:52,160 Sir, you with the hat. 288 00:29:00,310 --> 00:29:06,290 So what was happening was we would get a connection back for like two to three minutes and then it would cut off. 289 00:29:06,330 --> 00:29:07,930 And it was the same time every time. 290 00:29:07,930 --> 00:29:11,630 And when we looked up the IP addresses we were getting back, they were all registered to Microsoft. 291 00:29:12,390 --> 00:29:22,650 So we were able to look up those IP addresses and after we got four or five of them back and it kept detonating and they were all kind of in the same IP space and they were all registered to Microsoft. 292 00:29:22,670 --> 00:29:23,950 So we were able to do that. 293 00:29:26,230 --> 00:29:35,550 The question was how were we able to tell that we were in a sandbox prior to, without being told that when there was no documentation on it. 294 00:29:35,970 --> 00:29:36,950 So any other questions? 295 00:29:36,950 --> 00:29:37,650 Yes, sir. 296 00:29:49,600 --> 00:29:55,000 So the question was are there any more advertisers that are using sandboxes that aren't advertised. 297 00:29:55,580 --> 00:29:57,320 We are not aware of any. 298 00:29:58,160 --> 00:30:07,080 We haven't, I haven't been able to determine, Google rolled out sandboxes for G suite but I haven't been able to determine if they are being used on just standard Gmail accounts or not. 299 00:30:07,080 --> 00:30:09,580 I haven't seen anything that indicates that they are. 300 00:30:10,540 --> 00:30:14,880 Because like all of our payloads were going, like we were having the issue with the outlook. 301 00:30:14,880 --> 00:30:19,960 Our payload was still going through on Gmail because we tested on that to see if it was some other issue. 302 00:30:20,080 --> 00:30:21,880 It didn't get detonated there. 303 00:30:22,100 --> 00:30:24,500 So we're not, they were all making it through. 304 00:30:24,500 --> 00:30:28,380 So I'm not aware of anyone else putting unadvertised sandboxes in yet. 305 00:30:30,220 --> 00:30:30,760 Cool. 306 00:30:30,760 --> 00:30:31,840 Any other questions? 307 00:30:33,040 --> 00:30:33,760 Cool. 308 00:30:33,760 --> 00:30:34,720 Thanks, guys. 309 00:30:34,820 --> 00:30:35,760 I appreciate it.