1 00:00:00,000 --> 00:00:03,820 Thanks everybody for coming. I appreciate it. Good turnout. This is good stuff. 2 00:00:03,980 --> 00:00:06,740 This is my second time talking at DEF CON and it was good turnout both years. 3 00:00:07,600 --> 00:00:11,460 I am Jacob West. I run security research at Fortify Software. 4 00:00:11,720 --> 00:00:14,660 And Matias is one of our researchers. I'll let him introduce himself in a second. 5 00:00:14,840 --> 00:00:19,880 I came to the security world because I worked on static analysis. 6 00:00:20,100 --> 00:00:23,840 So I worked on a static analysis tool at Berkeley for looking for security vulnerabilities 7 00:00:23,840 --> 00:00:27,840 in C and C++. And I got really excited when on our last 8 00:00:27,840 --> 00:00:31,560 project with that, we applied it to the entire Red Hat Linux distribution. 9 00:00:31,820 --> 00:00:35,640 So it was like over 100 million lines of code. It was the biggest static analysis exercise 10 00:00:35,640 --> 00:00:39,320 to date. And what it turned up was we could find a bunch of bugs. 11 00:00:39,420 --> 00:00:43,480 And bugs that were easy to report, easy to fix, easy to deal with for the most part. 12 00:00:43,680 --> 00:00:47,720 And so that got me really excited and I joined this company called Fortify and since then 13 00:00:47,720 --> 00:00:51,720 we've been building static and now some dynamic analysis tools to find 14 00:00:51,720 --> 00:00:55,960 security vulnerabilities. I got to write a book a few years ago called Secure Programming 15 00:00:55,960 --> 00:00:57,780 with Static Analysis with a college 16 00:00:57,840 --> 00:01:01,880 of mine, Brian Chess. That's a great reference for any programmers out there 17 00:01:01,880 --> 00:01:05,260 who want to understand how static analysis as a technology 18 00:01:05,820 --> 00:01:09,720 and software security can come together. And how static analysis, which is good for 19 00:01:09,720 --> 00:01:13,120 hammering all different kinds of nails, is particularly good at the software security problem. 20 00:01:13,980 --> 00:01:18,180 As I mentioned, my co-host today is Matias Mado. Matias, you want to introduce yourself? 21 00:01:18,480 --> 00:01:21,860 Yep. So I'm principal security researcher at Fortify Software 22 00:01:21,860 --> 00:01:25,260 and at Fortify Software I focus mainly on 23 00:01:25,260 --> 00:01:28,160 developing new techniques for finding vulnerabilities. 24 00:01:28,920 --> 00:01:33,320 This by doing static analysis on source code and dynamic analysis 25 00:01:33,320 --> 00:01:36,980 on running apps. Another project that I'm working on is 26 00:01:36,980 --> 00:01:41,180 developing new ways to protect web application firewalls. So we have 27 00:01:41,180 --> 00:01:45,080 some sort of a web application firewall that is inside the application 28 00:01:45,080 --> 00:01:49,300 so it's context sensitive so we can actually do a better job. 29 00:01:50,480 --> 00:01:53,160 Last year I contributed to the BSIM Europe 30 00:01:53,160 --> 00:01:57,240 project. I'm not sure if you're familiar with BSIM, but BSIM is a maturity model 31 00:01:57,240 --> 00:02:01,080 that is... I'm sorry to interrupt. I'm curious about this audience. Who's heard of BSIM? 32 00:02:01,940 --> 00:02:03,880 Oh. That's more than I expected. 33 00:02:05,460 --> 00:02:09,120 So BSIM, for the other people, BSIM is a maturity model that is based 34 00:02:09,120 --> 00:02:12,080 on real world data from leading 35 00:02:12,980 --> 00:02:17,180 software enterprises. So this model can help you actually shape 36 00:02:17,180 --> 00:02:19,960 and plan your software security initiative. 37 00:02:20,760 --> 00:02:23,380 And when I was a researcher at Ghent University 38 00:02:23,380 --> 00:02:26,660 I developed a code obfuscation and binary writing tool. 39 00:02:27,340 --> 00:02:28,920 So that's a little bit of my past. 40 00:02:30,800 --> 00:02:35,760 Alright, fantastic. So I'm going to get us started today with a little background on what we mean 41 00:02:35,760 --> 00:02:39,740 by the insider threat problem. What we mean by an insider, what kind of threat 42 00:02:39,740 --> 00:02:43,540 they might pose. Matthias is going to go through a series of examples 43 00:02:43,540 --> 00:02:47,480 and kind of a classification of the insider threats, the code level that we've identified 44 00:02:47,480 --> 00:02:51,200 and then I'll talk some about what tools 45 00:02:51,200 --> 00:02:55,420 people trying to protect against insiders have at their disposal, both in terms 46 00:02:55,420 --> 00:02:59,420 of process and technology. And then we'll conclude with the examples that Matthias 47 00:02:59,420 --> 00:03:03,300 already explained, lined up against the defense techniques and the technology 48 00:03:03,300 --> 00:03:07,440 that I'm going to talk about and showing you in the real world what we can actually 49 00:03:07,440 --> 00:03:09,640 accomplish today in terms of identifying insiders. 50 00:03:11,140 --> 00:03:15,340 So first off, last year 43%, more than 51 00:03:15,340 --> 00:03:17,460 43% of organizations that responded to BSIM were 52 00:03:17,480 --> 00:03:21,260 responded to a CSI survey said that they attributed at least some of their 53 00:03:21,260 --> 00:03:25,220 losses to insiders. So people that were employed for their company 54 00:03:26,380 --> 00:03:29,040 ostensibly working towards the same goals as the company but 55 00:03:29,040 --> 00:03:31,160 exacted some damage deliberately. 56 00:03:33,380 --> 00:03:37,080 I like a definition that Bishop and Gates, 57 00:03:37,200 --> 00:03:40,580 Gates is from CA Labs and Matt Bishop of course is at UC Davis 58 00:03:41,280 --> 00:03:45,200 used to define the insider threat. So there are really two 59 00:03:45,200 --> 00:03:49,220 kinds of threats that we're worried about here when we talk about an insider, somebody inside 60 00:03:49,220 --> 00:03:52,960 the organization. One is they have some existing set of permissions, 61 00:03:53,240 --> 00:03:57,080 access to some resource, something of value, and they use that 62 00:03:57,080 --> 00:04:01,240 in an incorrect way. So they have permissions legitimately 63 00:04:01,240 --> 00:04:05,260 to read all the users from the database because they work in support. But when they 64 00:04:05,260 --> 00:04:09,200 take that information and send it to their buddy on the outside or use it to spam 65 00:04:09,200 --> 00:04:13,440 all the users, then they've used legitimate access for a nefarious 66 00:04:13,440 --> 00:04:15,180 goal, some illegitimate goal. 67 00:04:15,200 --> 00:04:18,320 The other class we're interested in are 68 00:04:19,200 --> 00:04:22,440 insiders who gain some access that they're not supposed to have. 69 00:04:23,560 --> 00:04:27,360 They're supposed to have a user login that would let them query their own account in LDAP. 70 00:04:27,580 --> 00:04:31,120 They hack into the system and gain access to an admin 71 00:04:31,120 --> 00:04:35,020 login that can update all the records in LDAP. That's gaining 72 00:04:35,020 --> 00:04:38,840 more access than they were intended to have. So you can take legitimate access 73 00:04:38,840 --> 00:04:42,820 and do illegitimate things, or you can gain ill-gotten access, 74 00:04:42,940 --> 00:04:45,180 illegitimate access, and do more than you're supposed to do. 75 00:04:45,200 --> 00:04:45,900 be able to do with it. 76 00:04:48,060 --> 00:04:49,160 Of course, insiders 77 00:04:49,160 --> 00:04:51,180 can fill all kinds of roles. So we hear a lot 78 00:04:51,180 --> 00:04:53,160 about IT people, we hear about people on 79 00:04:53,160 --> 00:04:54,800 the support team, we hear about 80 00:04:54,800 --> 00:04:57,260 all kinds of users who might be upset 81 00:04:57,260 --> 00:04:59,020 with the organization or want to do some damage. 82 00:04:59,520 --> 00:05:01,060 At Fortify and from 83 00:05:01,060 --> 00:05:03,160 our backgrounds, we're interested in software. We're software 84 00:05:03,160 --> 00:05:05,120 people. So in particular, we're going to talk 85 00:05:05,120 --> 00:05:07,120 about developers and what kind of 86 00:05:07,120 --> 00:05:09,200 an insider threat a developer with access 87 00:05:09,200 --> 00:05:10,720 to commit code to 88 00:05:10,720 --> 00:05:13,020 whatever your organization's codebase might be, 89 00:05:13,160 --> 00:05:15,180 what kind of damage they can do, and 90 00:05:15,200 --> 00:05:16,880 how we can identify the kinds of problems 91 00:05:16,880 --> 00:05:17,560 that they introduce. 92 00:05:19,180 --> 00:05:20,960 So what motivates a 93 00:05:20,960 --> 00:05:21,680 malicious insider? 94 00:05:22,540 --> 00:05:25,080 One of the most interesting stories I have from 95 00:05:25,080 --> 00:05:27,080 two or three years of working on this is 96 00:05:27,080 --> 00:05:28,820 a board of directors 97 00:05:28,820 --> 00:05:31,000 contacted our senior management 98 00:05:31,000 --> 00:05:33,260 and said, what can Fortify do to help with 99 00:05:33,260 --> 00:05:34,500 insider threats? 100 00:05:34,920 --> 00:05:37,080 And we said, the board of directors is 101 00:05:37,080 --> 00:05:38,820 asking about IT insider 102 00:05:38,820 --> 00:05:41,100 threat programmers. They don't know those 103 00:05:41,100 --> 00:05:42,040 people. What are they doing? 104 00:05:42,760 --> 00:05:44,980 Turned out they were getting ready. This was a big financial 105 00:05:45,200 --> 00:05:46,760 institution around 2008. 106 00:05:47,080 --> 00:05:48,660 And they were getting ready to lay off 107 00:05:48,660 --> 00:05:49,960 6,000 programmers. 108 00:05:51,100 --> 00:05:52,600 They were really worried about 109 00:05:52,600 --> 00:05:55,100 one of those programmers that they were about to lay off 110 00:05:55,100 --> 00:05:56,840 leaving something behind, a time bomb, 111 00:05:57,160 --> 00:05:59,000 some sort of malicious logic to do some damage 112 00:05:59,000 --> 00:06:01,040 to the organization. So they had 113 00:06:01,040 --> 00:06:02,960 started pushing their internal security team, 114 00:06:03,200 --> 00:06:05,120 what are you going to do to protect us against 115 00:06:05,120 --> 00:06:07,060 this? What's your process and technology in 116 00:06:07,060 --> 00:06:08,960 place to avoid these insiders 117 00:06:08,960 --> 00:06:10,760 doing damage? And in this case, 118 00:06:10,860 --> 00:06:13,080 these two potential motives, 119 00:06:13,260 --> 00:06:15,000 revenge, this is the first 120 00:06:15,200 --> 00:06:16,860 and foremost, but also maybe 121 00:06:16,860 --> 00:06:18,780 monetary gain, right? If I'm going to screw 122 00:06:18,780 --> 00:06:21,020 the big guy, maybe I can do a little good 123 00:06:21,020 --> 00:06:22,240 for myself on the way out. 124 00:06:22,640 --> 00:06:25,160 These come up again and again. And these are the concerns 125 00:06:25,160 --> 00:06:26,620 both that drive 126 00:06:26,620 --> 00:06:29,000 and motivate the insiders and the 127 00:06:29,000 --> 00:06:30,960 concerns that organizations looking 128 00:06:30,960 --> 00:06:33,100 to stop insiders focus on. 129 00:06:33,240 --> 00:06:34,880 And what really motivate effort 130 00:06:34,880 --> 00:06:37,080 in this area like the work that 131 00:06:37,080 --> 00:06:37,460 we have done. 132 00:06:39,940 --> 00:06:41,020 So, we're looking 133 00:06:41,020 --> 00:06:42,780 for developers. We're looking for developers 134 00:06:42,780 --> 00:06:43,880 who might be trying to 135 00:06:45,200 --> 00:06:46,860 bring monetary gain for themselves or 136 00:06:46,860 --> 00:06:49,040 do some damage, get revenge against their 137 00:06:49,040 --> 00:06:51,000 company. The main crowbar, 138 00:06:51,140 --> 00:06:52,620 the main tool the developer has 139 00:06:52,620 --> 00:06:54,900 in contrast to an IT administrator 140 00:06:54,900 --> 00:06:57,060 or someone on the support team is 141 00:06:57,060 --> 00:06:58,780 code. They get to check in code. 142 00:06:59,060 --> 00:07:00,940 They get to control the software 143 00:07:00,940 --> 00:07:03,080 in some form or another. Now we'll talk 144 00:07:03,080 --> 00:07:05,020 about a lot of examples today and 145 00:07:05,020 --> 00:07:07,080 how just checking 146 00:07:07,080 --> 00:07:08,700 in code to do something really nasty, 147 00:07:08,840 --> 00:07:11,120 it's not quite as simple as just checking in code to do 148 00:07:11,120 --> 00:07:12,580 something really nasty. You've got some 149 00:07:13,060 --> 00:07:15,020 concerns like not getting caught in the way too. 150 00:07:15,200 --> 00:07:17,200 And how that 151 00:07:17,200 --> 00:07:19,040 functionality is actually going to execute as part 152 00:07:19,040 --> 00:07:21,180 of a greater system. But in the end 153 00:07:21,180 --> 00:07:22,780 what we're really looking for is bad code. 154 00:07:23,140 --> 00:07:25,180 And we don't necessarily mean code that is vulnerable. 155 00:07:25,660 --> 00:07:27,160 We'll see a lot of examples today 156 00:07:27,160 --> 00:07:28,800 where the malicious 157 00:07:28,800 --> 00:07:31,120 insider code has a perfectly legitimate 158 00:07:31,120 --> 00:07:33,180 use. Except that's not 159 00:07:33,180 --> 00:07:35,280 the way it's being used in the case that we're looking for. 160 00:07:35,420 --> 00:07:36,680 It's being used illegitimately. 161 00:07:38,960 --> 00:07:41,080 So, where do you find examples of this stuff? 162 00:07:41,260 --> 00:07:43,140 If you want to find the newest way to 163 00:07:43,140 --> 00:07:44,840 write a SQL injection vulnerability or 164 00:07:45,200 --> 00:07:46,920 the latest and greatest JSP tag 165 00:07:46,920 --> 00:07:47,940 crosshead scripting example, 166 00:07:48,600 --> 00:07:50,340 there's plenty of open source out there. 167 00:07:50,440 --> 00:07:52,020 You can find examples of these vulnerabilities 168 00:07:52,800 --> 00:07:55,080 very readily. If you can't 169 00:07:55,080 --> 00:07:56,860 find it there, then you can go talk to companies 170 00:07:56,860 --> 00:07:58,900 and you can say, okay, you've got crosshead scripting. 171 00:07:58,940 --> 00:08:00,880 We all know you've got crosshead scripting. Why don't you show us 172 00:08:00,880 --> 00:08:03,160 some of it and we can help you detect it and avoid it 173 00:08:03,160 --> 00:08:04,960 in the future. People 174 00:08:04,960 --> 00:08:06,580 don't want to talk about insider threats. 175 00:08:07,100 --> 00:08:09,000 If you've been bitten by an insider 176 00:08:09,560 --> 00:08:09,960 then 177 00:08:10,720 --> 00:08:13,180 it means you had some employee that you hired 178 00:08:13,180 --> 00:08:14,780 and paid a paycheck to every month 179 00:08:15,200 --> 00:08:16,760 and they tried to bring your company down 180 00:08:16,760 --> 00:08:18,000 or they tried to steal from you. 181 00:08:18,260 --> 00:08:20,200 It's one of the most embarrassing problems 182 00:08:20,200 --> 00:08:21,880 in the software security field. 183 00:08:22,200 --> 00:08:24,900 And for that reason, A, it doesn't crop up a lot 184 00:08:24,900 --> 00:08:26,760 in open source because who's the target? 185 00:08:26,900 --> 00:08:28,940 Who are you trying to get revenge against there exactly? 186 00:08:29,360 --> 00:08:29,760 And 187 00:08:31,000 --> 00:08:32,600 companies that are actually 188 00:08:33,260 --> 00:08:35,320 susceptible to these or have been bitten by these 189 00:08:35,320 --> 00:08:36,780 don't want to talk about them. 190 00:08:36,880 --> 00:08:37,820 They don't want to show you examples. 191 00:08:38,120 --> 00:08:39,820 They don't want to even admit that it's happened. 192 00:08:40,060 --> 00:08:42,360 So coming up with examples is a real challenge. 193 00:08:43,440 --> 00:08:45,080 There have been some notable examples 194 00:08:45,200 --> 00:08:47,400 in open source or public disclosures 195 00:08:47,400 --> 00:08:49,440 of closed source examples of this. 196 00:08:49,580 --> 00:08:51,420 We'll show some of those later today. 197 00:08:52,040 --> 00:08:53,260 Some of our customers 198 00:08:53,260 --> 00:08:54,840 have at least gotten close 199 00:08:54,840 --> 00:08:56,140 to showing us the real thing. 200 00:08:56,340 --> 00:08:58,140 They're like, well it looked kind of like this 201 00:08:58,140 --> 00:08:59,980 except we changed a few things around. 202 00:09:00,320 --> 00:09:01,720 So that at least gives us an idea. 203 00:09:02,340 --> 00:09:05,300 But one of the most useful sources of examples 204 00:09:05,300 --> 00:09:06,980 that we found was a contest 205 00:09:06,980 --> 00:09:08,340 run at Stanford in 2004 206 00:09:08,980 --> 00:09:10,880 called the Obfuscated Voting Contest. 207 00:09:11,040 --> 00:09:13,180 And the goal there was to write an electronic 208 00:09:13,180 --> 00:09:15,100 voting system that contained 209 00:09:15,820 --> 00:09:16,860 malicious code. 210 00:09:17,080 --> 00:09:18,720 Basically an insider threat to 211 00:09:18,720 --> 00:09:20,940 miscount votes and skew the results 212 00:09:20,940 --> 00:09:22,900 of the election subtly towards 213 00:09:22,900 --> 00:09:23,840 one of the candidates. 214 00:09:24,120 --> 00:09:26,580 So in this case we had 40 or 50 215 00:09:27,200 --> 00:09:29,140 strong programmers come in and try 216 00:09:29,140 --> 00:09:30,660 to circumvent 217 00:09:30,660 --> 00:09:32,900 a review. Try to keep auditors from 218 00:09:32,900 --> 00:09:34,600 finding their insider code 219 00:09:34,980 --> 00:09:37,040 from their time bombs or whatever it might be. 220 00:09:37,460 --> 00:09:39,120 And we found that this was a great 221 00:09:39,120 --> 00:09:41,060 example of the techniques that programmers 222 00:09:41,060 --> 00:09:43,200 are likely to use to try to avoid detection. 223 00:09:43,560 --> 00:09:45,120 So between these three sources 224 00:09:45,200 --> 00:09:47,060 we've come up with the examples that we'll talk about today. 225 00:09:49,160 --> 00:09:51,140 We have to acknowledge some related work here. 226 00:09:51,240 --> 00:09:53,180 This is a relatively new field but there are 227 00:09:53,180 --> 00:09:54,980 plenty of people that have made important contributions. 228 00:09:56,020 --> 00:09:56,800 Weisopel and Eng 229 00:09:56,800 --> 00:09:58,920 published a great paper about using static 230 00:09:58,920 --> 00:10:01,140 analysis on binaries to detect backdoors 231 00:10:01,140 --> 00:10:02,160 and other insider threats. 232 00:10:02,780 --> 00:10:04,740 Jeff Williams has done work in this area. 233 00:10:05,240 --> 00:10:06,960 Matt Bishop, who I mentioned earlier 234 00:10:06,960 --> 00:10:09,160 and various co-authors of his. 235 00:10:09,520 --> 00:10:11,200 He's approaching it very much from the 236 00:10:11,200 --> 00:10:13,160 we need an academic underpinning 237 00:10:13,160 --> 00:10:14,940 for all this. We need to define the terms 238 00:10:15,200 --> 00:10:17,020 and give formal definitions for what we mean 239 00:10:17,020 --> 00:10:19,000 by an insider and a threat in that context. 240 00:10:19,520 --> 00:10:21,320 And then finally at CMU 241 00:10:21,320 --> 00:10:22,980 there's a research group called Scilab 242 00:10:22,980 --> 00:10:24,840 that's doing work on the insider threat problem 243 00:10:24,840 --> 00:10:26,640 more broadly. And they've actually 244 00:10:26,640 --> 00:10:29,200 with a little coercion focused somewhat on 245 00:10:29,200 --> 00:10:30,700 developers and programmers. 246 00:10:30,920 --> 00:10:32,820 Code level insiders. So this is a particularly 247 00:10:32,820 --> 00:10:33,820 interesting one for us. 248 00:10:34,840 --> 00:10:37,100 So there's our background. I'm going to 249 00:10:37,100 --> 00:10:38,960 hand it over to Matthias to go through some examples 250 00:10:38,960 --> 00:10:41,000 and classifications of different sorts of threats 251 00:10:41,000 --> 00:10:43,020 that we're concerned about. And then we'll come back 252 00:10:43,020 --> 00:10:45,100 and look at some of the techniques we use to defend against them. 253 00:10:46,360 --> 00:10:46,860 Okay. 254 00:10:47,000 --> 00:10:48,860 So there are like numerous ways 255 00:10:48,860 --> 00:10:50,580 to classify insider threats. 256 00:10:50,800 --> 00:10:52,640 And to give you an idea, I'm going to go through 257 00:10:52,640 --> 00:10:55,840 a couple of examples and I will try to classify them. 258 00:10:56,340 --> 00:10:58,520 So I have three examples up here. 259 00:10:58,680 --> 00:11:00,060 First of all, it's the Medco case. 260 00:11:00,340 --> 00:11:02,940 So after a particular date and time 261 00:11:03,580 --> 00:11:05,580 it will delete over 70s 262 00:11:05,580 --> 00:11:07,740 all the files on 70 servers. 263 00:11:08,080 --> 00:11:10,320 So first of all, we can classify this 264 00:11:10,320 --> 00:11:12,080 as a very destructive insider threat. 265 00:11:12,960 --> 00:11:14,540 Another way to classify this 266 00:11:14,540 --> 00:11:15,180 is it's a very destructive insider threat. 267 00:11:15,200 --> 00:11:16,580 It's like of high risk of the company itself 268 00:11:16,580 --> 00:11:17,580 for the business. 269 00:11:18,500 --> 00:11:20,240 If this piece of code is executed, 270 00:11:20,580 --> 00:11:22,780 it will delete 70 servers which means downtime 271 00:11:22,780 --> 00:11:23,840 which means no business. 272 00:11:24,080 --> 00:11:26,060 So it's like of a high risk for the company itself. 273 00:11:26,900 --> 00:11:29,000 It's also trivial to write 274 00:11:29,000 --> 00:11:31,120 this piece of code. It's not complicated at all. 275 00:11:31,280 --> 00:11:32,920 So you can classify this as a 276 00:11:32,920 --> 00:11:35,380 very trivial way to implement. 277 00:11:36,820 --> 00:11:39,100 Depending on where this code lands 278 00:11:39,100 --> 00:11:40,420 in the application itself, 279 00:11:40,760 --> 00:11:42,220 it's like an auto-trigger. 280 00:11:42,400 --> 00:11:44,060 You do not have to manually poke it. 281 00:11:45,200 --> 00:11:46,860 A certain date arrives 282 00:11:46,860 --> 00:11:47,740 and it will execute. 283 00:11:47,960 --> 00:11:49,580 So a fourth category can be like 284 00:11:49,580 --> 00:11:51,040 it is an auto-trigger. 285 00:11:52,640 --> 00:11:54,920 The second one is from Linux. 286 00:11:56,500 --> 00:11:58,220 The functionality of the if statement 287 00:11:58,220 --> 00:11:59,340 should be like the following. 288 00:11:59,520 --> 00:12:01,400 Two flags for a particular command 289 00:12:01,400 --> 00:12:03,540 can only be executed when a person is root. 290 00:12:04,220 --> 00:12:06,520 So the options, you're going to compare 291 00:12:06,520 --> 00:12:07,840 the options again, clone and wall 292 00:12:07,840 --> 00:12:10,360 and you check if the user is root or zero. 293 00:12:10,580 --> 00:12:12,180 And then you can actually use 294 00:12:12,180 --> 00:12:14,140 the if case. 295 00:12:15,200 --> 00:12:15,780 Something is wrong over here. 296 00:12:15,880 --> 00:12:18,160 Can somebody tell me why my... 297 00:12:18,160 --> 00:12:23,960 Yeah, correct. 298 00:12:25,480 --> 00:12:27,200 It is not trivial to see 299 00:12:27,200 --> 00:12:29,140 but over here this is not a comparison. 300 00:12:29,460 --> 00:12:30,820 It's setting the value 301 00:12:30,820 --> 00:12:32,560 setting the user ID to zero 302 00:12:32,560 --> 00:12:34,420 not comparing the user ID to zero. 303 00:12:34,700 --> 00:12:36,920 And this is a little bit blended into the code. 304 00:12:37,060 --> 00:12:38,760 It's not like a separate statement that says 305 00:12:38,760 --> 00:12:40,440 hey we are making the user ID root. 306 00:12:40,560 --> 00:12:42,460 No, this is in the if statement itself. 307 00:12:43,220 --> 00:12:44,920 So this is definitely 308 00:12:45,200 --> 00:12:46,800 trying to hide from a 309 00:12:47,740 --> 00:12:48,780 from a 310 00:12:48,780 --> 00:12:49,940 manual auditor. 311 00:12:51,260 --> 00:12:53,040 Another way to classify this 312 00:12:53,040 --> 00:12:54,820 is this has to do with 313 00:12:54,820 --> 00:12:56,680 authorization. So only the 314 00:12:56,680 --> 00:12:59,060 root person can execute this particular 315 00:12:59,060 --> 00:13:00,960 command. Over here we have a problem so this 316 00:13:00,960 --> 00:13:02,580 can also land in another bucket which is 317 00:13:02,580 --> 00:13:03,040 authorization. 318 00:13:05,060 --> 00:13:06,900 The third one was a Borland 319 00:13:06,900 --> 00:13:08,980 Interbase case. So at Borland 320 00:13:08,980 --> 00:13:09,980 they had a software 321 00:13:10,880 --> 00:13:12,960 design problem and the way they fixed it 322 00:13:12,960 --> 00:13:14,640 they had a chicken and egg problem about 323 00:13:15,560 --> 00:13:17,200 authentication. And the way they fixed this 324 00:13:17,200 --> 00:13:19,200 was by inserting this line 325 00:13:19,200 --> 00:13:20,960 of code. So they hard coded checked 326 00:13:20,960 --> 00:13:23,100 if the user name was politically 327 00:13:23,100 --> 00:13:24,980 and the password was correct. So this 328 00:13:24,980 --> 00:13:27,120 works if the code is 329 00:13:27,120 --> 00:13:29,100 closed source. But of course when you 330 00:13:29,100 --> 00:13:31,020 open up the source to everybody if you make that 331 00:13:31,020 --> 00:13:33,100 source, if you make it open source 332 00:13:33,100 --> 00:13:34,840 everybody can spot this line of code and 333 00:13:34,840 --> 00:13:37,160 everybody can grant himself access to 334 00:13:37,160 --> 00:13:39,200 the code. So the way we can 335 00:13:39,200 --> 00:13:41,280 classify that one is in three ways. 336 00:13:41,420 --> 00:13:42,640 So we can classify it as an 337 00:13:43,300 --> 00:13:44,260 authentication modification. 338 00:13:45,640 --> 00:13:47,260 We can also classify 339 00:13:47,260 --> 00:13:49,140 this as hard coded sensitive data 340 00:13:49,140 --> 00:13:51,140 that's in your application should not 341 00:13:51,140 --> 00:13:53,200 be there. Hard coded 342 00:13:53,200 --> 00:13:55,200 username, hard coded password should not be in 343 00:13:55,200 --> 00:13:57,240 your application itself. And the third way 344 00:13:57,240 --> 00:13:59,180 to classify this is it's 345 00:13:59,180 --> 00:14:01,000 actually abnormal control flow path creation. 346 00:14:01,360 --> 00:14:03,220 So this normally 347 00:14:03,220 --> 00:14:05,020 should not be in your application so 348 00:14:05,020 --> 00:14:06,740 you're creating an additional control flow 349 00:14:06,740 --> 00:14:09,180 through your application that bypasses 350 00:14:09,180 --> 00:14:10,840 the authentication mechanism. 351 00:14:13,880 --> 00:14:14,480 Sorry. 352 00:14:15,700 --> 00:14:17,320 So the way 353 00:14:17,320 --> 00:14:18,480 we actually classify 354 00:14:19,420 --> 00:14:21,160 insider threats is based on 355 00:14:21,160 --> 00:14:22,600 characteristics to spot 356 00:14:23,180 --> 00:14:25,220 the insider threat. So later 357 00:14:25,220 --> 00:14:27,220 on in this presentation this classification 358 00:14:27,220 --> 00:14:29,180 will become clear so now it's a little bit 359 00:14:29,180 --> 00:14:30,860 odd to look at this. But 360 00:14:30,860 --> 00:14:33,080 during the face off I'm going to explain how we 361 00:14:33,080 --> 00:14:35,000 actually find these 362 00:14:35,000 --> 00:14:37,200 insider threats in your application and 363 00:14:37,200 --> 00:14:39,220 then it will become clear why we chose these classes 364 00:14:39,220 --> 00:14:40,440 of insider 365 00:14:41,000 --> 00:14:42,920 classification of insider threats. 366 00:14:44,300 --> 00:14:44,860 So 367 00:14:45,200 --> 00:14:47,120 what I'm going to do next is I will go through 368 00:14:47,120 --> 00:14:49,200 these classes and I'll give you 369 00:14:49,200 --> 00:14:51,140 some code examples. So I'm going to explain the 370 00:14:51,140 --> 00:14:53,120 class and I'm going to give you some code 371 00:14:53,120 --> 00:14:55,060 examples. So I will not show you how 372 00:14:55,060 --> 00:14:57,160 you can spot it in your code. That's 373 00:14:57,160 --> 00:14:58,960 for later on in this presentation. That's 374 00:14:58,960 --> 00:15:00,120 for during the face off. 375 00:15:01,260 --> 00:15:03,100 So first of all logic bomb and time 376 00:15:03,100 --> 00:15:05,080 bomb. I'm pretty sure that everybody is familiar 377 00:15:05,080 --> 00:15:07,280 with that. So it's 378 00:15:07,280 --> 00:15:09,120 a piece of malicious code that is 379 00:15:09,120 --> 00:15:11,080 dormant in your code until something 380 00:15:11,080 --> 00:15:13,100 triggers it. If that 381 00:15:13,100 --> 00:15:14,720 triggering mechanism is related to 382 00:15:15,200 --> 00:15:16,960 time then we call it a time bomb. 383 00:15:17,220 --> 00:15:18,160 There are like numerous 384 00:15:18,160 --> 00:15:20,300 public disclosures over here 385 00:15:21,020 --> 00:15:23,140 and it's mainly about 386 00:15:23,140 --> 00:15:25,060 comparing hard coded date and time against 387 00:15:25,060 --> 00:15:25,780 the current time. 388 00:15:28,680 --> 00:15:31,020 What we've seen so far is that 389 00:15:31,020 --> 00:15:32,820 if you're really destructive 390 00:15:32,820 --> 00:15:35,220 if you have a destructive piece of code 391 00:15:35,220 --> 00:15:36,860 you're using a time bomb to 392 00:15:36,860 --> 00:15:39,300 set it off. You choose 393 00:15:39,300 --> 00:15:41,000 like a date like your birthday or 394 00:15:41,000 --> 00:15:43,180 when you're a year 395 00:15:43,180 --> 00:15:44,600 laid off or something like that. 396 00:15:46,260 --> 00:15:47,220 One interesting 397 00:15:47,220 --> 00:15:49,140 case over here is the logic bomb. Hacker gets 398 00:15:49,140 --> 00:15:51,080 eight years for failed stock rigging. So 399 00:15:51,080 --> 00:15:53,080 UBS employee planted 400 00:15:53,080 --> 00:15:54,740 the logic bomb into the code 401 00:15:54,740 --> 00:15:56,620 and went short on the stock. 402 00:15:56,820 --> 00:15:59,340 So the logic bomb went off. It deleted 403 00:15:59,340 --> 00:16:01,100 files over a thousand 404 00:16:01,100 --> 00:16:03,120 of computers. He got caught. He 405 00:16:03,120 --> 00:16:05,080 was prosecuted. He was eight years in jail. 406 00:16:05,320 --> 00:16:07,260 And unfortunately for him the stock 407 00:16:07,260 --> 00:16:08,960 didn't even go down. So he was like completely 408 00:16:08,960 --> 00:16:09,240 screwed. 409 00:16:13,100 --> 00:16:15,080 What we actually figured out or 410 00:16:15,200 --> 00:16:17,160 what we found in code was not that 411 00:16:17,160 --> 00:16:19,120 it was really destructive. So what 412 00:16:19,120 --> 00:16:20,740 we found in code was that people 413 00:16:20,740 --> 00:16:22,560 used it for various reasons. 414 00:16:22,960 --> 00:16:24,920 For instance in the first case what 415 00:16:24,920 --> 00:16:26,780 we figured out with this 416 00:16:26,780 --> 00:16:29,200 logic bomb was that they tried to bypass 417 00:16:29,200 --> 00:16:31,260 control mechanism. I'm not going into detail 418 00:16:31,260 --> 00:16:32,480 of what they exactly did. 419 00:16:32,740 --> 00:16:34,600 But so there were like checks installed 420 00:16:34,600 --> 00:16:37,280 and after a particular date these checks were no longer 421 00:16:37,280 --> 00:16:39,040 valid. So you could 422 00:16:39,040 --> 00:16:40,420 easily bypass these checks. 423 00:16:41,160 --> 00:16:42,900 Another one that we found is 424 00:16:42,900 --> 00:16:44,920 instead of being truly 425 00:16:45,200 --> 00:16:46,840 malicious what you can do is 426 00:16:46,840 --> 00:16:48,880 update queries at random, change 427 00:16:48,880 --> 00:16:51,140 some data. And this is really hard to track 428 00:16:51,140 --> 00:16:53,140 it down. If you do not find this particular 429 00:16:53,140 --> 00:16:54,600 piece of code you're going to look into 430 00:16:54,600 --> 00:16:56,840 where you're updating your queries or 431 00:16:56,840 --> 00:16:58,900 whatever is related 432 00:16:58,900 --> 00:17:01,100 to the fact that your database 433 00:17:01,100 --> 00:17:02,940 is changing and you will not look at this 434 00:17:02,940 --> 00:17:04,920 piece of code. So this is really hard to 435 00:17:04,920 --> 00:17:06,940 spot or to track down if you do not 436 00:17:06,940 --> 00:17:08,260 find this inside the thread. 437 00:17:10,840 --> 00:17:12,140 Backdoors and secret credentials. 438 00:17:12,780 --> 00:17:14,860 This category is all about securing 439 00:17:15,200 --> 00:17:16,560 your future access to the machine. 440 00:17:16,780 --> 00:17:19,140 And you can achieve that in like numerous ways. 441 00:17:20,280 --> 00:17:21,180 What you can 442 00:17:21,180 --> 00:17:22,860 do is adding additional credentials. 443 00:17:22,880 --> 00:17:24,460 Adding a master password. 444 00:17:24,980 --> 00:17:26,420 Some code that allows 445 00:17:26,420 --> 00:17:29,180 some remote access to the machine. 446 00:17:29,400 --> 00:17:30,420 You're bypassing 447 00:17:31,200 --> 00:17:33,120 some authentication 448 00:17:33,120 --> 00:17:34,880 mechanism or even just 449 00:17:34,880 --> 00:17:37,060 a way to execute commands on the machine 450 00:17:37,060 --> 00:17:39,020 is enough to grant yourself 451 00:17:39,020 --> 00:17:40,060 access later on. 452 00:17:41,880 --> 00:17:43,180 A couple of examples 453 00:17:43,180 --> 00:17:45,140 over here. Well I've explained already the 454 00:17:45,200 --> 00:17:46,100 Borland Intercase 455 00:17:47,960 --> 00:17:49,240 Interbase example 456 00:17:49,240 --> 00:17:51,200 where you insert like a hard 457 00:17:51,200 --> 00:17:52,420 coded username and password. 458 00:17:53,060 --> 00:17:54,800 Another one to 459 00:17:54,800 --> 00:17:56,980 secure your way 460 00:17:56,980 --> 00:17:58,980 afterwards was the WordPress backdoor. 461 00:17:59,200 --> 00:17:59,660 So 462 00:18:00,900 --> 00:18:02,300 you can still execute 463 00:18:03,200 --> 00:18:05,080 commands on the server itself 464 00:18:05,080 --> 00:18:06,760 if you know the special parameter. 465 00:18:07,040 --> 00:18:09,120 So knowing the special parameter means you can 466 00:18:09,120 --> 00:18:10,840 execute whatever you want on the server. 467 00:18:11,040 --> 00:18:12,560 So later on you can 468 00:18:12,560 --> 00:18:15,100 grant yourself access. You can execute whatever you want 469 00:18:15,200 --> 00:18:15,560 on the server. 470 00:18:16,160 --> 00:18:18,820 The last one that we found in code was 471 00:18:20,020 --> 00:18:21,040 inserting some 472 00:18:21,040 --> 00:18:22,540 special credentials at startup. 473 00:18:22,840 --> 00:18:24,280 So if you're starting up your 474 00:18:25,020 --> 00:18:26,860 application, the first thing that's 475 00:18:26,860 --> 00:18:28,840 executed, well after a while 476 00:18:29,560 --> 00:18:31,180 the credentials database 477 00:18:31,180 --> 00:18:32,500 is created and 478 00:18:32,980 --> 00:18:34,900 they inserted a line of code that 479 00:18:34,900 --> 00:18:37,140 added an additional pair of credentials 480 00:18:37,140 --> 00:18:38,300 to that credentials database. 481 00:18:38,600 --> 00:18:40,820 So later on you could come back and 482 00:18:40,820 --> 00:18:43,020 use the username insider and the 483 00:18:43,020 --> 00:18:45,000 password thread to grant yourself access to that 484 00:18:45,200 --> 00:18:45,620 particular machine. 485 00:18:47,120 --> 00:18:48,980 And so backdoors 486 00:18:48,980 --> 00:18:50,880 and secret credentials are 487 00:18:50,880 --> 00:18:52,880 not like limited to these 488 00:18:52,880 --> 00:18:54,100 normal applications. 489 00:18:55,000 --> 00:18:56,780 All applications can be backdoored. 490 00:18:56,860 --> 00:18:58,700 For instance, Optics Pro 491 00:18:58,700 --> 00:19:00,340 is actually a backdoor program 492 00:19:01,360 --> 00:19:02,840 containing a backdoor 493 00:19:02,840 --> 00:19:04,880 because it was like a master password to grant 494 00:19:04,880 --> 00:19:05,560 yourself access. 495 00:19:06,420 --> 00:19:08,720 Sub7 is a trojan with the backdoor. 496 00:19:08,800 --> 00:19:11,020 So it's not limited to normal applications. 497 00:19:13,720 --> 00:19:14,880 Nefarious communications 498 00:19:15,200 --> 00:19:15,400 so 499 00:19:17,560 --> 00:19:18,880 nefarious communication is 500 00:19:18,880 --> 00:19:21,280 about a fixed communication channel 501 00:19:21,280 --> 00:19:23,000 to transfer data outside of the 502 00:19:23,940 --> 00:19:24,460 organization. 503 00:19:25,000 --> 00:19:26,840 So we cannot execute 504 00:19:26,840 --> 00:19:28,140 whatever you want on the 505 00:19:28,680 --> 00:19:30,920 server, but it contains some code 506 00:19:30,920 --> 00:19:32,900 in it and we can poke it and trigger it 507 00:19:32,900 --> 00:19:35,100 or it connects back to 508 00:19:35,100 --> 00:19:36,400 us and it gives us some data. 509 00:19:37,320 --> 00:19:39,000 So it's an excellent way to transfer 510 00:19:39,000 --> 00:19:40,840 sensitive data out of the organization. 511 00:19:41,360 --> 00:19:41,880 So 512 00:19:41,880 --> 00:19:45,100 a couple of examples over here. So you can 513 00:19:45,200 --> 00:19:46,840 do that for instance by the server 514 00:19:46,840 --> 00:19:49,000 opening a socket or opening a network 515 00:19:49,000 --> 00:19:50,720 connection to our machine and transferring 516 00:19:50,720 --> 00:19:52,560 data to us or you can actually 517 00:19:53,040 --> 00:19:54,900 the server containing 518 00:19:54,900 --> 00:19:57,040 some mailing application that 519 00:19:57,040 --> 00:19:58,960 mails once in a while some secret information 520 00:19:58,960 --> 00:20:01,080 to us. And the way you can 521 00:20:01,080 --> 00:20:03,160 the way that code 522 00:20:03,160 --> 00:20:04,920 becomes active is sometimes it's 523 00:20:04,920 --> 00:20:06,700 time based. So on a certain 524 00:20:06,700 --> 00:20:08,820 date or on a regular basis 525 00:20:08,820 --> 00:20:10,700 it sends over some information 526 00:20:10,700 --> 00:20:13,200 or you can actually monitor the database 527 00:20:13,200 --> 00:20:13,660 some 528 00:20:15,200 --> 00:20:17,100 confidential database and if that database 529 00:20:17,100 --> 00:20:19,080 is updated it's going to transfer the whole 530 00:20:19,080 --> 00:20:20,980 database to our server. 531 00:20:21,800 --> 00:20:23,220 Or you can actually poke it. 532 00:20:23,320 --> 00:20:25,000 If you know how to poke it 533 00:20:25,000 --> 00:20:26,340 it gives you back the information. 534 00:20:27,500 --> 00:20:29,180 A couple of examples 535 00:20:29,180 --> 00:20:30,640 over here. So 536 00:20:31,720 --> 00:20:32,880 this is about 537 00:20:33,720 --> 00:20:34,720 making a server 538 00:20:34,720 --> 00:20:36,420 sorry, making a socket 539 00:20:37,180 --> 00:20:38,980 creating a new socket and 540 00:20:38,980 --> 00:20:40,980 they were actually monitoring one 541 00:20:40,980 --> 00:20:41,880 specific file. 542 00:20:42,760 --> 00:20:45,080 I've changed it to confidential file so they were 543 00:20:45,200 --> 00:20:47,000 monitoring one specific file and 544 00:20:47,000 --> 00:20:48,620 if that file changed it opened 545 00:20:48,620 --> 00:20:50,900 it created a new socket on port 666 546 00:20:50,900 --> 00:20:52,320 and it transferred the 547 00:20:52,320 --> 00:20:54,660 whole file out of the organization. 548 00:20:56,240 --> 00:20:57,100 This is a 549 00:20:57,100 --> 00:20:58,940 very similar one. It's pretty much 550 00:20:58,940 --> 00:21:01,080 the same but instead of opening a socket 551 00:21:01,080 --> 00:21:02,720 over here it's post to 552 00:21:02,720 --> 00:21:05,200 to a website. So to an evil website. 553 00:21:05,880 --> 00:21:07,220 Again you can monitor 554 00:21:07,220 --> 00:21:09,120 the file and transfer 555 00:21:09,120 --> 00:21:11,140 it out or you can manually poke it. 556 00:21:12,640 --> 00:21:15,060 The email, so the Blackberry 557 00:21:15,200 --> 00:21:16,120 email spying case. 558 00:21:17,660 --> 00:21:18,900 So in a 559 00:21:18,900 --> 00:21:21,080 particular country this 560 00:21:21,080 --> 00:21:22,000 update was 561 00:21:22,920 --> 00:21:24,700 advertised as a performance update. 562 00:21:24,940 --> 00:21:26,980 When you actually decompiled 563 00:21:26,980 --> 00:21:29,200 the performance update you found 564 00:21:29,200 --> 00:21:30,580 the following piece of code. 565 00:21:30,820 --> 00:21:32,900 So it contains like some forwarding mechanism 566 00:21:32,900 --> 00:21:35,360 that for each mail you receive on your Blackberry 567 00:21:35,360 --> 00:21:37,180 it was also forwarded to that particular 568 00:21:37,180 --> 00:21:37,500 address. 569 00:21:39,340 --> 00:21:40,740 That was actually deliberately 570 00:21:40,740 --> 00:21:43,000 into the code and it was there to comply 571 00:21:43,000 --> 00:21:43,520 with regulations. 572 00:21:48,920 --> 00:21:49,520 So 573 00:21:50,380 --> 00:21:51,180 work of 574 00:21:51,180 --> 00:21:53,040 Jeff Williams, well sorry 575 00:21:53,040 --> 00:21:54,860 dynamic code injection and manipulation 576 00:21:54,860 --> 00:21:57,320 this category is all about 577 00:21:57,320 --> 00:21:59,240 changing, adding, compiling 578 00:21:59,240 --> 00:22:00,680 code on the fly. So you have 579 00:22:00,680 --> 00:22:03,060 some source code in your application and 580 00:22:03,060 --> 00:22:04,760 you compile it on the fly and execute it. 581 00:22:06,260 --> 00:22:07,020 We got 582 00:22:07,020 --> 00:22:08,920 inspired by Jeff Williams 583 00:22:08,920 --> 00:22:11,080 work on this particular 584 00:22:11,080 --> 00:22:12,960 category. So he 585 00:22:12,960 --> 00:22:15,140 enumerates like a lot of categories. Like 586 00:22:15,200 --> 00:22:16,680 abuse of reflection where you 587 00:22:17,120 --> 00:22:18,340 rewrite read only variables, 588 00:22:19,060 --> 00:22:20,780 resource rewriting, compilation 589 00:22:20,780 --> 00:22:22,880 on the fly, abusing class loaders. 590 00:22:23,220 --> 00:22:24,140 Pretty neat stuff. 591 00:22:26,060 --> 00:22:26,960 One example 592 00:22:26,960 --> 00:22:28,860 over here comes out of 593 00:22:28,860 --> 00:22:30,900 his work, out of Jeff Williams work. 594 00:22:31,100 --> 00:22:32,920 It's the abuse of reflection. So 595 00:22:32,920 --> 00:22:34,600 what you're actually doing over here 596 00:22:35,060 --> 00:22:36,620 so you have some final strings 597 00:22:36,620 --> 00:22:39,140 in your application. You're not able to modify 598 00:22:39,140 --> 00:22:40,740 it. You're not able to change the data 599 00:22:40,740 --> 00:22:42,960 of these final strings. What you're doing 600 00:22:42,960 --> 00:22:44,620 is you change the string class. 601 00:22:45,200 --> 00:22:47,160 So you change the string class in such a 602 00:22:47,160 --> 00:22:49,040 way that all final strings 603 00:22:49,040 --> 00:22:51,280 become writable. 604 00:22:52,160 --> 00:22:53,020 So it 605 00:22:53,020 --> 00:22:54,920 doesn't matter anymore 606 00:22:54,920 --> 00:22:57,020 if there's final with the string. You can 607 00:22:57,020 --> 00:22:58,980 actually rewrite all the final strings. 608 00:23:01,980 --> 00:23:02,940 Obfuscation and camouflage. 609 00:23:03,260 --> 00:23:04,880 Over here you're trying to hide from 610 00:23:04,880 --> 00:23:07,220 different actors. For instance 611 00:23:07,220 --> 00:23:08,720 you can try to hide from auditors. 612 00:23:09,460 --> 00:23:11,200 These days we see that people try to 613 00:23:11,200 --> 00:23:13,080 hide from tools too. But 614 00:23:13,080 --> 00:23:14,920 at the beginning it was mainly about hiding 615 00:23:15,200 --> 00:23:16,760 from people looking at the code doing 616 00:23:16,760 --> 00:23:18,080 manual analysis on the code. 617 00:23:19,080 --> 00:23:20,960 And the way they do it is they make 618 00:23:20,960 --> 00:23:22,720 really subtle changes that 619 00:23:22,720 --> 00:23:25,100 by doing that they achieve their goal. 620 00:23:25,280 --> 00:23:27,060 But it's really hard to spot. I went 621 00:23:27,060 --> 00:23:27,880 through the first one 622 00:23:29,160 --> 00:23:31,100 that didn't check if it was root but it 623 00:23:31,100 --> 00:23:32,960 was actually setting the root. Another one 624 00:23:32,960 --> 00:23:35,000 is the X11 case. So the forgotten 625 00:23:35,000 --> 00:23:35,600 parenthesis. 626 00:23:37,900 --> 00:23:39,000 There are like 627 00:23:39,000 --> 00:23:41,000 two checks over here. The get UID and 628 00:23:41,000 --> 00:23:43,160 the get EUID. So the effective user ID. 629 00:23:43,620 --> 00:23:44,960 With the second one 630 00:23:45,200 --> 00:23:46,980 as you can see they forgot the parenthesis. 631 00:23:47,340 --> 00:23:49,220 So this will 632 00:23:49,220 --> 00:23:51,020 make the statement always true which means 633 00:23:51,640 --> 00:23:53,100 that it can use whatever 634 00:23:53,100 --> 00:23:55,100 module you want. And normally 635 00:23:55,100 --> 00:23:56,880 that was exclusively for the root. 636 00:23:57,060 --> 00:23:59,320 But now over here because of the forgotten parenthesis 637 00:23:59,320 --> 00:24:01,080 everybody can add 638 00:24:01,080 --> 00:24:01,460 a module. 639 00:24:03,300 --> 00:24:05,160 And it's just a mix up of names. 640 00:24:05,200 --> 00:24:06,620 So if you have like a variable 641 00:24:06,980 --> 00:24:08,640 with the same name you can do this stuff. 642 00:24:10,480 --> 00:24:12,260 Another one over here is 643 00:24:14,560 --> 00:24:15,040 assuming 644 00:24:15,200 --> 00:24:17,000 you want to hide the following piece of code. 645 00:24:17,160 --> 00:24:19,080 So you want to hide that you want to remove 646 00:24:19,080 --> 00:24:21,440 everything in the root directory. 647 00:24:21,680 --> 00:24:23,140 So you want to rip out everything on a 648 00:24:23,140 --> 00:24:25,040 particular machine. But this 649 00:24:25,040 --> 00:24:27,080 statement is obvious to spot for a 650 00:24:27,080 --> 00:24:28,960 manual auditor. The way you can 651 00:24:28,960 --> 00:24:30,880 achieve that is you're going to encode it 652 00:24:30,880 --> 00:24:32,920 with base 64 for instance. You're going to 653 00:24:32,920 --> 00:24:35,180 encode it. You're going to decode it 654 00:24:35,180 --> 00:24:37,300 on the fly and you're going to execute it. 655 00:24:37,480 --> 00:24:38,920 The good part over here is 656 00:24:38,920 --> 00:24:41,060 these three lines of code do not have 657 00:24:41,060 --> 00:24:41,400 to be 658 00:24:41,400 --> 00:24:45,060 in sequential order. You can spread them 659 00:24:45,200 --> 00:24:47,040 out over your application where 660 00:24:47,040 --> 00:24:49,040 it makes more sense to put that 661 00:24:49,040 --> 00:24:50,500 piece of code. So 662 00:24:51,200 --> 00:24:53,160 once you come to the execution 663 00:24:53,160 --> 00:24:55,080 of the string you have no 664 00:24:55,080 --> 00:24:57,080 idea what's actually executed. It's not obvious. 665 00:24:57,320 --> 00:24:59,000 So you have to track back and try to 666 00:24:59,000 --> 00:25:00,840 figure out what's actually executed over here. 667 00:25:01,040 --> 00:25:02,820 So that's like a neat way to hide. 668 00:25:06,340 --> 00:25:07,080 Another way 669 00:25:07,080 --> 00:25:09,020 to hide from a manual inspector is 670 00:25:09,020 --> 00:25:10,840 using very simple substitution 671 00:25:10,840 --> 00:25:12,860 ciphers like for instance rod13 672 00:25:12,860 --> 00:25:15,180 foursquare, bfit and so on and so on. 673 00:25:16,480 --> 00:25:17,300 Over here 674 00:25:17,300 --> 00:25:19,120 what they did is they wanted 675 00:25:19,120 --> 00:25:21,080 to insert something in a particular database 676 00:25:21,080 --> 00:25:23,020 but they wanted to hide what kind of database 677 00:25:23,020 --> 00:25:25,140 they were inserting to and they also wanted to 678 00:25:25,140 --> 00:25:27,040 hide what kind of values they were inserting to 679 00:25:27,040 --> 00:25:29,180 that database. So what they did up 680 00:25:29,180 --> 00:25:31,120 front was they declared a couple of 681 00:25:31,120 --> 00:25:33,020 variables, the database, the data and 682 00:25:33,020 --> 00:25:34,920 data2. They didn't give any specific 683 00:25:34,920 --> 00:25:37,300 names and they encoded 684 00:25:37,300 --> 00:25:38,080 it with rod13. 685 00:25:38,820 --> 00:25:41,180 Rod13 is really useful 686 00:25:41,180 --> 00:25:43,160 because it only requires 687 00:25:43,160 --> 00:25:44,900 like six lines of code to implement. 688 00:25:45,200 --> 00:25:46,880 So if it's not by default in your 689 00:25:46,880 --> 00:25:48,920 application you only need six lines of code 690 00:25:48,920 --> 00:25:50,000 and you have it over there. 691 00:25:51,260 --> 00:25:53,040 So what this was actually doing was 692 00:25:53,040 --> 00:25:54,680 inserting into the credentials database 693 00:25:54,980 --> 00:25:57,060 insider and thread but it was a little bit hidden 694 00:25:57,060 --> 00:25:58,940 from, so I've shown that example 695 00:25:58,940 --> 00:26:01,280 before where it was just like you inserted 696 00:26:01,280 --> 00:26:02,860 in the credentials database over here 697 00:26:02,860 --> 00:26:05,140 it's much more harder to track down 698 00:26:05,140 --> 00:26:07,180 by use of a, for a manual 699 00:26:07,180 --> 00:26:07,540 auditor. 700 00:26:09,120 --> 00:26:11,060 So I've introduced like a little bit 701 00:26:11,060 --> 00:26:12,600 the classes of insider threads and 702 00:26:13,140 --> 00:26:14,500 a couple of examples. 703 00:26:15,200 --> 00:26:16,900 Jacob is going to tell how, 704 00:26:16,980 --> 00:26:18,980 what kind of techniques you can use 705 00:26:18,980 --> 00:26:20,060 to spot these 706 00:26:21,140 --> 00:26:22,100 malicious code. 707 00:26:24,380 --> 00:26:25,420 Thanks Matthias. 708 00:26:27,460 --> 00:26:29,120 So I'm going to talk about a couple 709 00:26:29,120 --> 00:26:31,040 of techniques. First and foremost 710 00:26:31,040 --> 00:26:32,680 maybe most popular, peer review. 711 00:26:32,840 --> 00:26:34,960 Manual code review. You're reading through code 712 00:26:34,960 --> 00:26:36,720 that somebody else in your organization wrote. 713 00:26:37,540 --> 00:26:38,900 Static analysis is 714 00:26:38,900 --> 00:26:41,100 when it comes to security vulnerabilities a great 715 00:26:41,100 --> 00:26:43,040 way to expand on 716 00:26:43,040 --> 00:26:45,180 and expedite the code review process. 717 00:26:45,200 --> 00:26:46,900 So we're going to talk about how static analysis 718 00:26:46,900 --> 00:26:48,600 can apply to finding insider threats. 719 00:26:49,340 --> 00:26:51,200 A couple of slides on run time 720 00:26:51,200 --> 00:26:53,100 techniques for tracking these down and then 721 00:26:53,100 --> 00:26:55,200 a little bit about how to interpret the results. 722 00:26:55,520 --> 00:26:57,320 It takes a little bit of a different mindset 723 00:26:57,320 --> 00:26:58,980 when you're looking for an insider 724 00:26:58,980 --> 00:27:01,200 as opposed to an accidentally introduced 725 00:27:01,200 --> 00:27:02,020 vulnerability. 726 00:27:03,340 --> 00:27:04,500 So first off 727 00:27:04,500 --> 00:27:06,600 if you're doing a code review 728 00:27:07,060 --> 00:27:09,000 and you see those lines up at the top 729 00:27:09,000 --> 00:27:11,220 you're going to ask what on earth 730 00:27:11,220 --> 00:27:13,120 is that? Why is that in the code? 731 00:27:13,280 --> 00:27:15,060 That would look strange no matter what 732 00:27:15,200 --> 00:27:16,920 codebase it was in. Maybe it's a crypto 733 00:27:16,920 --> 00:27:19,100 key or something interesting but whatever 734 00:27:19,100 --> 00:27:20,440 it is there aren't many of them. 735 00:27:22,080 --> 00:27:23,040 The second 736 00:27:23,040 --> 00:27:24,860 line is a little 737 00:27:24,860 --> 00:27:27,060 suspicious but there isn't anything completely 738 00:27:27,060 --> 00:27:29,140 out of the place there. You're checking a request 739 00:27:29,140 --> 00:27:31,060 parameter and then you're doing something based 740 00:27:31,060 --> 00:27:33,280 on the request parameter. That happens 741 00:27:33,280 --> 00:27:35,260 in a lot of codebases. Usually not with 742 00:27:35,260 --> 00:27:36,660 a hard coded name and 743 00:27:36,660 --> 00:27:38,920 a very specific case like this but 744 00:27:38,920 --> 00:27:40,680 that one might slip by. 745 00:27:40,940 --> 00:27:43,000 If you came back after lunch and you were reading through 746 00:27:43,000 --> 00:27:45,100 code and you saw that one you might let it go. 747 00:27:46,300 --> 00:27:47,160 What about the 748 00:27:47,160 --> 00:27:47,580 last one? 749 00:27:48,540 --> 00:27:51,080 Somebody over on this side of the room I think tracked down 750 00:27:51,080 --> 00:27:53,200 the problem with the last line of code 751 00:27:53,200 --> 00:27:55,140 there when we put one line of code 752 00:27:55,140 --> 00:27:56,940 on the screen and asked what's wrong with it. 753 00:27:57,420 --> 00:27:59,320 If that was one of a thousand 754 00:27:59,320 --> 00:28:01,060 or ten thousand lines of code 755 00:28:01,060 --> 00:28:02,520 that you've read this day or week 756 00:28:02,520 --> 00:28:04,380 you're much less likely to see it. 757 00:28:04,640 --> 00:28:07,020 So the ability to track these things down 758 00:28:07,020 --> 00:28:09,080 with manual code review is 759 00:28:09,080 --> 00:28:11,240 relatively low. And we've seen 760 00:28:11,240 --> 00:28:13,140 this with the success of 761 00:28:13,140 --> 00:28:14,740 insiders writing code like this 762 00:28:15,200 --> 00:28:17,080 that is laying dormant in codebases that have been 763 00:28:17,080 --> 00:28:18,540 reviewed year after year 764 00:28:19,040 --> 00:28:20,720 because it's not a smoking gun. 765 00:28:20,980 --> 00:28:23,160 It's a breadcrumb. It kind of points towards 766 00:28:23,160 --> 00:28:24,640 maybe a possible problem 767 00:28:25,200 --> 00:28:26,440 something a little bit fishy 768 00:28:26,440 --> 00:28:29,320 but again it's nothing egregious in and of itself. 769 00:28:30,300 --> 00:28:30,820 So 770 00:28:30,820 --> 00:28:32,700 those are really the two challenges 771 00:28:32,700 --> 00:28:34,660 with using manual review for 772 00:28:35,000 --> 00:28:36,720 insider threats. One is 773 00:28:36,720 --> 00:28:39,260 your reviewer has to know what you're looking for. 774 00:28:39,360 --> 00:28:41,420 What he's looking for, what she's looking for. 775 00:28:41,560 --> 00:28:43,220 So they need to have a lot of 776 00:28:43,220 --> 00:28:44,940 domain expertise in terms of the 777 00:28:45,200 --> 00:28:47,140 kinds of techniques that insiders are going to use 778 00:28:47,140 --> 00:28:48,840 to do some sort of damage. 779 00:28:49,220 --> 00:28:51,040 So A, your reviewer 780 00:28:51,040 --> 00:28:53,000 has to be pretty well trained. They've got to be thinking about 781 00:28:53,000 --> 00:28:54,180 this problem specifically. 782 00:28:55,520 --> 00:28:56,920 Two, where do you look? 783 00:28:57,480 --> 00:28:59,360 Some vulnerabilities, it's easy. 784 00:28:59,560 --> 00:29:01,260 I'm going to look where important stuff 785 00:29:01,260 --> 00:29:02,980 is happening. The database queries 786 00:29:02,980 --> 00:29:05,240 that access the table with money 787 00:29:05,240 --> 00:29:07,120 in it, I'm going to go code review 788 00:29:07,120 --> 00:29:08,580 those, make sure there's no SQL injection. 789 00:29:09,040 --> 00:29:10,820 The pages that deal with authentication 790 00:29:10,820 --> 00:29:13,080 or other sensitive activity, I'm going to check 791 00:29:13,080 --> 00:29:15,160 to make sure XSS and CSR 792 00:29:15,200 --> 00:29:17,080 aren't a problem. Insider 793 00:29:17,080 --> 00:29:18,340 threat code could be anywhere. 794 00:29:18,740 --> 00:29:20,920 A lot of it isn't terribly interesting. 795 00:29:21,240 --> 00:29:23,220 A lot of it is, as Matias 796 00:29:23,220 --> 00:29:24,340 showed on the slide before, 797 00:29:25,280 --> 00:29:27,160 hiding the thing that you want to use, 798 00:29:27,420 --> 00:29:29,320 decoding the thing that you want to use, 799 00:29:29,440 --> 00:29:30,900 and then eventually maybe using it. 800 00:29:31,040 --> 00:29:33,180 Only the place where you use it would get any 801 00:29:33,180 --> 00:29:34,880 sort of security attention because the other two 802 00:29:34,880 --> 00:29:37,100 can live in any arbitrary place, some dark 803 00:29:37,100 --> 00:29:38,100 corner of the code base. 804 00:29:39,820 --> 00:29:41,100 Static analysis can help 805 00:29:41,100 --> 00:29:42,720 find insider threats in code 806 00:29:42,720 --> 00:29:45,140 two ways. One, it can 807 00:29:46,280 --> 00:29:47,260 represent all of 808 00:29:47,260 --> 00:29:49,080 that domain expertise. What are all the kinds 809 00:29:49,080 --> 00:29:51,120 of ways insiders might attack a code base 810 00:29:51,120 --> 00:29:53,260 in a set of rules? Granted, 811 00:29:53,300 --> 00:29:55,160 those rules aren't the same as the rules we use 812 00:29:55,160 --> 00:29:57,160 to find normal vulnerabilities, but 813 00:29:57,160 --> 00:29:59,060 they can be codified and 814 00:29:59,060 --> 00:30:01,200 used systematically. The static analysis 815 00:30:01,200 --> 00:30:03,140 tool can apply those time and time again. 816 00:30:03,340 --> 00:30:05,240 The reviewer doesn't need to keep them all in their 817 00:30:05,240 --> 00:30:07,220 head. Second, they 818 00:30:07,220 --> 00:30:08,820 can tie those breadcrumbs together. 819 00:30:09,220 --> 00:30:11,420 I said a lot of these techniques that insiders 820 00:30:11,420 --> 00:30:13,280 are going to use aren't necessarily 821 00:30:13,280 --> 00:30:15,180 malicious. There's a malicious 822 00:30:15,200 --> 00:30:17,340 use for them, and then there are lots of legitimate 823 00:30:17,340 --> 00:30:17,980 uses too. 824 00:30:19,100 --> 00:30:21,200 Static analysis can start to look at an 825 00:30:21,200 --> 00:30:22,820 entire code base as opposed to 826 00:30:23,320 --> 00:30:25,140 however much of it we can cover with manual 827 00:30:25,140 --> 00:30:26,980 review, 1%, 3% maybe. 828 00:30:27,420 --> 00:30:28,800 It can look at an entire code base 829 00:30:28,800 --> 00:30:30,820 and can track down all these breadcrumbs. 830 00:30:31,260 --> 00:30:32,960 It can start to show you a heat map 831 00:30:32,960 --> 00:30:34,840 of the application. It can start to show you 832 00:30:34,840 --> 00:30:36,580 where is there a particularly 833 00:30:37,680 --> 00:30:39,480 thick line of breadcrumbs. 834 00:30:39,600 --> 00:30:41,120 Where do things start to look like 835 00:30:41,120 --> 00:30:43,040 there's this suspicious thing and that 836 00:30:43,040 --> 00:30:45,080 suspicious thing, and there are three of them there. 837 00:30:45,200 --> 00:30:46,940 That really warrants some further 838 00:30:46,940 --> 00:30:49,040 review. They're not going to find smoking 839 00:30:49,040 --> 00:30:51,100 guns, and we'll look at examples of that, 840 00:30:51,220 --> 00:30:52,780 because these things aren't smoking guns. 841 00:30:53,020 --> 00:30:54,940 They're, again, perfectly legitimate ways 842 00:30:54,940 --> 00:30:57,040 to do all the things that an insider would want 843 00:30:57,040 --> 00:30:59,200 to do. They're just doing it in an illegitimate 844 00:30:59,200 --> 00:30:59,500 way. 845 00:31:01,340 --> 00:31:02,740 Just to give you a little 846 00:31:02,740 --> 00:31:05,080 idea of what the inside of a static analysis 847 00:31:05,080 --> 00:31:07,060 tool looks like, the piece we're 848 00:31:07,060 --> 00:31:08,460 talking about is just one 849 00:31:08,980 --> 00:31:10,960 aspect of the tool 850 00:31:10,960 --> 00:31:13,180 overall. Source code comes in the front end. 851 00:31:13,320 --> 00:31:15,040 You build a model from that source code. 852 00:31:15,200 --> 00:31:17,200 You run some various kinds of analysis 853 00:31:17,200 --> 00:31:19,020 on it, and out the other end come 854 00:31:19,020 --> 00:31:21,020 results. The piece that we're talking about 855 00:31:21,020 --> 00:31:23,200 changing are the rules. These are the definitions 856 00:31:23,200 --> 00:31:24,940 that tell the analyzer what to look for, 857 00:31:25,040 --> 00:31:26,160 what constitutes a problem. 858 00:31:27,720 --> 00:31:29,220 Here, it's very different 859 00:31:29,220 --> 00:31:30,460 from vulnerability detection. 860 00:31:32,700 --> 00:31:33,220 Vulnerability 861 00:31:33,220 --> 00:31:34,480 detection is useful, too. 862 00:31:34,980 --> 00:31:36,280 Sometimes an insider 863 00:31:37,660 --> 00:31:39,180 leverages something that is 864 00:31:39,180 --> 00:31:41,140 technically just vulnerable. This is an 865 00:31:41,140 --> 00:31:43,140 example that Matthias talked a little bit about 866 00:31:43,140 --> 00:31:45,180 earlier, except he just had the first line 867 00:31:45,200 --> 00:31:47,160 of code. The first line of code 868 00:31:47,160 --> 00:31:49,080 says, this is 869 00:31:49,080 --> 00:31:50,880 PHP code, I'm going to check a 870 00:31:50,880 --> 00:31:52,600 request parameter, and if it exists, 871 00:31:52,740 --> 00:31:55,220 called IZ, then I'm going to call this 872 00:31:55,220 --> 00:31:56,900 get theme m command 873 00:31:56,900 --> 00:31:59,280 function. What the hell 874 00:31:59,280 --> 00:32:01,220 does get theme m command? I guess 875 00:32:01,220 --> 00:32:03,120 it's going to load a theme. If I was doing 876 00:32:03,120 --> 00:32:04,840 a manual review and I wasn't looking too 877 00:32:04,840 --> 00:32:07,120 carefully at this, I might just read right past it. 878 00:32:07,900 --> 00:32:08,860 The definition 879 00:32:08,860 --> 00:32:11,060 of get theme m command is 880 00:32:11,060 --> 00:32:13,300 to execute pass-through, which just executes 881 00:32:13,300 --> 00:32:15,000 a shell command or a script. 882 00:32:16,740 --> 00:32:18,180 This is a command 883 00:32:18,180 --> 00:32:19,560 injection vulnerability. Any 884 00:32:19,560 --> 00:32:21,080 static analysis tool worth its 885 00:32:21,920 --> 00:32:23,840 price would find this out of the 886 00:32:23,840 --> 00:32:25,480 box, because you're taking a request 887 00:32:25,480 --> 00:32:27,920 parameter, IZ, and passing it 888 00:32:27,920 --> 00:32:29,560 to execute as a shell command. 889 00:32:29,840 --> 00:32:31,380 That's just a bad idea, no matter why 890 00:32:31,380 --> 00:32:33,320 you're doing it. It doesn't matter that you've got 891 00:32:33,320 --> 00:32:34,960 that conditional over to the left 892 00:32:34,960 --> 00:32:36,880 that says only do it sometimes. 893 00:32:37,380 --> 00:32:38,400 It's always a bad deal. 894 00:32:38,720 --> 00:32:41,080 Out of the box rules would find this problem. 895 00:32:42,740 --> 00:32:43,380 Some other 896 00:32:43,380 --> 00:32:45,100 problems aren't as obvious. They aren't 897 00:32:45,200 --> 00:32:46,480 vulnerabilities in and of themselves. 898 00:32:47,100 --> 00:32:48,980 Let's talk about a scenario that Matias 899 00:32:48,980 --> 00:32:50,060 already showed us code for. 900 00:32:50,960 --> 00:32:53,080 A laid off employee installs code that 901 00:32:53,080 --> 00:32:54,900 reads the entire database 902 00:32:54,900 --> 00:32:57,140 on a regular basis and sends the 903 00:32:57,140 --> 00:32:58,160 results over the network. 904 00:32:58,940 --> 00:33:01,140 There's a couple of bad things going 905 00:33:01,140 --> 00:33:03,280 on there. I'm going to talk about them one by one 906 00:33:03,280 --> 00:33:04,960 and then show you from a detection 907 00:33:04,960 --> 00:33:07,020 standpoint how we might go about identifying 908 00:33:07,020 --> 00:33:09,140 this broader insider threat. 909 00:33:10,420 --> 00:33:13,260 First off, if you're reading the entire 910 00:33:13,260 --> 00:33:14,640 database and entire 911 00:33:15,380 --> 00:33:17,100 table for any reason, 912 00:33:18,020 --> 00:33:19,060 it's pretty suspicious. 913 00:33:19,400 --> 00:33:20,480 If you're doing migration, 914 00:33:20,860 --> 00:33:23,080 that's a possible legitimate use for it. 915 00:33:23,300 --> 00:33:25,160 But you probably are looking at more than 916 00:33:25,160 --> 00:33:26,700 just one table at a time, too. 917 00:33:27,060 --> 00:33:29,020 So if you have a query 918 00:33:29,020 --> 00:33:31,040 in your code base that does a 919 00:33:31,040 --> 00:33:32,960 select star on a single table, 920 00:33:33,200 --> 00:33:35,220 that is in and of itself suspicious. 921 00:33:36,100 --> 00:33:37,140 It's not a vulnerability 922 00:33:37,140 --> 00:33:39,160 all by itself. It's not a command 923 00:33:39,160 --> 00:33:40,900 injection like the slide we looked at last. 924 00:33:41,100 --> 00:33:43,120 But it's pretty weird and 925 00:33:43,120 --> 00:33:45,120 if you're a manual reviewer looking for 926 00:33:45,660 --> 00:33:46,440 insider threats, 927 00:33:46,800 --> 00:33:48,040 this is a good place to start. 928 00:33:48,160 --> 00:33:49,740 This is a bread crumb in a pile. 929 00:33:51,360 --> 00:33:53,000 Second off, you're reading 930 00:33:53,000 --> 00:33:54,820 something from the database and 931 00:33:55,900 --> 00:33:57,100 we'll assume you're in a web 932 00:33:57,100 --> 00:33:58,220 app here because a lot of people 933 00:33:58,220 --> 00:33:59,700 looking for these things are in web apps. 934 00:33:59,860 --> 00:34:02,740 It's your banking site. It's your e-commerce site. 935 00:34:02,820 --> 00:34:04,460 These are where insiders tend to target. 936 00:34:05,740 --> 00:34:06,780 You're doing manual 937 00:34:06,780 --> 00:34:08,120 network connection management. 938 00:34:08,480 --> 00:34:10,840 You're opening sockets, particularly sockets 939 00:34:10,840 --> 00:34:11,920 with hard-coded ports. 940 00:34:12,280 --> 00:34:14,700 Again, perfectly legitimate reasons 941 00:34:15,200 --> 00:34:16,680 to do that, but it's pretty uncommon. 942 00:34:17,660 --> 00:34:19,120 Not something you'd 943 00:34:19,120 --> 00:34:20,560 regularly see in a web application. 944 00:34:21,060 --> 00:34:22,800 So we can create another rule that flags 945 00:34:22,800 --> 00:34:25,380 uses of sockets in web applications. 946 00:34:25,680 --> 00:34:26,300 And in particular, 947 00:34:26,960 --> 00:34:28,460 hard-coded socket numbers, 948 00:34:28,760 --> 00:34:30,800 just really strange. You're building in 949 00:34:30,800 --> 00:34:32,860 some special sauce there, whether it's for 950 00:34:32,860 --> 00:34:35,000 legitimate purposes or malicious purposes 951 00:34:35,000 --> 00:34:36,360 remains to be seen. 952 00:34:38,940 --> 00:34:40,860 Alright. A regular basis. 953 00:34:42,200 --> 00:34:43,400 Most applications 954 00:34:43,400 --> 00:34:44,860 don't depend on 955 00:34:45,200 --> 00:34:46,180 fixed points in time. 956 00:34:47,160 --> 00:34:48,680 That's not to say there aren't legitimate 957 00:34:48,680 --> 00:34:50,860 reasons why they might, but if you're 958 00:34:50,860 --> 00:34:52,920 checking the current time, that's 959 00:34:52,920 --> 00:34:54,680 a breadcrumb. That's something interesting. 960 00:34:54,900 --> 00:34:56,800 You're not going to do that a million places in your 961 00:34:56,800 --> 00:34:58,900 code base. So a manual reviewer 962 00:34:58,900 --> 00:35:01,080 looking for insider threats could afford to look at 963 00:35:01,080 --> 00:35:03,020 all the places where you read the current time 964 00:35:03,020 --> 00:35:04,600 and check on what you do with it. 965 00:35:06,220 --> 00:35:07,020 In particular, 966 00:35:07,200 --> 00:35:08,740 an interesting thing you might do with it 967 00:35:08,740 --> 00:35:10,820 is compare it against some hard-coded value. 968 00:35:11,600 --> 00:35:12,960 So if you access the current 969 00:35:12,960 --> 00:35:14,980 time, that's a little suspicious. 970 00:35:15,200 --> 00:35:17,000 If you access the current time 971 00:35:17,000 --> 00:35:19,160 and then compare it to a static string, 972 00:35:19,380 --> 00:35:21,180 compile time string in your application, 973 00:35:21,560 --> 00:35:22,900 that's really bizarre. 974 00:35:23,280 --> 00:35:25,200 There are very few legitimate reasons for that. 975 00:35:25,540 --> 00:35:27,080 So again, the pile of breadcrumbs 976 00:35:27,080 --> 00:35:27,840 gets a little thicker. 977 00:35:29,540 --> 00:35:31,160 I guess that's the last breadcrumb. 978 00:35:31,540 --> 00:35:33,200 This is a lot of 979 00:35:33,200 --> 00:35:35,160 what goes into the detection techniques that Matisse 980 00:35:35,160 --> 00:35:36,400 is going to show examples of later. 981 00:35:36,980 --> 00:35:39,140 I'll talk about this a little more when we talk about interpreting 982 00:35:39,140 --> 00:35:41,220 results, but again, you don't get to find 983 00:35:41,220 --> 00:35:43,100 a single smoking gun. You're looking for 984 00:35:43,760 --> 00:35:44,960 things that indicate 985 00:35:45,200 --> 00:35:45,940 something suspicious. 986 00:35:46,420 --> 00:35:48,720 The more suspicious things you find 987 00:35:48,720 --> 00:35:50,640 and the more suspicious each of them is, 988 00:35:50,840 --> 00:35:53,060 the more likely you are to have an insider threat. 989 00:35:53,540 --> 00:35:55,320 The goal for most organizations 990 00:35:55,320 --> 00:35:57,260 would be to run this rule pack 991 00:35:57,260 --> 00:35:59,260 against their code base and not find 992 00:35:59,260 --> 00:36:01,080 anything. That wouldn't be terribly 993 00:36:01,080 --> 00:36:03,060 surprising. You might just not find anything. 994 00:36:03,580 --> 00:36:05,220 Or you might find a few of these 995 00:36:05,220 --> 00:36:06,260 that are being used legitimately. 996 00:36:06,660 --> 00:36:08,800 Or you might find a few more and see, 997 00:36:08,920 --> 00:36:10,760 hey, this spot on the heat map is looking 998 00:36:10,760 --> 00:36:12,640 a little red. This is actually a problem. 999 00:36:14,360 --> 00:36:14,800 Okay. 1000 00:36:15,200 --> 00:36:16,260 So aside from static analysis, 1001 00:36:16,420 --> 00:36:18,640 how might you track down insider threats? 1002 00:36:19,580 --> 00:36:21,280 Your existing functional testing 1003 00:36:21,280 --> 00:36:22,960 in QA can be pretty useful here. 1004 00:36:23,940 --> 00:36:25,340 Here, for the most part, 1005 00:36:25,420 --> 00:36:27,500 you're looking for code that isn't run very often. 1006 00:36:27,700 --> 00:36:29,180 And probably during a functional test, 1007 00:36:29,300 --> 00:36:31,000 it's code that's going to look dead, in fact. 1008 00:36:31,480 --> 00:36:33,540 If you have a mechanism for overlaying 1009 00:36:33,540 --> 00:36:35,420 what's potentially security relevant, 1010 00:36:35,780 --> 00:36:37,140 so talking to the database, 1011 00:36:37,340 --> 00:36:38,480 talking to a directory server, 1012 00:36:38,820 --> 00:36:40,280 printing content out to the web, 1013 00:36:40,520 --> 00:36:41,560 executing shell commands, 1014 00:36:41,760 --> 00:36:44,300 there are a handful of things that are security sensitive. 1015 00:36:45,200 --> 00:36:47,000 If you can overlay your ability to detect 1016 00:36:47,000 --> 00:36:48,720 dead code during functional testing 1017 00:36:48,720 --> 00:36:51,440 with things that might be security sensitive, 1018 00:36:51,760 --> 00:36:53,360 you find people opening sockets 1019 00:36:53,360 --> 00:36:53,940 in dead code, 1020 00:36:54,500 --> 00:36:56,220 that's a good thing to get rid of either way. 1021 00:36:56,440 --> 00:36:58,920 At the very least, it's dead code that might 1022 00:36:58,920 --> 00:37:00,740 introduce a bug or cause some problem later on. 1023 00:37:00,980 --> 00:37:03,100 But it's also quite possible that 1024 00:37:03,100 --> 00:37:04,820 it's behind one of these logic bombs 1025 00:37:04,820 --> 00:37:07,020 or hard-coded credentials, 1026 00:37:07,300 --> 00:37:08,980 time bombs, something that's meant to 1027 00:37:08,980 --> 00:37:10,940 not execute on a regular basis. 1028 00:37:12,900 --> 00:37:15,080 In production, runtime monitoring 1029 00:37:15,080 --> 00:37:16,540 can do you some good, too. 1030 00:37:16,900 --> 00:37:19,460 Because, now this is a little 1031 00:37:19,460 --> 00:37:20,840 late in the game, 1032 00:37:21,060 --> 00:37:22,520 but if you suddenly see 1033 00:37:22,520 --> 00:37:24,740 a bunch of data being written out from your web app 1034 00:37:24,740 --> 00:37:25,500 that isn't typically, 1035 00:37:25,800 --> 00:37:28,200 or a bunch of traffic on your admin console 1036 00:37:28,200 --> 00:37:29,300 that isn't typically there, 1037 00:37:29,820 --> 00:37:32,320 there are things at runtime that suggest 1038 00:37:32,750 --> 00:37:34,000 something is out of the normal here. 1039 00:37:34,240 --> 00:37:36,040 And this comes down to, for the most part, 1040 00:37:36,180 --> 00:37:38,600 anomaly detection, looking for common behavior 1041 00:37:38,600 --> 00:37:40,920 and looking for things that deviate. 1042 00:37:40,940 --> 00:37:43,160 So, watching your application 1043 00:37:43,160 --> 00:37:44,960 both in QA and in production 1044 00:37:44,960 --> 00:37:46,440 can help track these things down. 1045 00:37:46,960 --> 00:37:48,880 We're particularly partial to the static analysis 1046 00:37:48,880 --> 00:37:50,600 approach because that's where we put a lot of our energy, 1047 00:37:50,740 --> 00:37:53,260 but belt and suspenders does apply here, too. 1048 00:37:54,620 --> 00:37:55,100 Okay. 1049 00:37:55,260 --> 00:37:56,660 So, now you have a really 1050 00:37:56,660 --> 00:37:58,680 big pile of breadcrumbs. 1051 00:37:58,840 --> 00:37:59,980 None of them are smoking guns. 1052 00:38:00,880 --> 00:38:02,500 Let's talk about this code for a second. 1053 00:38:02,640 --> 00:38:04,740 So, you get the current time. That's nasty. 1054 00:38:04,960 --> 00:38:06,720 You compare the current time against 1055 00:38:06,720 --> 00:38:08,800 some hard-coded string. That's nasty, too. 1056 00:38:09,900 --> 00:38:10,800 This might 1057 00:38:10,940 --> 00:38:12,420 legitimately be update code. 1058 00:38:12,740 --> 00:38:14,620 You might say, we're a startup 1059 00:38:14,620 --> 00:38:16,960 and once a month we just want to check to make sure 1060 00:38:16,960 --> 00:38:18,480 there aren't some new bits that we should download. 1061 00:38:18,720 --> 00:38:19,980 And this was a hacky way to, 1062 00:38:20,560 --> 00:38:21,740 kludgy way to introduce that. 1063 00:38:22,880 --> 00:38:24,920 It's possible. You might be able to talk 1064 00:38:24,920 --> 00:38:25,840 your way around it, but 1065 00:38:26,460 --> 00:38:28,900 it might also be nasty. And the fact that 1066 00:38:28,900 --> 00:38:30,980 we see the two breadcrumbs that we latched 1067 00:38:30,980 --> 00:38:32,940 onto before, right? Accessing the current 1068 00:38:32,940 --> 00:38:34,960 time and doing a comparison based on it 1069 00:38:35,600 --> 00:38:36,860 give us a little more confidence. 1070 00:38:38,640 --> 00:38:40,680 So, in the end, what we can really do with these 1071 00:38:40,940 --> 00:38:42,760 results is we can associate 1072 00:38:42,760 --> 00:38:44,800 a strength with them 1073 00:38:44,800 --> 00:38:46,700 or a priority with them. Just like we would other 1074 00:38:46,700 --> 00:38:48,640 vulnerabilities that we detected in an automated 1075 00:38:48,640 --> 00:38:50,920 fashion. So, some problems 1076 00:38:50,920 --> 00:38:52,860 like accessing the current 1077 00:38:52,860 --> 00:38:55,000 time might only give us a low fidelity 1078 00:38:55,000 --> 00:38:56,840 feed that it's an insider 1079 00:38:56,840 --> 00:38:58,820 threat. There might be lots of reasons you 1080 00:38:58,820 --> 00:38:59,880 access the current time. 1081 00:39:00,580 --> 00:39:02,840 But if you compare that with a hard-coded time, 1082 00:39:03,540 --> 00:39:04,920 that's pretty strange. 1083 00:39:05,100 --> 00:39:06,720 Maybe that goes at the high end of the bucket. 1084 00:39:06,980 --> 00:39:08,660 So, each one of these breadcrumbs has 1085 00:39:08,660 --> 00:39:10,880 a strength of implication. How likely 1086 00:39:10,940 --> 00:39:12,560 is it to describe a real vulnerability? 1087 00:39:13,060 --> 00:39:15,000 And one of the most exciting things you can do 1088 00:39:15,000 --> 00:39:16,860 with static analysis is combine 1089 00:39:16,860 --> 00:39:19,060 these. So you have a low, a low, 1090 00:39:19,260 --> 00:39:20,880 a medium, and they're all in the 1091 00:39:20,880 --> 00:39:22,820 same method. Okay, that method 1092 00:39:22,820 --> 00:39:24,420 definitely warrants manual review. 1093 00:39:24,680 --> 00:39:27,000 But it's important to see that eventually 1094 00:39:27,000 --> 00:39:28,880 this does come back to a manual 1095 00:39:28,880 --> 00:39:30,780 review process. You need a smart person 1096 00:39:30,780 --> 00:39:32,860 who understands what an insider 1097 00:39:32,860 --> 00:39:34,820 might go after and how they might do it. 1098 00:39:35,000 --> 00:39:37,000 And that person needs to take 1099 00:39:37,000 --> 00:39:38,400 the code base as one input 1100 00:39:38,780 --> 00:39:40,920 and the feedback from the analysis tools as another 1101 00:39:40,940 --> 00:39:42,960 input and maybe some run time 1102 00:39:42,960 --> 00:39:44,880 monitoring as another input and 1103 00:39:44,880 --> 00:39:46,780 combine all these things to start 1104 00:39:46,780 --> 00:39:47,940 looking for the real problems. 1105 00:39:49,260 --> 00:39:50,940 Of course, if you've been doing this 1106 00:39:50,940 --> 00:39:53,020 by hand, this is going to sound 1107 00:39:53,020 --> 00:39:54,740 great because now you've got more inputs. 1108 00:39:54,940 --> 00:39:56,600 It used to just be the code, right? 1109 00:39:56,620 --> 00:39:58,780 Figure it out. Now you've got other 1110 00:39:58,780 --> 00:40:00,660 things to help start to develop that heat map. 1111 00:40:01,660 --> 00:40:02,360 If, however, 1112 00:40:02,820 --> 00:40:04,800 you weren't doing it before, if you weren't looking 1113 00:40:04,800 --> 00:40:06,740 for insider threats and somebody says, 1114 00:40:06,960 --> 00:40:08,900 yeah, now you've got all these inputs and it's up 1115 00:40:08,900 --> 00:40:10,760 to you to interpret them, it's going to sound like a hard 1116 00:40:10,940 --> 00:40:12,920 problem. So a piece of this all boils 1117 00:40:12,920 --> 00:40:14,920 back down into what's 1118 00:40:14,920 --> 00:40:16,680 the motivation and what's the organization actually 1119 00:40:16,680 --> 00:40:18,860 after finding. Are they interested in finding these 1120 00:40:18,860 --> 00:40:20,840 things? If so, this is going to sound like a good 1121 00:40:20,840 --> 00:40:21,100 story. 1122 00:40:22,620 --> 00:40:24,980 Okay, so I talked a little bit about how you might 1123 00:40:24,980 --> 00:40:26,780 find these things. Matthias talked about 1124 00:40:26,780 --> 00:40:28,660 what these things are, classes of 1125 00:40:28,660 --> 00:40:30,840 insider threats. Now we're going to line the two up 1126 00:40:30,840 --> 00:40:32,860 and talk a little bit about how latching on 1127 00:40:32,860 --> 00:40:34,840 to some of these specific attributes at 1128 00:40:34,840 --> 00:40:37,040 analysis time, we can point out problems 1129 00:40:37,040 --> 00:40:38,680 at varying degrees of 1130 00:40:38,680 --> 00:40:39,140 priority. 1131 00:40:42,680 --> 00:40:43,640 The face-off. 1132 00:40:43,820 --> 00:40:45,220 So what have we done? 1133 00:40:45,600 --> 00:40:46,740 So where are we today? 1134 00:40:47,000 --> 00:40:48,900 We have 17 1135 00:40:48,900 --> 00:40:50,880 insider threat categories and we've implemented 1136 00:40:50,880 --> 00:40:51,940 them all for Java. 1137 00:40:52,180 --> 00:40:52,960 Ten minutes. 1138 00:40:54,320 --> 00:40:56,700 We found multiple real issues in 1139 00:40:56,700 --> 00:40:58,600 enterprise code, so we have confirmed issues 1140 00:40:58,600 --> 00:41:00,620 that we found in enterprise code. 1141 00:41:00,820 --> 00:41:02,900 So the way I'm going to do this is 1142 00:41:02,900 --> 00:41:04,660 I'm going to rerun the examples 1143 00:41:04,660 --> 00:41:06,560 and I'm going to describe what we flag. 1144 00:41:06,760 --> 00:41:08,600 So just 1145 00:41:08,600 --> 00:41:09,840 to have all the 1146 00:41:10,940 --> 00:41:13,120 we have like 17 categories, they are listed 1147 00:41:13,120 --> 00:41:14,620 here, they are in the slides so you can 1148 00:41:14,620 --> 00:41:16,280 if you want to talk about them afterwards 1149 00:41:16,740 --> 00:41:17,640 feel free to do so. 1150 00:41:18,260 --> 00:41:20,960 So all these categories are like sub-categories 1151 00:41:21,480 --> 00:41:22,540 to these main 1152 00:41:22,540 --> 00:41:24,500 classes of insider threats. 1153 00:41:24,900 --> 00:41:27,040 So I will tell you what we flag 1154 00:41:27,040 --> 00:41:28,880 in the code, what we flag and how 1155 00:41:28,880 --> 00:41:30,820 that relates to the code that we've shown before. 1156 00:41:31,640 --> 00:41:32,720 So first thing first. 1157 00:41:32,980 --> 00:41:34,040 Logic bomb and 1158 00:41:34,520 --> 00:41:36,740 logic and time bomb. So what we flag 1159 00:41:36,740 --> 00:41:38,460 is in a low priority 1160 00:41:38,460 --> 00:41:40,840 if you get the current time it goes into 1161 00:41:40,940 --> 00:41:41,920 the low priority bucket. 1162 00:41:42,260 --> 00:41:44,460 If you get the current time and you compare it against 1163 00:41:44,460 --> 00:41:47,240 you get the current time and you compare it 1164 00:41:47,240 --> 00:41:49,260 it goes in the medium priority bucket. 1165 00:41:49,460 --> 00:41:50,740 If you get the current time 1166 00:41:50,740 --> 00:41:52,900 you compare it and you compare it to a hardcoded 1167 00:41:52,900 --> 00:41:54,760 date, then we drop it in the 1168 00:41:54,760 --> 00:41:56,880 high priority bucket. So obviously 1169 00:41:56,880 --> 00:41:58,940 this was found in the high priority bucket 1170 00:41:58,940 --> 00:42:00,940 so it's ticked out, we found it immediately. 1171 00:42:02,500 --> 00:42:02,940 Backdoors 1172 00:42:02,940 --> 00:42:03,720 and secret credentials. 1173 00:42:04,220 --> 00:42:06,140 The way we flag stuff goes as follows. 1174 00:42:06,300 --> 00:42:08,060 We flag insertions in the database. 1175 00:42:08,060 --> 00:42:09,960 If you insert 1176 00:42:09,960 --> 00:42:12,060 something in the credential database it's a low 1177 00:42:12,060 --> 00:42:14,040 issue because there are good reasons 1178 00:42:14,040 --> 00:42:15,660 to insert new credentials in the database. 1179 00:42:15,960 --> 00:42:18,120 If you insert something in the credential 1180 00:42:18,120 --> 00:42:20,000 database and it's a hardcoded credential 1181 00:42:20,000 --> 00:42:21,780 well that's pretty suspicion and that's 1182 00:42:21,780 --> 00:42:23,880 at least a medium issue. 1183 00:42:24,560 --> 00:42:26,140 If you insert in the credential 1184 00:42:26,140 --> 00:42:28,080 database a hardcoded credential and you 1185 00:42:28,080 --> 00:42:29,780 do that at startup which means that these 1186 00:42:29,780 --> 00:42:31,940 credentials will always be there and you can always 1187 00:42:31,940 --> 00:42:34,120 use them, well then it's definitely a high 1188 00:42:34,120 --> 00:42:34,440 issue. 1189 00:42:35,400 --> 00:42:37,720 And that's a perfect way to 1190 00:42:38,060 --> 00:42:40,120 secure yourself access to the machine. 1191 00:42:41,840 --> 00:42:43,840 What else do we report in this category? 1192 00:42:44,460 --> 00:42:46,080 We report comparing 1193 00:42:46,080 --> 00:42:47,800 hardcoded usernames and 1194 00:42:47,800 --> 00:42:48,920 hardcoded passwords. 1195 00:42:49,760 --> 00:42:52,020 All the comparisons of the 1196 00:42:52,020 --> 00:42:53,800 username with the hardcoded username 1197 00:42:53,800 --> 00:42:55,800 and or the password with the 1198 00:42:55,800 --> 00:42:57,560 hardcoded password, we flag that 1199 00:42:57,560 --> 00:42:59,880 as a high priority because that's 1200 00:42:59,880 --> 00:43:00,720 most likely a threat. 1201 00:43:02,160 --> 00:43:03,860 How do we tell what a username is? 1202 00:43:04,220 --> 00:43:06,020 Okay, so we have a couple 1203 00:43:06,020 --> 00:43:07,880 of username and password 1204 00:43:08,060 --> 00:43:09,720 if the variable is username and password 1205 00:43:09,720 --> 00:43:11,480 it's obvious but not in all applications 1206 00:43:11,480 --> 00:43:13,980 it's username and password. So you can also customize 1207 00:43:13,980 --> 00:43:15,980 your, we have some custom 1208 00:43:15,980 --> 00:43:17,920 rules available for your application that 1209 00:43:17,920 --> 00:43:20,040 you can simply use your variables 1210 00:43:21,120 --> 00:43:21,640 and 1211 00:43:21,640 --> 00:43:23,620 we will automatically trigger them. 1212 00:43:25,240 --> 00:43:25,940 Default command 1213 00:43:25,940 --> 00:43:27,860 injection in WordPress, so for some 1214 00:43:27,860 --> 00:43:29,720 cases we do not need any special rules. 1215 00:43:30,420 --> 00:43:31,680 So the command injection 1216 00:43:31,680 --> 00:43:33,960 it will be found by regular 1217 00:43:33,960 --> 00:43:36,100 static analysis. If you really want to 1218 00:43:36,100 --> 00:43:37,840 have this in your 1219 00:43:38,360 --> 00:43:39,740 insider threat code base, 1220 00:43:39,900 --> 00:43:41,960 what you can do is you can take the 1221 00:43:41,960 --> 00:43:43,900 command injection rules and port them over to 1222 00:43:43,900 --> 00:43:45,960 the insider threat rule 1223 00:43:45,960 --> 00:43:47,760 pack and we will flag that as 1224 00:43:47,760 --> 00:43:49,840 a backdoor and secret credential. 1225 00:43:51,100 --> 00:43:51,920 Nefarious communication, 1226 00:43:52,400 --> 00:43:53,920 we flag hardcoded 1227 00:43:53,920 --> 00:43:56,000 ports and sockets. So if you use a socket 1228 00:43:56,000 --> 00:43:57,900 and it's a, if you 1229 00:43:57,900 --> 00:44:00,000 create a new socket with a hardcoded 1230 00:44:00,000 --> 00:44:02,020 port, we flag that as a high issue. 1231 00:44:02,220 --> 00:44:03,940 What we also flag in general 1232 00:44:03,940 --> 00:44:04,940 is server sockets. 1233 00:44:05,640 --> 00:44:07,740 Most of our customer base they are not 1234 00:44:08,060 --> 00:44:09,560 using any server sockets, so if you do, 1235 00:44:09,580 --> 00:44:11,620 we flag that as a medium issue. 1236 00:44:12,420 --> 00:44:13,300 We also 1237 00:44:13,300 --> 00:44:15,660 flag accessing hardcoded files. 1238 00:44:15,840 --> 00:44:17,580 So we have a couple of default rules 1239 00:44:17,580 --> 00:44:19,900 if you try to access ETC password or whatever 1240 00:44:19,900 --> 00:44:21,740 file you do not want to expose, 1241 00:44:22,380 --> 00:44:23,580 we are going to flag that. 1242 00:44:23,860 --> 00:44:25,880 We also have custom rules, so if you know 1243 00:44:25,880 --> 00:44:27,840 of some files that are really confidential to 1244 00:44:27,840 --> 00:44:30,000 your organization, you can 1245 00:44:30,000 --> 00:44:30,740 set them and 1246 00:44:32,300 --> 00:44:33,900 we can track that. 1247 00:44:37,600 --> 00:44:38,040 Hardcoded 1248 00:44:38,060 --> 00:44:40,020 email addresses, so every hardcoded email 1249 00:44:40,020 --> 00:44:41,820 address is flagged in your application. 1250 00:44:42,240 --> 00:44:44,320 There are again legitimate usages 1251 00:44:44,320 --> 00:44:46,220 when you want to contact 1252 00:44:46,220 --> 00:44:47,400 the administrator or whatever, 1253 00:44:47,660 --> 00:44:50,160 that's a legit usage, but in normal cases 1254 00:44:50,160 --> 00:44:51,940 it's legit. We can also flag 1255 00:44:52,880 --> 00:44:53,960 mailing APIs 1256 00:44:53,960 --> 00:44:54,580 for instance. 1257 00:44:56,520 --> 00:44:57,660 We flag functions 1258 00:44:57,660 --> 00:44:59,720 that change the read-only flag, so 1259 00:44:59,720 --> 00:45:01,740 for instance the set accessible 1260 00:45:01,740 --> 00:45:03,820 on a field class, 1261 00:45:04,080 --> 00:45:05,200 we're going to flag that because 1262 00:45:05,200 --> 00:45:07,960 you shouldn't use that in your application. 1263 00:45:08,060 --> 00:45:10,100 We have similar rules for all 1264 00:45:10,100 --> 00:45:11,800 the categories that are described in 1265 00:45:11,800 --> 00:45:13,540 Jeff Williams' paper, but we 1266 00:45:14,060 --> 00:45:15,740 broadened our view and we thought about more 1267 00:45:15,740 --> 00:45:17,440 examples and how people do stuff, 1268 00:45:17,700 --> 00:45:19,480 so we have rules for all 1269 00:45:19,820 --> 00:45:20,440 these things. 1270 00:45:22,940 --> 00:45:23,940 Obfuscation and camouflage, 1271 00:45:24,340 --> 00:45:26,080 we flag the usage of a single 1272 00:45:26,080 --> 00:45:27,500 equals inside an if statement. 1273 00:45:27,720 --> 00:45:29,960 You should not use a single equals in an 1274 00:45:29,960 --> 00:45:32,060 if statement, so we flag that in the obfuscation 1275 00:45:32,060 --> 00:45:32,540 and camouflage. 1276 00:45:33,340 --> 00:45:36,120 We also flag when you're 1277 00:45:36,120 --> 00:45:37,800 having the same name for a 1278 00:45:38,060 --> 00:45:39,160 variable as a common function. 1279 00:45:39,940 --> 00:45:41,840 If you're doing that, we will flag that 1280 00:45:41,840 --> 00:45:43,160 in the obfuscation and camouflage. 1281 00:45:44,100 --> 00:45:45,900 And then the really useful one 1282 00:45:45,900 --> 00:45:47,700 is if you're trying to decode 1283 00:45:47,700 --> 00:45:49,880 hard-coded strings, we're going to flag 1284 00:45:49,880 --> 00:45:51,680 that as an obfuscation and camouflage. 1285 00:45:52,000 --> 00:45:54,020 That turned out to be a really useful 1286 00:45:54,020 --> 00:45:55,820 one. We found a lot of issues with 1287 00:45:55,820 --> 00:45:57,960 this kind of rule. If you 1288 00:45:57,960 --> 00:45:59,780 decode a hard-coded string, it's very suspicious. 1289 00:46:00,080 --> 00:46:01,760 It's implicitly saying, like, hey, I'm 1290 00:46:01,760 --> 00:46:03,920 hiding something. So you do 1291 00:46:03,920 --> 00:46:05,480 not want to have that in your code. 1292 00:46:06,700 --> 00:46:07,920 So I hope that makes sense. 1293 00:46:08,060 --> 00:46:09,900 And for the conclusion, 1294 00:46:10,080 --> 00:46:11,660 I want to hand off to Jacob again. 1295 00:46:12,720 --> 00:46:13,820 Thanks again, Matthias. 1296 00:46:14,300 --> 00:46:15,960 All right, we're almost done, guys. 1297 00:46:16,100 --> 00:46:17,940 First, and particularly for the 1298 00:46:17,940 --> 00:46:19,120 DEF CON crowd, 1299 00:46:19,540 --> 00:46:21,100 how do you avoid getting caught? 1300 00:46:21,380 --> 00:46:23,940 So companies are going to start using technology like this 1301 00:46:23,940 --> 00:46:25,000 to find insider threats. 1302 00:46:25,340 --> 00:46:27,820 How do you avoid detection? What's the 1303 00:46:27,820 --> 00:46:29,680 technique for not getting caught? 1304 00:46:30,660 --> 00:46:32,020 First off, and one that 1305 00:46:32,020 --> 00:46:33,760 we've seen used again and again, is 1306 00:46:33,760 --> 00:46:36,100 make the code look as legitimate as possible. 1307 00:46:36,220 --> 00:46:37,940 Make it look like real code and 1308 00:46:38,060 --> 00:46:39,540 make it look like code that 1309 00:46:40,060 --> 00:46:41,480 fits with its surroundings. 1310 00:46:42,240 --> 00:46:44,280 If you have a five-line 1311 00:46:44,280 --> 00:46:45,560 encrypted string 1312 00:46:45,560 --> 00:46:47,840 hard-coded at the top of your class definition, 1313 00:46:48,160 --> 00:46:49,920 it's going to stand out no matter who's 1314 00:46:49,920 --> 00:46:51,560 looking at it, even if it's just a 1315 00:46:51,560 --> 00:46:53,320 cursory review to make some other edit. 1316 00:46:53,640 --> 00:46:54,480 So make it look real. 1317 00:46:55,500 --> 00:46:57,860 Also, if you can make it benign, 1318 00:46:57,920 --> 00:46:59,800 meaning it doesn't show up as 1319 00:46:59,800 --> 00:47:01,920 a pure vulnerability, like 1320 00:47:01,920 --> 00:47:03,620 that command injection that I talked about in 1321 00:47:03,620 --> 00:47:05,840 WordPress, that's better. The more 1322 00:47:05,840 --> 00:47:08,040 it looks like application logic, as opposed to 1323 00:47:08,060 --> 00:47:09,500 a vulnerability, 1324 00:47:09,800 --> 00:47:11,780 the less likely it is to turn up for people 1325 00:47:11,780 --> 00:47:13,600 who aren't really looking for insider threats. 1326 00:47:15,340 --> 00:47:16,020 It's good to 1327 00:47:16,020 --> 00:47:17,700 understand who you're up against. 1328 00:47:18,020 --> 00:47:19,700 So understand what 1329 00:47:20,380 --> 00:47:22,040 organizations and security teams are 1330 00:47:22,040 --> 00:47:23,940 looking for, and understand what tools 1331 00:47:23,940 --> 00:47:25,940 they're using to look for those problems. 1332 00:47:26,220 --> 00:47:27,940 If you can get access 1333 00:47:27,940 --> 00:47:30,000 to one of those tools, if you can run, for example, 1334 00:47:30,140 --> 00:47:31,960 the static analysis tool against your code 1335 00:47:31,960 --> 00:47:34,080 again and again, you can tweak little attributes 1336 00:47:34,080 --> 00:47:35,700 of it until it doesn't show up. 1337 00:47:35,900 --> 00:47:37,880 And this is, of course, a real concern for the defender. 1338 00:47:38,060 --> 00:47:39,820 But finally, 1339 00:47:40,560 --> 00:47:42,040 there's a lot more attention on 1340 00:47:42,040 --> 00:47:43,940 this problem today. So one way not to get 1341 00:47:43,940 --> 00:47:45,800 caught would be to just not do it in the first place. 1342 00:47:46,080 --> 00:47:47,720 I think getting a job on the support team 1343 00:47:47,720 --> 00:47:49,760 and avoiding the source code altogether 1344 00:47:49,760 --> 00:47:51,760 would probably be an easier route to 1345 00:47:51,760 --> 00:47:53,420 wreak some insider damage. 1346 00:47:54,800 --> 00:47:55,980 So for the good guys, 1347 00:47:56,720 --> 00:47:58,020 what does this all boil 1348 00:47:58,020 --> 00:47:59,980 down to? It's really 1349 00:47:59,980 --> 00:48:01,920 like looking for a needle in a haystack. 1350 00:48:02,160 --> 00:48:03,480 So you're looking for 1351 00:48:03,480 --> 00:48:06,020 a huge variety of different 1352 00:48:06,020 --> 00:48:07,900 tools and attackers that people might 1353 00:48:08,500 --> 00:48:08,940 use. 1354 00:48:09,600 --> 00:48:11,900 It's hard to think with this big number three 1355 00:48:11,900 --> 00:48:13,000 in front of my eyes, sorry. 1356 00:48:15,300 --> 00:48:16,020 The attackers 1357 00:48:16,020 --> 00:48:18,100 have a big arsenal of tools at their disposal 1358 00:48:18,100 --> 00:48:19,980 because they've got the entire programming language 1359 00:48:19,980 --> 00:48:21,500 or multiple programming languages. 1360 00:48:21,680 --> 00:48:22,840 If you think of a multi-tier application, 1361 00:48:23,240 --> 00:48:25,500 they might do some damage in JSP or Java 1362 00:48:25,500 --> 00:48:27,720 or PLSQL or a native C procedure 1363 00:48:27,720 --> 00:48:28,980 that no one's ever going to look at. 1364 00:48:29,300 --> 00:48:31,180 So they have a lot of tools at their disposal. 1365 00:48:32,720 --> 00:48:33,160 And 1366 00:48:36,260 --> 00:48:38,040 what we've seen for the most part 1367 00:48:38,060 --> 00:48:38,580 has been 1368 00:48:39,920 --> 00:48:41,540 they put a lot of planning into this. 1369 00:48:41,660 --> 00:48:42,920 They think about the code for a long time. 1370 00:48:43,120 --> 00:48:45,560 They've got it in place a year before they get laid off. 1371 00:48:45,760 --> 00:48:46,740 It's not a spur of the moment. 1372 00:48:46,900 --> 00:48:48,940 Oh man, I hate my pointy-headed boss. 1373 00:48:49,140 --> 00:48:50,760 I'm going to go code up something really nasty. 1374 00:48:51,060 --> 00:48:52,200 They put a lot of effort into these. 1375 00:48:52,340 --> 00:48:54,620 So they've got a lot of variety available to them 1376 00:48:54,620 --> 00:48:58,240 and they have a really large window of attack. 1377 00:48:58,480 --> 00:48:59,740 Much bigger than the period 1378 00:48:59,740 --> 00:49:01,720 between when the board decides to lay people off 1379 00:49:01,720 --> 00:49:02,700 and they actually do. 1380 00:49:04,400 --> 00:49:05,800 Technology can help a lot here. 1381 00:49:05,940 --> 00:49:07,680 I hope with some of the examples that we showed today, 1382 00:49:08,060 --> 00:49:09,220 you guys see that static analysis, 1383 00:49:09,480 --> 00:49:11,960 although is never going to point out 1384 00:49:11,960 --> 00:49:12,560 smoking guns, 1385 00:49:12,880 --> 00:49:14,960 is a big help over manual review. 1386 00:49:15,120 --> 00:49:17,980 And can really reduce a multi-million line application 1387 00:49:17,980 --> 00:49:19,940 into a heat map of areas 1388 00:49:19,940 --> 00:49:22,280 that a code review can do more value in 1389 00:49:22,280 --> 00:49:24,200 by focusing on those hot spots. 1390 00:49:25,020 --> 00:49:25,520 And 1391 00:49:25,520 --> 00:49:28,060 it's really key that going into it 1392 00:49:28,060 --> 00:49:29,320 you don't just rely on technology 1393 00:49:29,320 --> 00:49:30,920 but that you have your auditors 1394 00:49:30,920 --> 00:49:32,080 and the people looking for problems 1395 00:49:32,680 --> 00:49:34,040 apply the right mindset. 1396 00:49:34,300 --> 00:49:37,380 The things coming out of the static or runtime analysis 1397 00:49:38,060 --> 00:49:38,620 aren't smoking guns. 1398 00:49:38,860 --> 00:49:39,640 They aren't vulnerabilities. 1399 00:49:40,100 --> 00:49:41,380 They're breadcrumbs. 1400 00:49:41,380 --> 00:49:42,920 They're indicators of a potential problem. 1401 00:49:43,220 --> 00:49:45,460 And until you get a thick enough pile of breadcrumbs 1402 00:49:45,460 --> 00:49:47,120 you're not guaranteed of finding a problem. 1403 00:49:48,280 --> 00:49:49,100 Thanks very much. 1404 00:49:49,320 --> 00:49:52,700 I know software is not the usual DEF CON topic 1405 00:49:52,700 --> 00:49:54,200 but I appreciate you humoring us 1406 00:49:54,200 --> 00:49:55,800 and thanks a lot for coming out today. 1407 00:49:55,940 --> 00:49:58,080 We'll be happy to take any questions after the fact.