1 00:00:00,000 --> 00:00:02,380 Without further ado, here's Alex with his talk. 2 00:00:03,940 --> 00:00:04,600 Thank you. 3 00:00:05,820 --> 00:00:08,280 Thank you for coming on a Sunday morning. 4 00:00:09,540 --> 00:00:12,020 We are gathered here today to talk about AI. 5 00:00:12,860 --> 00:00:14,920 My talk is entitled AI DevOps, 6 00:00:15,180 --> 00:00:18,760 Behind the Scenes of a Global Antivirus's Machine Learning Infrastructure. 7 00:00:19,020 --> 00:00:22,820 And just a meta note real quick, in making this talk, 8 00:00:23,960 --> 00:00:27,460 I'm going to be talking about work that was performed by many people on my team. 9 00:00:27,460 --> 00:00:30,000 So I actually interviewed about four people. 10 00:00:30,900 --> 00:00:33,600 And this work spans about two years. 11 00:00:34,100 --> 00:00:35,980 And I have about 20 minutes to tell you about it. 12 00:00:36,180 --> 00:00:41,680 So this is going to be a very kind of distilled highlight reel of our story. 13 00:00:44,080 --> 00:00:44,820 Who am I? 14 00:00:45,600 --> 00:00:47,540 So I'm doing a lot of things at the team. 15 00:00:47,620 --> 00:00:48,380 I do a lot of web dev. 16 00:00:48,500 --> 00:00:51,240 I do a lot of AWS backend stuff. 17 00:00:52,000 --> 00:00:53,220 Some ML research. 18 00:00:53,380 --> 00:00:54,540 I've done some Android stuff. 19 00:00:55,180 --> 00:00:56,300 That's a picture of my face. 20 00:00:57,460 --> 00:00:58,240 And my contact information. 21 00:00:59,380 --> 00:01:02,580 This is a picture of my cats, which you have three seconds to enjoy. 22 00:01:04,100 --> 00:01:06,040 This is the data science team at Sophos. 23 00:01:07,080 --> 00:01:09,440 Maddy Shihapa is actually in the crowd today. 24 00:01:10,640 --> 00:01:14,400 And Hillary Sanders, Konstantin Berlin, and the two Mats at the bottom 25 00:01:14,400 --> 00:01:18,060 contributed a lot more than I did to the work that I'm taking credit for today. 26 00:01:19,300 --> 00:01:21,420 I also have you on here because we're hiring. 27 00:01:21,620 --> 00:01:25,940 So if you have any expertise at the crossroads of cybersecurity and data science, 28 00:01:27,460 --> 00:01:28,180 we'd love to hear from you. 29 00:01:30,060 --> 00:01:34,840 Okay, so in the beginning, there was signature-based antivirus. 30 00:01:35,020 --> 00:01:37,100 And by beginning, I mean 2017. 31 00:01:38,700 --> 00:01:41,960 That's about the time that the data science team was added to Sophos. 32 00:01:42,080 --> 00:01:46,560 And we were the first kind of introduction of ML to their antivirus product. 33 00:01:47,060 --> 00:01:50,640 And there were a lot of just initial misconceptions. 34 00:01:51,600 --> 00:01:55,260 The big one being that machine learning is all you need. 35 00:01:56,660 --> 00:01:57,440 So this is a big one. 36 00:01:57,440 --> 00:02:01,020 This is something that we kind of had to convince people was wrong, 37 00:02:01,220 --> 00:02:02,780 even though we are the data scientists. 38 00:02:04,360 --> 00:02:07,220 And so just to kind of give you guys a way of thinking about this, 39 00:02:08,380 --> 00:02:10,920 if you imagine sort of the space of all files, 40 00:02:11,300 --> 00:02:14,060 and the green ones are benignware and the red ones are malware, 41 00:02:15,040 --> 00:02:17,780 and you kind of imagine that similar files are closer together, 42 00:02:18,000 --> 00:02:19,660 so the malware is sort of clustered in the middle. 43 00:02:21,100 --> 00:02:23,000 If you have signature-based antivirus, 44 00:02:23,100 --> 00:02:26,780 then your analysts are sort of writing these rules to draw these circles around, 45 00:02:26,780 --> 00:02:28,260 around specific malware samples. 46 00:02:28,870 --> 00:02:34,640 And the problem that has kind of besieged the whole industry in the last 10 years or so 47 00:02:34,640 --> 00:02:39,060 is that malware authors will just mutate their malware. 48 00:02:39,240 --> 00:02:41,540 They'll create variations, and it just overwhelms analysts. 49 00:02:41,940 --> 00:02:44,280 And the process of trying to update your signature 50 00:02:44,280 --> 00:02:48,460 and capture these new variations without capturing any false positives 51 00:02:48,460 --> 00:02:52,740 is just very tedious, and it's very laborious because it's all done by humans. 52 00:02:53,510 --> 00:02:56,760 So ML's value is a kind of fudge. 53 00:02:56,760 --> 00:02:57,560 So ML's value is a kind of fudge. 54 00:02:57,580 --> 00:02:57,640 So ML's value is a kind of fudge. 55 00:02:57,640 --> 00:02:57,980 So ML's value is a kind of fudge. 56 00:02:57,980 --> 00:03:00,620 Kind of generalize and take those original signatures 57 00:03:00,620 --> 00:03:02,500 and then just kind of learn from them. 58 00:03:03,140 --> 00:03:07,580 So it kind of helps to counteract this main tool that malware authors are using. 59 00:03:07,700 --> 00:03:10,040 So it's actually very well suited for this challenge, 60 00:03:10,740 --> 00:03:14,660 but it's important to keep in mind that without the signatures, 61 00:03:14,860 --> 00:03:16,220 there would be no ground truth, 62 00:03:16,440 --> 00:03:19,400 and there would be nothing for machine learning to learn. 63 00:03:19,780 --> 00:03:24,980 So ML is not really all you need. 64 00:03:25,060 --> 00:03:26,600 You still need humans in the loop. 65 00:03:29,460 --> 00:03:36,780 so some other some other things that we've added to kind of help ml are whitelists for critical 66 00:03:36,780 --> 00:03:43,380 system files that you might not want to fp on like explorer.exe blacklists for things that you 67 00:03:43,380 --> 00:03:48,920 just know or malware and what i'm calling fuzzy whitelists so we have sort of a reputation system 68 00:03:48,920 --> 00:03:53,520 where if we've seen a file in a lot of different computers we've seen a lot of times we sort of 69 00:03:53,520 --> 00:03:57,500 make the assumption that that means it's not malicious so we sort of give it a probabilistic 70 00:03:58,220 --> 00:04:03,640 it's probably good um when people at the company asked well why can't machine learning do all this 71 00:04:03,640 --> 00:04:10,300 we were like well math and stuff um basically um if you if you imagine like a neural network or 72 00:04:10,300 --> 00:04:14,540 something the number of layers that it has the number of neurons that it has that's a certain 73 00:04:14,540 --> 00:04:19,840 capacity that it has to learn patterns and there's no reason to waste the capacity trying 74 00:04:19,840 --> 00:04:22,920 to learn certain patterns of files that you never want to 75 00:04:23,480 --> 00:04:27,480 convict or files that you always want to convict when you can just do these kind of dead simple 76 00:04:27,480 --> 00:04:34,460 whitelists and blacklists um so the tone kind of changed from machine learning is all you need 77 00:04:34,460 --> 00:04:39,260 to kind of hey you know that project you got over there you know you how you could make it even 78 00:04:39,260 --> 00:04:45,260 better put some machine learning on it and that project that would be great with some machine 79 00:04:45,260 --> 00:04:50,800 learning um if you don't know this is from portlandia and this is an episode where they're 80 00:04:50,800 --> 00:04:52,900 making fun of how everyone in portland is making fun of how everyone in portland is making fun of 81 00:04:52,920 --> 00:04:58,400 things things look better with birds drawn on them um the best part about this episode is the ending 82 00:04:58,400 --> 00:05:03,740 when a bird actually flies into her shop and she's totally disgusted about it which is sort of 83 00:05:03,740 --> 00:05:11,000 what happened to us um now machine learning is alive and well at sophos but um the reality of 84 00:05:11,000 --> 00:05:17,580 trying to deploy it in a production environment was a lot uglier than anyone envisioned which 85 00:05:17,580 --> 00:05:22,720 brings me to scalability um so the main 86 00:05:22,920 --> 00:05:27,880 issue with scalability is just that when you're working with a product that's deployed across 87 00:05:27,880 --> 00:05:32,160 millions of endpoints and it's scanning tens of thousands of files on each endpoint every day 88 00:05:32,160 --> 00:05:37,360 that's a very different data set than the one that you trained and tested on which may be 89 00:05:37,360 --> 00:05:41,680 maybe tens of millions of samples and it's a static data set that you're kind of 90 00:05:41,680 --> 00:05:48,600 optimizing over and over on um so a lot of just different things sort of manifest um so just as an 91 00:05:48,600 --> 00:05:52,900 example to kind of illustrate this um was anybody born on august 12th 92 00:05:54,580 --> 00:06:00,120 okay so it's nobody's birthday today in this room um if you were to be very naive you might 93 00:06:00,120 --> 00:06:06,300 take that statistic and say well there's nobody born on august 12th um which presumably is wrong 94 00:06:06,300 --> 00:06:12,440 presumably roughly one 365th of the population is born on august 12th um but so that kind of 95 00:06:12,440 --> 00:06:17,620 demonstrates a small sample size issue and the same thing occurs with malware analysis if you 96 00:06:17,620 --> 00:06:22,900 have a small malware sample um data set then those kind of tiny pieces of data that you're 97 00:06:22,920 --> 00:06:28,940 just kind of get they disappear so it may be a small variation of a family or some critical 98 00:06:28,940 --> 00:06:33,960 system files um so what we've done is we set up this testing gauntlet so a model will get like 99 00:06:33,960 --> 00:06:39,200 three million files to work on to train and test on and if it reaches a certain threshold then it 100 00:06:39,200 --> 00:06:43,600 gets like five million and if it does well there it gets 10 million and you keep ramping it up 101 00:06:43,600 --> 00:06:48,940 that way you don't waste training time on large amounts of data you you start with three million 102 00:06:48,940 --> 00:06:52,720 and that's a test you can run relatively quickly if that goes well then you 103 00:06:52,920 --> 00:06:59,340 you keep amping it up um so in general um scalability just kind of amplifies things 104 00:06:59,340 --> 00:07:05,160 um we also have to strive for ridiculously low false positive rates because we're running our 105 00:07:05,160 --> 00:07:13,920 model so often and um the last last thing that sort of gets amplified is just costs so if you're 106 00:07:13,920 --> 00:07:21,020 using something like aws um which you should be it's great because whenever you ask for resources 107 00:07:21,020 --> 00:07:22,340 you get resources 108 00:07:22,920 --> 00:07:28,120 um the problem with aws is that whenever you ask for resources you get resources and you don't 109 00:07:28,120 --> 00:07:34,420 always know how much you're really asking for um so in one situation um we had a bunch of data 110 00:07:34,420 --> 00:07:40,460 on s3 that we were trying to move into glacier to save money and we neglected to notice that 111 00:07:40,460 --> 00:07:47,260 there was a small transaction fee to every move from s3 to glacier and we ended up blowing through 112 00:07:47,260 --> 00:07:50,240 our monthly budget in a couple of days so that was our bad 113 00:07:54,040 --> 00:08:00,420 um so another thing that we did to address scalability was um the switch from dynamo db to 114 00:08:00,420 --> 00:08:07,320 redshift so um dynamo db if you don't know is it's great for row based data if you want to pull 115 00:08:07,320 --> 00:08:14,880 out individual rows that works but um it's not great for aggregate statistics so you can't really 116 00:08:14,880 --> 00:08:18,780 run sql queries over large data sets because you have to pull down the entire table every time you 117 00:08:18,780 --> 00:08:22,900 want to do that um redshift is column based so it supports that more and more and it's not just 118 00:08:22,920 --> 00:08:30,420 a way to pull out the data much more quickly um so one other thing i'll touch on is just the actual 119 00:08:30,420 --> 00:08:39,480 going into production so um so one thing that we constantly have to deal with is what we're 120 00:08:39,480 --> 00:08:46,260 calling concept drift um which is also referred to as model dk um but essentially what happens is 121 00:08:46,260 --> 00:08:51,960 that you put a model in production and even over the course of a month the um effectiveness of the 122 00:08:51,960 --> 00:08:57,460 model stops starts to drop perceivably um this is just because new malware is being released and 123 00:08:57,460 --> 00:09:03,340 new benignware is also being released and so to actually compensate for this we have to train 124 00:09:03,340 --> 00:09:08,300 with sort of a handicap so we have to train on older data and test on newer data to kind of 125 00:09:08,300 --> 00:09:17,100 predict how our model will decay um there are also language discrepancies so um all of our 126 00:09:17,100 --> 00:09:21,660 research is done in python and we've literally had to rewrite some parts of 127 00:09:21,960 --> 00:09:28,660 c++ to get it to run on windows machines um releasing updates is tricky because you don't 128 00:09:28,660 --> 00:09:33,340 really know what you're releasing i mean you know certain ways of changing your model and 129 00:09:33,340 --> 00:09:37,280 maybe the architecture has changed you don't know how its behavior is going to change in production 130 00:09:37,280 --> 00:09:41,960 and it's not like releasing a code update where you can be pretty certain about what's going to 131 00:09:41,960 --> 00:09:49,560 happen um this is kind of a black box and so that's a little scary and that kind of ties into 132 00:09:49,560 --> 00:09:51,940 cultural because now you have data scientists who are doing a lot of the work and they're 133 00:09:51,960 --> 00:09:56,560 in like the production bloodstream which is sort of bad because we don't really know what we're 134 00:09:56,560 --> 00:10:01,680 doing there um there's been a lot of knowledge that we've had to gather along the way like 135 00:10:01,680 --> 00:10:08,020 the things i've talked about about scalability um and so there's been a lot of learning that 136 00:10:08,020 --> 00:10:11,600 we've had to do as a data science team and we've all had kind of had to take off our data science 137 00:10:11,600 --> 00:10:18,960 hats and put on engineering hats um and then kind of one anomaly that came up um someone wrote 138 00:10:18,960 --> 00:10:21,480 a hello world program in c++ 139 00:10:21,960 --> 00:10:25,980 and they compiled it with certain settings and our model said it was malicious 140 00:10:26,880 --> 00:10:31,320 and um you know management came to us and they were like well why is that happening and we were 141 00:10:31,320 --> 00:10:38,080 like well math and stuff um but they wanted a fix right it's like that's not good and in a 142 00:10:38,080 --> 00:10:43,360 production system if there's something that's impacting customers you you do a hot fix so you 143 00:10:43,360 --> 00:10:50,020 kind of surgically fix the code that's causing that problem without changing anything else you 144 00:10:50,020 --> 00:10:51,560 can't really do that in machine learning 145 00:10:51,960 --> 00:10:58,140 um so if you if you imagine a model like a pinball machine and you imagine that the model is all 146 00:10:58,140 --> 00:11:02,580 these pegs and samples we're running through it are these balls and the way the classification 147 00:11:02,580 --> 00:11:07,200 that is producing are these bins at the bottom you might run a bunch of samples through the model 148 00:11:07,200 --> 00:11:13,500 and it might get most of them right but there's that annoying little benign wear ball that we've 149 00:11:13,500 --> 00:11:20,180 fp'd on and what are we supposed to do about that like the position of all these pegs has 150 00:11:20,180 --> 00:11:21,920 been optimized through an automated process of 151 00:11:21,960 --> 00:11:26,960 over hundreds of hours like what are we going to do about that we could pick some peg and say well I 152 00:11:26,960 --> 00:11:36,560 wonder what happens if we twist it and run it all again and okay yay we got it but oh wait now we 153 00:11:36,560 --> 00:11:41,720 have a false negative so um you know there's really no way that our puny little human brains 154 00:11:41,720 --> 00:11:45,840 are going to like look at all these pegs and be able to figure out the right optimal solution that 155 00:11:45,840 --> 00:11:51,780 works for all samples so uh if you're afraid of robot overlords you might 156 00:11:51,960 --> 00:12:00,060 want to be but the actual takeaway here is that if you go back to the original thing that I was 157 00:12:00,060 --> 00:12:06,780 talking about um machine learning by itself doesn't always work it makes mistakes and when 158 00:12:06,780 --> 00:12:11,440 it's fudging the lines sometimes it fudges the lines in the wrong direction and it actually loses 159 00:12:11,440 --> 00:12:18,920 something that a signature would have caught um so robot overlords still kind of need us cool 160 00:12:24,460 --> 00:12:33,040 okay um I have six minutes to demo something and answer questions so AI total is an internal tool 161 00:12:33,040 --> 00:12:39,160 that we use for testing out our models um this is everything that it's built with um some of the 162 00:12:39,160 --> 00:12:43,100 interesting stuff we're starting to use SageMaker which I don't know if people are aware about but 163 00:12:43,100 --> 00:12:48,240 you put your model in a docker and docker container and it kind of handles everything else 164 00:12:48,240 --> 00:12:49,240 which is pretty great 165 00:12:52,720 --> 00:13:01,060 um okay so I wasn't able to connect to wi-fi which I'm not blaming anybody but maybe a defcon 166 00:13:01,060 --> 00:13:07,560 related issue um so I'm not able to give you a live demo but this is AI total um we've done a lot 167 00:13:07,560 --> 00:13:11,700 of work on different things other than PEs so we have I don't know if you can read the top but we 168 00:13:11,700 --> 00:13:20,620 have HTML models URL PE office docs um and Android um and so the way that this works is that you can 169 00:13:20,620 --> 00:13:21,940 actually live query the model and then you can do a lot of work on it and then you can do a lot of 170 00:13:21,960 --> 00:13:27,660 work on the other models that we have so this is our URL model and um you can actually type in 171 00:13:27,660 --> 00:13:33,260 a URL here and get instant feedback from the model and this allows us to kind of um just get a little 172 00:13:33,260 --> 00:13:38,160 sense before we push things out into production like how's it actually going to behave um for the 173 00:13:38,160 --> 00:13:43,940 other models for PE and office doc you can actually upload a file but um for URL because it takes 174 00:13:43,940 --> 00:13:51,740 text you can just type it in um so yeah um that's what I have for you guys thank you. 175 00:13:51,960 --> 00:13:52,460 any questions.