1 00:00:00,000 --> 00:00:06,340 Hi everyone, I'm Nikhil Mittal and I'm presenting on Hacking with Human Interface Devices. 2 00:00:06,640 --> 00:00:09,160 Welcome to the Hardware Hacking Village. 3 00:00:09,740 --> 00:00:11,480 A couple of things about me. 4 00:00:11,820 --> 00:00:13,000 I'm a hacker. 5 00:00:13,740 --> 00:00:14,800 Still not audible? 6 00:00:16,040 --> 00:00:16,780 A bit louder. 7 00:00:16,960 --> 00:00:17,900 I'm a hacker. 8 00:00:18,100 --> 00:00:19,160 I'm a trainer. 9 00:00:19,480 --> 00:00:22,320 I speak at conferences. 10 00:00:24,140 --> 00:00:28,240 I'm in two open source toolkits, Cautelia and Nishan. 11 00:00:28,240 --> 00:00:33,500 So, Cautelia is the toolkit which we are going to have a look at today. 12 00:00:34,220 --> 00:00:39,840 It could be used to generate ready-to-use sketches for Arduino-like devices. 13 00:00:41,100 --> 00:00:46,660 And those sketches could be used for penetration testing or breaking into machines if you are 14 00:00:46,660 --> 00:00:47,600 authorized to do so. 15 00:00:48,460 --> 00:00:52,460 This is my Twitter handle and that is my blog, so follow me. 16 00:00:52,520 --> 00:00:53,620 I'm a sucker for followers. 17 00:00:55,180 --> 00:00:57,880 I'm generally interested in offensive information security. 18 00:00:58,240 --> 00:01:00,100 And new ways to get into systems. 19 00:01:01,120 --> 00:01:04,240 And I've spoken at a couple of conferences previously as well. 20 00:01:06,140 --> 00:01:12,060 So, what we are going to have a look at today is why should we use human interface devices? 21 00:01:12,520 --> 00:01:14,300 What is a human interface device? 22 00:01:15,220 --> 00:01:17,660 And obviously, a lot about my tool. 23 00:01:18,100 --> 00:01:21,800 We will also see some live demonstrations and hope they work. 24 00:01:22,080 --> 00:01:23,580 I've just tested everything in the morning. 25 00:01:23,780 --> 00:01:26,580 So, if something doesn't work, assume and trust me. 26 00:01:28,240 --> 00:01:32,740 And at last, we will talk about a couple of defenses against these attacks. 27 00:01:34,680 --> 00:01:36,660 So, I missed a slide. 28 00:01:36,840 --> 00:01:38,740 What is a human interface device? 29 00:01:39,160 --> 00:01:42,900 So, those of you who don't know it, it is something. 30 00:01:43,020 --> 00:01:49,340 So, we as humans interface with computers using different things like mouse, keyboard, touch, joystick. 31 00:01:50,180 --> 00:01:55,420 A human interface device is something which allows us to do that. 32 00:01:55,520 --> 00:01:57,460 For example, a keyboard is a HID. 33 00:01:57,580 --> 00:01:58,140 A mouse. 34 00:01:58,140 --> 00:01:59,480 A mouse is a HID and so on. 35 00:02:00,000 --> 00:02:03,580 So, why should we use these things in penetration tests? 36 00:02:04,140 --> 00:02:07,560 First and foremost, they are really powerful as you will see in a few minutes. 37 00:02:08,580 --> 00:02:16,720 Countermeasures like antivirus, HIPs, security teams, they trust these devices. 38 00:02:17,300 --> 00:02:23,800 For example, when you plug in a programmable keyboard, it's obviously detected as a keyboard. 39 00:02:24,360 --> 00:02:28,120 And I've rarely seen any corporate environment or any of my clients. 40 00:02:28,140 --> 00:02:31,200 Who block keyboards to be attached to their machines. 41 00:02:31,440 --> 00:02:36,260 A lot of people block mass storage devices, but no one really cares about keyboards. 42 00:02:38,980 --> 00:02:41,240 And the last thing is, it's really cheap. 43 00:02:41,380 --> 00:02:45,940 The device I'm going to use is a TNC 3.0 from pgrc.com. 44 00:02:46,020 --> 00:02:48,100 It's just like a $20-$22 device. 45 00:02:49,660 --> 00:02:53,620 So, you can literally use dozens of them in your penetration test gigs. 46 00:02:56,480 --> 00:02:57,820 There are so many devices. 47 00:02:57,820 --> 00:03:00,720 There are so many HIDs or human-driven devices which hackers can use. 48 00:03:00,840 --> 00:03:04,040 I've listed a couple of them which are really cheap and small in size. 49 00:03:04,360 --> 00:03:06,780 For example, TNC which I'm going to use today. 50 00:03:07,100 --> 00:03:07,620 OpenCubos. 51 00:03:08,420 --> 00:03:09,320 Arduino Micro. 52 00:03:10,120 --> 00:03:11,580 And a lot more devices. 53 00:03:11,800 --> 00:03:14,140 In fact, I've not listed here of them. 54 00:03:14,400 --> 00:03:15,580 There are so many devices. 55 00:03:16,120 --> 00:03:23,600 Just keep in mind that if you really want to use them in penetration tests, the size, the physical size should be small. 56 00:03:23,820 --> 00:03:26,320 For example, I've seen using guys, Arduino Duo. 57 00:03:26,320 --> 00:03:28,720 As a human-driven device, but it's like this big. 58 00:03:28,900 --> 00:03:29,960 At least this big. 59 00:03:30,060 --> 00:03:31,760 Like the size of a palm. 60 00:03:32,140 --> 00:03:37,340 So, it could not be easily hidden inside other devices. 61 00:03:40,840 --> 00:03:42,400 So, about my toolkit. 62 00:03:43,160 --> 00:03:43,640 Kautilya. 63 00:03:43,740 --> 00:03:47,960 It is named after some Indian guy who was a political thinker back there. 64 00:03:48,080 --> 00:03:50,800 So, do not think about it. 65 00:03:51,380 --> 00:03:52,620 It is written in Ruby. 66 00:03:53,300 --> 00:03:56,160 And it's available on my GitHub. 67 00:03:56,160 --> 00:04:00,440 It contains like 54 payloads right now. 68 00:04:00,500 --> 00:04:03,760 45 for Windows, 5 for Linux and 4 for OS X. 69 00:04:04,820 --> 00:04:07,400 So, your mileage may vary on OS X. 70 00:04:07,560 --> 00:04:09,940 Because I just ported it on VMware. 71 00:04:10,080 --> 00:04:11,240 I own a PC. 72 00:04:11,340 --> 00:04:12,640 I work on Windows technologies. 73 00:04:13,880 --> 00:04:17,000 But Windows payloads should be quite stable. 74 00:04:21,800 --> 00:04:22,400 Okay. 75 00:04:26,340 --> 00:04:32,040 So, Kautilya currently supports TNC++ 2.0 and TNC 3.0. 76 00:04:32,900 --> 00:04:38,440 So, as you will see, we can just input some things to this tool. 77 00:04:40,300 --> 00:04:43,260 And it has an old-school GUI, menu-driven thing. 78 00:04:45,180 --> 00:04:45,740 Okay. 79 00:04:45,760 --> 00:04:46,580 I'm scared of this thing. 80 00:04:49,800 --> 00:04:50,740 I'm still audible? 81 00:04:51,280 --> 00:04:51,840 Yeah. 82 00:04:51,960 --> 00:04:52,380 That's fine. 83 00:04:52,960 --> 00:04:53,520 Okay. 84 00:04:53,520 --> 00:05:03,540 And because Arduino supports only TNC devices, there has been a port of Kautilya for Arduino Micro by some awesome guy. 85 00:05:03,740 --> 00:05:05,240 So, you can check that one as well. 86 00:05:07,080 --> 00:05:09,800 And that brings us to the pen test scenarios. 87 00:05:10,520 --> 00:05:12,660 So, we'll be having a look at these things. 88 00:05:13,280 --> 00:05:15,180 So, these are the things which I've tested today. 89 00:05:15,860 --> 00:05:18,200 There are a lot more things which you can do with Kautilya. 90 00:05:18,260 --> 00:05:23,040 If there is any user of Kautilya, you can ask for a demonstration and I will do that. 91 00:05:23,520 --> 00:05:23,980 Right now. 92 00:05:25,300 --> 00:05:28,940 And the target I'm going to use is a Windows 7. 93 00:05:29,140 --> 00:05:30,080 It's not pirated. 94 00:05:30,620 --> 00:05:35,640 It's a demo version, but its activation has, I mean, it shows that it is not activated. 95 00:05:35,920 --> 00:05:37,760 So, do not think that it is a pirated one. 96 00:05:38,040 --> 00:05:43,100 I just created that, like, 30, 40 days back and it has expired a couple of days back. 97 00:05:43,300 --> 00:05:44,780 So, it's not a pirated thing. 98 00:05:44,980 --> 00:05:46,700 Do not complain to Microsoft, please. 99 00:05:49,140 --> 00:05:49,580 So... 100 00:05:51,760 --> 00:05:53,800 This is going to be our target. 101 00:05:54,260 --> 00:05:58,480 What we are going to do is we program our HID and connect it to this target. 102 00:05:59,760 --> 00:06:01,480 And let's see what happens. 103 00:06:02,220 --> 00:06:06,840 So, this is our device, TwinC3.0. 104 00:06:14,640 --> 00:06:17,840 As you can see, the target must be unlocked. 105 00:06:17,840 --> 00:06:20,960 Only in that case you can use this. 106 00:06:21,160 --> 00:06:25,100 I mean, it works even if the target is locked, but you won't be able to type anything. 107 00:06:25,720 --> 00:06:27,880 So, the target must be unlocked. 108 00:06:29,580 --> 00:06:32,220 And this is not a pirated version. 109 00:06:35,120 --> 00:06:35,640 Okay. 110 00:06:37,740 --> 00:06:39,680 So, this would be our target. 111 00:06:46,160 --> 00:06:48,820 And this is how Quartillion looks. 112 00:06:49,660 --> 00:06:51,280 It looks a bit ugly here. 113 00:06:51,400 --> 00:06:54,640 It is designed and developed on Ubuntu. 114 00:06:54,840 --> 00:06:57,420 But I'm using it on Windows right now. 115 00:06:57,520 --> 00:07:02,080 If you have Ruby installed on Windows, you can use this on Windows as well. 116 00:07:03,500 --> 00:07:08,440 So, our first Pinterest scenario is getting access to a target environment. 117 00:07:08,440 --> 00:07:13,080 And we would use a couple of reverse shells. 118 00:07:13,240 --> 00:07:15,580 That is, the shells which connect back to us. 119 00:07:16,300 --> 00:07:20,100 And the target, which is this machine. 120 00:07:21,600 --> 00:07:25,100 It is in a fairly restricted environment. 121 00:07:25,580 --> 00:07:29,100 On both TCP, only 80 and 443 are allowed. 122 00:07:29,400 --> 00:07:32,040 On UDP, only 53 and only ICMPV4. 123 00:07:32,480 --> 00:07:35,580 So, that's quite a restricted environment. 124 00:07:37,680 --> 00:07:41,820 So, Quartillion has a really old-school GUI. 125 00:07:41,880 --> 00:07:45,100 You have to enter your options like this. 126 00:07:45,600 --> 00:07:47,040 Is it visible to the back? 127 00:07:48,760 --> 00:07:50,260 You save one here. 128 00:07:51,580 --> 00:07:52,140 Sorry. 129 00:07:55,420 --> 00:07:58,080 Then, the shells are in the execute category. 130 00:07:58,220 --> 00:07:58,900 Press 2. 131 00:07:59,420 --> 00:08:01,820 And we have 11 options for shells. 132 00:08:01,900 --> 00:08:05,320 Let's use a reverse TCP, which is the seventh one. 133 00:08:06,480 --> 00:08:10,360 It shows a small help and the options you can enter. 134 00:08:10,480 --> 00:08:15,760 So, right now, it is asking for the IP address to which the reverse shell will connect back. 135 00:08:22,900 --> 00:08:24,060 And now, the port. 136 00:08:25,500 --> 00:08:29,380 So, let's use 443 because it is generally allowed through the firewalls. 137 00:08:30,960 --> 00:08:33,880 And now, it asks for the type of board you want to use. 138 00:08:33,880 --> 00:08:35,160 So, let's go to NC3. 139 00:08:37,880 --> 00:08:42,600 And it has created a sketch, which could be used in the Arduino IDE. 140 00:08:43,620 --> 00:08:46,760 And the sketch is in the output directory of Quartillion. 141 00:08:47,040 --> 00:08:48,280 So, let's just open that. 142 00:08:50,700 --> 00:08:51,260 Okay. 143 00:08:54,500 --> 00:08:55,060 So... 144 00:08:58,220 --> 00:09:01,040 So, this is our sketch. 145 00:09:01,040 --> 00:09:09,640 We'll just either open it in IDE, Arduino IDE, or just copy it and paste it here. 146 00:09:13,120 --> 00:09:14,680 Now, I'll connect the device. 147 00:09:15,000 --> 00:09:16,760 First, I'll upload the sketch to it. 148 00:09:17,920 --> 00:09:23,000 And because there is a sketch already loaded on it, first, I have to stop the device after inserting it. 149 00:09:26,020 --> 00:09:27,400 So, I'll just... 150 00:09:30,660 --> 00:09:33,480 Disable the auto-reboot and stop the device. 151 00:09:33,660 --> 00:09:35,020 Oh, it started working. 152 00:09:43,440 --> 00:09:44,040 Okay. 153 00:09:44,560 --> 00:09:47,480 So, the device is now ready. 154 00:09:47,700 --> 00:09:50,540 Now, we can upload our sketch to this device. 155 00:09:52,300 --> 00:09:54,020 Just press upload. 156 00:10:00,740 --> 00:10:02,300 Just stay more... 157 00:10:02,300 --> 00:10:03,140 Okay. 158 00:10:09,460 --> 00:10:11,040 No. Stop. Stop. Stop. 159 00:10:15,160 --> 00:10:15,660 Okay. 160 00:10:22,920 --> 00:10:24,900 I believe the sketch has been uploaded. 161 00:10:25,740 --> 00:10:26,880 Let's just try it out. 162 00:10:26,880 --> 00:10:32,860 so we I entered the IP address of my host machine and put 443 so let's start 163 00:10:32,860 --> 00:10:33,640 a listener on it 164 00:10:37,660 --> 00:10:38,140 okay 165 00:10:41,860 --> 00:10:47,000 so I'm going to use power cut which is a net cat code to PowerShell or you can use 166 00:10:47,000 --> 00:10:55,740 your net get on Linux as well so it's our choice and let's use net cat so for 167 00:10:55,740 --> 00:11:10,860 that I need to just change the IP address so this is IP of this Kali Linux 168 00:11:10,860 --> 00:11:12,480 running over here let's start 169 00:11:12,480 --> 00:11:13,920 you 170 00:11:25,740 --> 00:11:36,460 start a listener on port 443 and now if I connect this device to the VM that is 171 00:11:36,460 --> 00:11:45,340 our target let's see if it works so what it will do first if it is for the first 172 00:11:45,340 --> 00:11:49,580 time it is being used on a machine it waits for the drivers that minimizes 173 00:11:49,580 --> 00:11:55,600 everything and opens up a really small command prompt types in dark blue one 174 00:11:55,740 --> 00:12:08,600 just that is what I want so let me just disconnect and reconnect it 175 00:12:18,400 --> 00:12:19,760 be connected 176 00:12:19,760 --> 00:12:19,840 and 177 00:12:22,800 --> 00:12:23,840 let's see if it 178 00:12:28,700 --> 00:12:36,080 So the idea behind this thing is you can program it as a keyboard and it can type really fast 179 00:12:36,560 --> 00:12:37,480 and without errors. 180 00:12:38,020 --> 00:12:44,980 So in internal gigs you can assume it as you have access to a machine and you want to really 181 00:12:44,980 --> 00:12:49,280 fast add a user and do something like that then this device is for you. 182 00:13:09,940 --> 00:13:13,240 Let me just re-burn it to the device because it was. 183 00:13:14,100 --> 00:13:16,260 The different IP address previously. 184 00:13:23,540 --> 00:13:30,860 How I use it in external pentest gigs is I take a couple of dozen of these things, hide 185 00:13:30,860 --> 00:13:37,600 them inside either thumb drives or USB toys and things like that and then I drop it in 186 00:13:37,600 --> 00:13:43,080 my client's parking lots, cafeterias, etc. or near their office and the success rate 187 00:13:43,080 --> 00:13:43,220 is very high. 188 00:13:43,220 --> 00:13:44,980 It has been quite high, like 30 to 40 percent. 189 00:13:46,340 --> 00:13:51,920 So that's really, really good because once you have access to even a single machine you 190 00:13:51,920 --> 00:13:52,200 are in. 191 00:13:58,980 --> 00:14:02,180 So let's see if right now we have something. 192 00:14:03,560 --> 00:14:04,520 Oh, it sucks. 193 00:14:11,060 --> 00:14:11,560 Okay. 194 00:14:16,320 --> 00:14:18,460 Let me start a powercat listener. 195 00:14:24,360 --> 00:14:34,960 Let me start a powercat listener. 196 00:14:35,060 --> 00:14:35,600 Okay. 197 00:14:35,780 --> 00:14:41,120 So it drops partial scripts in the temp directory of the user because this is not working right 198 00:14:41,120 --> 00:14:41,300 now. 199 00:14:41,300 --> 00:14:49,120 let me check that script if it is something wrong with the script I'm 200 00:14:49,120 --> 00:14:55,180 trying to make it file less but right now this is what it does so it dropped 201 00:14:55,180 --> 00:15:02,320 these partial script and we be script in the temporary directory of the user and 202 00:15:02,320 --> 00:15:03,460 I don't know what's wrong with this 203 00:15:07,320 --> 00:15:15,720 nice it connects to my okay it's there so it took some time I'm sorry so we 204 00:15:15,720 --> 00:15:22,220 have this interactive PowerShell connect back from the target machine it 205 00:15:22,220 --> 00:15:26,780 took some time so now we can run the native commands 206 00:15:29,860 --> 00:15:30,500 PowerShell 207 00:15:32,320 --> 00:15:36,920 let's as well whatever you want and once you have a PowerShell session you 208 00:15:36,920 --> 00:15:44,860 can really like in couple of seconds upgrade it to a metapeter or in fact 209 00:15:44,860 --> 00:15:50,320 only using PowerShell you can do really cool stuff and I do a training for that 210 00:15:50,320 --> 00:15:57,040 so please join that so this is a reverse TCP proxy of your shell you can use it 211 00:15:57,040 --> 00:15:59,360 over internet in your external gigs or whatever 212 00:16:02,400 --> 00:16:07,700 another thing I would like to show you is a reverse ICMP shell please note that 213 00:16:07,700 --> 00:16:14,260 that reverse ICMP shell is not churning anything so if someone is looking at the 214 00:16:14,260 --> 00:16:18,840 network I'm sorry to say he will see everything your commands your responses 215 00:16:18,840 --> 00:16:24,620 I'm walking on and putting things right now the problem is if you include this 216 00:16:24,620 --> 00:16:30,760 base 64 Endo things they would be so huge that you will generate malformed ICMP 217 00:16:30,760 --> 00:16:31,060 packets 218 00:16:31,060 --> 00:16:32,040 so that is not 219 00:16:32,320 --> 00:16:45,740 we want so is this good I'm going to close this shell okay so if you want to 220 00:16:45,740 --> 00:16:50,800 have a look at it just in case you don't feel like that 221 00:16:55,280 --> 00:16:59,880 it's off I'm sorry I'll just turn this on 222 00:17:04,220 --> 00:17:06,340 and if you see we have 223 00:17:10,260 --> 00:17:12,800 only a couple of outbound rules 224 00:17:16,080 --> 00:17:19,240 let's enable outbound ICMP as well 225 00:17:26,400 --> 00:17:36,200 so for an ICMP reverse shell we'll again go to payload for windows execute and now 226 00:17:36,200 --> 00:17:42,640 let's select the reverse ICMP shell option or if you want I can show reverse 227 00:17:42,640 --> 00:17:49,320 HTTPS shell as well so the reverse HTTPS shell is a certificate paint 228 00:17:49,320 --> 00:17:50,780 completely encrypted shell 229 00:17:50,780 --> 00:17:55,100 so really hard to detect let's see both 230 00:17:55,100 --> 00:18:02,100 of them okay so nine notice that in this 231 00:18:02,100 --> 00:18:04,880 case you must have the listener on a 232 00:18:04,880 --> 00:18:06,640 Linux machine because you cannot turn 233 00:18:06,640 --> 00:18:16,040 off ping replies on Windows so this is 234 00:18:16,040 --> 00:18:18,960 my Kali Linux couple of other options 235 00:18:20,780 --> 00:18:21,760 we have a sketch 236 00:18:29,060 --> 00:18:38,080 let's just copy this a sketch to the Arduino IDE and let's upload at two 237 00:18:39,480 --> 00:18:40,080 devices 238 00:18:43,340 --> 00:18:44,700 now we must start 239 00:18:44,700 --> 00:18:50,200 a listener and if you notice the help here it will it top the comes out list 240 00:18:50,200 --> 00:18:50,760 if you notice the help here it will it shows the cargo it self it will come modern use 241 00:18:50,760 --> 00:19:00,840 command you need to execute on your Linux machine to turn off ping replies let me just 242 00:19:00,840 --> 00:19:17,580 copy this we have stopped ping replies by the OS it's our server which will reply to 243 00:19:17,580 --> 00:19:26,520 the pings and we need as a server we need the server from ICMP as such tool 244 00:19:26,520 --> 00:19:27,940 suit so let's start that 245 00:19:42,580 --> 00:19:47,420 so now our server is listening for ICMP probe 246 00:19:47,420 --> 00:19:47,560 so now our server is listening for ICMP probe 247 00:19:58,200 --> 00:20:01,300 now if I reboot the device that is connected to the victim 248 00:20:08,760 --> 00:20:16,900 it again will open up a command prompt and type some stuff in case of windows most of the payloads 249 00:20:16,900 --> 00:20:17,540 are in PowerShell 250 00:20:17,540 --> 00:20:18,040 . 251 00:20:20,640 --> 00:20:21,280 . 252 00:20:28,060 --> 00:20:28,700 . 253 00:20:28,700 --> 00:20:29,000 . 254 00:20:32,560 --> 00:20:33,200 . 255 00:20:33,200 --> 00:20:33,220 . 256 00:20:33,220 --> 00:20:33,240 . 257 00:20:33,240 --> 00:20:33,260 . 258 00:20:33,260 --> 00:20:33,280 . 259 00:20:33,280 --> 00:20:33,620 . 260 00:20:35,660 --> 00:20:36,300 . 261 00:20:36,300 --> 00:20:36,320 . 262 00:20:36,320 --> 00:20:47,880 an elevated shell, for example, to dump user passwords in plain. It uses the, we have our 263 00:20:49,040 --> 00:21:04,520 reverse PowerShell shell here. For example, let's run whoami again. So this is completely 264 00:21:04,520 --> 00:21:23,660 ICMP. Let's just exit this one. Yeah. So that was our first pentest use case, reverse shells 265 00:21:23,660 --> 00:21:31,220 or shell or shells for Windows machines. Let's use the second one. For example, in a social 266 00:21:31,220 --> 00:21:34,500 engineering campaign, you may be asked to gather user code. 267 00:21:34,520 --> 00:21:43,480 So let's try that. So for that, you need to go to the gathered category, which is one. 268 00:21:45,300 --> 00:21:53,260 And then the ninth one, which is dump passwords in plain. So what this script does is it needs 269 00:21:53,260 --> 00:21:59,540 to pull Mimikatz ported into PowerShell, which is a script called invoke Mimikatz. It needs 270 00:21:59,540 --> 00:22:04,500 to pull it from the internet. That's a bad part. It executes it in memory on the power 271 00:22:04,520 --> 00:22:10,800 of target, dumps, passwords, and paste it back or exfiltrate it to whatever you want. 272 00:22:11,340 --> 00:22:22,340 So let's use our local web server. So this is the URL of our script. We need not pass 273 00:22:22,340 --> 00:22:32,080 any argument. And let's exfiltrate to our own local web server. So that would be option 274 00:22:32,080 --> 00:22:32,640 number three. 275 00:22:32,640 --> 00:22:38,500 Post requests to your own website or web server. And that is my Kali Linux. 276 00:22:51,380 --> 00:23:00,860 And that is it. So we have a sketch. Let's open that sketch. 277 00:23:04,080 --> 00:23:22,760 Paste it here and upload it to the device. And now if I run or connect this device or 278 00:23:22,760 --> 00:23:32,160 reboot it here, now the mode of operation would be a bit different. It will open up 279 00:23:32,160 --> 00:23:36,980 an elevated shell because that script, obviously like any other method, needs administrative 280 00:23:36,980 --> 00:23:47,580 access to do that. But I don't think this user has administrative access. Let's see. 281 00:23:47,700 --> 00:23:56,460 I don't know. I think this user, okay, I don't know. Okay, it does. Now it presses 282 00:23:56,460 --> 00:24:01,980 left arrow and Y to say yes to this UAC prompt. 283 00:24:01,980 --> 00:24:04,780 And that thing right now is an elevated shell. 284 00:24:12,500 --> 00:24:18,100 So it types the PowerShell code for downloading a script which we specified and executing 285 00:24:18,100 --> 00:24:28,400 it. The time it takes prior to closing this is because it waits if the drivers needs to 286 00:24:28,400 --> 00:24:31,220 be installed. Also it has a reliability check. 287 00:24:31,380 --> 00:24:31,960 Okay. 288 00:24:31,980 --> 00:24:36,100 That if a user clicks in between where it is typing, it restarts the process. 289 00:24:39,000 --> 00:24:47,420 Okay. So as you can see, it was downloaded from my local web server and should be executed. 290 00:24:47,500 --> 00:25:00,520 Let's check. Okay. It is, it should be this. So this is obviously an encoded output. Let's 291 00:25:00,520 --> 00:25:01,760 just copy this. 292 00:25:09,100 --> 00:25:14,420 So Cortelia in the extras directory has scripts to decode things. 293 00:25:22,400 --> 00:25:29,380 So it has written the decoded data to Decoded.txt. 294 00:25:29,560 --> 00:25:30,060 Okay. 295 00:25:31,340 --> 00:25:39,780 And now if I open it, you can see that we have password in plain for that user. 296 00:25:40,480 --> 00:25:45,240 So it's quite powerful, but you must have internet access to pull the script. 297 00:25:45,280 --> 00:25:52,000 Right now what I am working on is to mount an SD card over this device which pulls the 298 00:25:52,000 --> 00:25:58,160 scripts from it so that we need not depend on access to an external web server in case 299 00:25:58,160 --> 00:25:59,060 of large scripts. 300 00:26:00,280 --> 00:26:06,900 So we used, we downloaded the script here because it is so huge that if, I don't think 301 00:26:06,900 --> 00:26:11,160 the device would be able to hold that and even if it holds that, it would take so much 302 00:26:11,160 --> 00:26:14,380 time to type that out, which is non-practical. 303 00:26:17,220 --> 00:26:20,720 So that was just another case. 304 00:26:22,440 --> 00:26:27,700 Okay, the third one is, obviously I cannot show it at DEF CON. 305 00:26:27,700 --> 00:26:34,540 Because both of these, these are my favorite ones, not really practical, but really cool. 306 00:26:34,720 --> 00:26:38,740 For example, this one, the first one, which means GOPT, which means secret in my language, 307 00:26:40,260 --> 00:26:42,380 that reads SSID names. 308 00:26:42,800 --> 00:26:50,720 So the idea behind that thing is, it looks for a specifically crafted SSID name and the 309 00:26:50,720 --> 00:26:56,300 command which it needs to execute, the target needs to execute, is within that SSID name. 310 00:26:56,400 --> 00:26:56,660 That is. 311 00:26:56,660 --> 00:26:58,320 And it never connects to that network. 312 00:26:59,080 --> 00:27:06,840 So there are slight chances that of WIPS or any Wi-Fi countermeasure may detect or may 313 00:27:06,840 --> 00:27:07,600 not detect it. 314 00:27:07,820 --> 00:27:12,260 So I'll show you how to configure it, but obviously I cannot run it here. 315 00:27:15,240 --> 00:27:17,300 So these are the back doors available. 316 00:27:20,940 --> 00:27:22,640 So this is how it works. 317 00:27:22,800 --> 00:27:26,280 You need to specify a magic string, a four character magic string. 318 00:27:27,080 --> 00:27:43,500 If I go by the example in the payload itself, or nothing, okay, so what happens now if 319 00:27:43,500 --> 00:27:51,440 I connect it to a target, is it will look for an SSID whose name, whose first four characters 320 00:27:51,440 --> 00:27:52,300 are open. 321 00:27:54,280 --> 00:27:56,640 And if the fifth character is open, it will look for an SSID whose name, whose first four 322 00:27:56,640 --> 00:27:56,860 characters are open. 323 00:27:56,860 --> 00:28:02,420 And if the sixth character is C for command, then the rest of the SSID name, up to 32 characters, 324 00:28:02,560 --> 00:28:03,500 is considered a command. 325 00:28:03,760 --> 00:28:09,420 For example, if you, if I run this on my machine, and you start a hotspot called open 326 00:28:09,420 --> 00:28:12,320 C who am I, it will execute who am I on the target. 327 00:28:13,420 --> 00:28:19,940 And to execute scripts, unfortunately, because SSID names are limited to 32 characters, you 328 00:28:19,940 --> 00:28:25,720 have to specify open U and the shortened path of Google URL shortener. 329 00:28:25,860 --> 00:28:26,620 So it will look for an SSID whose name is open U and the shortened path of Google URL 330 00:28:26,640 --> 00:28:30,860 But it takes that URL shortener, expands it, and pulls down the script from there. 331 00:28:32,360 --> 00:28:38,400 So I like it because it looks cool, but not really practical, unless you are sitting with 332 00:28:38,400 --> 00:28:43,040 a targeted antenna in a cafe across the road of your client, which is always possible. 333 00:28:45,340 --> 00:28:56,620 So okay, I cannot show this. 334 00:28:56,620 --> 00:28:58,440 Let's look at the next one as well, the rogue AP. 335 00:28:58,880 --> 00:29:00,840 So I can explain what it does. 336 00:29:01,020 --> 00:29:06,780 A Windows 7 and onwards, there's a feature of hosted wireless networks. 337 00:29:07,380 --> 00:29:14,720 So what this rogue AP does is this. 338 00:29:18,220 --> 00:29:23,820 You can provide SSID, which would be created, which would be used on the target machine. 339 00:29:24,960 --> 00:29:25,960 And that. 340 00:29:26,100 --> 00:29:26,600 Okay. 341 00:29:26,620 --> 00:29:30,700 And then there is a metadata bind started on the machine. 342 00:29:30,780 --> 00:29:39,300 So it is like you have SSID with proper key on the target, and you can connect to it. 343 00:29:39,420 --> 00:29:41,960 And as soon as you connect to it, there would be a bind metadata. 344 00:29:42,880 --> 00:29:45,440 This payload adds firewall exceptions as well. 345 00:29:45,580 --> 00:29:48,140 So there would be a bind metadata listening for it. 346 00:29:48,200 --> 00:29:54,900 You can just connect to it so that you have a private network on a single machine with 347 00:29:54,900 --> 00:29:55,700 a metadata session. 348 00:29:55,700 --> 00:30:02,100 So again, because my VM does not have a Wi-Fi card, unfortunately, I'm not getting an external 349 00:30:02,100 --> 00:30:02,380 one. 350 00:30:02,640 --> 00:30:05,400 So I have to create it in my machine, so I'm not doing that. 351 00:30:07,560 --> 00:30:08,760 So just close this. 352 00:30:11,340 --> 00:30:11,780 Okay. 353 00:30:12,640 --> 00:30:13,320 What else? 354 00:30:17,960 --> 00:30:20,180 We can drop infected files as well. 355 00:30:20,220 --> 00:30:24,300 Again, in case of Windows, PowerShell allows a lot of things to do. 356 00:30:24,660 --> 00:30:25,680 So we can drop infected files as well. 357 00:30:25,680 --> 00:30:32,720 We can drop a Word, Excel, Compile, Help file, LNK shortcut files on the target which are 358 00:30:32,720 --> 00:30:33,200 infected. 359 00:30:35,080 --> 00:30:38,220 Word and Excel files use auto-executable macros. 360 00:30:38,740 --> 00:30:43,320 So if there is something which detects auto-executable macros, it will catch that. 361 00:30:43,960 --> 00:30:46,960 But I've not seen any AV flagging it yet. 362 00:30:47,220 --> 00:30:49,620 So we can use it. 363 00:30:50,180 --> 00:30:55,660 Another thing is, as far as I know and I tried, it is not working. 364 00:30:55,660 --> 00:30:59,820 It is not programmatically possible to password protect your macros. 365 00:31:00,420 --> 00:31:03,260 So someone can open it and have a look at your macro. 366 00:31:03,880 --> 00:31:05,780 So let's just try this one out. 367 00:31:08,240 --> 00:31:08,840 Okay. 368 00:31:08,880 --> 00:31:10,280 I forgot the HTTPS. 369 00:31:10,480 --> 00:31:12,780 So I'll demonstrate the HTTPS shell first. 370 00:31:13,100 --> 00:31:15,420 I just missed that. 371 00:31:16,360 --> 00:31:16,960 So. 372 00:31:17,920 --> 00:31:18,520 Okay. 373 00:31:18,520 --> 00:31:18,740 Okay. 374 00:31:29,060 --> 00:31:29,740 Okay. 375 00:31:31,540 --> 00:31:36,960 So this is our listener, so this needs to be executed on the attacker's machine. 376 00:31:39,400 --> 00:31:41,940 And this is Windows Specific right now. 377 00:31:45,780 --> 00:31:51,560 So we have our listener running on our attacker machine. 378 00:31:51,940 --> 00:31:52,380 Okay. 379 00:31:56,340 --> 00:32:06,540 Let's choose 10 which is reverse HTTPS shell and the IP address of our machine and the port. 380 00:32:16,540 --> 00:32:21,880 Now let's just paste it here, upload it to the device. 381 00:32:28,720 --> 00:32:35,880 And now if I connect it to the target, let's see if it works. 382 00:32:47,680 --> 00:32:55,320 It is one of the smallest payloads in Cordula, just two lines needs to be typed on the target. 383 00:32:55,660 --> 00:32:59,600 It is really fast, doesn't need administrative privileges or anything like that. 384 00:33:21,020 --> 00:33:22,660 No, it didn't work. 385 00:33:31,440 --> 00:33:33,360 Yes, it's perfect, it should work. 386 00:33:43,420 --> 00:33:47,040 There could be some issue with the payload, let's not waste time on it. 387 00:33:47,220 --> 00:33:55,220 Keep one thing in mind that if you are using, if you are trying to use this with Arduino, 388 00:33:55,660 --> 00:33:57,400 you must install TNC 3.0 and things. 389 00:33:57,560 --> 00:34:03,140 So that is written in detail on the website of these vendors. 390 00:34:03,620 --> 00:34:11,280 Make sure that you use the correct board, which is in this case TNC 3.0 and the USB type. 391 00:34:12,120 --> 00:34:16,940 So these two things should be kept in mind. 392 00:34:17,240 --> 00:34:19,240 Okay, that could be firewall here. 393 00:34:19,440 --> 00:34:22,220 Just let me see if I have allowed port 4.3 or not. 394 00:34:29,780 --> 00:34:30,620 Okay, it's allowed. 395 00:34:30,840 --> 00:34:31,900 So it should work. 396 00:34:31,940 --> 00:34:32,940 I don't know why it didn't work. 397 00:34:36,980 --> 00:34:37,880 It didn't work. 398 00:34:37,980 --> 00:34:38,320 Okay. 399 00:34:38,640 --> 00:34:39,900 Again, sorry, it took time. 400 00:34:41,960 --> 00:34:49,320 So this is a completely encrypted certificate pinned session. 401 00:34:54,320 --> 00:34:55,100 It should work. 402 00:35:05,120 --> 00:35:09,080 So this was a reverse HTTPS shell. 403 00:35:10,360 --> 00:35:12,740 Now onto dropping infected files. 404 00:35:12,980 --> 00:35:14,140 Let's test. 405 00:35:14,340 --> 00:35:22,200 So the idea behind dropping infected file is just to have another way of breaking into a system. 406 00:35:22,360 --> 00:35:24,400 For example, if you can have a reverse shell. 407 00:35:25,320 --> 00:35:30,220 There is no need to basically drop files on a target. 408 00:35:30,380 --> 00:35:31,160 But let's see it anyways. 409 00:35:33,400 --> 00:35:36,100 So these are the options which we have with us. 410 00:35:36,240 --> 00:35:38,560 Let's go for MS Word. 411 00:35:42,320 --> 00:35:48,940 So it asks for a PowerShell one-liner or native command, whatever you want. 412 00:35:52,760 --> 00:35:54,380 So let's use MS Word. 413 00:35:58,060 --> 00:36:02,700 Okay, let's use a reverse shell, a one-liner reverse shell. 414 00:36:02,780 --> 00:36:05,120 Let's see if that works. 415 00:36:16,380 --> 00:36:16,860 Okay. 416 00:36:21,300 --> 00:36:23,240 So you can always copy it from here. 417 00:36:32,940 --> 00:36:36,960 And let me copy a one-liner reverse shell. 418 00:36:37,200 --> 00:36:42,240 It connects back to again 443. 419 00:36:44,840 --> 00:36:45,680 Okay. 420 00:36:56,040 --> 00:37:00,020 So it asks for, so if you want, you can change the name of the file as well. 421 00:37:10,500 --> 00:37:11,900 And if you see the sketch. 422 00:37:13,240 --> 00:37:24,440 You will see that it is nothing but just a simple PowerShell script which drops the file on the target. 423 00:37:26,000 --> 00:37:27,740 So let's just try this thing out. 424 00:37:36,340 --> 00:37:42,200 I need to execute this on the local machine because there is no MS Office on the target. 425 00:37:42,480 --> 00:37:45,980 So let me just reboot it here. 426 00:37:48,470 --> 00:37:51,200 So it will drop that file on the user's desktop. 427 00:37:59,040 --> 00:37:59,520 Hopefully. 428 00:38:17,640 --> 00:38:21,620 So it is a good thing to have if you want. 429 00:38:21,720 --> 00:38:27,720 You just want a different way to stay in a client's world. 430 00:38:27,720 --> 00:38:27,900 Okay. 431 00:38:27,900 --> 00:38:28,760 So let's try this machine on the target machine. 432 00:38:30,000 --> 00:38:35,080 So the Word file, this one, is the infected one. 433 00:38:37,820 --> 00:38:38,780 And, okay. 434 00:38:43,700 --> 00:38:46,620 If I start, let me start a new one. 435 00:38:47,120 --> 00:38:50,440 I have to start a listener before I open that file. 436 00:39:04,360 --> 00:39:05,080 Whoa. 437 00:39:07,560 --> 00:39:08,480 Okay, no. 438 00:39:10,480 --> 00:39:12,180 Let me just close this one. 439 00:39:13,300 --> 00:39:15,140 So it connected back actually. 440 00:39:23,520 --> 00:39:27,700 So this is how our infected file works. 441 00:39:27,700 --> 00:39:31,600 And hopefully we will have a reverse shell here. 442 00:39:34,500 --> 00:39:37,900 The flip side with this thing is this. 443 00:39:38,080 --> 00:39:42,120 Anyone can go to the macros and see what we are up to. 444 00:39:42,760 --> 00:39:49,960 So if you are really using it in a social engineering campaign, then you have to password protect it. 445 00:39:50,060 --> 00:39:52,440 Otherwise, anyone would be able to see. 446 00:39:52,480 --> 00:39:57,680 For example, if you are downloading a script, anyone looking at the macro would be able to see. 447 00:39:57,680 --> 00:40:01,040 Your IP address. 448 00:40:03,820 --> 00:40:05,420 So that's a flip side. 449 00:40:10,840 --> 00:40:12,100 Maybe it is taking time. 450 00:40:12,220 --> 00:40:14,200 Let's come back to it in a couple of minutes. 451 00:40:20,360 --> 00:40:20,920 Okay. 452 00:40:21,000 --> 00:40:22,520 A reverse meta printer. 453 00:40:24,780 --> 00:40:27,660 So there are two ways of getting a reverse meta printer. 454 00:40:27,660 --> 00:40:29,120 A reverse meta printer using this thing. 455 00:40:29,220 --> 00:40:32,420 The first one is, which we saw a couple of minutes back. 456 00:40:33,120 --> 00:40:39,120 Get a reverse power shell and use it to upgrade it to a meta printer. 457 00:40:40,920 --> 00:40:44,620 Or you can use this one. 458 00:40:46,140 --> 00:40:46,660 Okay. 459 00:40:47,200 --> 00:40:49,240 Six, which is execute shellcode. 460 00:40:49,500 --> 00:40:54,140 So you need just create a shellcode using msfvenom. 461 00:40:54,420 --> 00:40:55,280 Paste it. 462 00:40:56,400 --> 00:40:56,800 To... 463 00:40:58,800 --> 00:40:59,920 Okay, not this one, sorry. 464 00:41:01,040 --> 00:41:01,920 Not this one. 465 00:41:02,020 --> 00:41:02,360 Not this one. 466 00:41:05,500 --> 00:41:06,300 It is... 467 00:41:07,940 --> 00:41:08,540 Okay, sorry. 468 00:41:08,580 --> 00:41:09,240 It is the first one. 469 00:41:09,580 --> 00:41:11,280 So you can create... 470 00:41:12,800 --> 00:41:16,180 So msfvenom supports creating meta printer in power shell. 471 00:41:16,280 --> 00:41:20,700 You can just create that and execute it on the target and you will be fine. 472 00:41:20,960 --> 00:41:22,360 I'm not going to demonstrate that. 473 00:41:22,360 --> 00:41:25,460 We have already seen so many reverse shells. 474 00:41:34,040 --> 00:41:37,520 So defenses against these things. 475 00:41:37,760 --> 00:41:41,340 So you can always control installation of devices using group policies. 476 00:41:41,720 --> 00:41:48,680 But I have seen in real corporate environment and in my clients, what they do, they at max, 477 00:41:48,780 --> 00:41:52,200 they block mass storage devices and nothing else. 478 00:41:52,880 --> 00:41:56,920 So if someone is really smart enough and blocks installation of any hardware device 479 00:41:56,920 --> 00:42:01,140 or hardware device by class, then this thing could be blocked. 480 00:42:01,480 --> 00:42:07,520 But if someone is using, for example, so many antivirus vendors, block devices by VID, vendor 481 00:42:07,520 --> 00:42:08,400 ID and product ID. 482 00:42:08,640 --> 00:42:11,920 You can always change that by going here. 483 00:42:14,580 --> 00:42:15,180 Okay. 484 00:42:15,660 --> 00:42:17,820 And Arduino. 485 00:42:20,440 --> 00:42:21,040 Okay. 486 00:42:22,840 --> 00:42:32,300 Hardware, TNC, course and this one. 487 00:42:33,880 --> 00:42:34,880 Not this one. 488 00:42:38,320 --> 00:42:40,140 I believe it's this one. 489 00:42:40,360 --> 00:42:41,780 So it's there on my blog. 490 00:42:41,960 --> 00:42:43,440 I'm not able to recall it right now. 491 00:42:45,220 --> 00:42:45,740 Okay. 492 00:42:45,760 --> 00:42:46,160 Here it is. 493 00:42:46,380 --> 00:42:50,960 So you can always change these vendor ID and product ID. 494 00:42:50,960 --> 00:42:58,160 So if there is, you know that there is an antivirus or any endpoint protection which blocks 495 00:42:58,160 --> 00:43:04,780 a particular VID and PID, you can always mimic HP keyboard or Microsoft keyboard or 496 00:43:04,780 --> 00:43:05,420 whatever you want. 497 00:43:07,060 --> 00:43:08,980 So you can just change it here. 498 00:43:09,880 --> 00:43:16,920 So there's a list of vendor IDs and PIDs on usb.org and so many websites. 499 00:43:21,200 --> 00:43:26,040 So one defense is to, on Windows machines, is to use group policy. 500 00:43:26,260 --> 00:43:28,500 On Linux is to use UDAV. 501 00:43:28,900 --> 00:43:36,900 But the best thing is just put glue on, in all the USB ports but one and lock that USB 502 00:43:36,900 --> 00:43:38,080 device to the machine. 503 00:43:38,220 --> 00:43:39,280 So that's the best defense. 504 00:43:39,580 --> 00:43:46,020 If you have USB ports open, there are so many devices, as we saw a couple of minutes back, 505 00:43:47,020 --> 00:43:49,280 you can do really nasty things with them. 506 00:43:49,640 --> 00:43:58,180 And the best thing is to make your employees aware of the risks of attaching unclustered 507 00:43:58,180 --> 00:44:00,820 or new USB devices to their work machines. 508 00:44:01,560 --> 00:44:07,100 I mean, I've seen like in one of my Pentas gigs, this device didn't work. 509 00:44:07,200 --> 00:44:15,440 So it was, I used it that way that I used a two-port USB hub and connected the toy, 510 00:44:15,440 --> 00:44:20,800 and the device together inside the toy, and there was a single cable coming out of it. 511 00:44:22,060 --> 00:44:28,160 So it didn't work on one of the guy's machine, so they connected it in their colleague's machine 512 00:44:28,160 --> 00:44:31,500 and I got like three shells from a single device. 513 00:44:31,840 --> 00:44:34,420 So employee awareness is the best defense. 514 00:44:36,300 --> 00:44:38,060 And a couple of closing remarks. 515 00:44:39,120 --> 00:44:41,540 Bad guys are already using it. 516 00:44:41,680 --> 00:44:45,360 I have myself seen this with a couple of clients. 517 00:44:45,360 --> 00:44:46,780 Clients getting hacked by this thing. 518 00:44:47,420 --> 00:44:48,920 Even good guys are using it. 519 00:44:48,940 --> 00:44:50,120 It's not really something groundbreaking. 520 00:44:51,640 --> 00:44:58,160 And as long as operating systems and system administrators and countermeasures keep trusting things, 521 00:44:58,980 --> 00:45:00,180 these things will work. 522 00:45:00,320 --> 00:45:02,040 Because security ends with trust. 523 00:45:04,660 --> 00:45:07,080 Okay, so some shameless self-promotion. 524 00:45:07,180 --> 00:45:10,660 I do training for this thing, so have a look at it on my blog. 525 00:45:10,860 --> 00:45:12,480 And these are my contact details. 526 00:45:12,800 --> 00:45:14,940 You can find Quartile on my GitHub. 527 00:45:16,080 --> 00:45:18,100 There is another tool, open source tool I maintain. 528 00:45:18,220 --> 00:45:19,960 You can find it there as well. 529 00:45:21,420 --> 00:45:22,420 So that was all. 530 00:45:23,060 --> 00:45:23,800 Any questions? 531 00:45:27,480 --> 00:45:28,180 No questions? 532 00:45:29,540 --> 00:45:30,100 Thank you.