1 00:00:00,250 --> 00:00:04,549 Good morning. Good afternoon. I guess at this point ‑‑ We are 2 00:00:04,549 --> 00:00:07,420 Lucas, Michael or McAtee. We are 3 00:00:07,420 --> 00:00:10,969 here to talk to you about Microsoft Windows Shares and how 4 00:00:10,969 --> 00:00:12,860 we use them on our internal 5 00:00:12,860 --> 00:00:18,289 pens. Briefly about us, my name is Lucas. I'm manager for a 6 00:00:18,289 --> 00:00:19,609 company called Crowe Horwath an 7 00:00:19,609 --> 00:00:23,769 accounting and consulting firm. We work as part of the security 8 00:00:23,769 --> 00:00:26,900 and privacy group inside that. 9 00:00:26,900 --> 00:00:31,099 I'm manager, in quotes. I don't manage a lot. When I do im 10 00:00:31,099 --> 00:00:33,640 probably bad at it I'm also a 11 00:00:33,640 --> 00:00:36,940 pen tester an ultimately a code monkey. I write a lot of script 12 00:00:36,940 --> 00:00:38,640 a lot of tool and other things. 13 00:00:38,640 --> 00:00:41,710 >> And my name is Michael McAtee and I'm a senior consultant a 14 00:00:41,710 --> 00:00:44,680 Crowe as well, an pentester and 15 00:00:44,680 --> 00:00:48,410 was a sys admin before that. so that's why this talk is on the 16 00:00:48,410 --> 00:00:49,660 Windows Share and we couldn't 17 00:00:49,660 --> 00:00:52,219 think of anything funny We just left a placeholder for something 18 00:00:52,219 --> 00:00:53,510 funny so insert your won joke 19 00:00:53,510 --> 00:00:57,399 there. And then please to contact us this is the 20 00:00:57,399 --> 00:00:59,410 obligatory go to the page or 21 00:00:59,410 --> 00:01:05,390 tweet us. >> Quick overview of what we're going to talk about. 22 00:01:05,390 --> 00:01:06,340 We will start off with a 23 00:01:06,340 --> 00:01:10,090 refresher on SMB and CIFS and Microsoft Windows Share with 24 00:01:10,090 --> 00:01:11,700 kind of as the same base 25 00:01:11,700 --> 00:01:14,710 understands the problem we were running into and why we built 26 00:01:14,710 --> 00:01:17,530 this tool and why we use this as 27 00:01:17,530 --> 00:01:21,259 one of our primary go to methodologies in pentesting now 28 00:01:21,259 --> 00:01:24,700 We will dive into how permission 29 00:01:24,700 --> 00:01:29,409 in window share work, share permissions version NTFS, how 30 00:01:29,409 --> 00:01:31,439 those are stored, what they 31 00:01:31,439 --> 00:01:33,759 mean, what we're pulling, what the tool is actually putting 32 00:01:33,759 --> 00:01:35,560 out, all that nitty gritty 33 00:01:35,560 --> 00:01:38,909 stuff. The problem we found, when we started using this data 34 00:01:38,909 --> 00:01:40,400 they end up troubles with other 35 00:01:40,400 --> 00:01:44,220 tools great at what they do but didn't do what we need them to 36 00:01:44,220 --> 00:01:46,270 do, and then we'll kind of 37 00:01:46,270 --> 00:01:49,790 detail our methodology, what we look for, why we look at shares, 38 00:01:49,790 --> 00:01:52,299 and tools, hopefully at demo or 39 00:01:52,299 --> 00:01:55,579 maybe a video instead. We will see how it goes. >> lets see if 40 00:01:55,579 --> 00:01:57,009 the Sacrifices for the demo gods 41 00:01:57,009 --> 00:02:02,020 were successful  ‑‑ >> Yeah. >> So, start off with CIFS, common 42 00:02:02,020 --> 00:02:03,310 Internet file system this was 43 00:02:03,310 --> 00:02:06,329 microsoft nice and pretty name put on SMB when they want it to 44 00:02:06,329 --> 00:02:08,190 make it a standard, and went 45 00:02:08,190 --> 00:02:11,620 ahead and sent the nice draft off to standardize it and let it 46 00:02:11,620 --> 00:02:12,940 expire and never made any other 47 00:02:12,940 --> 00:02:17,690 changes so It is almost open and almost to standard, but it's 48 00:02:17,690 --> 00:02:18,500 what everything its published 49 00:02:18,500 --> 00:02:22,370 against theres not a great define, here's how you implement 50 00:02:22,370 --> 00:02:24,040 cifs, its more heres how you get 51 00:02:24,040 --> 00:02:27,250 close enough that you can get a file share and figure out the 52 00:02:27,250 --> 00:02:30,900 bugs as you go along. Since 53 00:02:30,900 --> 00:02:35,220 Windows . Microsoft has had networking built in to Windows, 54 00:02:35,220 --> 00:02:37,040 and some kind of an SMB, SMB was 55 00:02:37,040 --> 00:02:41,010 originally developed by IBM and Microsoft took it and ran with 56 00:02:41,010 --> 00:02:43,010 it. Pretty much every major 57 00:02:43,010 --> 00:02:46,180 version of Windows with the release brings a new version of 58 00:02:46,180 --> 00:02:48,769 SMB. Especially here in the past 59 00:02:48,769 --> 00:02:52,629 few years with Windows 7 and 8, Microsoft was pushed hard on 60 00:02:52,629 --> 00:02:55,099 this as the core technology, not 61 00:02:55,099 --> 00:02:58,599 just for file shares and things of that nature. but they're 62 00:02:58,599 --> 00:03:00,090 backing hyper B‑clusters with 63 00:03:00,090 --> 00:03:05,540 it. i recommend it over using I-scuzzy or NFS And they put a 64 00:03:05,540 --> 00:03:06,900 lot of effort into cleaning up 65 00:03:06,900 --> 00:03:11,519 the performance. If you look at the specifications from to , 66 00:03:11,519 --> 00:03:12,250 they dropped the number of 67 00:03:12,250 --> 00:03:17,300 commands from over a to . so really cleaning up the spec 68 00:03:17,300 --> 00:03:19,159 trying to make it better. We'll 69 00:03:19,159 --> 00:03:22,260 get the sample later. and kind of start to follow that process 70 00:03:22,260 --> 00:03:25,980 just a little bit behind. So 71 00:03:25,980 --> 00:03:29,790 share types. Probably everyone has seen these before. if you 72 00:03:29,790 --> 00:03:30,680 see a share with the dollar at 73 00:03:30,680 --> 00:03:33,409 the end unless someone has done something funny that typically 74 00:03:33,409 --> 00:03:34,750 means it's hidden. Doesn't show 75 00:03:34,750 --> 00:03:39,360 up unless you go looking for it or have a tool that looks for it 76 00:03:39,360 --> 00:03:40,330 specifically. Another share that 77 00:03:40,330 --> 00:03:42,720 you'll see everywhere is the IPC$, its inter process 78 00:03:42,720 --> 00:03:46,110 communication. This is where all 79 00:03:46,110 --> 00:03:49,540 SMB session start. SMB is used for a couple of things, not just 80 00:03:49,540 --> 00:03:50,780 file shares but also printer 81 00:03:50,780 --> 00:03:55,180 sharing. You can also share serial ports, apparently over 82 00:03:55,180 --> 00:03:58,080 it. Microsoft has all sorts of 83 00:03:58,080 --> 00:04:04,099 random calls IPC$ is how you pull ‑‑ where R P C endpoints 84 00:04:04,099 --> 00:04:06,269 are in a windows environment. If 85 00:04:06,269 --> 00:04:08,700 you have a bunch SQL server instances running on a microsoft 86 00:04:08,700 --> 00:04:09,920 machine you are going to connect 87 00:04:09,920 --> 00:04:14,340 through SMB to IPC$ make calls against that and give you the 88 00:04:14,340 --> 00:04:15,180 information you need to 89 00:04:15,180 --> 00:04:18,030 go connect that so it's all that automatic finding fun stuff that 90 00:04:18,030 --> 00:04:19,840 happens all kind that goes 91 00:04:19,840 --> 00:04:24,479 through IPC$ . That's starting point of any Microsoft window 92 00:04:24,479 --> 00:04:27,380 SMB connection. The next is 93 00:04:27,380 --> 00:04:31,520 admin$. This is a special share that is kind of a core part of 94 00:04:31,520 --> 00:04:33,190 our methodology. So well get to 95 00:04:33,190 --> 00:04:36,250 those specifics. but this is on by default every version of 96 00:04:36,250 --> 00:04:37,500 Windows and it takes you to 97 00:04:37,500 --> 00:04:41,460 Windows system . It's supposed to be an admin shares. Some 98 00:04:41,460 --> 00:04:44,270 tools use it. for instance 99 00:04:44,270 --> 00:04:48,000 PsExec uses this. so if you use PsExec and you upload an 100 00:04:48,000 --> 00:04:48,710 executable its gonna drop that 101 00:04:48,710 --> 00:04:52,270 executable into admin$ sharing. you can open up wireshark you 102 00:04:52,270 --> 00:04:54,000 can actually see it mapped and 103 00:04:54,000 --> 00:04:58,389 drop and drop the file. Along that same line is other admin 104 00:04:58,389 --> 00:05:00,940 shares, C$, D$,E$, however many 105 00:05:00,940 --> 00:05:04,990 drives we have will pop up. and those are just administrative 106 00:05:04,990 --> 00:05:06,380 that are locked down by default 107 00:05:06,380 --> 00:05:10,810 to local administrators. They will allow you to gain access to 108 00:05:10,810 --> 00:05:14,120 the various drives. Here, until 109 00:05:14,120 --> 00:05:17,120 recently, you couldn't turn those off. You could disable. 110 00:05:17,120 --> 00:05:19,550 When you reboot, they come back. 111 00:05:19,550 --> 00:05:24,550 Microsoft, has released a hotfix though to fully disable them. A 112 00:05:24,550 --> 00:05:25,910 nice fix for work stations if 113 00:05:25,910 --> 00:05:27,990 you know they shouldn't be sharing anything. You don't want 114 00:05:27,990 --> 00:05:29,320 anybody to set something up they 115 00:05:29,320 --> 00:05:32,580 didn't know about. You can run this on all of your work 116 00:05:32,580 --> 00:05:33,789 stations and no more file 117 00:05:33,789 --> 00:05:39,449 sharing. Make sure you're not using them [Laughter] tools you 118 00:05:39,449 --> 00:05:42,259 will not expect to use them >> 119 00:05:42,259 --> 00:05:46,220 So if we start looking at a little bit more detail of share 120 00:05:46,220 --> 00:05:48,520 permision, there's actually a 121 00:05:48,520 --> 00:05:52,009 few things that we wanted to talk about. The first here is 122 00:05:52,009 --> 00:05:53,320 what's called the DACL, 123 00:05:53,320 --> 00:05:57,860 discretionary access control lift. A mouth full. This is how 124 00:05:57,860 --> 00:06:00,030 Microsoft stores permission for 125 00:06:00,030 --> 00:06:05,990 everything. It's part of called the SDDL, and basically it keeps 126 00:06:05,990 --> 00:06:09,139 permission for random stuffs, 127 00:06:09,139 --> 00:06:14,680 shares, files, services, processes,threads all have DACLS 128 00:06:14,680 --> 00:06:15,889 that can be associated with 129 00:06:15,889 --> 00:06:19,889 them. I was surprised when we started digging into this all of 130 00:06:19,889 --> 00:06:21,430 the places that these were 131 00:06:21,430 --> 00:06:25,509 applied. Basically, the way they're put together you can see 132 00:06:25,509 --> 00:06:28,940 here, it's just stored obviously 133 00:06:28,940 --> 00:06:33,889 when you print it, you get a string like this, and it is just 134 00:06:33,889 --> 00:06:37,740 key colon value, coma separated. 135 00:06:37,740 --> 00:06:40,380 And you will see a lot of different things. This case the 136 00:06:40,380 --> 00:06:42,479 example is for a share, and you 137 00:06:42,479 --> 00:06:46,889 will find the revisions well as basically the owner, the group 138 00:06:46,889 --> 00:06:48,550 that owns it as well as the ACL. 139 00:06:48,550 --> 00:06:53,860 This is actually the DACL as part of this. What this comes 140 00:06:53,860 --> 00:06:54,990 down to is all the stuff you can 141 00:06:54,990 --> 00:07:00,560 set in security tab is all this, condensed down into a computer. 142 00:07:00,560 --> 00:07:02,520 So inside the DACL we have the 143 00:07:02,520 --> 00:07:06,539 ACL, and each ACL has a single line called an ace or an access 144 00:07:06,539 --> 00:07:09,220 control entity. What an ace has 145 00:07:09,220 --> 00:07:15,319 is a principal. This stored as a SID. We reverse those because 146 00:07:15,319 --> 00:07:18,130 who wants to read SID's all day. 147 00:07:18,130 --> 00:07:25,130 It's the SID, and a colon. First number says allow or deny. In 148 00:07:25,180 --> 00:07:26,020 this case it's going to allow 149 00:07:26,020 --> 00:07:29,250 because it's a zero. This is what most people use. I feel 150 00:07:29,250 --> 00:07:33,050 most we do, we always see allow. 151 00:07:33,050 --> 00:07:36,259 Sometimes we do see a deny. It would be a . The second number 152 00:07:36,259 --> 00:07:38,389 after the slash is basically 153 00:07:38,389 --> 00:07:41,960 flags that are on this ace. The ones you see the most and the 154 00:07:41,960 --> 00:07:43,449 ones only relevant to what we're 155 00:07:43,449 --> 00:07:47,660 doing here are we inheriting this from above? Are we forcing 156 00:07:47,660 --> 00:07:49,879 a propagation down, those sort 157 00:07:49,879 --> 00:07:56,660 of settings. Finally, we have the access mask. It is a ‑bit 158 00:07:56,660 --> 00:08:00,199 mask that we use for all of 159 00:08:00,199 --> 00:08:03,830 the various settings what's important is this, the way this 160 00:08:03,830 --> 00:08:07,199 works is unified across all the 161 00:08:07,199 --> 00:08:12,300 different types of objects that Microsoft keeps permission for. 162 00:08:12,300 --> 00:08:14,050 Individual items within might 163 00:08:14,050 --> 00:08:21,020 change, but not necessarily beyond the specifications. Let's 164 00:08:21,020 --> 00:08:22,110 talk a little bit about files 165 00:08:22,110 --> 00:08:26,300 and shares specifically. Shares have permission, files have 166 00:08:26,300 --> 00:08:27,699 permission. In the end it takes 167 00:08:27,699 --> 00:08:30,710 whatever the lowest privilege is that you've been given. so if 168 00:08:30,710 --> 00:08:31,379 you have a share thats read 169 00:08:31,379 --> 00:08:33,459 only, but if your NTFS permission gives you full 170 00:08:33,459 --> 00:08:34,479 control, you are only going to 171 00:08:34,479 --> 00:08:37,760 be able to read from it. Shares, the permissions are pretty 172 00:08:37,760 --> 00:08:38,830 limited, limited to what we 173 00:08:38,830 --> 00:08:42,500 would do in old DOS days. We could read, change, execute. 174 00:08:42,500 --> 00:08:44,640 what you basically see is 175 00:08:44,640 --> 00:08:49,310 read,change and full control. On NTFS we have a lot more 176 00:08:49,310 --> 00:08:51,250 granularity that we can put in. 177 00:08:51,250 --> 00:08:54,070 These are the main ones, probably pretty 178 00:08:54,070 --> 00:08:58,810 self‑explanatory. but If you 179 00:08:58,810 --> 00:09:02,380 look at special permissions a lot, and with each new each new 180 00:09:02,380 --> 00:09:04,130 version of windows, you get even 181 00:09:04,130 --> 00:09:11,130 more I mean, a lot of stuff that they store. >> well how many 182 00:09:11,200 --> 00:09:12,250 people have ever opened up this 183 00:09:12,250 --> 00:09:15,019 security tab and what so special with .. well im not gonna mess 184 00:09:15,019 --> 00:09:16,220 with it right now. when you 185 00:09:16,220 --> 00:09:19,870 check that all these get enabled by default. That's why, so when 186 00:09:19,870 --> 00:09:21,580 you hit full control in that box 187 00:09:21,580 --> 00:09:24,269 is the only one that get's added from having read and write, 188 00:09:24,269 --> 00:09:26,649 that's all of these thats 189 00:09:26,649 --> 00:09:31,990 adding. >> Be aware. >> In addition to N T F S permission, 190 00:09:31,990 --> 00:09:34,610 also attributes that can be set. 191 00:09:34,610 --> 00:09:38,510 From the old days of DOS. They are still there, and basically 192 00:09:38,510 --> 00:09:39,580 the two that we really care 193 00:09:39,580 --> 00:09:44,779 about or read only and hidden. There are several others. 194 00:09:44,779 --> 00:09:45,709 Actually sometimes you will find 195 00:09:45,709 --> 00:09:48,420 some interesting things with archives because you can pull 196 00:09:48,420 --> 00:09:50,029 things back and do some other 197 00:09:50,029 --> 00:09:52,850 stuff if people changed versions. you maybe able to do 198 00:09:52,850 --> 00:09:53,740 some stuff with security 199 00:09:53,740 --> 00:09:56,040 controls. In general, read only and hidden are the only ones we 200 00:09:56,040 --> 00:09:57,920 care about, Shares and 201 00:09:57,920 --> 00:10:01,350 directories as well as files can all be flagged, so although 202 00:10:01,350 --> 00:10:03,290 mentioned earlier have a dollar 203 00:10:03,290 --> 00:10:06,010 sign after a share, that's likely how most people make it 204 00:10:06,010 --> 00:10:08,890 hidden. You can flag it. and 205 00:10:08,890 --> 00:10:11,250 although it gets a little weird when you look at it in Explorer. 206 00:10:11,250 --> 00:10:14,260 It will cause it to be hidden. 207 00:10:14,260 --> 00:10:18,970 The same thing with read only, if you have permission set, it 208 00:10:18,970 --> 00:10:20,980 will only be read only. It's a 209 00:10:20,980 --> 00:10:24,350 weird interaction between old DOS days and new days and 210 00:10:24,350 --> 00:10:25,360 keeping stuff backward 211 00:10:25,360 --> 00:10:29,790 compatible that you have these permissions. In addition to the 212 00:10:29,790 --> 00:10:32,050 DOS mode, recently they've 213 00:10:32,050 --> 00:10:35,450 started adding extended attributes or EAs. These things 214 00:10:35,450 --> 00:10:36,959 that are entirely accustomed. 215 00:10:36,959 --> 00:10:41,130 They can be added by different programs, extensions. We have 216 00:10:41,130 --> 00:10:42,490 seen back‑up programs that use 217 00:10:42,490 --> 00:10:45,589 it to flag you know when they've last passed this handle 218 00:10:45,589 --> 00:10:47,550 incrementals, anti‑virus 219 00:10:47,550 --> 00:10:54,550 programs. Lots of things can. In the end, for us, as pen testers, 220 00:10:54,820 --> 00:10:57,230 is ‑‑ it's not as much of a 221 00:10:57,230 --> 00:10:59,399 problem, it's not as big of a deal. These are things we are 222 00:10:59,399 --> 00:11:00,890 seeing in user space. We haven't 223 00:11:00,890 --> 00:11:03,029 seen any vulnerabilities or anything that we've done with 224 00:11:03,029 --> 00:11:04,899 it. There's probably some 225 00:11:04,899 --> 00:11:08,110 potential there. It would be awesome some someone dove into 226 00:11:08,110 --> 00:11:09,589 that. >> Especially going 227 00:11:09,589 --> 00:11:13,670 forward as Microsoft starts to dig it some more. >> A lots of 228 00:11:13,670 --> 00:11:15,100 internal tools and other things 229 00:11:15,100 --> 00:11:20,300 are using it. >> So if we get into the ultimate nitty gritty 230 00:11:20,300 --> 00:11:22,089 of DACL's and permissions. this 231 00:11:22,089 --> 00:11:27,050 is what an access mask looks like As mentioned before, it's 232 00:11:27,050 --> 00:11:29,370 ‑bits. In the end, it all 233 00:11:29,370 --> 00:11:33,779 comes down to this in the center, in the green, you will 234 00:11:33,779 --> 00:11:36,329 actually see what are the global 235 00:11:36,329 --> 00:11:40,709 or standard access rights. These are available on every single 236 00:11:40,709 --> 00:11:42,930 type of object. So the rights 237 00:11:42,930 --> 00:11:47,149 that you have are pretty generic. The first one, 238 00:11:47,149 --> 00:11:48,700 synchronize, basically what it 239 00:11:48,700 --> 00:11:52,180 says is are we allowed to access this object, synchronously or in 240 00:11:52,180 --> 00:11:53,230 asynchronously. did my thread 241 00:11:53,230 --> 00:11:57,950 have to hold or not,its not one or we've ever been worried 242 00:11:57,950 --> 00:11:59,790 about, from a file and directory 243 00:11:59,790 --> 00:12:02,200 perspective, you are pretty much always allowed to do it always 244 00:12:02,200 --> 00:12:03,779 synchronously , otherwise the 245 00:12:03,779 --> 00:12:10,779 system will break. The next one ‑‑ so the next one is are we 246 00:12:10,820 --> 00:12:12,329 allowed to write the owner? Can 247 00:12:12,329 --> 00:12:17,209 I change the owner of this object? Pretty straight forward. 248 00:12:17,209 --> 00:12:19,200 We also have can I write the 249 00:12:19,200 --> 00:12:24,610 DACL? Are we allowed to change the access permission and alter 250 00:12:24,610 --> 00:12:26,459 the ACL. so its a little meta 251 00:12:26,459 --> 00:12:29,029 and that the ACL includes the permission on can someone modify 252 00:12:29,029 --> 00:12:31,970 itself. We also have can I write 253 00:12:31,970 --> 00:12:35,000 to extend the attributes and can I read extended attributes? or 254 00:12:35,000 --> 00:12:38,139 read and write attributes? This 255 00:12:38,139 --> 00:12:41,940 is not extended attributes. This is the attributes talking about 256 00:12:41,940 --> 00:12:44,430 before, the DOS. This is hidden, 257 00:12:44,430 --> 00:12:48,810 read only, that sort of thing. Are we allowed to modify them? 258 00:12:48,810 --> 00:12:51,800 And then, finally, most 259 00:12:51,800 --> 00:12:58,170 self‑explanatory out there, can we delete the object? So those 260 00:12:58,170 --> 00:13:00,600 green ones are always there. The 261 00:13:00,600 --> 00:13:04,130 ones ‑‑ so the further to the left, in black is one that 262 00:13:04,130 --> 00:13:06,579 also ‑‑ is global. Always 263 00:13:06,579 --> 00:13:12,389 available. It says can I access the system access mask? This is 264 00:13:12,389 --> 00:13:14,250 one you don't see often. but 265 00:13:14,250 --> 00:13:17,680 basically There are DACLs and the there are SACL's. What a 266 00:13:17,680 --> 00:13:20,389 SACL is the name is misnomer in 267 00:13:20,389 --> 00:13:26,350 my mind is that it basically says am I going to audit when 268 00:13:26,350 --> 00:13:29,329 something happens? It drives a 269 00:13:29,329 --> 00:13:31,430 lot of stuff that goes into the Windows event log, that goes 270 00:13:31,430 --> 00:13:33,540 into other extended logs you 271 00:13:33,540 --> 00:13:38,079 have and turn on. It's not one we see often or worry about from 272 00:13:38,079 --> 00:13:39,810 our testing perspective, but it 273 00:13:39,810 --> 00:13:46,810 is certainly one just to keep in mind. Finally, [Laughter] if you 274 00:13:48,000 --> 00:13:50,620 look on the right. Not you, if 275 00:13:50,620 --> 00:13:57,620 you look on the right in the orange ‑‑ [Laughter]. >> If you 276 00:13:58,839 --> 00:14:00,709 look on the right in the orange, 277 00:14:00,709 --> 00:14:02,959 these are the ones the that are specific to files and 278 00:14:02,959 --> 00:14:04,350 directories. This is where you 279 00:14:04,350 --> 00:14:06,860 will see more of the stuff you will expect to see from a 280 00:14:06,860 --> 00:14:08,139 permissions perspective? Can I 281 00:14:08,139 --> 00:14:10,420 read and write extended attributes? Can I delete the 282 00:14:10,420 --> 00:14:13,889 file? Can I write new files? The 283 00:14:13,889 --> 00:14:17,230 ones you see listed up here are for files, the names are 284 00:14:17,230 --> 00:14:19,320 different for directories. The 285 00:14:19,320 --> 00:14:26,320 object type is different. Can you do a shot? >> Of course. 286 00:14:29,220 --> 00:14:36,220 [Laughter]. >> Give a round of 287 00:14:36,649 --> 00:14:40,709 applause. (Applause). >> And this is where the presentation 288 00:14:40,709 --> 00:14:42,269 went downhill. >> Give me about 289 00:14:42,269 --> 00:14:49,269 minutes and then we'll see. [Laughter]. >> Okay. So in the 290 00:14:57,570 --> 00:14:58,730 orange, the one that you see up 291 00:14:58,730 --> 00:15:01,880 here are what you'd expect. As I said, with files, those are the 292 00:15:01,880 --> 00:15:03,880 names you see listed here. With 293 00:15:03,880 --> 00:15:06,420 directories, well honestly on the file if it says can i write 294 00:15:06,420 --> 00:15:07,620 to the file? the permission on 295 00:15:07,620 --> 00:15:11,320 the directory says can I create the file? They map. They are 296 00:15:11,320 --> 00:15:12,970 standard. In some of the stuff 297 00:15:12,970 --> 00:15:15,769 we've done we don't even bother keeping the two names, but just 298 00:15:15,769 --> 00:15:16,880 in case you might decide to look 299 00:15:16,880 --> 00:15:20,459 at this in Microsoft documentation A, I'm sorry, B, 300 00:15:20,459 --> 00:15:21,820 note that the names are 301 00:15:21,820 --> 00:15:27,560 different. >> It is extensive documentation. >> i Made him do 302 00:15:27,560 --> 00:15:30,110 it. >> Go back. >> Sorry. >> 303 00:15:30,110 --> 00:15:36,639 Finally, the four blue on the right are kind meta permissions. 304 00:15:36,639 --> 00:15:37,230 These are the ones you would 305 00:15:37,230 --> 00:15:38,970 expect to see. you have write, you have read, you have full 306 00:15:38,970 --> 00:15:41,000 control, you have change So, 307 00:15:41,000 --> 00:15:46,589 really, if someone sets these, it sets all the other flags. 308 00:15:46,589 --> 00:15:48,519 They are assumed, though, that 309 00:15:48,519 --> 00:15:51,259 typically almost every program will implement it. If you pick 310 00:15:51,259 --> 00:15:58,259 the read flag, I think bit, . 311 00:15:58,470 --> 00:16:01,110 If you pick the read one, technically you have all the 312 00:16:01,110 --> 00:16:02,389 read ones. It doesn't bother to 313 00:16:02,389 --> 00:16:05,389 look at the rest of them. Pretty much every program on the planet 314 00:16:05,389 --> 00:16:07,540 will set the fact that you can 315 00:16:07,540 --> 00:16:11,180 read files, list directories, it sets synchronously, it sets 316 00:16:11,180 --> 00:16:16,839 reads extended attributes. So 317 00:16:16,839 --> 00:16:22,399 those are there also. Also important to note. This is ‑‑ A 318 00:16:22,399 --> 00:16:23,670 lot of time spent figuring out 319 00:16:23,670 --> 00:16:27,160 what the right document was. When we found it, it was 320 00:16:27,160 --> 00:16:31,920 actually quite easy. Okay. So we 321 00:16:31,920 --> 00:16:35,699 had to go re‑learn some of that and learn for the first time a 322 00:16:35,699 --> 00:16:38,600 lot of it because of a problem. 323 00:16:38,600 --> 00:16:41,660 Share scanning we keep finding as kind of a pentesters best 324 00:16:41,660 --> 00:16:43,029 friend. One its where all the 325 00:16:43,029 --> 00:16:46,550 information is typically. You are going to go after it for 326 00:16:46,550 --> 00:16:47,790 that. find somebody's Password 327 00:16:47,790 --> 00:16:53,680 .txt things like that. Images, pull creds out, all that fun 328 00:16:53,680 --> 00:16:55,730 stuff. There's other stuff you 329 00:16:55,730 --> 00:17:00,060 can do too. What we found was the tools weren't built to do 330 00:17:00,060 --> 00:17:01,860 everything we need them to do. 331 00:17:01,860 --> 00:17:04,480 There were some problems with some the tools that existed 332 00:17:04,480 --> 00:17:05,980 because they had been built to 333 00:17:05,980 --> 00:17:10,470 do this or that and didn't take into consideration some of the 334 00:17:10,470 --> 00:17:11,230 things. Some of those problems 335 00:17:11,230 --> 00:17:14,699 ran into. Some of the tools have immature or incomplete 336 00:17:14,699 --> 00:17:16,549 authentication libraries. so 337 00:17:16,549 --> 00:17:20,809 while they'll may not support LM or NTLMv, they may not support 338 00:17:20,809 --> 00:17:22,250 v or maybe they don't 339 00:17:22,250 --> 00:17:25,939 appropriately handle NTLMSSP that the security provider 340 00:17:25,939 --> 00:17:28,010 process. Even though library may 341 00:17:28,010 --> 00:17:31,150 support v, they never get prompted for v. it wont ever 342 00:17:31,150 --> 00:17:33,809 just kick in We ran this with a 343 00:17:33,809 --> 00:17:36,960 couple of tools. It includes often times these tools aren't 344 00:17:36,960 --> 00:17:39,330 share scanning tools. They are 345 00:17:39,330 --> 00:17:43,700 support scanner, vulnerability scanner, a generalized security 346 00:17:43,700 --> 00:17:45,059 framework. We will go through 347 00:17:45,059 --> 00:17:50,730 some of the tools later. They do other things. Inmaps, scans for 348 00:17:50,730 --> 00:17:52,390 open ports before it does any of 349 00:17:52,390 --> 00:17:55,419 the scripting stuff, ENS does some checks to see what kind of 350 00:17:55,419 --> 00:17:57,780 system it's testing so if you 351 00:17:57,780 --> 00:18:00,650 check don't scan printers and all that stuff, it knows it's 352 00:18:00,650 --> 00:18:02,669 not a printer. There's a lot of 353 00:18:02,669 --> 00:18:05,419 traffic that isn't share traffic. It will often time can 354 00:18:05,419 --> 00:18:07,039 tip somebody off on What is 355 00:18:07,039 --> 00:18:11,309 going on in the network something weird and malicious. 356 00:18:11,309 --> 00:18:14,059 We wanted it to be as clean. and 357 00:18:14,059 --> 00:18:16,600 all legitimate traffic so It's much harder to detect. >> We 358 00:18:16,600 --> 00:18:18,179 don't like getting caught. >> 359 00:18:18,179 --> 00:18:22,460 No. The other thing is slow. Other tools just wrap other 360 00:18:22,460 --> 00:18:25,000 existing tools like SMP client, 361 00:18:25,000 --> 00:18:29,090 some are written in scripting languages, whole library are, a 362 00:18:29,090 --> 00:18:30,490 crazy feet, kudos to the people 363 00:18:30,490 --> 00:18:34,120 who wrote those. They are slower. How many times you've 364 00:18:34,120 --> 00:18:35,490 gone to window file share,and 365 00:18:35,490 --> 00:18:39,770 slow and thats all written in C and optimized for years by 366 00:18:39,770 --> 00:18:41,460 Microsoft. Somebody implementing 367 00:18:41,460 --> 00:18:48,460 that in a scripting line, it is slow. We need it to be fast. And 368 00:18:49,090 --> 00:18:50,370 finally, almost none of the 369 00:18:50,370 --> 00:18:54,840 tools would go down to . If you have a folder structure that has 370 00:18:54,840 --> 00:18:57,900 , objects file and 371 00:18:57,900 --> 00:19:00,669 directories and all that stuff, these tools wouldn't find those 372 00:19:00,669 --> 00:19:02,039 for you. They will give you the 373 00:19:02,039 --> 00:19:05,960 share permissions, maybe the share permissions plus upload a 374 00:19:05,960 --> 00:19:08,220 file to tell you if you have the 375 00:19:08,220 --> 00:19:09,710 right access. They didn't give us all the information we 376 00:19:09,710 --> 00:19:14,789 wanted. So here's some of the 377 00:19:14,789 --> 00:19:17,679 reasons that we share. First one is obvious. This is why everyone 378 00:19:17,679 --> 00:19:20,039 looks at share sensitive data. 379 00:19:20,039 --> 00:19:23,700 You look for H.R. share. Check out the salary, the person who 380 00:19:23,700 --> 00:19:25,840 hired you. What is he or she 381 00:19:25,840 --> 00:19:29,480 making? What is the IT person yelling at you that you broke 382 00:19:29,480 --> 00:19:30,620 this or you broke that, what 383 00:19:30,620 --> 00:19:35,990 he's making, all that fun stuff. you look for IT shares The 384 00:19:35,990 --> 00:19:37,390 Windows administrator has that 385 00:19:37,390 --> 00:19:41,980 big installer package for SCCM, and you download it, now its 386 00:19:41,980 --> 00:19:43,630 gonna get to server installed 387 00:19:43,630 --> 00:19:47,510 on. he's working hours that day,so he just opens a share in 388 00:19:47,510 --> 00:19:49,780 his documents. Opens it up and 389 00:19:49,780 --> 00:19:54,030 dumps it in an application share somewhere. Now this has become a 390 00:19:54,030 --> 00:19:55,200 dumping ground. and just all his 391 00:19:55,200 --> 00:19:58,520 stuff is all in there Scripts, pass words, all that stuff. All 392 00:19:58,520 --> 00:20:00,039 of them come from Windows 393 00:20:00,039 --> 00:20:04,650 maintenance at am . >> Exactly. [Chuckles]. >> Backups. We see 394 00:20:04,650 --> 00:20:07,020 this all the time. A backup 395 00:20:07,020 --> 00:20:10,130 folder that if a permission was opened up, the tool X, Y Z can 396 00:20:10,130 --> 00:20:11,900 go and grab a visual machine and 397 00:20:11,900 --> 00:20:17,059 make a backup or do a backup of the specific share, or all these 398 00:20:17,059 --> 00:20:18,440 different things, and they dump 399 00:20:18,440 --> 00:20:21,409 it to a regular share or some piece of storage storage. No one 400 00:20:21,409 --> 00:20:22,730 ever goes and lock down those 401 00:20:22,730 --> 00:20:27,789 permissions. We have got in control of several admin 402 00:20:27,789 --> 00:20:30,280 passwords by grabbing a backup 403 00:20:30,280 --> 00:20:34,500 and dumping that out into a Windows image file or V ranger 404 00:20:34,500 --> 00:20:35,559 or something like that and 405 00:20:35,559 --> 00:20:38,570 pulling local admin creds, pulling sometimes cash 406 00:20:38,570 --> 00:20:40,140 credentials anything you can 407 00:20:40,140 --> 00:20:42,740 pull off a hard drive system, you can pull off these back up 408 00:20:42,740 --> 00:20:45,630 images typically. Finally one of 409 00:20:45,630 --> 00:20:50,480 the more fun ones, source code a lot in shares. Source code for 410 00:20:50,480 --> 00:20:53,350 vendor tools or stuff created by 411 00:20:53,350 --> 00:20:57,210 those tools, one the ones that was interesting is we found a 412 00:20:57,210 --> 00:21:01,659 very large help desk system that 413 00:21:01,659 --> 00:21:05,950 let you attach and track changes tickets and all this by default 414 00:21:05,950 --> 00:21:07,159 when you set it up creates a 415 00:21:07,159 --> 00:21:10,470 share that you can map and everyone has access to that 416 00:21:10,470 --> 00:21:11,270 contains all of those 417 00:21:11,270 --> 00:21:15,809 attachments. If you're change control system, putting here's 418 00:21:15,809 --> 00:21:17,470 our original router and here's 419 00:21:17,470 --> 00:21:20,320 the change we're going to make, a nonredacted configuration 420 00:21:20,320 --> 00:21:23,309 internal, we could get those. We 421 00:21:23,309 --> 00:21:29,000 did dump ‑‑ we dumped configuration for switches and 422 00:21:29,000 --> 00:21:29,760 routers, firewall 423 00:21:29,760 --> 00:21:36,760 configurations. >> Passwords. >> Yeah, new passwords. Audit for 424 00:21:37,350 --> 00:21:38,870 service accounts. We know eight 425 00:21:38,870 --> 00:21:45,870 passwords, we can't change them, and here they are. Common stuff 426 00:21:46,700 --> 00:21:49,039 you can find. That's only a 427 00:21:49,039 --> 00:21:52,620 portion of what we do. Typically it's do after we have taken over 428 00:21:52,620 --> 00:21:54,610 a network. The goal is not to 429 00:21:54,610 --> 00:21:57,350 take over the network. This is the other stuff we go through. 430 00:21:57,350 --> 00:22:01,530 Paragraph. >> I was going to say 431 00:22:01,530 --> 00:22:05,740 admin is fine. You come to a bank with every account number, 432 00:22:05,740 --> 00:22:08,220 they listen. >> So the first 433 00:22:08,220 --> 00:22:15,220 thing we always do before is system fingerprinting. Once you 434 00:22:23,370 --> 00:22:24,470 have authentication. Anybody 435 00:22:24,470 --> 00:22:27,130 know the two shares that own every domain controller? 436 00:22:27,130 --> 00:22:31,140 Anybody? SYSVOL and log-on, You 437 00:22:31,140 --> 00:22:34,070 see those, you are looking at a domain controller. It tells you 438 00:22:34,070 --> 00:22:36,490 what that system is. If you see 439 00:22:36,490 --> 00:22:42,650 WDS, Windows deployment services, that kicks in. 440 00:22:42,650 --> 00:22:45,130 Deployment share is that one. 441 00:22:45,130 --> 00:22:51,190 SCCM, default shares hat they have put enabled. Older versions 442 00:22:51,190 --> 00:22:55,150 of IIS. Find the H.R. system, 443 00:22:55,150 --> 00:22:59,549 look for the IT share on one server or the H.R. share on one 444 00:22:59,549 --> 00:23:00,860 serve somewhere. You want to see 445 00:23:00,860 --> 00:23:05,890 where everybody's files are? Profile or users on has 446 00:23:05,890 --> 00:23:08,460 everybody's stuff. Sometimes 447 00:23:08,460 --> 00:23:12,100 those permissions aren't right. It will tell you a ton of what 448 00:23:12,100 --> 00:23:14,500 you are looking at. >> As a side 449 00:23:14,500 --> 00:23:17,940 note, if youre trying to be really stealthy, you can't do 450 00:23:17,940 --> 00:23:19,740 anything to actively identify 451 00:23:19,740 --> 00:23:24,549 Windows host use something like NBTEnum user info winfo and go 452 00:23:24,549 --> 00:23:28,179 to the domain computer groups, 453 00:23:28,179 --> 00:23:31,390 remove the dollar from the end, that will give you pretty much a 454 00:23:31,390 --> 00:23:32,870 full list of every work station 455 00:23:32,870 --> 00:23:36,929 and server in the domain. It's not going to get caught. >> You 456 00:23:36,929 --> 00:23:37,840 are not going to get caught. the 457 00:23:37,840 --> 00:23:39,169 only problem you're going to have with that is that if the 458 00:23:39,169 --> 00:23:40,659 dont clean their environment 459 00:23:40,659 --> 00:23:44,960 which no one does You will have half of them, disabled three 460 00:23:44,960 --> 00:23:47,250 years ago and don't exist. You 461 00:23:47,250 --> 00:23:54,250 can clean that up too. Okay. Beyond that, beyond what is the 462 00:23:56,360 --> 00:23:58,110 obvious shares, we have also 463 00:23:58,110 --> 00:24:02,480 found a couple of unique uses for us. We were actually talking 464 00:24:02,480 --> 00:24:04,000 earlier, probably about half of 465 00:24:04,000 --> 00:24:09,679 our attack vector two domain on all of our Pentest involve this. 466 00:24:09,679 --> 00:24:11,110 We will probably start to 467 00:24:11,110 --> 00:24:15,100 change, but the first one, the big one is, is the local 468 00:24:15,100 --> 00:24:16,870 administrator password reused? 469 00:24:16,870 --> 00:24:23,080 Remember the admin share. If you popped a box, got one work 470 00:24:23,080 --> 00:24:24,470 station, let's say it's through 471 00:24:24,470 --> 00:24:30,029 social engineering Or I don't know, you've got a share with 472 00:24:30,029 --> 00:24:33,000 WDS images and a local admin 473 00:24:33,000 --> 00:24:37,419 password. The next question is where is it re‑used? You can do 474 00:24:37,419 --> 00:24:42,429 a lot of different tools to find 475 00:24:42,429 --> 00:24:46,500 that. That's going to look like a log‑on attempt. It may get you 476 00:24:46,500 --> 00:24:49,169 caught. It may rise above the 477 00:24:49,169 --> 00:24:53,659 back beyond and radiation of the network. It's really simple, try 478 00:24:53,659 --> 00:24:55,669 and mount admin dollar on every 479 00:24:55,669 --> 00:24:59,370 work station with that account. If it works, bam, you know where 480 00:24:59,370 --> 00:25:01,450 it's re‑used. We're on pens all 481 00:25:01,450 --> 00:25:06,299 the time a thousand or , work stations, what we will find 482 00:25:06,299 --> 00:25:07,870 is sometimes clients are pretty 483 00:25:07,870 --> 00:25:11,169 good. Maybe put I T local administrator password, maybe 484 00:25:11,169 --> 00:25:13,950 H.R. and everybody the same one, 485 00:25:13,950 --> 00:25:20,200 at that point, if I can control of your work stations, 486 00:25:20,200 --> 00:25:21,320 it's only a matter of time. The 487 00:25:21,320 --> 00:25:28,320 domain will log in. You have got to be patient. The other piece 488 00:25:29,390 --> 00:25:30,539 that you can actually help out 489 00:25:30,539 --> 00:25:33,049 with is you can start to learn is it rename this in the same 490 00:25:33,049 --> 00:25:35,179 place everywhere. AdminwhaAdmin 491 00:25:35,179 --> 00:25:39,309 is one that we found. >> That is my favorite local administrator. 492 00:25:39,309 --> 00:25:41,470 Everyone should use this, 493 00:25:41,470 --> 00:25:46,230 adminwhatadmin. >> My favorite is still ‑‑ we have had several 494 00:25:46,230 --> 00:25:49,130 clients, per our recommendation, 495 00:25:49,130 --> 00:25:52,929 renamed the admin account or disabled it, which is good. 496 00:25:52,929 --> 00:25:53,610 Disabling the admin account 497 00:25:53,610 --> 00:25:57,289 prevents a lot of lateral expansion of your access. Then 498 00:25:57,289 --> 00:25:59,500 they will go around and create 499 00:25:59,500 --> 00:26:03,260 new ones, help desk, one for anti virus updates and patching, 500 00:26:03,260 --> 00:26:05,490 and they're all local admins. We 501 00:26:05,490 --> 00:26:09,159 give them a blank stare, being like, okay, did you think this 502 00:26:09,159 --> 00:26:12,070 through? So we also find that 503 00:26:12,070 --> 00:26:15,440 all the time, where there's local account that are reused. 504 00:26:15,440 --> 00:26:16,980 Sometimes they're local users. 505 00:26:16,980 --> 00:26:20,580 We can work with that. but more often theyre not local admins, 506 00:26:20,580 --> 00:26:25,779 That's just bad. Also, we will 507 00:26:25,779 --> 00:26:29,600 also find where if we get one usage set of credentials, 508 00:26:29,600 --> 00:26:33,830 responder, you know about that? 509 00:26:33,830 --> 00:26:36,669 It's really cool. I suggest look into it. We will get a 510 00:26:36,669 --> 00:26:38,409 credential from that and manage 511 00:26:38,409 --> 00:26:43,400 to crack it. Maybe we will get some local cash cred, thru 512 00:26:43,400 --> 00:26:46,240 mimikatz that have come to us. 513 00:26:46,240 --> 00:26:51,169 sadly theyre Regular domain user. No one important. But, you 514 00:26:51,169 --> 00:26:53,309 will often find again, you have 515 00:26:53,309 --> 00:26:56,549 , work stations. How often do you think the admins have 516 00:26:56,549 --> 00:26:58,669 gone through every single work 517 00:26:58,669 --> 00:27:00,760 station and make sure that people aren't on local admin on 518 00:27:00,760 --> 00:27:02,520 it?. How can you make sure that 519 00:27:02,520 --> 00:27:06,570 work station haven't been up graded from windows N T and has 520 00:27:06,570 --> 00:27:08,190 the everyone group in the local 521 00:27:08,190 --> 00:27:12,900 administrators? It turns out pretty often that's the case. I 522 00:27:12,900 --> 00:27:14,200 would say consistently we will 523 00:27:14,200 --> 00:27:17,610 find one or two work stations, or maybe a server where everyone 524 00:27:17,610 --> 00:27:19,770 is a local admin or domain users 525 00:27:19,770 --> 00:27:23,770 have been put in that group. We are now immediately escalated 526 00:27:23,770 --> 00:27:30,159 up. We do something to get 527 00:27:30,159 --> 00:27:33,450 credentials. Half the time there aren't any in there. Again, what 528 00:27:33,450 --> 00:27:34,919 we will do here is as soon we 529 00:27:34,919 --> 00:27:38,929 get creds, passwords whatever, we start scanning for the admin 530 00:27:38,929 --> 00:27:40,830 dollar share across all of these 531 00:27:40,830 --> 00:27:45,279 systems to see where we have admin access. There's one more 532 00:27:45,279 --> 00:27:49,679 step. >> Before we start writing 533 00:27:49,679 --> 00:27:52,610 these tools, these are the tools, with the exception of 534 00:27:52,610 --> 00:27:53,980 winshare, we kind of have access 535 00:27:53,980 --> 00:27:58,679 too. Nmap has the NSC script. they have been working on the on 536 00:27:58,679 --> 00:28:02,299 the authentication piece. it 537 00:28:02,299 --> 00:28:06,320 gives you the default permissions for that share. 538 00:28:06,320 --> 00:28:07,700 Upload a file to see if you can 539 00:28:07,700 --> 00:28:14,279 write to it, let's you know if you can read to it. It's a port 540 00:28:14,279 --> 00:28:16,909 scanner. It does port scanning 541 00:28:16,909 --> 00:28:21,330 beforehand. It checks for random ports aren't related to Windows 542 00:28:21,330 --> 00:28:23,899 traffic. It's easy to look for 543 00:28:23,899 --> 00:28:30,899 traffic. to see if it is an actual share mounting. System 544 00:28:31,460 --> 00:28:32,980 internal sharEnum , very hard 545 00:28:32,980 --> 00:28:38,200 for a pen tester to use it. It's finicky. If you are a Windows 546 00:28:38,200 --> 00:28:39,870 admin and your wanting to review 547 00:28:39,870 --> 00:28:43,179 your own share permissions and look at things, it's a great 548 00:28:43,179 --> 00:28:44,890 tool. It's hard for us to use 549 00:28:44,890 --> 00:28:49,289 this at scale if looking at , Windows system. We don't 550 00:28:49,289 --> 00:28:52,360 have a domain machine to run it. 551 00:28:52,360 --> 00:28:58,140 >> It won't let you put in creds. >> and then Nessus, our 552 00:28:58,140 --> 00:29:01,679 bigger complaint is slow. Faster 553 00:29:01,679 --> 00:29:06,299 in the last year. It will go to some level of recursion. It's 554 00:29:06,299 --> 00:29:08,039 not clear how far it will go 555 00:29:08,039 --> 00:29:10,730 down. It will pull some files and folders and tell you 556 00:29:10,730 --> 00:29:13,159 permissions there. It will tell 557 00:29:13,159 --> 00:29:15,480 you if you have write permission. Upload a file to 558 00:29:15,480 --> 00:29:16,970 verify if you have write 559 00:29:16,970 --> 00:29:23,970 permission. It's a vulnerability scanner. If it's a novel system. 560 00:29:25,409 --> 00:29:27,159 It's pretty obvious that 561 00:29:27,159 --> 00:29:31,690 something that's not a Windows Shares is going on. >> The 562 00:29:31,690 --> 00:29:33,450 plug‑in will actually look for 563 00:29:33,450 --> 00:29:38,630 several common share names, so it's also easy to identify. It 564 00:29:38,630 --> 00:29:40,720 will try invalid shares just to 565 00:29:40,720 --> 00:29:43,770 see if they exist >> Mataspoint has a couple of different 566 00:29:43,770 --> 00:29:46,539 modules that we used to we use 567 00:29:46,539 --> 00:29:52,110 this before we wrote shareEnum. You can try log on, which is 568 00:29:52,110 --> 00:29:54,140 just failed log on attempts. If 569 00:29:54,140 --> 00:29:56,809 you don't do it write. Successful log on attempts if no 570 00:29:56,809 --> 00:30:00,130 activity. Suspicious if across a 571 00:30:00,130 --> 00:30:07,130 thousand work stations. It will try to mount or try to upload a 572 00:30:10,470 --> 00:30:13,279 file to see if you have write 573 00:30:13,279 --> 00:30:17,760 permissions. And it is also used to be slow. and now the threaded 574 00:30:17,760 --> 00:30:19,909 their's because they rewrote 575 00:30:19,909 --> 00:30:26,909 their SMB libraries. WinShareEnum is one that we 576 00:30:27,730 --> 00:30:29,669 found while we were writing this 577 00:30:29,669 --> 00:30:35,720 tools it runs on dot net ., I believe. It's difficult to get 578 00:30:35,720 --> 00:30:38,659 running, when it does, it's 579 00:30:38,659 --> 00:30:44,620 works. but It if it gives failed access attempt it will retry 580 00:30:44,620 --> 00:30:45,659 just to make sure if it really 581 00:30:45,659 --> 00:30:49,220 got the failed access Again, that just looks ‑‑ it looks 582 00:30:49,220 --> 00:30:50,210 malicious if you you are looking 583 00:30:50,210 --> 00:30:56,240 at logs, why four failed log ins in a row. It will try to bind 584 00:30:56,240 --> 00:30:59,539 whether you gave creds or not. 585 00:30:59,539 --> 00:31:04,820 It's not necessarily what we want. We want to some clean 586 00:31:04,820 --> 00:31:06,830 information from it without 587 00:31:06,830 --> 00:31:11,010 being too noisy. Finally, you can always use explorer net use 588 00:31:11,010 --> 00:31:13,240 and SMB client. If you don't 589 00:31:13,240 --> 00:31:17,529 use SMB client if you have used a command line FTP client, that 590 00:31:17,529 --> 00:31:21,230 is SMB client, you can list the 591 00:31:21,230 --> 00:31:25,340 shares, you can connect to them, and you can do M get, M put, it 592 00:31:25,340 --> 00:31:26,850 doesn't say the permissions, you 593 00:31:26,850 --> 00:31:29,100 don't have permission, it yells at you. If you have permission, 594 00:31:29,100 --> 00:31:32,120 it will download or whatever it 595 00:31:32,120 --> 00:31:39,120 does. That will take forever. >> Okay. These are a lot of the 596 00:31:39,409 --> 00:31:41,019 tools that we use. They were 597 00:31:41,019 --> 00:31:44,669 great tools, but they didn't meet the need that we had which 598 00:31:44,669 --> 00:31:46,480 was to do it in bulk without 599 00:31:46,480 --> 00:31:51,649 sending a lot of traffic. We thought to ourselves we could be 600 00:31:51,649 --> 00:31:52,820 like a lot of other hackers and 601 00:31:52,820 --> 00:31:58,600 do it ourselves. We are not crazy. We don't want to 602 00:31:58,600 --> 00:32:00,890 implement SMB or ruby or pearl. 603 00:32:00,890 --> 00:32:04,710 At that time that really wasn't there. There actually is a group 604 00:32:04,710 --> 00:32:05,850 of people that have done this 605 00:32:05,850 --> 00:32:09,480 already and done a damn good job at it. and thats Samba, They 606 00:32:09,480 --> 00:32:12,610 have Samba can emulate a 607 00:32:12,610 --> 00:32:19,200 domain controller. I have one client that handed it in ‑‑ 608 00:32:19,200 --> 00:32:23,220 They're crazy, but, smart. 609 00:32:23,220 --> 00:32:26,059 Basically what we decided is use the same library that SMB client 610 00:32:26,059 --> 00:32:30,419 does. An extraction library 611 00:32:30,419 --> 00:32:33,769 which provides a lot of functions that you can use to 612 00:32:33,769 --> 00:32:35,390 call all of these different 613 00:32:35,390 --> 00:32:41,640 things. It's a lot faster. They have compiled I D L's that 614 00:32:41,640 --> 00:32:43,269 allows them to make RPCcalls 615 00:32:43,269 --> 00:32:47,809 quickly. More native and written in C, so in general it's going 616 00:32:47,809 --> 00:32:50,210 to be just faster than using A 617 00:32:50,210 --> 00:32:54,350 and interpreted language The other really nice benefit here 618 00:32:54,350 --> 00:32:56,779 is Samba team worked hard to 619 00:32:56,779 --> 00:33:00,610 make sure they can support all of the same stuff that Microsoft 620 00:33:00,610 --> 00:33:02,570 does. They are behind because 621 00:33:02,570 --> 00:33:05,820 they had to implement specifics after my company soft comes out. 622 00:33:05,820 --> 00:33:06,720 It's open source. They don't 623 00:33:06,720 --> 00:33:11,610 have the army of programmers that Microsoft does. It supports 624 00:33:11,610 --> 00:33:12,940 all the cool stuff we need 625 00:33:12,940 --> 00:33:17,590 NTLMV… NTLMSSP. Our tool doesn't do it. If we wanted it 626 00:33:17,590 --> 00:33:21,130 to, it would support cobra soft. 627 00:33:21,130 --> 00:33:25,320 If you have it, good for you. We are not implementing it until we 628 00:33:25,320 --> 00:33:30,360 find someone who does It made 629 00:33:30,360 --> 00:33:35,789 this a lot easier for us. >> It works everywhere, almost every 630 00:33:35,789 --> 00:33:38,200 printer. You will find the Samba 631 00:33:38,200 --> 00:33:42,130 code in various versions on almost every code out there. It 632 00:33:42,130 --> 00:33:43,899 has been battle tested and 633 00:33:43,899 --> 00:33:50,899 optimized by everybody Windows Share. >> A side note, a remote 634 00:33:51,000 --> 00:33:51,990 exploitation in command 635 00:33:51,990 --> 00:33:55,980 objection vulnerability in NETBIOS name damon for Samba 636 00:33:55,980 --> 00:34:01,580 that was released this week. It 637 00:34:01,580 --> 00:34:08,570 might be interesting to take a look at. We gather the DACL's 638 00:34:08,570 --> 00:34:11,240 and parse the aces and nice SCB 639 00:34:11,240 --> 00:34:16,119 so you can go to your spreadsheet of choice and filter 640 00:34:16,119 --> 00:34:18,839 everything out. We do also 641 00:34:18,839 --> 00:34:22,780 recursively go and go as deep as you want. We have actually 642 00:34:22,780 --> 00:34:24,500 pulled every permission from a 643 00:34:24,500 --> 00:34:28,659 file server that had over half a million objects on it. It took 644 00:34:28,659 --> 00:34:31,060 about minutes. It was a 645 00:34:31,060 --> 00:34:36,780 gigantic C S C file excel complaint. We also support 646 00:34:36,780 --> 00:34:38,359 anonymous. We can use regular 647 00:34:38,359 --> 00:34:45,359 creds. We support the DACL that's out there. So we do have 648 00:34:45,960 --> 00:34:49,679 a demo. >> At least a video, 649 00:34:49,679 --> 00:34:56,639 hopefully a demo. >> Hopefully this is easy to read. >> Is it 650 00:34:56,639 --> 00:34:58,579 good? >> Can everybody see. >> 651 00:34:58,579 --> 00:35:02,599 We are irritated when people throw up a terminal and its 652 00:35:02,599 --> 00:35:05,180 point font, black background on 653 00:35:05,180 --> 00:35:12,180 green. [Laughter]. >> Okay. So. Push print here, again. We have 654 00:35:14,869 --> 00:35:16,570 a nice menu that tells you all 655 00:35:16,570 --> 00:35:21,329 the flags. Updates. Make it big so you can see what we're 656 00:35:21,329 --> 00:35:25,050 typing. Not as nicely formatted. 657 00:35:25,050 --> 00:35:28,480 The first one is just enumerating share, we have a set 658 00:35:28,480 --> 00:35:30,470 of creds, a list, a IT or host 659 00:35:30,470 --> 00:35:36,950 name for line file of the targets we want. Get that. >> 660 00:35:36,950 --> 00:35:41,170 Hosting a Test lab. >> one of 661 00:35:41,170 --> 00:35:45,089 these creds have access to what shares are out there. >> We do 662 00:35:45,089 --> 00:35:48,579 sharEnum. We give it a user. You 663 00:35:48,579 --> 00:35:55,210 can do without the domain, but I will do the domain. Escape. if 664 00:35:55,210 --> 00:35:58,920 you you type it right you will 665 00:35:58,920 --> 00:36:01,700 have lockout count. >> Yeah. Yeah. We have locked out counts 666 00:36:01,700 --> 00:36:06,470 too. >> The password. Super 667 00:36:06,470 --> 00:36:13,470 strong password. We give it an output file just a C S V and 668 00:36:13,839 --> 00:36:17,829 provide the targets we give that 669 00:36:17,829 --> 00:36:22,990 a run. You will see nice pretty colors. >> It pauses too to make 670 00:36:22,990 --> 00:36:25,900 sure you put the password in 671 00:36:25,900 --> 00:36:29,849 right. >> You will see it goes through and telling you what it 672 00:36:29,849 --> 00:36:32,099 is actually getting. If it has 673 00:36:32,099 --> 00:36:34,290 some errors because you didn't have access, it will tell you 674 00:36:34,290 --> 00:36:36,910 that. If it pulled objects and 675 00:36:36,910 --> 00:36:40,849 information, it will tell you that. We give you color to see 676 00:36:40,849 --> 00:36:42,260 if you are getting red X's or 677 00:36:42,260 --> 00:36:47,460 getting some data back. We will show you what that looks like 678 00:36:47,460 --> 00:36:53,500 here. >> While he's pulling that 679 00:36:53,500 --> 00:36:56,869 up, for each of these demos we're also going to talk about 680 00:36:56,869 --> 00:36:58,349 steps if you are on the other 681 00:36:58,349 --> 00:37:01,960 side. We like breaking into things. Both used to be admins 682 00:37:01,960 --> 00:37:03,740 in the past. We understand we 683 00:37:03,740 --> 00:37:06,570 don't want to come and break everything and leave. And say 684 00:37:06,570 --> 00:37:12,180 here. [Chuckles]. >> We prefer 685 00:37:12,180 --> 00:37:16,040 to at least help you along the way. So let's talk about this 686 00:37:16,040 --> 00:37:17,700 one. This is very difficult. You 687 00:37:17,700 --> 00:37:20,790 need shares enabled. Something one of our client did, took 688 00:37:20,790 --> 00:37:24,730 surprise. They actually logged 689 00:37:24,730 --> 00:37:29,030 whenever someone used C dollar or admin dollar. Basically if 690 00:37:29,030 --> 00:37:30,790 they saw more than five in a 691 00:37:30,790 --> 00:37:34,490 time period, C product, generated an order. That stopped 692 00:37:34,490 --> 00:37:39,750 us real quick. That's tough. >> 693 00:37:39,750 --> 00:37:44,410 Have the six up here. Provide a lot of information, some headers 694 00:37:44,410 --> 00:37:45,920 of the user you ran the account 695 00:37:45,920 --> 00:37:50,619 with. So if you're combining these into a lot to you have 696 00:37:50,619 --> 00:37:52,260 this, you can tell what user you 697 00:37:52,260 --> 00:37:56,410 ran it with, the host, what the share name is, what type it is. 698 00:37:56,410 --> 00:37:57,680 Right now it will just show file 699 00:37:57,680 --> 00:38:03,300 shares. It will say whether its's a directory or a file. We 700 00:38:03,300 --> 00:38:08,890 pull the D A C L's we talked 701 00:38:08,890 --> 00:38:12,210 about. Authenticated users. You can actually go through and 702 00:38:12,210 --> 00:38:13,599 filter it. If we want to look 703 00:38:13,599 --> 00:38:18,820 for all those admins we talked about, now we can tell where 704 00:38:18,820 --> 00:38:20,550 this user has local 705 00:38:20,550 --> 00:38:24,290 administrator access. If this was a pen test, we would go to 706 00:38:24,290 --> 00:38:25,740 the system and pull the local 707 00:38:25,740 --> 00:38:32,680 administrator test, which we've done for you. If I can use the 708 00:38:32,680 --> 00:38:36,030 screens. Again, this same user 709 00:38:36,030 --> 00:38:42,490 account we have provided the credential. This is the format, 710 00:38:42,490 --> 00:38:43,720 the same one that metaspoint 711 00:38:43,720 --> 00:38:49,550 uses, the LM hash colon, the M T L M hash. You provide it that. 712 00:38:49,550 --> 00:38:51,440 You copy it straight out of P W. 713 00:38:51,440 --> 00:38:57,589 Make sure there's no space password. Make sure you put 714 00:38:57,589 --> 00:39:00,920 that. Tool left that run. You 715 00:39:00,920 --> 00:39:03,750 will see we're pulling results again for each of the host with 716 00:39:03,750 --> 00:39:07,270 a hash there. If we look at that 717 00:39:07,270 --> 00:39:14,270 output, again we can filter this up, make it with the same user. 718 00:39:24,400 --> 00:39:25,660 Still this one account. If we 719 00:39:25,660 --> 00:39:29,720 had run it with it with actual local administrator, we would 720 00:39:29,720 --> 00:39:31,500 see that admin share every 721 00:39:31,500 --> 00:39:35,099 where. I tend to running a big host, I will have him open just 722 00:39:35,099 --> 00:39:36,880 looking for admi$ with right 723 00:39:36,880 --> 00:39:41,040 access. That will tell you, you have a system where you have 724 00:39:41,040 --> 00:39:42,310 local admin. >> Let's take a 725 00:39:42,310 --> 00:39:48,780 minute to talk about local admin access. This is difficult. More 726 00:39:48,780 --> 00:39:50,140 often than not we find our 727 00:39:50,140 --> 00:39:52,960 client are using it accidentally. It's not a 728 00:39:52,960 --> 00:39:55,230 situation where they wanted 729 00:39:55,230 --> 00:39:59,200 everyone to have local admin. It was a situation they needed it. 730 00:39:59,200 --> 00:40:01,300 They set it up once and turned 731 00:40:01,300 --> 00:40:05,849 it off. This is where were doing that review, a whole lot of 732 00:40:05,849 --> 00:40:08,290 tools you can do to do groups. 733 00:40:08,290 --> 00:40:12,200 We listed a few that do a share. You can filter on admin$ dollar. 734 00:40:12,200 --> 00:40:13,829 It's a good review. You can do 735 00:40:13,829 --> 00:40:16,569 it probably once on your network. It will take a while if 736 00:40:16,569 --> 00:40:18,890 you have a large network. If you 737 00:40:18,890 --> 00:40:24,040 want to get more granular, you can use expert pro, nesus will 738 00:40:24,040 --> 00:40:25,750 do it, pull the group membership 739 00:40:25,750 --> 00:40:29,900 on every system. A couple of hours, I know that's a couple of 740 00:40:29,900 --> 00:40:32,359 hours most of us don't have. To 741 00:40:32,359 --> 00:40:35,700 be honest, keeping people from having local admin is one where 742 00:40:35,700 --> 00:40:38,700 I say three top things to 743 00:40:38,700 --> 00:40:45,700 recommend. Keep your pen testers frustrated. >> So the next demo 744 00:40:45,770 --> 00:40:47,470 here is the recursion. You will 745 00:40:47,470 --> 00:40:51,069 see we added same thing as before, password user name. 746 00:40:51,069 --> 00:40:55,060 Added R flag. Go 10 levels deep. 747 00:40:55,060 --> 00:41:01,630 We will ride it against one host. There's a third way you 748 00:41:01,630 --> 00:41:02,589 can provide hosting. You can 749 00:41:02,589 --> 00:41:06,569 provide a file that is one gear host name per line. You can 750 00:41:06,569 --> 00:41:08,880 provide one target the host name 751 00:41:08,880 --> 00:41:11,650 and whatever system you want to look at. It will go on 752 00:41:11,650 --> 00:41:12,579 everything in that system. That 753 00:41:12,579 --> 00:41:17,020 is what we will do here and let that run. The last one you will 754 00:41:17,020 --> 00:41:19,839 see in a second is limit it to a 755 00:41:19,839 --> 00:41:23,780 share to folders deep in a share. You can give it the full 756 00:41:23,780 --> 00:41:25,089 path where you want it to go. It 757 00:41:25,089 --> 00:41:30,280 will go and do a recursion against those. Will you see 758 00:41:30,280 --> 00:41:33,880 there, theres objects it 759 00:41:33,880 --> 00:41:39,500 found. We will open that guy up. Paragraph. >> While he's doing 760 00:41:39,500 --> 00:41:40,630 that, the last mitigate we 761 00:41:40,630 --> 00:41:44,520 wanted to talk about was admin passwords reuse. I would put 762 00:41:44,520 --> 00:41:47,520 this in my top three. When 763 00:41:47,520 --> 00:41:51,839 clients have basically.. you are pulling from an image or you 764 00:41:51,839 --> 00:41:53,150 have it set in group policy and 765 00:41:53,150 --> 00:41:57,930 preferences setting the local admin. If I take over one work 766 00:41:57,930 --> 00:41:58,750 station, I am effectively taking 767 00:41:58,750 --> 00:42:03,190 over all, which is bad. Ultimately all networks getting 768 00:42:03,190 --> 00:42:06,190 broken into every day. We have 769 00:42:06,190 --> 00:42:11,450 to accept that. It's our goal to contain people. One of the first 770 00:42:11,450 --> 00:42:12,880 lines of defense you can do that 771 00:42:12,880 --> 00:42:16,940 is preventing them from getting access to other work stations. 772 00:42:16,940 --> 00:42:17,810 If your users are running as 773 00:42:17,810 --> 00:42:23,210 regular user was U A C set to and everything is perfect, I can 774 00:42:23,210 --> 00:42:26,530 still, hopefully, get access to 775 00:42:26,530 --> 00:42:31,040 the local admin hash and the local admin credentials. From 776 00:42:31,040 --> 00:42:33,300 there, you prevented regular 777 00:42:33,300 --> 00:42:35,670 users from doing things there, the attacker can get access to 778 00:42:35,670 --> 00:42:37,910 every station. The optimal 779 00:42:37,910 --> 00:42:40,660 solution here is to disable the account, coz that could be 780 00:42:40,660 --> 00:42:41,819 difficult unless you're 781 00:42:41,819 --> 00:42:44,430 reimaging the system, if they fall off the domain, you are 782 00:42:44,430 --> 00:42:47,130 screwed. You will not get it 783 00:42:47,130 --> 00:42:51,540 back. There are a few other things. One prevent that account 784 00:42:51,540 --> 00:42:52,550 from logging on over the 785 00:42:52,550 --> 00:42:56,060 network. That way got at local console, if the system falls off 786 00:42:56,060 --> 00:42:58,510 domain. You prevented an 787 00:42:58,510 --> 00:43:03,920 attacker from using it over the network. It works well. 788 00:43:03,920 --> 00:43:04,990 Sometimes you can't do that. 789 00:43:04,990 --> 00:43:08,599 Some people haven't been able to get to it work. Networks are 790 00:43:08,599 --> 00:43:11,980 complex species. The next best 791 00:43:11,980 --> 00:43:15,630 option is to start to group them, have a pass word for 792 00:43:15,630 --> 00:43:19,250 admins, for I T, H.R., have a 793 00:43:19,250 --> 00:43:23,380 pass word for accounting, so that at least you contained your 794 00:43:23,380 --> 00:43:24,880 access, to only access the only 795 00:43:24,880 --> 00:43:30,230 information they already had. You want to get crazy, Microsoft 796 00:43:30,230 --> 00:43:31,170 theres actually some power soft 797 00:43:31,170 --> 00:43:33,470 script that you can get that they've put out that will set 798 00:43:33,470 --> 00:43:34,750 every password on every system 799 00:43:34,750 --> 00:43:38,450 in your domain to a random value. >> They released it as 800 00:43:38,450 --> 00:43:40,150 part of when they pushed that 801 00:43:40,150 --> 00:43:47,150 update to quote unquote kill pass the hash. They, and far PGP 802 00:43:47,420 --> 00:43:49,650 update disables the ability to 803 00:43:49,650 --> 00:43:54,270 store password and group policy. They provided a power source 804 00:43:54,270 --> 00:43:56,550 script that go through every 805 00:43:56,550 --> 00:44:00,369 work station. It will run against it set the local pass 806 00:44:00,369 --> 00:44:01,690 word to something random and 807 00:44:01,690 --> 00:44:08,089 dump it and throw in a key pass and some encrypted store, if you 808 00:44:08,089 --> 00:44:10,440 have to log in, there is it. You 809 00:44:10,440 --> 00:44:16,950 will not need it that often, so it's fine. You will see here, C 810 00:44:16,950 --> 00:44:19,930 S V have directories files, file 811 00:44:19,930 --> 00:44:25,180 shares, the permission for each and who has permission. Same 812 00:44:25,180 --> 00:44:27,460 thing, some format for each one. 813 00:44:27,460 --> 00:44:31,369 In this one that object file start to give us full 814 00:44:31,369 --> 00:44:35,579 directories levels deep. Our 815 00:44:35,579 --> 00:44:40,660 last demo here, you will see ‑‑ so we will give it a specific 816 00:44:40,660 --> 00:44:42,750 path. If you would look through 817 00:44:42,750 --> 00:44:46,349 the results that we have before you, a folder Smith. looks like 818 00:44:46,349 --> 00:44:49,060 a user directory, i wanna know 819 00:44:49,060 --> 00:44:51,829 everything what this user has in his user directory, We are going 820 00:44:51,829 --> 00:44:52,810 to run a hundred levels of 821 00:44:52,810 --> 00:44:59,810 recursion and run against this share. This has bitten me before 822 00:45:00,170 --> 00:45:02,619 where there's a file serve and 823 00:45:02,619 --> 00:45:06,810 go deep on one share, but they also have other shares that 824 00:45:06,810 --> 00:45:08,240 are massive and it will never 825 00:45:08,240 --> 00:45:11,829 finish if it has to run against all of them. You should be as 826 00:45:11,829 --> 00:45:18,829 specific as you want to be. So 827 00:45:19,720 --> 00:45:23,700 we've pulled that there. You notice that when you do a 828 00:45:23,700 --> 00:45:24,780 specific path , you have to do a 829 00:45:24,780 --> 00:45:31,780 SMB-colon-slash -slash which is standard. You have to add that. 830 00:45:36,040 --> 00:45:43,040 Let me pull up ‑‑ no. >> You're 831 00:45:44,069 --> 00:45:49,240 fine. >> Okay. >> So by the numbers. Right now this is some 832 00:45:49,240 --> 00:45:50,940 of the numbers we've pulled with 833 00:45:50,940 --> 00:45:54,000 the current version to see how fast it runs. It takes about 834 00:45:54,000 --> 00:45:55,740 seconds for a standard host and 835 00:45:55,740 --> 00:45:59,230 that includes Samba warming up and tools warming up. It will 836 00:45:59,230 --> 00:46:02,810 give a pause before you lock 837 00:46:02,810 --> 00:46:08,319 everything out. One host with some recursion for about 838 00:46:08,319 --> 00:46:09,400 objects takes about minutes, 839 00:46:09,400 --> 00:46:14,440 and a half minutes. This isn't quite as fast as we like it to 840 00:46:14,440 --> 00:46:16,480 be. We will try to make it 841 00:46:16,480 --> 00:46:20,760 faster. For what we're doing it's quicker. Finally a small 842 00:46:20,760 --> 00:46:26,280 network with limited lan links. 843 00:46:26,280 --> 00:46:30,160 We have remote locations connectivity. It took about 844 00:46:30,160 --> 00:46:34,200 or minutes to do window 845 00:46:34,200 --> 00:46:38,930 cells. We have used this in networks as large as , , 846 00:46:38,930 --> 00:46:41,150 work station servers. It will 847 00:46:41,150 --> 00:46:47,069 keep running. Sometimes it takes a little bit. >> As far as 848 00:46:47,069 --> 00:46:48,319 challenges, Samba is a big 849 00:46:48,319 --> 00:46:52,300 beast. There's a lot of stuff to it. More importantly, there's a 850 00:46:52,300 --> 00:46:53,400 patch that we are having to 851 00:46:53,400 --> 00:46:57,119 issue through Samba itself. The reason being if you try to do 852 00:46:57,119 --> 00:46:59,390 pass the hash, it supports it, 853 00:46:59,390 --> 00:47:03,470 but there is one portion where you pull extended attribute, 854 00:47:03,470 --> 00:47:06,230 DACL, start treating the pass 855 00:47:06,230 --> 00:47:11,810 word hash again and locks out accounts, so not good. Also it's 856 00:47:11,810 --> 00:47:13,819 written in C, haven't written in 857 00:47:13,819 --> 00:47:19,710 C in a long time, so terrible. Anybody has any questions, we 858 00:47:19,710 --> 00:47:21,819 will be around. Anybody here has 859 00:47:21,819 --> 00:47:27,400 written RPC code for Samba, we would like to buy you a beer. We 860 00:47:27,400 --> 00:47:28,150 have some questions for some 861 00:47:28,150 --> 00:47:32,500 other tools. Here is the contact info. Thanks, everybody. 862 00:47:32,500 --> 00:47:36,300 (Applause) .