1 00:00:00,000 --> 00:00:06,240 Good morning. Thanks for coming out. Hope everybody had a good evening and is rehydrating now. 2 00:00:08,900 --> 00:00:15,360 Welcome to a multiplayer Metasploit tag team pen testing and reporting. I'm Ryan Lin. I'm a 3 00:00:15,360 --> 00:00:21,800 information security engineer for SAS Institute and I play around with Metasploit for fun. So 4 00:00:22,700 --> 00:00:29,540 this isn't my day job, but I think that it is a great time. So we're going to start off by 5 00:00:29,540 --> 00:00:37,520 talking a little bit about why we did this. So talking a little bit about why I think that this 6 00:00:37,520 --> 00:00:42,460 is a really cool thing. Talk about what solutions are out there currently. Talk a little bit 7 00:00:42,460 --> 00:00:49,040 about how all of the communication happens. Discuss a little bit about types of objects and 8 00:00:49,040 --> 00:00:53,880 I'm actually probably going to do demos earliest to make sure that we get to see fun stuff 9 00:00:53,880 --> 00:00:59,520 first. So the reason that I started working on this is because I wanted to make sure that 10 00:00:59,540 --> 00:01:06,500 I was doing pen tests with other people. It was hard to organize information. You know, we have 11 00:01:06,500 --> 00:01:13,340 wikis, we have all sorts of other things. But it all requires some good attention to detail from 12 00:01:13,340 --> 00:01:18,520 the people working. If you have results and you're multitasking and you don't upload them 13 00:01:18,520 --> 00:01:22,720 right away, you can have people waiting for data. You can have people that have incomplete 14 00:01:22,720 --> 00:01:28,920 data. And overall, just making sure that in a team environment, especially when it is a 15 00:01:29,980 --> 00:01:35,240 separate physical area, so you may have one person testing remote, one person testing locally or 16 00:01:35,240 --> 00:01:40,640 even people in different rooms in the same building, it's hard to make sure that you have all 17 00:01:40,640 --> 00:01:47,220 the coordination there. So it occurred to me that Metasploit has a really powerful database 18 00:01:47,220 --> 00:01:53,200 back end. But the problem is, is that it's hard to get to that information right now. Unless 19 00:01:53,200 --> 00:01:59,520 you're sitting in front of the console, pretty much one person can work on it at a time. So I'm 20 00:02:00,900 --> 00:02:05,040 going to talk about that. So what was missing for me is I use a lot of the XML RPC capabilities, 21 00:02:05,320 --> 00:02:11,440 which allows you to remotely talk back and forth to Metasploit. So since there wasn't a database 22 00:02:11,440 --> 00:02:17,540 module, I said, okay, fine, I'll write one. So I went ahead and made it so that remotely you 23 00:02:17,540 --> 00:02:23,100 can talk to Metasploit, you can push data in and you can get data out. So now that I had that 24 00:02:23,100 --> 00:02:28,900 part, I wanted to make sure that I had some good ways for some of my applications to talk in. 25 00:02:29,540 --> 00:02:36,920 So you're going to see three examples today. The first one is Nmap. The second one is going to be 26 00:02:36,920 --> 00:02:45,540 Nicto. And the third one is going to be Beef. So what our goal is, is instead of doing tasks, then 27 00:02:45,540 --> 00:02:52,240 when you're done uploading stuff in, what if you could go ahead and your scanners directly log the 28 00:02:52,240 --> 00:02:58,560 data into Metasploit. Then at that point, what you really have is you have real time, actionable 29 00:02:58,560 --> 00:02:59,520 information in Metasploit. And that's what we're going to do. So we're going to go ahead and 30 00:02:59,540 --> 00:03:03,880 log the data into Metasploit. So as you're going through your process, you're not waiting on 31 00:03:03,880 --> 00:03:09,500 other people. You're not wondering, hey, is this information complete or not. There are programmatic 32 00:03:09,500 --> 00:03:13,900 things that you can do to find out whether or not someone has started a task, completed a task, 33 00:03:14,080 --> 00:03:20,380 what the status of the data is in the database. And as you start building profiles, for instance, 34 00:03:21,060 --> 00:03:26,860 you know, most scans start at low IPs, go to high IPs. You know, once you have a couple of 35 00:03:26,860 --> 00:03:29,520 different types of scans running, you can already be looking at information that's already been 36 00:03:29,520 --> 00:03:32,380 completed. You can already be looking at information from some of the first parts of the scan before 37 00:03:32,380 --> 00:03:42,880 the scan is even finished. So that's the basic problem. So that outlines most of that. The other 38 00:03:42,880 --> 00:03:56,800 piece is reporting. So two of the things that holy crap. You guys want to riot, too? No. 39 00:04:00,700 --> 00:04:08,720 But so basically the one of the problems is once you have all this data, how do you get a delta from 40 00:04:08,720 --> 00:04:13,400 one test to another? So we already have all the data in the database. So programmatically, it 41 00:04:13,400 --> 00:04:20,420 should be pretty easy to say tell me what things are different from the time before. Also, there's 42 00:04:20,420 --> 00:04:24,900 no easy way to automate reporting once you get all this data in Metasploit. You can look at your 43 00:04:24,900 --> 00:04:29,500 hosts. You can look at what exploits ran. You can look at all that. But, you know, how do you 44 00:04:29,520 --> 00:04:35,060 dump out a report that says this is what I did, this is what time it was, you know, what got me 45 00:04:35,060 --> 00:04:39,460 shells back, what didn't get me shells back. You're relying a whole lot on the people doing the pen 46 00:04:39,460 --> 00:04:45,420 test being really scrupulous about one information they're writing down. Also, if someone comes to 47 00:04:45,420 --> 00:04:51,080 you and says what happened at this time, it's nice to be able to go, okay, let me look at this 48 00:04:51,080 --> 00:04:55,940 specific time period and say these were the tests that we were running right then and have all of 49 00:04:55,940 --> 00:04:56,880 that in a central location. 50 00:04:58,220 --> 00:04:59,500 So right now, I'm going to go ahead and go ahead and go ahead and go ahead and go ahead and go ahead 51 00:04:59,520 --> 00:05:00,120 and go ahead and go ahead 52 00:05:00,120 --> 00:05:02,980 I think Dray this is one of the strong alternatives to this right 53 00:05:02,980 --> 00:05:09,040 now, but the problem is back again to, okay, so we're running tasks, then we're putting data 54 00:05:09,040 --> 00:05:12,340 into the database, and then we can sort of correlate there, 55 00:05:12,560 --> 00:05:17,380 but it's all people having to be very diligent about as soon as they're done getting results, 56 00:05:17,520 --> 00:05:22,000 making sure things are uploaded. You don't have any real time analysis, and especially if you 57 00:05:22,000 --> 00:05:28,340 have scans that are long-running scans. Or, you know, scans where you have multiple pieces. 58 00:05:28,840 --> 00:05:29,500 It's not like with online, like, with I tomb sites or something with zoom ASMR, it's it's very past that these those are 59 00:05:29,520 --> 00:05:33,740 necessarily extremely easy to put all that back together and get a 60 00:05:33,740 --> 00:05:38,340 comprehensive view of what you've got. Leo I included because it's on the 61 00:05:38,340 --> 00:05:42,340 backtrack CD so I know a lot of people are familiar with it and it's not really 62 00:05:42,340 --> 00:05:46,260 geared for a multi-person is really geared for only one person and wikis are 63 00:05:46,260 --> 00:05:50,180 cool but they're really arbitrary so you have to be very good about having a 64 00:05:50,180 --> 00:05:55,820 librarian to keep all your information together. So since Metasploit is really 65 00:05:55,820 --> 00:06:00,180 accessible you know I think probably everybody knows where to get Metasploit 66 00:06:00,180 --> 00:06:06,800 I decided to extend the XML RPC stuff to facilitate the database transactions and 67 00:06:06,800 --> 00:06:11,520 this is some stuff that Metasploit Express already does but it does it 68 00:06:11,520 --> 00:06:17,980 through some some other methods so I don't have money so I thought that this 69 00:06:17,980 --> 00:06:22,620 would be a good way for for me to get it the same information so I just went 70 00:06:22,620 --> 00:06:25,800 ahead and created a database module and then started figuring out what 71 00:06:25,800 --> 00:06:31,440 what extra pieces I needed to add to it for it to be useful to me. So the XML RPC 72 00:06:31,440 --> 00:06:34,680 extension allows the central logging of all the information but the most 73 00:06:34,680 --> 00:06:39,140 important thing for me is that all this information is actionable so as far as 74 00:06:39,140 --> 00:06:42,760 when you're pulling vulnerabilities in when you're doing all of the scanning 75 00:06:42,760 --> 00:06:46,960 all of the information that you have available is information that you can 76 00:06:46,960 --> 00:06:51,160 run Metasploit modules against is information that you can query from 77 00:06:51,160 --> 00:06:55,780 other applications to perform further tests and overall it gives 78 00:06:55,780 --> 00:07:00,100 you a central store of information where you can have applications pulling and 79 00:07:00,100 --> 00:07:04,080 pushing data out so you can have very up-to-date information that is available 80 00:07:04,080 --> 00:07:12,600 with your applications and your testers. So I'm gonna instead of doing that start 81 00:07:12,600 --> 00:07:15,340 off just showing you guys some stuff because that's a lot more fun I think 82 00:07:15,340 --> 00:07:20,760 and then we'll talk about how it works for people who are interested. So the 83 00:07:20,760 --> 00:07:25,500 first thing I want to show you guys is last year I released a tool called in 84 00:07:25,780 --> 00:07:32,380 display which allows you to launch attacks from Nmap and use Metasploit 85 00:07:32,380 --> 00:07:37,160 on the backend to actually perform the attack so as Nmap is going through and 86 00:07:37,160 --> 00:07:40,880 Nmap can call a Nmap scripting engine script to go out talk to the Metasploit 87 00:07:40,880 --> 00:07:46,580 database and then Metasploit will launch an attack on Nmap's behalf so 88 00:07:47,300 --> 00:07:51,880 along those lines most people probably don't want to just start throwing 89 00:07:51,880 --> 00:07:55,760 exploits out there but the Nmap scripting engine script will report a 90 00:07:55,780 --> 00:08:01,420 is very powerful. It has port rules which will allow us to say if a port is open or in a certain 91 00:08:01,420 --> 00:08:08,020 status, let's fire a job. So the job that we're firing in this case is I've added the code to 92 00:08:08,020 --> 00:08:13,000 Insploit for this year to be able to directly talk to Metasploit and add hosts into the database. 93 00:08:13,420 --> 00:08:19,880 So the first thing we're going to do is we're going to start up the MSF console. And I've 94 00:08:19,880 --> 00:08:23,980 created a little RC script here that starts off by connecting to the Metasploit database 95 00:08:23,980 --> 00:08:31,840 as the user MSF to MSF. And Metasploit is going towards using Postgres. For a while you were 96 00:08:31,840 --> 00:08:37,640 able to use SQLite 3. But as the product becomes more powerful, you really want to look at 97 00:08:37,640 --> 00:08:43,080 switching towards Postgres. And Postgres is on backtrack, so it makes it a lot easier. So we're 98 00:08:43,080 --> 00:08:49,000 going to connect to our database back end using user ID MSF to the database called MSF. Then 99 00:08:49,000 --> 00:08:53,960 we're going to load the XML RPC module using our elite password of ABC123. And we're going to 100 00:08:55,600 --> 00:09:00,480 use the server type function is important. For a lot of the stuff I'm going to be showing, I'm 101 00:09:00,480 --> 00:09:06,140 using the web version. There's also a raw version. But the server type web is important. Because 102 00:09:06,140 --> 00:09:12,840 what this allows us to do is to communicate via the server over HTTP using XML RPC. With a lot 103 00:09:12,840 --> 00:09:18,260 of the stuff that is out there, this makes it just really easy. If you use the traditional 104 00:09:18,260 --> 00:09:23,840 server, that's null terminated raw XML RPC. And so you have to write some transforms for your 105 00:09:23,980 --> 00:09:31,820 code. So we're just using this because it's easy and I'm lazy. So we'll go ahead and start this 106 00:09:31,820 --> 00:09:37,320 up. And as you go through, you'll see the database creating objects. Actually, let me make this 107 00:09:37,320 --> 00:09:39,860 bigger so you can actually see the database creating objects. 108 00:10:01,360 --> 00:10:08,440 Can people in the back see that? Maybe? Yes? Okay. Well, if you can't, then wave at me and I'll fix it. 109 00:10:10,120 --> 00:10:12,280 Let me make this one a little bit larger as well. 110 00:10:25,820 --> 00:10:33,180 Okay. So what I've done is through Insploit, which is, again, a series of NSE modules and NSE 111 00:10:33,180 --> 00:10:39,880 scripts for the NMAP scripting engine, I'm going to basically just run a raw scan right now. Once 112 00:10:40,560 --> 00:10:46,540 you have Insploit installed, the Metasploit modules for actually adding the ports are set to 113 00:10:46,540 --> 00:10:53,680 run by default. So if you install it into your distribution, then it will go ahead and try to add 114 00:10:53,980 --> 00:11:03,700 stuff for you as it can. So we just have to do an NMAP-A and type in the right address. And so 115 00:11:03,700 --> 00:11:13,280 we're going to just start scanning our local little network up here. So back here, I have a 116 00:11:13,280 --> 00:11:21,140 listener for the XMLRPC channel. So one of the things that you'll notice is over here for NMAP, 117 00:11:21,220 --> 00:11:23,960 we're actually going to have data flowing through XMLRPC. So we're going to have a lot of data 118 00:11:23,980 --> 00:11:30,420 coming into our database before NMAP's even printing the data to the screen. So we're going 119 00:11:30,420 --> 00:11:34,380 to have more up-to-date information in our database than NMAP is even presenting us to the 120 00:11:34,380 --> 00:11:39,260 screen as we're scanning. So that's, I think, one of the pluses. As you're going through a scan 121 00:11:39,260 --> 00:11:44,080 with NMAP, especially for longer stuff, you're going to have data that is actionable in your 122 00:11:44,080 --> 00:11:48,840 database before any of this other stuff has happened. So there's NMAP sending all of the 123 00:11:48,840 --> 00:11:53,460 wonderful goodness into the database. And you can see that it hasn't actually printed anything to 124 00:11:53,460 --> 00:11:53,960 the screen yet. So that's one of the pluses. So that's one of the pluses. So that's one of the 125 00:11:53,980 --> 00:11:56,060 pluses. So that's one of the pluses. So that's one of the pluses. So we now have hosts that we 126 00:11:56,060 --> 00:12:02,600 know about, and we're just now seeing some output to the screen. So I'm going to let this go for a 127 00:12:02,600 --> 00:12:07,500 second while I talk about the next part. The next thing that I wanted to do was to be able to get 128 00:12:07,500 --> 00:12:15,440 some vulnerabilities in to be able to really talk about, to really get a better picture of how all 129 00:12:15,440 --> 00:12:20,080 of this stuff was fitting together to be able to look at a whole host and figure out what 130 00:12:20,080 --> 00:12:22,960 vulnerabilities and what other actionable information we have. 131 00:12:22,960 --> 00:12:30,500 So I chose NICTO because I do a lot of web stuff and created a new report type for NICTO that would 132 00:12:30,500 --> 00:12:36,560 allow us to, as NICTO is scanning, go through and add vulnerabilities to the database. So now that 133 00:12:36,560 --> 00:12:42,020 we're done with the NMAP scan, we can look at our hosts and we have all of our host information. 134 00:12:43,440 --> 00:12:48,020 And we have our services and we can look at all of that information. So as part of the scan, 135 00:12:48,160 --> 00:12:52,940 we discovered that we have a server here that is listening on port 80. And 136 00:12:52,960 --> 00:12:53,880 we can also look and민 137 00:12:53,880 --> 00:12:58,360 A listen in NICTO and look at exactly what vulnerabilities that might have. 138 00:13:07,340 --> 00:13:15,680 So our format for NICTO is right here. Basically what we have done is we've created a new reporting 139 00:13:15,680 --> 00:13:22,940 format. So I'm going to be releasing all this code on Monday on my blog. But the new format requires or 140 00:13:22,960 --> 00:13:24,900 is just a little patch to Nikto and will hopefully 141 00:13:24,900 --> 00:13:26,860 be in the distribution coming 142 00:13:26,860 --> 00:13:28,600 up within the next month or so. 143 00:13:29,180 --> 00:13:30,900 We specify our output 144 00:13:30,900 --> 00:13:32,960 file, which is the dash O, as our 145 00:13:32,960 --> 00:13:34,600 username colon password at 146 00:13:34,600 --> 00:13:36,760 the URL for our 147 00:13:36,760 --> 00:13:38,980 RPC listener through Metasploit, which 148 00:13:38,980 --> 00:13:40,760 Metasploit listeners by default 149 00:13:40,760 --> 00:13:42,260 are on 55553 150 00:13:42,260 --> 00:13:44,920 and use for the HTTP version 151 00:13:44,920 --> 00:13:46,740 a RPC directory 152 00:13:46,740 --> 00:13:48,920 of slash RPC2. So we 153 00:13:48,920 --> 00:13:52,380 choose our host, the 192.168.1.254 154 00:13:53,840 --> 00:13:54,800 and we'll 155 00:13:54,800 --> 00:13:56,680 just watch it start scanning and then we can look 156 00:13:56,680 --> 00:13:58,640 at that information going directly into 157 00:13:58,640 --> 00:13:59,060 the database. 158 00:14:03,180 --> 00:14:04,540 So with this 159 00:14:04,540 --> 00:14:06,800 with Nmap, it has to do a little 160 00:14:06,800 --> 00:14:08,200 bit before it actually starts running scripts. 161 00:14:08,520 --> 00:14:10,520 So as it is actually doing the port scans, 162 00:14:10,800 --> 00:14:12,680 we're not getting that data back, 163 00:14:12,840 --> 00:14:14,680 but as soon as Nmap starts the script 164 00:14:14,680 --> 00:14:16,740 portion of its scan, then 165 00:14:16,740 --> 00:14:18,700 it will put data into the 166 00:14:18,700 --> 00:14:20,680 database during that portion. With this, 167 00:14:20,700 --> 00:14:22,100 it starts pretty early, so we already 168 00:14:22,100 --> 00:14:22,320 have 169 00:14:23,500 --> 00:14:24,420 vulnerabilities in our 170 00:14:24,420 --> 00:14:25,860 database. So 171 00:14:26,400 --> 00:14:28,220 as it continues to add, 172 00:14:28,380 --> 00:14:29,760 we can see that number increasing. 173 00:14:30,400 --> 00:14:32,020 One of the important things to 174 00:14:32,020 --> 00:14:34,220 note about this, though, is if you notice, 175 00:14:34,380 --> 00:14:36,360 there's not a whole lot of data here 176 00:14:36,360 --> 00:14:37,140 that's very meaningful. 177 00:14:37,980 --> 00:14:40,260 And the reason is most of the time when people are using 178 00:14:40,260 --> 00:14:42,360 Metasploit, they're looking at the 179 00:14:42,360 --> 00:14:44,420 vulnerability references, because that's what gets 180 00:14:44,420 --> 00:14:46,400 you the exploit 181 00:14:46,400 --> 00:14:48,280 modules that you can use to further 182 00:14:48,280 --> 00:14:49,300 gain access to hosts. 183 00:14:50,780 --> 00:14:51,260 So 184 00:14:51,260 --> 00:14:54,020 the thing is, is all of this 185 00:14:54,020 --> 00:14:55,260 data is actually stored in the database. 186 00:14:55,640 --> 00:14:57,740 So we're actually going to be able to get more 187 00:14:57,740 --> 00:14:59,640 data out of Metasploit 188 00:14:59,640 --> 00:15:01,840 than what is traditionally printed to the screen 189 00:15:01,840 --> 00:15:04,000 through some of the reporting capabilities 190 00:15:04,000 --> 00:15:04,660 that we have. 191 00:15:05,560 --> 00:15:06,800 So as this goes 192 00:15:06,800 --> 00:15:08,720 through, we now 193 00:15:08,720 --> 00:15:10,720 have all of our vulnerabilities pushed in. 194 00:15:11,900 --> 00:15:12,880 And as you can see, 195 00:15:12,900 --> 00:15:14,780 we have a couple different vulnerability references. 196 00:15:16,300 --> 00:15:16,780 So 197 00:15:16,780 --> 00:15:18,020 the next thing that 198 00:15:18,020 --> 00:15:20,760 we want to do is look at how 199 00:15:20,760 --> 00:15:22,020 to use this for reporting. 200 00:15:23,160 --> 00:15:24,700 So right now we have some hosts 201 00:15:24,700 --> 00:15:26,780 in here, and if we want to get a full picture of what's 202 00:15:26,780 --> 00:15:28,500 going on, you know, we can look at 203 00:15:28,900 --> 00:15:30,680 dbhosts and say, okay, we can find our 204 00:15:30,680 --> 00:15:32,260 host and it's alive, and we know 205 00:15:32,260 --> 00:15:34,600 when it was added, and we can go over to db 206 00:15:34,600 --> 00:15:36,660 services, and we can 207 00:15:36,660 --> 00:15:38,560 say, okay, so let's match this up 208 00:15:38,560 --> 00:15:40,240 with the information that we have. 209 00:15:40,520 --> 00:15:42,640 And then we go over to dbvulns, and 210 00:15:42,640 --> 00:15:44,480 okay, so that's not necessarily 211 00:15:44,480 --> 00:15:46,240 the easiest way to get to all this. 212 00:15:47,000 --> 00:15:47,360 So 213 00:15:48,480 --> 00:15:48,840 instead, 214 00:15:55,460 --> 00:15:56,480 I wrote a host 215 00:15:56,480 --> 00:15:57,880 infoscript. And 216 00:15:57,880 --> 00:16:00,480 what the host infoscript is going 217 00:16:00,480 --> 00:16:02,380 to be able to let us do is 218 00:16:02,380 --> 00:16:04,560 to pull a full profile for a host that we 219 00:16:04,560 --> 00:16:06,540 have in the database and get all 220 00:16:06,540 --> 00:16:08,380 the information out. So 221 00:16:08,380 --> 00:16:10,620 there's four sort of core pieces 222 00:16:10,620 --> 00:16:12,140 of information that 223 00:16:13,020 --> 00:16:14,580 Metasploit stores about hosts. 224 00:16:14,880 --> 00:16:16,400 We've got the host information 225 00:16:16,400 --> 00:16:18,640 itself, which is like when 226 00:16:18,640 --> 00:16:20,560 the host was discovered, if it's up or not, 227 00:16:20,760 --> 00:16:22,400 all of that stuff. Service information, 228 00:16:22,700 --> 00:16:24,480 which is the basic stuff we get back from Nmap, 229 00:16:24,660 --> 00:16:26,700 what services are, whether or not they're up, 230 00:16:26,800 --> 00:16:28,460 all that goodness. We have 231 00:16:28,460 --> 00:16:29,600 vulnerabilities, which 232 00:16:30,460 --> 00:16:32,400 are pretty much a map host 233 00:16:32,400 --> 00:16:34,440 and service to a vulnerability type 234 00:16:35,180 --> 00:16:36,580 and store a little bit of 235 00:16:36,580 --> 00:16:38,620 extra data on that. And then notes, 236 00:16:38,700 --> 00:16:40,340 which are sort of general purpose 237 00:16:40,340 --> 00:16:42,440 storage. And you can put pretty much anything 238 00:16:42,440 --> 00:16:44,460 in a note that you want to retrieve later. 239 00:16:44,760 --> 00:16:46,540 So the host infoscript that 240 00:16:46,540 --> 00:16:48,480 is going to be in the source that 241 00:16:48,480 --> 00:16:50,400 I distribute is going to be able to pull 242 00:16:50,400 --> 00:16:52,300 the full listing of everything that's in the 243 00:16:52,300 --> 00:16:54,040 database about a 244 00:16:54,040 --> 00:16:56,440 specific host. So let me 245 00:16:56,440 --> 00:16:57,740 go ahead and 246 00:17:01,420 --> 00:17:02,400 change this up 247 00:17:02,400 --> 00:17:04,500 to be the host that we were actually scanning. 248 00:17:05,980 --> 00:17:06,720 And so 249 00:17:06,720 --> 00:17:08,360 we basically specified it, the 250 00:17:08,360 --> 00:17:10,320 username and password for our XMLRPC, 251 00:17:10,620 --> 00:17:12,220 our XMLRPC destination, 252 00:17:12,800 --> 00:17:14,320 and the IP address 253 00:17:14,320 --> 00:17:16,380 we want information for. And so this 254 00:17:16,380 --> 00:17:18,380 is just some quick and dirty Python, and I'm 255 00:17:18,380 --> 00:17:20,020 going to go over how the code works. 256 00:17:20,400 --> 00:17:21,240 In a couple minutes. 257 00:17:22,660 --> 00:17:24,280 So from here, we have 258 00:17:24,280 --> 00:17:26,340 all of our basic information. We've 259 00:17:26,340 --> 00:17:28,340 got the basic in-map 260 00:17:28,340 --> 00:17:30,380 information about when the host was first discovered 261 00:17:30,380 --> 00:17:32,440 and last discovered. And so this is 262 00:17:32,440 --> 00:17:34,360 important for if you've 263 00:17:34,360 --> 00:17:36,320 run multiple scans or something like that, you can 264 00:17:36,320 --> 00:17:37,960 see which scans something went in as. 265 00:17:38,160 --> 00:17:39,320 The port information 266 00:17:40,520 --> 00:17:42,200 about what ports were found. 267 00:17:42,360 --> 00:17:44,240 And you'll notice there's no OS listed 268 00:17:44,240 --> 00:17:46,320 here. Typically, if you have a couple 269 00:17:46,320 --> 00:17:47,780 ports open, a couple ports closed, 270 00:17:48,040 --> 00:17:50,160 then you'll get some OS 271 00:17:50,160 --> 00:17:51,800 information, but there weren't enough ports open 272 00:17:51,800 --> 00:17:53,980 to identify the host 273 00:17:53,980 --> 00:17:56,120 for sure, so I don't include it 274 00:17:56,120 --> 00:17:58,140 here. So for vulnerabilities, if you 275 00:17:58,140 --> 00:17:59,640 remember from the Nikto output, 276 00:17:59,940 --> 00:18:01,660 there was a lot more verbose output. 277 00:18:02,180 --> 00:18:04,020 Here's the verbose output that we 278 00:18:04,020 --> 00:18:05,860 had from Nikto that we're getting directly 279 00:18:05,860 --> 00:18:07,320 from the Metasploit database. 280 00:18:07,680 --> 00:18:09,920 So we have all of that data from before, 281 00:18:10,520 --> 00:18:12,200 and this will help us aggregate 282 00:18:12,200 --> 00:18:14,000 it. So where this is valuable 283 00:18:14,000 --> 00:18:16,080 is you have 284 00:18:16,080 --> 00:18:18,060 multiple pen testers working on multiple things, 285 00:18:18,760 --> 00:18:19,020 and 286 00:18:20,160 --> 00:18:21,760 so each person's probably 287 00:18:21,760 --> 00:18:23,600 concentrating on one or two things 288 00:18:23,600 --> 00:18:26,000 at a time. This will let you go into 289 00:18:26,000 --> 00:18:27,800 the database, pull everything you know 290 00:18:27,800 --> 00:18:29,440 about the 291 00:18:29,910 --> 00:18:31,600 specific target that you're looking at, 292 00:18:31,720 --> 00:18:33,920 and you'll have immediately all of the relevant 293 00:18:33,920 --> 00:18:36,060 data for that host 294 00:18:36,060 --> 00:18:38,040 and one little report that 295 00:18:38,040 --> 00:18:39,980 you can look at, instead of having to go 296 00:18:39,980 --> 00:18:41,920 for multiple places and possibly multiple 297 00:18:41,920 --> 00:18:43,940 documents to get the information 298 00:18:43,940 --> 00:18:45,860 that you need to really make some 299 00:18:45,860 --> 00:18:46,660 actionable decisions. 300 00:18:48,480 --> 00:18:49,940 So this just goes 301 00:18:49,940 --> 00:18:51,000 through, lists the vulnerabilities. 302 00:18:51,440 --> 00:18:53,500 There's no notes for this host, so 303 00:18:54,720 --> 00:18:55,620 there's none 304 00:18:55,620 --> 00:18:56,280 included here. 305 00:18:57,600 --> 00:18:59,280 So the third thing I did is 306 00:19:00,360 --> 00:19:01,320 for Beef, 307 00:19:01,580 --> 00:19:03,700 one of the things that you can do is you can 308 00:19:03,700 --> 00:19:04,780 really build some host profiles. 309 00:19:05,400 --> 00:19:07,420 But all that you know about the host 310 00:19:07,420 --> 00:19:08,780 while you're running Beef, 311 00:19:09,480 --> 00:19:11,680 which for people who may not be familiar 312 00:19:11,680 --> 00:19:13,500 with it, Beef stands for the 313 00:19:13,500 --> 00:19:15,680 Browser Exploitation Framework, and it 314 00:19:15,680 --> 00:19:17,740 allows you through cross-site 315 00:19:17,740 --> 00:19:19,780 scripting to encourage 316 00:19:19,940 --> 00:19:21,520 a target browser to execute 317 00:19:21,520 --> 00:19:22,480 code on your behalf. 318 00:19:23,520 --> 00:19:24,060 So 319 00:19:25,400 --> 00:19:27,760 basically what we can do with that 320 00:19:27,760 --> 00:19:29,820 is we can encourage the browser 321 00:19:29,820 --> 00:19:31,640 to run some fingerprinting 322 00:19:31,640 --> 00:19:33,180 information for itself. 323 00:19:33,520 --> 00:19:35,720 We can log that into the Metasploit database 324 00:19:35,720 --> 00:19:37,580 and then over time 325 00:19:37,580 --> 00:19:39,380 we can start building a profile 326 00:19:39,380 --> 00:19:41,780 of, for instance, maybe a company 327 00:19:41,780 --> 00:19:43,860 intranet, just based off 328 00:19:43,860 --> 00:19:45,060 a cross-site scripting vulnerability. 329 00:19:46,160 --> 00:19:46,700 So 330 00:19:46,700 --> 00:19:49,780 let me go ahead and pull 331 00:19:49,780 --> 00:19:50,660 that information up. 332 00:19:51,700 --> 00:19:53,420 So what I've done is as 333 00:19:53,420 --> 00:19:55,580 Beef is going through and gathering 334 00:19:55,580 --> 00:19:57,560 data, it's logging into the 335 00:19:57,560 --> 00:19:59,580 database. But also as you pull zombie 336 00:19:59,580 --> 00:20:01,500 reports, it's also pulling any 337 00:20:01,500 --> 00:20:03,480 information out of the database that you have about 338 00:20:03,480 --> 00:20:05,660 that host. So when you're looking 339 00:20:05,660 --> 00:20:07,660 at a host in Beef, you actually 340 00:20:07,660 --> 00:20:09,320 have all the actionable information 341 00:20:09,320 --> 00:20:11,680 that you may need in order to 342 00:20:13,600 --> 00:20:14,720 be able to 343 00:20:15,280 --> 00:20:16,740 do real work with it. 344 00:20:24,360 --> 00:20:24,840 So 345 00:20:24,840 --> 00:20:27,460 this is the front end for Beef. 346 00:20:28,360 --> 00:20:29,380 Let me go ahead 347 00:20:29,380 --> 00:20:30,640 and I've got a 348 00:20:51,220 --> 00:20:53,180 happy little Windows box over there 349 00:20:53,180 --> 00:20:55,280 that I have running 350 00:20:55,280 --> 00:20:57,520 our sample cross-site scripting. 351 00:20:57,800 --> 00:20:59,260 And so as you can see, 352 00:20:59,380 --> 00:21:00,840 we just had a zombie pop up. 353 00:21:01,720 --> 00:21:03,380 So to start off with, 354 00:21:03,480 --> 00:21:05,080 just for basic information, 355 00:21:05,440 --> 00:21:07,520 we can go under zombies and we 356 00:21:07,520 --> 00:21:09,300 can pull everything we already know about this host. 357 00:21:09,980 --> 00:21:11,280 So to start with, 358 00:21:12,300 --> 00:21:13,460 this is all 359 00:21:13,460 --> 00:21:15,340 of the basic stuff that Beef normally logs. 360 00:21:15,500 --> 00:21:17,520 Information about what the 361 00:21:17,520 --> 00:21:19,760 browser is, what the operating system is, 362 00:21:20,280 --> 00:21:21,720 resolution, all that 363 00:21:21,720 --> 00:21:22,160 good stuff. 364 00:21:23,660 --> 00:21:25,540 And a little bit of information 365 00:21:25,540 --> 00:21:26,560 about the page it's on. 366 00:21:27,020 --> 00:21:29,600 So all of this information is now logged 367 00:21:29,600 --> 00:21:30,440 into Metasploit. 368 00:21:30,700 --> 00:21:33,660 So offline, we can get to all of this 369 00:21:33,660 --> 00:21:35,580 stuff. But also, more importantly, 370 00:21:35,820 --> 00:21:37,240 for instance, if 371 00:21:37,240 --> 00:21:39,580 you have a couple people who are accessing 372 00:21:39,580 --> 00:21:41,320 the company intranet page, 373 00:21:41,660 --> 00:21:43,440 you may be able to tell a lot more 374 00:21:43,440 --> 00:21:44,960 about what's going on with the company 375 00:21:44,960 --> 00:21:47,680 just based off this portion right here, 376 00:21:47,800 --> 00:21:49,760 which is the HTML that was on the page. 377 00:21:49,760 --> 00:21:51,960 That had the vulnerability 378 00:21:51,960 --> 00:21:53,840 itself as the person 379 00:21:53,840 --> 00:21:54,800 who was looking at it. 380 00:21:55,040 --> 00:21:57,660 So you can get a whole lot more information, 381 00:21:57,820 --> 00:21:59,480 especially if, you know, 382 00:21:59,500 --> 00:22:01,480 maybe you're looking at testing an HR app 383 00:22:01,480 --> 00:22:03,820 or something like that. You could really have the potential 384 00:22:03,820 --> 00:22:05,600 of maybe mining more information 385 00:22:05,600 --> 00:22:07,040 and showing that 386 00:22:07,040 --> 00:22:09,200 maybe the HR app has vulnerabilities 387 00:22:09,200 --> 00:22:11,600 by actually showing people what each person 388 00:22:11,600 --> 00:22:13,540 was looking at on that page. 389 00:22:14,800 --> 00:22:15,320 So 390 00:22:15,320 --> 00:22:17,200 now you have all of this 391 00:22:17,200 --> 00:22:18,320 delicious information. 392 00:22:19,760 --> 00:22:21,640 You want to go ahead and 393 00:22:21,640 --> 00:22:23,920 further gather information about a host. 394 00:22:24,500 --> 00:22:25,780 So we can 395 00:22:25,780 --> 00:22:27,900 click on our zombie, go under our standard 396 00:22:27,900 --> 00:22:29,920 modules, and find out if it's 397 00:22:29,920 --> 00:22:30,940 got Java or whatever. 398 00:22:31,300 --> 00:22:33,780 So we'll select it, send now to determine 399 00:22:33,780 --> 00:22:35,500 whether or not the host has Java installed. 400 00:22:36,360 --> 00:22:37,560 You'll see over here 401 00:22:37,560 --> 00:22:39,600 that module code was sent 402 00:22:39,600 --> 00:22:41,640 and that Java is available. 403 00:22:42,100 --> 00:22:43,780 And when we come back over here 404 00:22:43,780 --> 00:22:45,240 to our zombies, 405 00:22:47,440 --> 00:22:48,940 we can see that 406 00:22:48,940 --> 00:22:49,280 that's 407 00:22:49,860 --> 00:22:50,980 it is both 408 00:22:50,980 --> 00:22:52,880 here in our module results 409 00:22:52,880 --> 00:22:55,460 but also here in the Metasploit 410 00:22:55,460 --> 00:22:57,500 information. But you can also 411 00:22:57,500 --> 00:22:58,400 come back over here 412 00:23:00,740 --> 00:23:01,780 and see 413 00:23:01,780 --> 00:23:03,000 we now have a bunch of notes 414 00:23:03,000 --> 00:23:05,160 about that host. So 415 00:23:05,160 --> 00:23:07,320 all of this is pulling it back and forth 416 00:23:07,320 --> 00:23:09,360 and really merges things together. 417 00:23:09,800 --> 00:23:11,040 So again, for 418 00:23:11,040 --> 00:23:13,600 the beef portion, if we 419 00:23:13,600 --> 00:23:14,720 were to have an internal host, 420 00:23:15,400 --> 00:23:17,200 drop a little bit of JavaScript on it 421 00:23:17,200 --> 00:23:19,420 as some stored cross-site scripting, 422 00:23:19,760 --> 00:23:21,240 then we can really build a large 423 00:23:21,240 --> 00:23:22,780 profile of an organization 424 00:23:22,780 --> 00:23:24,800 and what types of browsers they're using 425 00:23:24,800 --> 00:23:27,160 through the auto-run plug-in portion 426 00:23:27,160 --> 00:23:28,980 of beef, we can start profiling 427 00:23:28,980 --> 00:23:31,080 what applications are installed in the browser 428 00:23:31,080 --> 00:23:33,080 and things like that. 429 00:23:33,300 --> 00:23:35,180 So I guess 430 00:23:35,180 --> 00:23:37,040 if you're interested in doing 431 00:23:37,040 --> 00:23:38,440 maybe further social engineering 432 00:23:38,440 --> 00:23:41,160 or further testing, you have a better 433 00:23:41,160 --> 00:23:43,240 idea of what software may or may 434 00:23:43,240 --> 00:23:43,820 not succeed. 435 00:23:45,800 --> 00:23:47,120 So this will 436 00:23:47,120 --> 00:23:49,320 let you build a much stronger profile 437 00:23:49,320 --> 00:23:50,080 of an organization 438 00:23:50,080 --> 00:23:53,060 from a different perspective 439 00:23:53,060 --> 00:23:55,000 than what your typical scanning 440 00:23:55,000 --> 00:23:55,520 gives you. 441 00:23:57,620 --> 00:23:58,700 So the 442 00:23:58,700 --> 00:24:00,880 last demo I want to do is 443 00:24:00,880 --> 00:24:02,880 so right now we have some 444 00:24:02,880 --> 00:24:04,720 vulnerabilities, but 445 00:24:05,840 --> 00:24:07,080 most people are 446 00:24:07,080 --> 00:24:08,760 not going to want to just do Nikto. 447 00:24:08,980 --> 00:24:11,000 Most people are going to want to run Nessus 448 00:24:11,000 --> 00:24:12,440 or Qualys or something like that. 449 00:24:13,300 --> 00:24:15,040 Metasploit already supports a couple 450 00:24:15,040 --> 00:24:17,100 different file formats, including 451 00:24:17,100 --> 00:24:18,740 Nexpose, Qualys, 452 00:24:19,600 --> 00:24:21,380 Nessus, and I think there may be 453 00:24:21,380 --> 00:24:22,960 one or two others. But 454 00:24:22,960 --> 00:24:25,080 remotely, it's not easy 455 00:24:25,080 --> 00:24:27,220 to push that data back into the database. 456 00:24:27,680 --> 00:24:29,520 So I wrote a quick script 457 00:24:29,520 --> 00:24:31,380 to just take a file that we have 458 00:24:31,380 --> 00:24:33,320 from Qualys or Nessus or whatever 459 00:24:33,320 --> 00:24:35,280 and go ahead and insert that into 460 00:24:35,280 --> 00:24:37,300 the database so that we 461 00:24:37,300 --> 00:24:38,860 have all of our data in one place. 462 00:24:39,200 --> 00:24:41,120 And again, all of this stuff, right now 463 00:24:41,120 --> 00:24:42,840 I'm doing it locally, but 464 00:24:42,840 --> 00:24:45,080 the whole point of this presentation is 465 00:24:45,560 --> 00:24:46,980 you can actually do this 466 00:24:46,980 --> 00:24:48,840 multiple people from multiple locations. 467 00:24:49,320 --> 00:24:51,200 And have this all centralized back 468 00:24:51,200 --> 00:24:53,200 to a central place. So multiple 469 00:24:53,200 --> 00:24:55,280 people are doing this. You don't just 470 00:24:55,280 --> 00:24:56,980 have to be able to do it from local host. 471 00:24:58,080 --> 00:24:59,260 So we're going to come back 472 00:24:59,260 --> 00:24:59,900 over to 473 00:25:02,700 --> 00:25:05,100 this window. And so 474 00:25:05,100 --> 00:25:07,040 I have this import file script 475 00:25:07,040 --> 00:25:08,580 and I have 476 00:25:10,080 --> 00:25:11,100 some happy little 477 00:25:11,100 --> 00:25:12,840 NBE files. So 478 00:25:12,840 --> 00:25:15,100 pretty much, for import 479 00:25:15,100 --> 00:25:17,180 file, it takes the same stuff 480 00:25:17,180 --> 00:25:18,840 as the host info does. 481 00:25:21,820 --> 00:25:23,240 Our XML RPC 482 00:25:23,240 --> 00:25:23,680 location. 483 00:25:31,180 --> 00:25:32,100 Our username. 484 00:25:34,460 --> 00:25:35,600 And the file, 485 00:25:35,760 --> 00:25:37,160 which we're going to use the 486 00:25:38,460 --> 00:25:39,300 illustrious test 487 00:25:39,300 --> 00:25:40,140 2.nbe. 488 00:25:41,000 --> 00:25:43,020 And we're going to go ahead and upload that. 489 00:25:43,380 --> 00:25:45,240 So we just now have 490 00:25:45,240 --> 00:25:46,200 uploaded our 491 00:25:47,700 --> 00:25:48,640 Nessus information. 492 00:25:49,320 --> 00:25:50,540 We look at our dbvulns again. 493 00:25:51,680 --> 00:25:53,300 We have all that information in 494 00:25:53,300 --> 00:25:54,980 there now. So now 495 00:25:54,980 --> 00:25:56,680 we can go ahead and pull another 496 00:25:57,180 --> 00:25:57,620 report. 497 00:26:01,800 --> 00:26:03,260 And that one was 498 00:26:03,260 --> 00:26:04,620 4.236. 499 00:26:09,800 --> 00:26:11,220 And so now based off that 500 00:26:11,220 --> 00:26:13,080 Nessus data that we had, which was completely 501 00:26:13,080 --> 00:26:15,360 different than the NMAP data, we now 502 00:26:15,360 --> 00:26:17,500 have all of the same information 503 00:26:17,500 --> 00:26:18,660 that we were able to get before. 504 00:26:20,220 --> 00:26:24,000 So that really allows everything to come together nicely. 505 00:26:24,540 --> 00:26:27,400 So, at this point I'm going to talk about code 506 00:26:27,400 --> 00:26:29,780 and how it all fits together for people who are interested. 507 00:26:34,000 --> 00:26:35,900 There's a couple different types of objects 508 00:26:35,900 --> 00:26:36,760 that are involved here. 509 00:26:37,260 --> 00:26:38,840 The first is workspaces. 510 00:26:39,280 --> 00:26:41,460 Workspaces sets a chunk aside 511 00:26:41,460 --> 00:26:44,640 for the project that you're working on. 512 00:26:44,800 --> 00:26:48,640 Where workspaces become nice is if you are doing workplaces, 513 00:26:48,640 --> 00:26:50,840 a pen test of the same company multiple years in a row, 514 00:26:51,000 --> 00:26:54,300 then you may be interested in pulling your database 515 00:26:54,300 --> 00:26:56,000 from last year for the same thing, 516 00:26:56,080 --> 00:26:57,020 opening a new workspace. 517 00:26:57,420 --> 00:26:59,760 And then as you're looking at changes between the two years 518 00:26:59,760 --> 00:27:02,060 for things that have hopefully improved, 519 00:27:03,260 --> 00:27:06,800 then you can compare the two workspaces programmatically 520 00:27:06,800 --> 00:27:09,520 to be able to determine what has changed and what hasn't. 521 00:27:10,560 --> 00:27:14,380 The host is pretty self-explanatory. 522 00:27:14,380 --> 00:27:15,520 Services, vulns. 523 00:27:15,520 --> 00:27:18,580 And I'm going to go into these for just a second 524 00:27:18,580 --> 00:27:19,300 a little bit deeper. 525 00:27:20,840 --> 00:27:24,200 So the workspaces are pretty much just labeled by name. 526 00:27:24,960 --> 00:27:26,160 The name is arbitrary. 527 00:27:26,580 --> 00:27:28,840 It gives some information about when it was created at. 528 00:27:29,020 --> 00:27:31,180 And there's a description field to allow you 529 00:27:31,180 --> 00:27:33,060 to give it a more descriptive label, 530 00:27:33,140 --> 00:27:36,020 like Ryan's pen test from 2009. 531 00:27:37,020 --> 00:27:39,120 The hosts have a lot more information in them. 532 00:27:39,880 --> 00:27:41,640 They have all sorts of information 533 00:27:41,640 --> 00:27:42,800 that you can get from NMAP, 534 00:27:42,840 --> 00:27:45,180 like the name, exactly what flavor, 535 00:27:45,180 --> 00:27:46,820 whatever of OS it is, the address. 536 00:27:47,200 --> 00:27:49,960 And there's actually a separate field for IPv6, 537 00:27:50,080 --> 00:27:51,780 so you can actually be looking at a host 538 00:27:51,780 --> 00:27:55,480 in the context of both the IPv4 and the IPv6 address. 539 00:27:58,560 --> 00:28:02,540 The services, each service maps to a host. 540 00:28:03,380 --> 00:28:07,800 And it includes just the port, the protocol, the state. 541 00:28:07,980 --> 00:28:09,480 It also has some name information 542 00:28:09,480 --> 00:28:11,580 about what that service is. 543 00:28:11,780 --> 00:28:13,840 And you can also drop in some extended information, 544 00:28:13,840 --> 00:28:17,100 for instance, full banners and stuff like that, 545 00:28:17,220 --> 00:28:18,460 that you can pull back later. 546 00:28:19,660 --> 00:28:23,600 The vulns is actually a relatively small table. 547 00:28:24,180 --> 00:28:26,740 It has a reference to a host in a service. 548 00:28:27,040 --> 00:28:28,580 You have the name of the vulnerability. 549 00:28:29,020 --> 00:28:34,340 You actually have references for OSVDB or CVEs or whatever 550 00:28:34,340 --> 00:28:35,660 that relate to that. 551 00:28:35,940 --> 00:28:37,320 And then you have an info block 552 00:28:37,320 --> 00:28:40,420 where we are storing all of that extended information 553 00:28:40,420 --> 00:28:43,060 about the full text of vulnerabilities. 554 00:28:45,020 --> 00:28:46,420 So notes are pretty cool, 555 00:28:46,560 --> 00:28:48,420 because if you have something that's not a vulnerability 556 00:28:48,420 --> 00:28:49,840 but you want to keep track of it, 557 00:28:50,420 --> 00:28:51,580 you do that with notes. 558 00:28:52,080 --> 00:28:53,560 So notes have a note type, 559 00:28:53,700 --> 00:28:55,200 which is essentially arbitrary. 560 00:28:56,300 --> 00:28:58,480 If you are developing something new, 561 00:28:58,580 --> 00:28:59,960 you want to keep track of it, 562 00:29:00,080 --> 00:29:01,520 you can create your own note type. 563 00:29:02,760 --> 00:29:04,660 Notes pertain to services and hosts. 564 00:29:05,440 --> 00:29:06,600 You can have critical, 565 00:29:06,820 --> 00:29:08,320 whether or not it's been seen before. 566 00:29:08,600 --> 00:29:09,800 And then it has a data block. 567 00:29:10,060 --> 00:29:12,680 And you can store pretty much anything you want to 568 00:29:12,680 --> 00:29:13,440 in that data block. 569 00:29:14,100 --> 00:29:15,340 Most of the time, 570 00:29:15,360 --> 00:29:16,860 objects are stored, 571 00:29:16,960 --> 00:29:18,240 so you can actually store information, 572 00:29:18,620 --> 00:29:21,620 extended information about what you found. 573 00:29:21,840 --> 00:29:22,320 So for instance, 574 00:29:22,580 --> 00:29:25,600 if you're storing information about maybe vhosts 575 00:29:26,200 --> 00:29:28,000 that you found on a server, 576 00:29:28,220 --> 00:29:31,180 you can actually include an array of vhosts in that object 577 00:29:31,180 --> 00:29:32,960 and have all of that accessible 578 00:29:32,960 --> 00:29:34,820 when you go through and pull your reports. 579 00:29:36,640 --> 00:29:38,660 Events are important to figure out 580 00:29:38,660 --> 00:29:40,180 what's going on on the system. 581 00:29:40,260 --> 00:29:41,360 Every time you type a command, 582 00:29:41,560 --> 00:29:42,440 an event is logged. 583 00:29:43,840 --> 00:29:46,700 So you have the host that it came from, 584 00:29:46,920 --> 00:29:48,800 the name, whether or not it's been seen, 585 00:29:48,940 --> 00:29:50,780 username, and then the extended info 586 00:29:50,780 --> 00:29:52,100 talks about what really happened. 587 00:29:52,400 --> 00:29:54,820 So if you have multiple people acting on the database, 588 00:29:55,080 --> 00:29:56,660 you're wondering who's doing what, 589 00:29:56,720 --> 00:29:58,380 whether or not a scan is started or finished. 590 00:29:58,620 --> 00:30:00,220 You can be logging the event information 591 00:30:00,220 --> 00:30:01,820 when the scans start and finish 592 00:30:01,820 --> 00:30:04,620 and tell real time what the status is 593 00:30:04,620 --> 00:30:06,280 and what people are working on. 594 00:30:08,340 --> 00:30:10,320 So then we have fat loots. 595 00:30:11,680 --> 00:30:13,280 And for loot, 596 00:30:13,840 --> 00:30:19,420 loot is mostly used by Metasport Express 597 00:30:19,420 --> 00:30:21,220 and the more commercial products, 598 00:30:21,420 --> 00:30:23,360 but we have it available to us as well. 599 00:30:23,860 --> 00:30:25,300 So with the loot, 600 00:30:26,070 --> 00:30:28,260 it's basically anything that you have acquired 601 00:30:28,260 --> 00:30:30,420 from the host that you find to be valuable. 602 00:30:30,680 --> 00:30:33,820 We don't store the content necessarily in the database, 603 00:30:34,960 --> 00:30:37,620 but we have the host service information, 604 00:30:37,880 --> 00:30:41,120 the type of the stuff that we have acquired. 605 00:30:41,620 --> 00:30:43,620 And then the path variable says, 606 00:30:43,840 --> 00:30:44,620 where to find that. 607 00:30:44,780 --> 00:30:46,480 So if you have a shared storage area 608 00:30:46,480 --> 00:30:49,460 that's secure where you put all of the goodies 609 00:30:49,460 --> 00:30:50,040 that you required, 610 00:30:50,520 --> 00:30:52,620 for instance, maybe a cracked password 611 00:30:52,620 --> 00:30:53,380 and stuff like that, 612 00:30:53,540 --> 00:30:54,800 you put the path to that. 613 00:30:55,000 --> 00:30:56,660 The data has some extended information 614 00:30:56,660 --> 00:30:59,620 about what that information is. 615 00:30:59,900 --> 00:31:02,380 The content type says exactly what it is. 616 00:31:03,140 --> 00:31:05,880 And then you have a name just to keep track of it. 617 00:31:08,560 --> 00:31:10,940 Clients are what we're using for beef. 618 00:31:11,540 --> 00:31:12,840 For all of the web stuff, 619 00:31:12,980 --> 00:31:13,740 we keep track of, 620 00:31:13,740 --> 00:31:15,740 we have a couple of different pieces of information 621 00:31:15,740 --> 00:31:18,120 as we have hosts come in. 622 00:31:18,660 --> 00:31:22,020 This information is also stored by things like DB Autopone 623 00:31:22,580 --> 00:31:24,840 and any of the other web parts that come in. 624 00:31:25,060 --> 00:31:26,780 We get information about the host, 625 00:31:26,940 --> 00:31:28,480 the full user agent string, 626 00:31:28,780 --> 00:31:33,380 but we also get some parsed out user agent information 627 00:31:33,960 --> 00:31:35,080 like the name and the version. 628 00:31:35,320 --> 00:31:39,400 So if you are looking for maybe performing some further testing 629 00:31:39,400 --> 00:31:42,920 on an older version of IE, this would become very handy. 630 00:31:42,920 --> 00:31:43,880 You can just go in, 631 00:31:43,900 --> 00:31:47,020 query all of our hosts that are running an older version of IE, 632 00:31:47,160 --> 00:31:49,720 and then send them a little file to test out. 633 00:31:53,000 --> 00:31:58,640 For users, the user information isn't always directly visible, 634 00:31:59,280 --> 00:32:01,120 but we can view it. 635 00:32:01,180 --> 00:32:02,460 It is created automatically. 636 00:32:02,960 --> 00:32:05,920 There's a plug-in that will allow you to get to it 637 00:32:05,920 --> 00:32:07,820 from the console, but through XMLRPC, 638 00:32:08,020 --> 00:32:09,480 we can get to it regardless. 639 00:32:10,420 --> 00:32:12,180 So we can store data here, 640 00:32:12,260 --> 00:32:12,900 even though MetaMask is a little bit more complex, 641 00:32:12,900 --> 00:32:14,640 but it's not storing data here. 642 00:32:14,860 --> 00:32:18,340 As we go through and we acquire some credentials, 643 00:32:19,060 --> 00:32:21,200 we have the ability to log all of that here 644 00:32:21,200 --> 00:32:23,000 for action in the future. 645 00:32:23,480 --> 00:32:26,580 This is especially valuable if you're doing things, 646 00:32:27,600 --> 00:32:30,540 for instance, you're wanting to do some 647 00:32:31,400 --> 00:32:33,320 pass the hash or things like that. 648 00:32:33,480 --> 00:32:36,080 We've got all of the tokens here and things like that 649 00:32:36,080 --> 00:32:39,560 that we can store to be able to further gain access on the network. 650 00:32:41,240 --> 00:32:41,720 So, 651 00:32:41,720 --> 00:32:43,720 I have a little bit more time, 652 00:32:43,880 --> 00:32:45,760 so I'm going to actually go into 653 00:32:45,760 --> 00:32:47,420 some of the code itself at this point. 654 00:32:50,140 --> 00:32:53,420 The code for a lot of this is fairly simple. 655 00:32:53,580 --> 00:32:54,380 I'm using Python, 656 00:32:55,280 --> 00:32:58,560 because Python has an XMLRPC module 657 00:32:58,560 --> 00:33:01,940 that facilitates working with this stuff very well. 658 00:33:03,220 --> 00:33:06,500 So I'm going to start off by looking at 659 00:33:06,500 --> 00:33:08,680 just the host info stuff. 660 00:33:11,720 --> 00:33:14,320 So for host info, all of this stuff up top 661 00:33:14,320 --> 00:33:15,480 is just parsing options. 662 00:33:15,960 --> 00:33:18,380 So basically, from the options that get passed in, 663 00:33:18,580 --> 00:33:22,000 we need a server URL that we're going to connect to. 664 00:33:22,280 --> 00:33:24,740 We need the username and the password 665 00:33:24,740 --> 00:33:26,280 to authenticate to XMLRPC. 666 00:33:26,960 --> 00:33:31,160 So for XMLRPC, there's a couple pieces of information 667 00:33:31,160 --> 00:33:32,240 that are really good to know 668 00:33:32,240 --> 00:33:33,500 when you're writing applications. 669 00:33:34,160 --> 00:33:36,420 The first is, after you authenticate, 670 00:33:37,000 --> 00:33:38,100 you're given a token. 671 00:33:38,280 --> 00:33:40,300 That token is good for 15 minutes, 672 00:33:40,300 --> 00:33:43,460 and any subsequent requests that you make, 673 00:33:43,480 --> 00:33:44,500 you pass in that token. 674 00:33:45,140 --> 00:33:47,960 After 15 minutes, then you won't get anything back, 675 00:33:48,100 --> 00:33:49,600 except for errors from Metasploit. 676 00:33:49,760 --> 00:33:51,600 So you have to make sure you're renewing your tokens 677 00:33:51,600 --> 00:33:52,440 every 15 minutes. 678 00:33:53,440 --> 00:33:55,400 I occasionally, when I've done stuff, 679 00:33:55,500 --> 00:33:58,720 because I've had slowness and things like that, 680 00:33:58,820 --> 00:34:01,500 ended up with tokens appearing to be expiring 681 00:34:01,500 --> 00:34:02,940 before the 15-minute mark. 682 00:34:03,240 --> 00:34:05,300 So typically, when I'm writing stuff, 683 00:34:05,500 --> 00:34:07,540 I renew my tokens at the 10-minute point. 684 00:34:09,580 --> 00:34:10,280 So basically, 685 00:34:10,300 --> 00:34:15,880 right here, we are opening up our PC connection 686 00:34:15,880 --> 00:34:17,540 into the Metasploit server. 687 00:34:18,060 --> 00:34:20,600 Then we call the auth.login function. 688 00:34:20,900 --> 00:34:22,220 And the auth.login function, 689 00:34:22,420 --> 00:34:24,300 we pass through our username and password, 690 00:34:24,520 --> 00:34:25,440 we get back our token. 691 00:34:25,940 --> 00:34:29,000 If the result from that, 692 00:34:29,140 --> 00:34:30,660 pretty much all of the calls 693 00:34:31,080 --> 00:34:32,860 come back with a result, 694 00:34:33,400 --> 00:34:36,020 if it is a thing that you're asking it to do. 695 00:34:36,540 --> 00:34:38,080 If you're asking for data, 696 00:34:38,220 --> 00:34:39,520 you don't get a result back, 697 00:34:40,300 --> 00:34:40,920 you just get data back. 698 00:34:42,020 --> 00:34:44,220 So since we have a result back, 699 00:34:45,040 --> 00:34:46,620 we know that we were successful, 700 00:34:46,880 --> 00:34:48,440 and then we take the token from that 701 00:34:48,440 --> 00:34:49,240 and we're going to use that 702 00:34:49,240 --> 00:34:50,680 for the rest of the stuff that we do. 703 00:34:52,060 --> 00:34:54,700 After that, we define our workspace. 704 00:34:55,120 --> 00:34:57,100 If we're looking at a specific workspace, 705 00:34:58,760 --> 00:35:01,460 then we will go ahead and assign that 706 00:35:01,460 --> 00:35:03,020 to our extra options. 707 00:35:03,940 --> 00:35:04,840 And after that, 708 00:35:04,980 --> 00:35:07,000 we just start asking for stuff 709 00:35:07,000 --> 00:35:07,800 and printing it out. 710 00:35:08,000 --> 00:35:10,120 So the get host says, 711 00:35:10,300 --> 00:35:11,200 get all of the hosts 712 00:35:11,200 --> 00:35:13,180 that we specified on the command line. 713 00:35:13,520 --> 00:35:14,900 And then after that, 714 00:35:15,000 --> 00:35:16,440 it's just a matter of enumerating through 715 00:35:16,440 --> 00:35:17,560 and printing stuff out. 716 00:35:17,860 --> 00:35:18,980 So for services, 717 00:35:19,560 --> 00:35:21,120 we just drop into a loop 718 00:35:22,280 --> 00:35:25,240 and print out each piece of the object at a time. 719 00:35:25,480 --> 00:35:28,020 So it's not overly complicated. 720 00:35:29,220 --> 00:35:30,720 Probably as you're going through, 721 00:35:30,860 --> 00:35:32,320 there's not a lot of documentation 722 00:35:32,320 --> 00:35:34,340 on exactly what's being returned right now. 723 00:35:35,540 --> 00:35:37,620 There's a wiki page in Metasploit 724 00:35:37,620 --> 00:35:39,480 which I'm going to start updating 725 00:35:39,480 --> 00:35:41,820 as soon as this makes it into the trunk 726 00:35:41,820 --> 00:35:43,740 with what information is returned back 727 00:35:43,740 --> 00:35:44,380 from which pieces 728 00:35:44,380 --> 00:35:47,080 so that there's some good reference for that. 729 00:35:47,340 --> 00:35:49,220 As far as the other functions go 730 00:35:50,380 --> 00:35:51,260 for XMLRPC 731 00:35:51,260 --> 00:35:53,280 and the documentation subdirectory, 732 00:35:53,400 --> 00:35:55,540 there's an XMLRPC.text 733 00:35:55,540 --> 00:35:57,780 that has a list of what you pass 734 00:35:57,780 --> 00:35:58,780 to each one of the functions. 735 00:36:00,300 --> 00:36:00,740 So, 736 00:36:02,460 --> 00:36:03,860 sorry, this is a little bit 737 00:36:03,860 --> 00:36:05,140 a pain to read, 738 00:36:05,320 --> 00:36:08,560 but basically we're just iterating through stuff 739 00:36:08,560 --> 00:36:11,260 and printing out each piece of the object in order. 740 00:36:12,860 --> 00:36:13,380 So, 741 00:36:14,280 --> 00:36:16,180 where this is especially valuable 742 00:36:16,180 --> 00:36:18,680 is if you want to perform further actions 743 00:36:18,680 --> 00:36:20,080 on stuff that you've done. 744 00:36:20,480 --> 00:36:20,920 So, 745 00:36:21,520 --> 00:36:22,040 for 746 00:36:26,000 --> 00:36:27,040 dcom.python 747 00:36:27,040 --> 00:36:27,360 which 748 00:36:27,360 --> 00:36:29,900 I wanted to do something where I could test 749 00:36:29,900 --> 00:36:31,040 and make sure it's working 750 00:36:31,040 --> 00:36:33,840 and dcom always works on 751 00:36:34,480 --> 00:36:35,780 XPServicePack0 boxes just about 752 00:36:35,780 --> 00:36:38,420 which is the awesome box that I've got up here. 753 00:36:38,560 --> 00:36:38,960 So, 754 00:36:39,100 --> 00:36:41,200 for testing it makes it really easy. 755 00:36:41,460 --> 00:36:44,440 So basically to only send it 756 00:36:44,440 --> 00:36:45,460 to hosts that have 757 00:36:46,100 --> 00:36:47,420 the right stuff listening, 758 00:36:47,640 --> 00:36:50,060 we specify our information about 759 00:36:50,060 --> 00:36:51,160 where to connect to up here. 760 00:36:51,820 --> 00:36:53,620 We're connecting to our local host, 761 00:36:53,840 --> 00:36:54,800 logging in, 762 00:36:54,980 --> 00:36:56,540 and then after that 763 00:36:57,600 --> 00:36:59,600 we are going to 764 00:37:00,600 --> 00:37:02,420 get a list of all of our services 765 00:37:02,420 --> 00:37:04,260 that are running on 139 766 00:37:04,260 --> 00:37:05,380 for TCP. 767 00:37:05,840 --> 00:37:08,080 And so from there we can make sure that 768 00:37:08,560 --> 00:37:09,040 we're calling stuff. 769 00:37:09,300 --> 00:37:11,400 We're only calling hosts that are relevant. 770 00:37:13,080 --> 00:37:13,560 So, 771 00:37:14,060 --> 00:37:14,840 from there, 772 00:37:16,720 --> 00:37:18,520 if you're going to be doing stuff like this 773 00:37:18,520 --> 00:37:19,480 a lot of the time 774 00:37:20,440 --> 00:37:22,200 you're better off using multihandler 775 00:37:22,200 --> 00:37:23,420 than you are using 776 00:37:24,100 --> 00:37:26,220 the default handler for exploits. 777 00:37:26,460 --> 00:37:28,680 And for people who may not be familiar with multihandler 778 00:37:28,680 --> 00:37:30,320 what it does is it acts 779 00:37:30,320 --> 00:37:31,920 as the handler for the exploits themselves. 780 00:37:32,380 --> 00:37:34,300 So you can have a whole bunch of different 781 00:37:34,300 --> 00:37:36,500 reverse TCP connections coming back in 782 00:37:36,500 --> 00:37:37,820 to the same place 783 00:37:38,560 --> 00:37:40,340 and you don't have to worry about 784 00:37:40,340 --> 00:37:42,040 any sort of conflicts with ports 785 00:37:42,040 --> 00:37:42,920 or anything like that. 786 00:37:43,340 --> 00:37:45,780 So, I do two things here. 787 00:37:45,980 --> 00:37:47,560 First I start off by 788 00:37:48,330 --> 00:37:50,340 going ahead and running multihandler 789 00:37:50,340 --> 00:37:52,520 so that any connections that come back 790 00:37:52,520 --> 00:37:54,780 come back to the multihandler 791 00:37:54,780 --> 00:37:56,320 instead of the payload handler 792 00:37:56,320 --> 00:37:57,220 for the exploit itself. 793 00:37:57,700 --> 00:37:59,680 Then I pull the list of services 794 00:37:59,680 --> 00:38:02,460 and for each service that's listening on 795 00:38:02,460 --> 00:38:03,740 port 139 796 00:38:04,420 --> 00:38:05,000 I 797 00:38:05,980 --> 00:38:07,420 run costploit on it. 798 00:38:08,560 --> 00:38:10,080 This does a basic execute 799 00:38:10,080 --> 00:38:11,700 for our exploit 800 00:38:11,700 --> 00:38:13,700 using our authentication token 801 00:38:14,360 --> 00:38:16,300 and in this case 802 00:38:16,300 --> 00:38:17,860 the Windows DCE RPC 803 00:38:18,980 --> 00:38:20,180 MSO 3026 804 00:38:20,180 --> 00:38:21,360 DECOM vulnerability. 805 00:38:21,820 --> 00:38:23,600 For this we just have to specify 806 00:38:23,600 --> 00:38:24,740 our IP address 807 00:38:25,640 --> 00:38:28,380 sorry, the IP address of the remote host 808 00:38:28,380 --> 00:38:29,340 that we passed in 809 00:38:29,340 --> 00:38:31,760 the payload we want to use, our IP 810 00:38:32,280 --> 00:38:34,060 and then one of the important things 811 00:38:34,060 --> 00:38:35,400 is the disabled payload handler 812 00:38:35,400 --> 00:38:37,700 which is what actually turns off the payload handler. 813 00:38:38,560 --> 00:38:39,520 This will also increase the speed 814 00:38:39,520 --> 00:38:40,380 if stuff goes out 815 00:38:40,380 --> 00:38:42,720 because your exploit won't be waiting 816 00:38:42,720 --> 00:38:44,720 for something to connect back to it. 817 00:38:45,300 --> 00:38:47,580 It will send the goodness out 818 00:38:47,580 --> 00:38:49,260 and then wait for it to connect back 819 00:38:49,260 --> 00:38:50,500 to the multihandler. 820 00:38:50,960 --> 00:38:53,060 So, for here 821 00:38:56,220 --> 00:38:58,220 we have a couple things that 822 00:38:58,220 --> 00:38:59,480 are running on 823 00:39:00,100 --> 00:39:01,100 Microsoft ports 824 00:39:01,100 --> 00:39:04,380 so we should be able to just come over here 825 00:39:06,820 --> 00:39:08,340 run our DECOM.py 826 00:39:10,000 --> 00:39:12,340 and it pulled the hosts 827 00:39:12,340 --> 00:39:13,320 that are in the database 828 00:39:13,320 --> 00:39:16,220 and now we have remotely 829 00:39:16,220 --> 00:39:18,680 called the exploit, gotten back our host 830 00:39:23,480 --> 00:39:25,880 and we have all of the goodness 831 00:39:25,880 --> 00:39:27,440 that we may want. 832 00:39:28,060 --> 00:39:30,080 So, with something like this 833 00:39:30,080 --> 00:39:31,480 and with PSExec 834 00:39:31,480 --> 00:39:34,100 one of the nice pieces 835 00:39:34,100 --> 00:39:35,340 about it is 836 00:39:35,340 --> 00:39:38,160 say you have gotten one host 837 00:39:38,560 --> 00:39:39,760 you have captured some credentials 838 00:39:41,400 --> 00:39:43,060 and you want to look at 839 00:39:43,060 --> 00:39:44,440 what other hosts in the network 840 00:39:44,960 --> 00:39:46,820 you may be able to get 841 00:39:46,820 --> 00:39:48,600 additional tokens on for pass the hash. 842 00:39:49,560 --> 00:39:50,520 With PSExec 843 00:39:50,520 --> 00:39:51,420 you can go through 844 00:39:51,420 --> 00:39:53,840 you can put in the credentials 845 00:39:53,840 --> 00:39:54,820 that you have right now 846 00:39:54,820 --> 00:39:56,140 start scanning the network 847 00:39:56,140 --> 00:39:58,600 and then use Metropeter's auto-run capabilities 848 00:39:58,600 --> 00:40:00,880 to do further information gathering 849 00:40:00,880 --> 00:40:01,980 as you're going through the network. 850 00:40:02,280 --> 00:40:04,200 So you may want to do something along the lines of 851 00:40:04,200 --> 00:40:06,700 WinEnum, which as it connects into the host 852 00:40:08,560 --> 00:40:09,900 comes back and will 853 00:40:09,900 --> 00:40:12,480 pretty much profile everything about the host. 854 00:40:12,800 --> 00:40:13,900 As this goes through 855 00:40:13,900 --> 00:40:14,840 you can start looking 856 00:40:14,840 --> 00:40:17,000 and further elevating privileges 857 00:40:17,540 --> 00:40:19,040 using the information from there 858 00:40:19,040 --> 00:40:21,240 but you'll also get a lot better network map 859 00:40:21,240 --> 00:40:22,740 as you start going through with that. 860 00:40:23,180 --> 00:40:24,280 Now the plus side is 861 00:40:24,280 --> 00:40:26,300 because we have already done an Nmap scan 862 00:40:26,300 --> 00:40:28,400 and we know which hosts are listening on Windows ports 863 00:40:28,400 --> 00:40:31,260 we're only going to be sending this stuff to Windows hosts. 864 00:40:31,580 --> 00:40:34,100 So if you have some sort of network anomaly based detection 865 00:40:34,100 --> 00:40:36,020 that's looking for traffic 866 00:40:36,020 --> 00:40:38,360 on Microsoft ports 867 00:40:38,560 --> 00:40:39,860 or for Linux boxes or whatever 868 00:40:39,860 --> 00:40:41,260 you're not going to trip that. 869 00:40:41,600 --> 00:40:44,180 And also you make sure that if you're limiting your scope 870 00:40:44,180 --> 00:40:45,760 you're only making 871 00:40:45,760 --> 00:40:48,640 you're only doing things that apply directly to your scope. 872 00:40:48,920 --> 00:40:50,500 So one of the scripts that might make sense 873 00:40:50,500 --> 00:40:51,440 for the future if 874 00:40:52,000 --> 00:40:53,920 people are interested in making sure that 875 00:40:53,920 --> 00:40:55,140 all of the hosts that they've scanned 876 00:40:55,140 --> 00:40:57,920 the information that they may do things that are actionable on 877 00:40:57,920 --> 00:40:59,220 is only limited to certain ranges 878 00:40:59,220 --> 00:41:01,740 is go through, look at what all is there 879 00:41:01,740 --> 00:41:03,420 and then delete everything out of the database 880 00:41:03,420 --> 00:41:06,600 before they start going that is outside of their scope. 881 00:41:07,800 --> 00:41:08,240 So 882 00:41:08,560 --> 00:41:10,100 as far as the exploit goes 883 00:41:10,100 --> 00:41:12,760 right now I just have it adding ports 884 00:41:12,760 --> 00:41:13,620 but 885 00:41:13,620 --> 00:41:16,060 one of the things that would be really cool is 886 00:41:16,060 --> 00:41:17,480 for the Nmap developers 887 00:41:17,480 --> 00:41:19,360 as they start writing checks 888 00:41:19,360 --> 00:41:22,180 for extended information about shares 889 00:41:22,180 --> 00:41:24,540 and all of the other goodness 890 00:41:24,540 --> 00:41:25,100 that's involved 891 00:41:25,100 --> 00:41:27,740 to be able to drop notes through this 892 00:41:27,740 --> 00:41:28,780 to be able to 893 00:41:29,540 --> 00:41:32,280 as you're scanning log every piece of information 894 00:41:32,280 --> 00:41:34,480 that shows up as the script portion 895 00:41:34,480 --> 00:41:35,100 for Nmap. 896 00:41:35,360 --> 00:41:37,880 So I'm going to look a little bit with you at 897 00:41:39,140 --> 00:41:40,580 the Nmap stuff. 898 00:41:42,330 --> 00:41:43,540 So the latest version of 899 00:41:43,540 --> 00:41:45,840 exploit will run a lot more places. 900 00:41:46,880 --> 00:41:47,900 It has 901 00:41:48,720 --> 00:41:49,840 before when 902 00:41:49,840 --> 00:41:51,380 sorry last year when I released it 903 00:41:51,380 --> 00:41:53,440 it required an additional Lua module. 904 00:41:53,820 --> 00:41:55,800 Now it is straight XML RPC 905 00:41:55,800 --> 00:41:57,820 it requires nothing else 906 00:41:57,820 --> 00:41:59,300 so it should run on iPhones 907 00:41:59,300 --> 00:42:01,440 it should run on any sort of device 908 00:42:01,440 --> 00:42:03,480 that you can put Nmap on 909 00:42:03,480 --> 00:42:06,240 and has the Lua stuff installed 910 00:42:06,240 --> 00:42:07,320 for scripting. 911 00:42:08,560 --> 00:42:09,720 When you drop it in 912 00:42:09,720 --> 00:42:11,660 you've got two separate directories 913 00:42:11,660 --> 00:42:14,020 you've got your NSElib and you've got your scripts. 914 00:42:14,660 --> 00:42:16,860 So my Nmap is installed 915 00:42:16,860 --> 00:42:17,500 in 916 00:42:18,720 --> 00:42:19,540 Usual Local 917 00:42:19,540 --> 00:42:21,900 and so if you look in Usual Local Share Nmap 918 00:42:22,520 --> 00:42:23,900 you'll see that there's 919 00:42:23,900 --> 00:42:25,400 two directories which correspond 920 00:42:25,400 --> 00:42:28,180 the NSElib which is all of the core libraries 921 00:42:28,180 --> 00:42:29,840 that the other scripts use 922 00:42:29,840 --> 00:42:31,340 and the scripts themselves 923 00:42:31,340 --> 00:42:34,360 and so pretty much you copy everything from 924 00:42:34,360 --> 00:42:36,500 NSElib and the exploit distribution 925 00:42:36,500 --> 00:42:38,440 over to NSElib and everything from 926 00:42:38,560 --> 00:42:39,140 scripts to scripts 927 00:42:39,140 --> 00:42:42,080 and so when we look in scripts 928 00:42:43,580 --> 00:42:45,680 we have MSF add port 929 00:42:46,420 --> 00:42:47,920 so basically for this 930 00:42:48,480 --> 00:42:50,500 we have two separate 931 00:42:50,500 --> 00:42:52,380 pieces. The port rule says 932 00:42:52,380 --> 00:42:53,280 when this should fire 933 00:42:53,280 --> 00:42:56,420 and so we've said that the port rule 934 00:42:56,420 --> 00:42:58,320 should fire whenever it finds 935 00:42:58,320 --> 00:43:00,560 a port that is in the open 936 00:43:00,560 --> 00:43:00,900 state 937 00:43:01,660 --> 00:43:04,160 and the action when it does that 938 00:43:04,160 --> 00:43:06,220 is we start off by initializing 939 00:43:06,220 --> 00:43:08,060 the exploit stuff and 940 00:43:08,560 --> 00:43:10,560 for exploit you have a 941 00:43:10,560 --> 00:43:12,660 file that is in your home directory 942 00:43:12,660 --> 00:43:14,680 with all of the information about where to connect to 943 00:43:14,680 --> 00:43:16,520 otherwise you have to pass a whole lot of 944 00:43:16,520 --> 00:43:18,740 information to Nmap and it's not a lot of 945 00:43:18,740 --> 00:43:20,540 fun so the config file ends up 946 00:43:20,540 --> 00:43:22,560 being a lot easier so the MSF 947 00:43:22,560 --> 00:43:24,160 init pulls your values in 948 00:43:24,160 --> 00:43:26,660 and then for this we specify our options 949 00:43:26,660 --> 00:43:28,620 for things that Nmap has found 950 00:43:28,620 --> 00:43:30,560 for us. Our host IP, our port 951 00:43:30,560 --> 00:43:32,220 number, protocols, blah blah blah 952 00:43:32,220 --> 00:43:34,540 and then from there we 953 00:43:34,540 --> 00:43:35,820 can just issue an MSF call 954 00:43:36,420 --> 00:43:38,360 directly to the XMLRPC API 955 00:43:38,560 --> 00:43:40,600 function. It goes ahead and takes 956 00:43:40,600 --> 00:43:42,200 care of the token handling for you 957 00:43:43,600 --> 00:43:44,640 and the reason 958 00:43:44,640 --> 00:43:45,300 for that is 959 00:43:46,980 --> 00:43:48,580 Nmap has some storage area 960 00:43:48,580 --> 00:43:50,620 where we can deal with that a lot easier 961 00:43:50,620 --> 00:43:52,360 than any of the individual scripts 962 00:43:52,360 --> 00:43:54,520 can handle it. So I take care of all of that 963 00:43:54,520 --> 00:43:56,480 in the exploit library. So pretty much all 964 00:43:56,480 --> 00:43:58,420 you have to pass to this one is the function 965 00:43:58,420 --> 00:44:00,140 you want to call and the 966 00:44:00,140 --> 00:44:02,160 options. So this goes out 967 00:44:02,560 --> 00:44:04,460 connects to Metasploit database, adds 968 00:44:04,460 --> 00:44:06,460 the data and comes back and a lot of 969 00:44:06,460 --> 00:44:08,420 this stuff has the ability to run in parallel. 970 00:44:09,840 --> 00:44:10,320 So, 971 00:44:11,320 --> 00:44:12,560 I'm getting close to being 972 00:44:12,560 --> 00:44:14,180 to the end, so 973 00:44:17,540 --> 00:44:18,740 Thanks very much 974 00:44:18,740 --> 00:44:20,020 I've had a great time here. 975 00:44:20,200 --> 00:44:22,300 Thanks to all these people who've helped me 976 00:44:22,300 --> 00:44:23,680 get stuff going 977 00:44:24,660 --> 00:44:26,640 and also especially to the people 978 00:44:26,640 --> 00:44:28,180 who've written the tools that 979 00:44:28,920 --> 00:44:29,880 I'm leveraging. 980 00:44:30,880 --> 00:44:32,580 Especially the Metasploit guys 981 00:44:33,240 --> 00:44:34,540 Theodore and Wade Alcorn 982 00:44:34,540 --> 00:44:36,100 who've helped me a lot with stuff. 983 00:44:36,380 --> 00:44:38,280 So, thank you guys very much. 984 00:44:39,440 --> 00:44:40,540 Here's my contact information 985 00:44:41,060 --> 00:44:42,920 if you're interested in more stuff 986 00:44:42,920 --> 00:44:43,600 let me know. 987 00:44:45,060 --> 00:44:46,460 Hit up my blog probably 988 00:44:46,980 --> 00:44:48,500 Monday evening and I'll have 989 00:44:48,500 --> 00:44:50,940 all the source code and I'll try to get the slides there. 990 00:44:51,940 --> 00:44:53,080 If you have any other questions 991 00:44:53,080 --> 00:44:54,520 please just let me know. Thank you very much.