1 00:00:00,000 --> 00:00:07,280 All right. Hi, everyone. My name is Eddie Lee. I'm from Fortify Software, and I'm going to talk about comparing application security tools. 2 00:00:08,680 --> 00:00:15,940 My talk's going to be pretty packed, so I'm just basically going to speed talk through this, and I might breathe through it, so bear with me. 3 00:00:17,460 --> 00:00:23,780 So the agenda for today's talk is I'm just going to give a brief intro to my experiment about comparing application security tools, 4 00:00:23,780 --> 00:00:32,480 go into the methodology and how you can reproduce your own experiments, and go into the results of my experiment, and then go into conclusions. 5 00:00:34,400 --> 00:00:40,720 So what I did in this experiment was actually I used two of the market-leading dynamic pen testing tools for web applications. 6 00:00:41,080 --> 00:00:46,820 I used a static code analyzer, a source code analyzer, and I used a dynamic test tracing tool. 7 00:00:47,900 --> 00:00:49,740 I'll talk about these tools on the next slide. 8 00:00:50,160 --> 00:00:53,760 The application I scanned was actually an open-source Java-based blogger. 9 00:00:53,780 --> 00:00:56,720 It's a tagging application. You can find it on SourceForge. 10 00:00:57,860 --> 00:01:03,760 Initially, I chose this application because I thought it would be really easy to scan with all these tools. 11 00:01:03,880 --> 00:01:09,180 It actually turned out that it was more difficult than I thought. It was more time-consuming than I thought. 12 00:01:09,640 --> 00:01:16,940 My original plan was to scan a bunch of applications with a bunch of tools and find a bunch of vulnerabilities, but that proved to be overly ambitious. 13 00:01:17,480 --> 00:01:21,320 So for today's talk, I'm just going to talk about the results for one application. 14 00:01:23,780 --> 00:01:28,660 So I basically took these tools, and I used them out of the box with little configuration. 15 00:01:29,040 --> 00:01:35,640 So basically, for the dynamic pen testing tools, I gave the tools a URL, some login information, and I let it run. 16 00:01:36,640 --> 00:01:39,580 And in some cases, I ran them in manual mode as well. 17 00:01:40,060 --> 00:01:42,160 And then I compared the findings from each of the tools. 18 00:01:43,300 --> 00:01:44,920 So how do these tools work? 19 00:01:45,080 --> 00:01:49,840 Well, for the dynamic testing tools, first what they do is they fuzz web input. 20 00:01:50,200 --> 00:01:52,140 They basically crawl web applications. 21 00:01:52,140 --> 00:01:58,700 They're looking for all sorts of web forms, and when it finds all those forms, it'll actually try to fuzz the inputs. 22 00:01:58,920 --> 00:02:03,480 Like, say if it's testing for cross-site scripting, it'll try to inject some kind of script tags. 23 00:02:03,660 --> 00:02:06,820 If it's looking for SQL injection, then they inject a single quote. 24 00:02:07,840 --> 00:02:12,820 And the way it finds these kind of vulnerabilities is usually signature-based or behavioral matching. 25 00:02:13,520 --> 00:02:20,160 Signature-based for, say, cross-site scripting, it'll look to see if the fuzz string was reflected back by the application. 26 00:02:20,560 --> 00:02:21,640 For SQL injection, 27 00:02:22,140 --> 00:02:25,340 it'll look for, say, certain error messages, like SQL exception or something like that. 28 00:02:26,020 --> 00:02:30,540 These dynamic pen testing tools also have a couple modes that you can run them in. 29 00:02:30,680 --> 00:02:34,460 You can run them first in auto-crawl mode, basically point-and-click mode. 30 00:02:34,640 --> 00:02:37,640 You give the tool a URL and some login information, and you press go. 31 00:02:37,820 --> 00:02:39,940 And the tool will try to find vulnerabilities in the app. 32 00:02:40,440 --> 00:02:46,340 Generally, that's not very thorough, so they also have a manual crawl mode where a human or, in this case, me, 33 00:02:46,440 --> 00:02:51,840 I actually crawl the web application trying to give the tool an idea of what kind of page flow 34 00:02:51,840 --> 00:02:52,680 the application had. 35 00:02:52,820 --> 00:02:57,520 And then the tool would actually take over and perform an auto-crawl after that. 36 00:02:57,760 --> 00:03:01,680 So these manual crawls are generally more thorough in their testing. 37 00:03:02,520 --> 00:03:08,760 With the source code analyzer, these tools actually have a couple analyzers within them themselves. 38 00:03:09,160 --> 00:03:14,160 For example, data flow analyzer, which basically looks at source code. 39 00:03:14,260 --> 00:03:21,140 It knows when malicious input comes in from some source API, and when it traces that input throughout the program, 40 00:03:21,140 --> 00:03:24,780 throughout the source code, and it knows when it reaches a specific sync API, 41 00:03:25,020 --> 00:03:25,980 a security-sensitive sync. 42 00:03:26,220 --> 00:03:30,600 So in the case of, say, SQL injection, it knows when there's input coming in from the web, 43 00:03:30,740 --> 00:03:35,800 and it knows that that input, that string, reaches a, say, database API. 44 00:03:37,280 --> 00:03:41,460 Control flow is basically the analysis of a sequence of events in your code. 45 00:03:41,780 --> 00:03:45,800 So this may be certain things like looking for a null pointer dereference. 46 00:03:45,800 --> 00:03:52,740 If you have a method that returns a null value and then you use that value without checking to see if it's null, 47 00:03:52,940 --> 00:03:54,860 it will find bugs like that. 48 00:03:55,560 --> 00:04:01,020 The semantic analyzer is basically like a super grep that will look for dangerous functions, things like that. 49 00:04:02,380 --> 00:04:04,320 The dynamic test tracing tool. 50 00:04:04,400 --> 00:04:05,460 This is kind of a new tool. 51 00:04:05,660 --> 00:04:10,200 The way it works is actually through bytecode instrumentation on, say, Java or .NET code. 52 00:04:10,740 --> 00:04:15,000 Basically what it does is it injects your compiled web app with monitors, 53 00:04:15,800 --> 00:04:21,780 these monitors actually run and monitor the application while you're running your dynamic testing tools, 54 00:04:21,860 --> 00:04:22,760 your pen testing tools. 55 00:04:22,920 --> 00:04:26,260 So it actually will observe fuzzing input coming into the application, 56 00:04:26,420 --> 00:04:31,000 and it will watch to see if that data reaches sensitive APIs in your web app. 57 00:04:32,320 --> 00:04:36,740 So you do run that in conjunction with your web pen testing tools. 58 00:04:39,080 --> 00:04:39,960 So methodology. 59 00:04:40,360 --> 00:04:44,240 Well, basically, this is how you would reproduce these experiments on your own. 60 00:04:44,840 --> 00:04:45,780 Download the source code. 61 00:04:45,800 --> 00:04:47,640 And build and deploy the application. 62 00:04:47,900 --> 00:04:55,640 That sounds pretty straightforward, but generally things don't always build when you download them from, say, SourceForge. 63 00:04:56,600 --> 00:05:01,760 But once you do deploy your application, you've got to make sure you know how to undeploy your application cleanly. 64 00:05:02,780 --> 00:05:08,700 For example, if your application requires a database, you need to be able to restore the database after a pen test. 65 00:05:08,900 --> 00:05:14,160 Because the fuzzed input from your pen test may affect results. 66 00:05:15,800 --> 00:05:16,680 In subsequent pen tests. 67 00:05:16,800 --> 00:05:18,920 So you want to really clear the database between runs. 68 00:05:20,740 --> 00:05:26,220 So when you run the scanner in auto-crawl mode, you just want to make sure the applications don't break. 69 00:05:26,360 --> 00:05:34,400 So while you're running your pen test tools for the first time, you basically want to keep checking the web app to make sure that it's still running and nothing is broken. 70 00:05:34,860 --> 00:05:40,400 Basically, you want to check certain areas of the web app just to make sure it functions correctly. 71 00:05:41,500 --> 00:05:45,080 If you do find that the web app breaks, you have to stop your auto-crawl testing. 72 00:05:45,800 --> 00:05:48,520 Go back, reconfigure the scanner, and test again. 73 00:05:48,760 --> 00:05:51,680 And be sure to clear your database before you retest. 74 00:05:52,560 --> 00:05:54,400 And that can be a really tedious process. 75 00:05:54,720 --> 00:06:01,200 But the configurations and settings will carry over to your next test, which is the manual crawl mode. 76 00:06:02,060 --> 00:06:05,600 So after you finish your auto-crawl mode, you want to go into your manual crawl mode. 77 00:06:05,720 --> 00:06:12,260 Which basically means you browse through all the pages of the web app, and then you let the web scanner take over from there. 78 00:06:13,400 --> 00:06:15,200 Of course, after you've got your... 79 00:06:15,800 --> 00:06:18,060 After you've got your scans, you want to verify the results. 80 00:06:18,300 --> 00:06:20,480 So what I did was I manually verified the results. 81 00:06:20,720 --> 00:06:27,480 A lot of times, these tools will say there's a lot of vulnerabilities over here, but they may be false positive. 82 00:06:27,600 --> 00:06:29,660 And you just want to weed out those false positives. 83 00:06:29,860 --> 00:06:36,220 And also make a note of the false positive rate in case you want to compare tools to see what kind of false positives they have. 84 00:06:37,400 --> 00:06:39,540 And finally, you want to normalize the results. 85 00:06:40,320 --> 00:06:42,300 Different tools report vulnerabilities differently. 86 00:06:42,560 --> 00:06:45,780 Say for the dynamic pen testing tools, they will report... 87 00:06:45,800 --> 00:06:53,820 ...vulnerabilities based on a URL and parameter basis, whereas the source code analyzers will report vulnerabilities on a file name line number basis. 88 00:06:54,360 --> 00:07:01,080 For my experiment, I actually chose to normalize vulnerabilities based on a source code file and line number basis. 89 00:07:03,660 --> 00:07:05,460 Running your source code analyzers. 90 00:07:05,540 --> 00:07:06,820 Well, there's not much to it. 91 00:07:07,520 --> 00:07:13,100 Basically, you get your source code, you point your scanner at it, tell it where the libraries and dependencies are, and you tell it to go. 92 00:07:14,260 --> 00:07:15,560 Just make sure you're running... 93 00:07:15,560 --> 00:07:23,180 ...you're scanning the same source code that you use to deploy your application or compile your application in the dynamic testing. 94 00:07:24,400 --> 00:07:31,740 Again, verify the results via manual testing and weed out the false positives and record the false positive rate and normalize the results. 95 00:07:33,200 --> 00:07:38,980 With the dynamic tracing tool, the way it works is first you instrument the compiled code. 96 00:07:39,180 --> 00:07:41,400 You basically inject the code with monitors. 97 00:07:41,920 --> 00:07:43,660 Then you deploy the instrumented code. 98 00:07:43,860 --> 00:07:45,540 And then you tell the application you want to start. 99 00:07:45,560 --> 00:07:46,160 And then you tell it to start recording. 100 00:07:46,360 --> 00:07:50,500 So after you tell it to start recording, you run your dynamic test tools on it. 101 00:07:51,420 --> 00:07:55,800 And all these monitors will start recording interactions between your fuzzer and the code. 102 00:07:56,420 --> 00:08:02,820 After the test is done, you stop recording and again verify results, record false positives, and normalize the results. 103 00:08:05,700 --> 00:08:06,140 Okay. 104 00:08:06,360 --> 00:08:07,900 Here, this is a big table. 105 00:08:08,020 --> 00:08:09,440 I know most of you can't read it. 106 00:08:09,480 --> 00:08:13,060 This is in your slides on the DEF CON CD if you want to reference that. 107 00:08:13,380 --> 00:08:15,200 But let me just go over briefly. 108 00:08:15,560 --> 00:08:16,440 What you see here. 109 00:08:16,560 --> 00:08:19,080 On the left, you'll actually see vulnerability information. 110 00:08:19,540 --> 00:08:24,420 And on the right, you'll see which tools actually found each vulnerability. 111 00:08:25,100 --> 00:08:30,880 The red X means that the vulnerability was found by that tool only in that column. 112 00:08:31,120 --> 00:08:35,300 A black X means that the vulnerability was found by multiple tools. 113 00:08:35,820 --> 00:08:39,680 So let me just go through the first line to help you guys understand this table more in depth. 114 00:08:40,820 --> 00:08:44,700 Here, the vulnerability occurs in the file blogentry.jsp. 115 00:08:44,700 --> 00:08:50,260 On line number 16, to access it via the web, you would go to the URL save blogentry.secureaction. 116 00:08:50,540 --> 00:08:55,940 And to actually exploit this cross-site scripting vulnerability, you would manipulate the title parameter. 117 00:08:56,420 --> 00:09:00,940 And in this case, the vulnerability was found by tool 1B and tool 2B. 118 00:09:01,220 --> 00:09:06,500 I'm not naming the tools here because I don't really want to bias anybody into thinking that one tool is better than the next. 119 00:09:08,360 --> 00:09:11,620 These tools will perform differently based on your own environment. 120 00:09:11,840 --> 00:09:14,680 So just because a specific tool looks like this, it doesn't mean that it's going to be the same tool that you're using. 121 00:09:14,680 --> 00:09:18,940 And if you think it performs well on this application, it may not be the case for your own application. 122 00:09:19,180 --> 00:09:23,560 So really, you've got to run these experiments on your own to see how they perform in your own environment. 123 00:09:25,620 --> 00:09:31,280 Again, so going back to this table, what you'll notice is that there are actually more red Xs than black Xs. 124 00:09:31,460 --> 00:09:36,960 What that means is there's not much overlap in findings between the tools. 125 00:09:39,600 --> 00:09:43,300 So tool 1B found a set of vulnerabilities. 126 00:09:43,440 --> 00:09:44,660 And tool 5A found a set of vulnerabilities. 127 00:09:44,680 --> 00:09:45,820 And tool 9B found a different set of vulnerabilities. 128 00:09:47,620 --> 00:09:52,240 You'll also notice that tool 1B, in this case, performed particularly well. 129 00:09:54,260 --> 00:09:58,860 So some vendors may say, well, my tool finds the most number of vulnerabilities, so we're the best. 130 00:09:59,080 --> 00:10:06,280 But if you actually look at the percentages, they find about like 50, 65% of the vulnerabilities of the known vulnerabilities. 131 00:10:06,600 --> 00:10:14,660 So you can't really rely on one tool to define all your vulnerabilities, because if you do, you're still missing like 35%, 40%, 60%, 100%. 132 00:10:14,680 --> 00:10:20,940 of the vulnerabilities in your application so let's just go into some 133 00:10:20,940 --> 00:10:27,140 exploit cases here we have in file error JSP line number 18 there's actually this 134 00:10:27,140 --> 00:10:31,580 parameter and it just printed out print printed out directly to a web page 135 00:10:31,580 --> 00:10:35,460 pretty straightforward vulnerability they're done doing any kind of output 136 00:10:35,460 --> 00:10:41,580 filtering to exploit this and over here you actually put in some scripting text 137 00:10:41,580 --> 00:10:46,680 into the URI section of the URL now this is kind of difficult for dynamic 138 00:10:46,680 --> 00:10:51,900 testing tools to find because to exploit this cross-site scripting vulnerability 139 00:10:51,900 --> 00:10:56,740 you have to put the application in a certain error state so this is something 140 00:10:56,740 --> 00:11:04,560 that actually a one of the the static tools found on the next vulnerability we 141 00:11:04,560 --> 00:11:08,980 have here view response dot JSP line number 31 this vulnerability was 142 00:11:08,980 --> 00:11:11,320 actually found by all of the tools so 143 00:11:11,320 --> 00:11:11,560 you 144 00:11:11,560 --> 00:11:15,700 this is a very straightforward vulnerability you see that there's a 145 00:11:15,700 --> 00:11:23,220 hidden field and in this particular JSP it prints a raw variable again path 146 00:11:23,220 --> 00:11:27,900 manipulation this is actually again one of the vulnerabilities that dynamic 147 00:11:27,900 --> 00:11:31,980 testing tools have trouble finding there may or may not be a signature associated 148 00:11:31,980 --> 00:11:37,660 with path manipulation when testing over ACPP in this case this vulnerability 149 00:11:37,660 --> 00:11:41,540 allows an attacker to overwrite an arbitrary file on the file system and 150 00:11:42,040 --> 00:11:47,000 it actually there's no indication of that sent back through the web this 151 00:11:47,000 --> 00:11:50,560 attack for this attack basically you put in dot-dot-slash dot-dot-slash and then 152 00:11:50,560 --> 00:11:54,600 some file name you include a percent zero zero at the end for null termination 153 00:11:54,600 --> 00:11:59,300 to get to truncate but dot properties extension so and then you can overwrite 154 00:11:59,300 --> 00:12:03,760 any file that the web server has permissions to overwrite arbitrary URL 155 00:12:03,760 --> 00:12:09,840 redirection this is mainly used for phishing so what happens here is that 156 00:12:09,840 --> 00:12:11,540 you just put in you type in any kind of URL in the domain and it will make an 157 00:12:11,560 --> 00:12:18,480 URL into the redirect URL parameter, and then it passes that string to the send redirect 158 00:12:18,480 --> 00:12:24,180 method. And that just sets the HTTP response location header, and users can be tricked 159 00:12:24,180 --> 00:12:27,900 into going to other sites when they think they're actually going to your site. 160 00:12:30,220 --> 00:12:34,180 While verifying the vulnerabilities, actually, I noticed there were some vulnerabilities 161 00:12:34,180 --> 00:12:39,100 that weren't reported by any of the tools. So for one of the pages, I actually did a 162 00:12:39,100 --> 00:12:42,640 manual code audit, and I found eight additional cross-site scripting vulnerabilities that 163 00:12:42,640 --> 00:12:47,480 none of the tools found. So what this means is that you really can't rely on tools themselves 164 00:12:47,480 --> 00:12:56,620 to perform an extremely thorough audit. You really need manual auditing to make sure your 165 00:12:57,840 --> 00:13:04,320 code audits are thorough. What we see here is actually a pie chart of 166 00:13:04,320 --> 00:13:09,080 all the cross-site scripting vulnerabilities. Again, you see tool 1b here. It finds the 167 00:13:09,100 --> 00:13:16,300 most, about 55% of the cross-site scripting vulnerabilities, but it misses about 45% of 168 00:13:16,300 --> 00:13:22,100 all the total cross-site scripting vulnerabilities. Again, you cannot rely on a single tool for 169 00:13:22,100 --> 00:13:23,800 all of your vulnerability assessments. 170 00:13:26,200 --> 00:13:32,500 All right. Conclusions. Again, single tool doesn't cut it. Using multiple tools drastically 171 00:13:33,040 --> 00:13:38,120 increases the number of vulnerabilities that you find. There's actually little overlap 172 00:13:38,660 --> 00:13:39,080 between the two. 173 00:13:39,100 --> 00:13:45,980 So really, you get a greater benefit by running all these tools. Tools alone are not enough. 174 00:13:46,500 --> 00:13:51,400 Manual audit really does help supplement these tools. You really can't rely on the 175 00:13:51,400 --> 00:13:53,360 tools to help you find vulnerabilities alone. 176 00:13:56,500 --> 00:14:01,140 And you really got to run these tests on your own apps to see how these tools will perform. 177 00:14:01,300 --> 00:14:07,700 These tools really do perform differently in different environments. In my case, tool 1b 178 00:14:08,560 --> 00:14:12,260 seemed to have performed the best, but in your environment, maybe it would be tool 179 00:14:12,260 --> 00:14:13,060 3a. 180 00:14:14,420 --> 00:14:19,700 And finally, I just want to say, fuzzing tools break shit. I mean, when I ran these 181 00:14:19,700 --> 00:14:24,920 dynamic testing tools, I had to reconfigure, re-scan the applications several times. It 182 00:14:24,920 --> 00:14:29,300 took hours and days to basically scan these applications. So if you want to reproduce 183 00:14:29,300 --> 00:14:36,740 these experiments on your own, don't expect these tests to be quick. And that's it. Thanks. 184 00:14:43,080 --> 00:14:44,140 Any questions? 185 00:14:45,680 --> 00:14:46,460 Go ahead. 186 00:14:51,600 --> 00:14:56,000 The question was, what type of vulnerabilities were most difficult for these tools to detect? 187 00:14:56,360 --> 00:15:02,380 Well, on the dynamic side, things like path manipulation where vulnerabilities actually 188 00:15:02,380 --> 00:15:07,680 didn't exhibit any kind of behavior over HTTP. Those were really difficult for those tools. 189 00:15:07,680 --> 00:15:12,660 Those pen testing tools to find. The dynamic testing tools did excel in finding things 190 00:15:12,660 --> 00:15:16,600 like cross-site scripting, say, just because that's what they're designed for. 191 00:15:18,140 --> 00:15:23,560 The static tools actually had trouble finding certain—understanding certain constructs 192 00:15:23,560 --> 00:15:28,560 in the code. And so it was—it missed certain things because of that. 193 00:15:33,840 --> 00:15:34,380 Right. 194 00:15:40,380 --> 00:15:48,480 I used—well, I used—I used a couple of the market-leading web pen testing tools. 195 00:15:48,620 --> 00:15:49,440 Let's put that— 196 00:15:52,460 --> 00:16:00,780 Sure. I think you'll need to contact my employer, and they'll answer that question for you. 197 00:16:04,880 --> 00:16:05,560 Mm-hmm. 198 00:16:09,080 --> 00:16:13,080 That's a good question. So, say we were able to fix all the vulnerabilities that the tool 199 00:16:13,080 --> 00:16:21,040 found, how long would it take for the hacker to find the next one? That's my guess. In 200 00:16:21,040 --> 00:16:26,980 this case, actually, for this specific application, it would be pretty quick, actually. I think 201 00:16:26,980 --> 00:16:30,220 there are a lot of vulnerabilities that were not detected by any of the tools. But that's 202 00:16:30,220 --> 00:16:31,240 for this application in particular. 203 00:16:32,680 --> 00:16:33,080 Good. 204 00:16:37,680 --> 00:16:43,000 There were some, but they were insignificant. They did not hinder me in verification of 205 00:16:43,000 --> 00:16:51,540 results or anything like that, which was surprising to me. Maybe, like, one out of thirty or 206 00:16:51,540 --> 00:16:52,140 something like that. 207 00:16:54,360 --> 00:16:54,920 Go ahead. 208 00:17:01,560 --> 00:17:02,440 In type—sorry. 209 00:17:06,380 --> 00:17:10,360 The question was, what type of features would I recommend vendors to add to these packages? 210 00:17:11,660 --> 00:17:17,220 I think verification. Something to assist in verification of the—of what they report. 211 00:17:18,080 --> 00:17:22,140 Just to make—so that you can validate that the results that they're reporting are—are 212 00:17:22,140 --> 00:17:22,980 actually true. 213 00:17:25,340 --> 00:17:25,820 Okay. 214 00:17:25,900 --> 00:17:27,840 The question was, how do you get these to work? 215 00:17:28,800 --> 00:17:29,280 Yeah. 216 00:17:31,020 --> 00:17:32,420 The question was, how do you get these to work? 217 00:17:32,440 --> 00:17:34,140 How do you get these tools to detect cross-site request forgery? 218 00:17:34,820 --> 00:17:39,140 Actually, we're running out of time. There—we can talk more in the Track 1 QA breakout room. 219 00:17:39,280 --> 00:17:40,820 I'll be across the room over there.