1 00:00:00,240 --> 00:00:06,480 This is lance, a first time speaker. he's doing an intro to backdooring operating system 2 00:00:13,600 --> 00:00:22,240 [ Applause ] >> Thank you, my name is Lance. I'm DC801 we run a hackers space in Salt Lake 3 00:00:23,040 --> 00:00:29,040 City. I wrote this presentation, kind of training material for new members of our hacker space 4 00:00:30,400 --> 00:00:36,316 and kind of to provide a basic introduction to do something kind of interesting with 5 00:00:37,760 --> 00:00:42,880 computer security and just kind of seeing, you know, what you can do with just basic tools. 6 00:00:43,680 --> 00:00:48,722 Not using anything complicated like ‑‑ Metasploit, or you know, any complicated coding. Or 7 00:00:49,760 --> 00:00:56,480 anything like this. So this is super introductory, I hope that you enjoy it. I like to give 8 00:00:56,800 --> 00:01:03,200 special thanks to NATDmac, metacortex, grifter, D3c4f and eveyone at DC801 here, and every 9 00:01:03,840 --> 00:01:08,800 one at this for helping me out with this presentation. You guys have been great. Just a little 10 00:01:10,560 --> 00:01:14,540 bit disclaimer, I'm not responsible for anything dumb that you do with this 11 00:01:16,160 --> 00:01:21,920 information. So ‑‑ if you do something dumb, don't say I learned this is from Nemus, here is his phone 12 00:01:22,440 --> 00:01:29,160 number. No. I'm not responsible. So what this presentation does not cover, I'm not going to tell 13 00:01:29,420 --> 00:01:35,160 you how to hide your backdoor from skilled forensic investigators. Most of the stuff 14 00:01:35,280 --> 00:01:40,940 you see here will probably be undetectable by regular users. But anyone who knows what they 15 00:01:41,240 --> 00:01:49,480 are doing will see this stuff immediately.And laugh at you. So just be warned that ‑‑ you can get in trouble 16 00:01:50,080 --> 00:01:56,980 and you're not hiding your tracks very well. Then the ‑‑ I thought it would be good to just 17 00:01:57,580 --> 00:02:01,900 kind of give you what I'm assuming your background is. So I'm assuming you have a 18 00:02:02,060 --> 00:02:10,160 familiarity with linux, and networking and windows command line, um, administration. 19 00:02:11,840 --> 00:02:20,020 So the goal of this talk is to take advantage of a user who has left their computer unlocked. Right? 20 00:02:20,160 --> 00:02:25,480 How many people here leave their computer unlocked to go to the bathroom. Every one raised your 21 00:02:26,180 --> 00:02:31,580 hand, you have done it. I do it, too. Right? So guess what happens. What happens when you 22 00:02:31,940 --> 00:02:38,520 do that and your coworker sees it you get David Hasselhoff, right? Sometimes you get this 23 00:02:38,580 --> 00:02:43,300 awesome picture of David Hasselhoff, right? And a great reminder of why you need to lock 24 00:02:43,620 --> 00:02:51,500 your computer, right? So I think was thinking we can get the David Hasselhoff in there by the 25 00:02:52,000 --> 00:02:55,320 time someone goes to the bathroom and comes back. So what else can we do, right? What 26 00:02:55,520 --> 00:03:00,580 other things can we do to the person who left their computer unlocked. Let's see how fast we 27 00:03:00,853 --> 00:03:05,893 can install a backdoor. Right? We have five minutes we want to get the backdoor installed, 28 00:03:06,133 --> 00:03:12,493 everything setup, and walk away, let them set down and start missing with them. So we're 29 00:03:12,640 --> 00:03:18,260 going to start using windows 7, setting up a Netcat backdoor. Netcat is really good, like the 30 00:03:18,640 --> 00:03:29,240 hello world of backdoors. Now, for this what we're using, we're using very basic tools we need 31 00:03:29,480 --> 00:03:35,660 a to set prebuilt. You have to do a‑‑ setup of all of your tools and everything beforehand 32 00:03:35,920 --> 00:03:41,240 so you are ready for when the user walks away from their computer. So you want to make 33 00:03:41,640 --> 00:03:46,932 sure that you have the files on a USB drive or on the Internet you can quickly download them 34 00:03:47,040 --> 00:03:53,415 and put them on your computer. Another thing you want to look for is portable applications. 35 00:03:53,800 --> 00:04:01,467 Portable applications are applications that don't require, DLLs, setup process, basically 36 00:04:01,640 --> 00:04:05,473 you put them on the computer and you can run them. 37 00:04:05,473 --> 00:04:09,273 So this is kind of my basic toolkit for windows 7. 38 00:04:09,980 --> 00:04:15,980 I'm using gViM, windows used to have edit, an awesome command line editor at 39 00:04:16,020 --> 00:04:23,420 16 bit. The new 64‑bit operating system doesn't have it. I found gVim, a portable binary, you 40 00:04:23,700 --> 00:04:32,100 connect to your netCat backdoor, you can use gVim to edit files. And Wget. Once you get on there 41 00:04:32,420 --> 00:04:37,878 you probably want more things you need a way of downloading that to the command line. 42 00:04:38,460 --> 00:04:46,043 This a great tool I found that is compiled for windows 64‑bit. There are 32‑bit out there. But it was kinda hard to find the 64-bit. 43 00:04:47,700 --> 00:04:53,700 Then the best place to get NETCAT is from the kali linux image. This is that. 44 00:04:54,400 --> 00:05:03,060 So ‑‑ we want to set up Netcat. So we get Netcat why we're going to grab it from and set up a backdoor. Right? 45 00:05:03,560 --> 00:05:11,394 Here in this command we're running Netcat with the listener on port 449 and telling it to execute the command line 46 00:05:11,780 --> 00:05:18,863 CMB. As soon as I connect to that port through Netcat as a client I'm going to get 47 00:05:19,140 --> 00:05:25,639 a command prompt. So before I can connect to it, I have to make the operating system allow 48 00:05:25,720 --> 00:05:32,920 me to connect to it. So I have to put Netcat somewhere, right? In the path, I have to do 49 00:05:33,260 --> 00:05:38,885 registry settings, and I have to disable that firewall, or add a rule to the firewall to allow 50 00:05:38,885 --> 00:05:46,647 me to get to that Netcat instance and also, I'm assuming that this point, the user log‑in 51 00:05:47,000 --> 00:05:53,792 has admin privileges. You need that to modify the firewall. This is an example I got actually 52 00:05:53,920 --> 00:05:59,220 expanded from the offensive security stuff. They have a great tutorial of setting up 53 00:05:59,660 --> 00:06:06,449 a persistant Netcat backdoor. I provided a link here and slides on their website, too. 54 00:06:07,920 --> 00:06:13,140 This is the basic windows command, if you're just not familiar with them. I thought I would put them in here 55 00:06:13,380 --> 00:06:18,100 just so you have something to reference on what their correlation to Linux commands are. 56 00:06:18,700 --> 00:06:25,720 The key here, mainly you're going to add new directories and items to the path. You're not 57 00:06:26,300 --> 00:06:32,300 constantly typing the full name path in there for the Netcat session. This is just kind of an 58 00:06:32,520 --> 00:06:39,937 example of what it looks like. So now that we have the firewalls disabled and Netcat 59 00:06:40,040 --> 00:06:45,691 running we now ‑‑ we have a persistent, we want to find the registration settings to allow 60 00:06:45,820 --> 00:06:51,070 Netcat to start, your computer reboots, but we want to get to it right now, we have the five 61 00:06:51,160 --> 00:06:57,160 minute window. Here is the VBS script, a visual basic script ‑‑ script that allows us to start 62 00:06:57,860 --> 00:07:05,200 Netcat and walkway. This puts Netcat in the background, and starts listening and don't wait 63 00:07:05,340 --> 00:07:08,180 for the use to restart the computer. 64 00:07:09,100 --> 00:07:12,320 We connect to the computer through Netcat here, 65 00:07:14,080 --> 00:07:20,000 you look at, this is probably ‑‑ it looks a little faded, I can't see. Basically it is just 66 00:07:20,600 --> 00:07:25,640 Netcat, we do the mode, the IP address and the port number. And we get connected and we have 67 00:07:26,280 --> 00:07:36,320 theCMD command prompt and access to the remote computers. This works great. Local LANs we will 68 00:07:36,540 --> 00:07:43,140 show you how to get to the firewall and connect that way. In this point working in the 69 00:07:43,440 --> 00:07:50,400 same office or same place with the target you can now connect to that computer from your 70 00:07:50,400 --> 00:07:57,520 computer and start messing with them. So if you're interested you can take care just to 71 00:07:57,920 --> 00:08:03,920 verify ‑‑ Oops, touched the cable, did it disconnect? 72 00:08:05,280 --> 00:08:36,520 (Technical difficulties, No Audio) 73 00:08:37,640 --> 00:08:48,040 All right. This is process explorer if you're not familiar with it.Process explorer let's us look at all of the processing on the operating system. 74 00:08:48,720 --> 00:08:54,160 going through this process and look at how Netcat works and how the processes works. You can use 75 00:08:54,680 --> 00:09:04,480 process explorer to see that Netcat is running thin background there, that is what 76 00:09:04,880 --> 00:09:09,720 is highlighted in the bottom. You can download process explorer and take a look at it. 77 00:09:12,120 --> 00:09:16,920 If you want to view connections to it, once you are connected the backdoor can, you can look 78 00:09:18,000 --> 00:09:23,120 at the Netcat has an executable coming to from another IP address. And a good tool for 79 00:09:23,840 --> 00:09:29,200 windows as the TCP view to view that. Now, so now we have connectivity to the box. 80 00:09:29,200 --> 00:09:40,720 So the next question is, okay. What can I do with the connectivity and the backdoor. What fun things 81 00:09:41,760 --> 00:09:45,920 can I do to the person has just left their computer unlocked and now they have come back? Right? 82 00:09:48,000 --> 00:09:55,200 So ‑‑ we, we, I have a list of pranks here. The one cool thing we can do, can have their 83 00:09:55,480 --> 00:10:02,920 keyboard time hello to them. Right? Every 100 seconds their keyboard is typing hello. They 84 00:10:03,160 --> 00:10:07,160 are working on code, and it was a types hello, go on forever. We can continuously cycle the cap 85 00:10:07,480 --> 00:10:16,680 lock button. Every one hundred seconds cap lock on and off. Can we can write a batch script 86 00:10:16,720 --> 00:10:26,640 spread to spread all over the place on their file system. Start notepad continuously. It 87 00:10:27,040 --> 00:10:32,560 starts notepad up, closes it, there it is again. Or you can have it start, this is really 88 00:10:33,440 --> 00:10:40,680 cool, you can have it start the website up, close it, there it is again. Start it up, close it, 89 00:10:40,960 --> 00:10:47,560 there it is again. You can make ‑‑ this is kind of cool, their keyboard, this makes a 90 00:10:48,000 --> 00:10:54,760 disco on the keyboard, it cycles the caps lock, scroll lock, it repeats the lights on the 91 00:10:54,760 --> 00:10:58,600 keyboard. It is really annoying. Because, I was testing these and trying to disable this one and 92 00:10:59,000 --> 00:11:03,520 it kept change everything when I was trying to turn it off. You know, and this is one of my 93 00:11:04,120 --> 00:11:10,840 favorites. You can continuously play the startup song, right? The best part about it is your 94 00:11:11,600 --> 00:11:18,920 coworker is like why are you restarting your computer, I'm not. It just keeps doing that. 95 00:11:19,520 --> 00:11:29,360 You know, this is the classic, popping the CD‑ROM drive in and out, right? Something weird is 96 00:11:29,880 --> 00:11:33,760 going on when your CD‑ROM just keeps going in and out in the old days. You get control of 97 00:11:34,400 --> 00:11:42,480 your computer, what do you do, Pop the CD‑ROM drive. So this is what the, this is what is called 98 00:11:42,880 --> 00:11:48,800 a fork bomb. So basically what this does is a piece of code or instructions that continuously 99 00:11:49,160 --> 00:11:53,840 eat up resources of the operating system. This is a fun thing. You know, they are typing 100 00:11:54,280 --> 00:11:59,680 along doing their stuff. You can start a fork bomb, and it will stop and halt, they have to reboot. 101 00:12:00,840 --> 00:12:07,760 Off stage, GOON interrupts: "New speakers?" - Lance: Me.. They are just my control panel. 102 00:12:07,760 --> 00:12:16,200 [ Laughter ] Applause ] [ Laughter ] 103 00:12:16,200 --> 00:12:25,680 Goon: To new speakers! Congratulations. (they do a shot) Cheers mate! 104 00:12:26,560 --> 00:12:35,800 Applause. 105 00:12:36,720 --> 00:12:49,640 inaudible. 106 00:12:50,200 --> 00:12:58,280 just a drunk hazard. [ Laughter ] This is another cool little thing. This is easy to get past 107 00:12:58,760 --> 00:13:04,120 if you know how to close a file, you know, control, kill a task. You don't know how to do this, 108 00:13:04,600 --> 00:13:10,400 this is super frustrating. Because it makes, like you hit the X, you minimize it, it just 109 00:13:11,480 --> 00:13:15,680 sits there in the desktop completely unable to do anything. This one is my 110 00:13:17,080 --> 00:13:23,400 favorite, so if you remoted into their computer through Netcat you can start talking to them 111 00:13:23,800 --> 00:13:27,760 with windows 7 because it has a text to speak engine. So you can start messing with them, 112 00:13:28,880 --> 00:13:36,360 start talking with them, saying hello. Hi, what's going on. You seem to be having trouble with your computer. 113 00:13:40,080 --> 00:13:46,000 So we had our fun, we've done everything. You know, and, so we might need, we 114 00:13:46,320 --> 00:13:51,240 might run into issues and might need to reboot their computer, because we feel like it, or 115 00:13:52,200 --> 00:13:59,560 happen after 30 seconds and walkout of the room saying it was not me, I'm not doing this. 116 00:14:00,120 --> 00:14:03,480 These are the shutdown commands for windows and command lines. 117 00:14:04,880 --> 00:14:12,280 This is another thing you can do to try to hide your code. So if someone sees what you're doing and you want to 118 00:14:12,760 --> 00:14:17,440 hide it so they don't know what the scrypt is, and can't use it again, right? Later in 119 00:14:17,440 --> 00:14:24,520 the office, you can use batch EXE and other ones here, these are sketchy backdoors that work 120 00:14:24,560 --> 00:14:31,800 really well. The VBS ones worked pretty well. Tried to power shell one, didn't have much luck 121 00:14:31,800 --> 00:14:35,600 with it. You can take your scrypt and turn it into binary code, at that point they have to 122 00:14:36,800 --> 00:14:43,560 live look at the binary and do things with it. Makes it a little bit more difficult to 123 00:14:43,640 --> 00:14:53,240 figure out how it works. Also kind of useful to be able to control the firewall on windows 7. 124 00:14:53,240 --> 00:14:56,280 These are all of the commands I thought were useful. You know, you can turn off all of the 125 00:14:56,360 --> 00:15:02,960 traffic. You can do all kinds of cool stuff with that. If you write a rule, you can delete it. 126 00:15:03,440 --> 00:15:06,080 You can control the windows firewall from the command line. 127 00:15:06,920 --> 00:15:15,960 So we set our scripts up and down a bunch of stuff, it is realtime. A great tool, you can use the "at" command to have 128 00:15:16,440 --> 00:15:20,760 stuff run later. You can setup your prank, do a bunch of stuff. Walkway from your terminal, get 129 00:15:21,400 --> 00:15:26,440 a glass of water and watch the guy who is frustrated with things that are happening to 130 00:15:26,760 --> 00:15:33,360 him. And this is a good command later on if you want your backdoor dial out, you can set 131 00:15:33,880 --> 00:15:39,120 it up with an at command and have it run at a certain time, or schedule it with a scheduler. 132 00:15:39,480 --> 00:15:43,880 That creates a process with the operating system that they can look at later. What is this 133 00:15:44,360 --> 00:15:51,400 program running every day at 3:00? But with at it is kind of invisible. You have to look at 134 00:15:52,120 --> 00:16:00,040 the at command and see all of the tasks set. Another good tool is S delete. This goes through 135 00:16:00,440 --> 00:16:07,440 and wipes all of the code, or basically what you tell it to it does a deep delete, better than 136 00:16:07,680 --> 00:16:14,760 normal delete, it doesn't leave as much fragmentation and remnants of the file. 137 00:16:15,080 --> 00:16:25,040 So we have gone over windows. Let's go to Linux so Linux admin. He typing away and goes to the bathroom 138 00:16:25,760 --> 00:16:32,800 and leave the shell in. Has the VPNN, the SSH, he is not going to close the session. 139 00:16:33,800 --> 00:16:40,320 So ‑‑ what can we do to mess with the Linux user or just the Linux consul that is open? At this point 140 00:16:41,080 --> 00:16:51,560 we're going to need a Linux tool kit, too. So another crucial to is the autoSSH. In this case, I 141 00:16:52,160 --> 00:17:00,920 went out and compiled GNU Netcat. I had a lot ‑‑ a little bit of trouble with it, shred 142 00:17:01,420 --> 00:17:08,480 and screen are useful tools. The great thing about auto SSH it is a persistent the backdoor. I 143 00:17:08,480 --> 00:17:12,060 It doesn't require any other binary so once you compile it. 144 00:17:12,220 --> 00:17:17,420 I took it from one machine to another and it worked just fine with that compiled version and just one file. 145 00:17:18,680 --> 00:17:23,180 So GNU Netcat doesn't have a persistent listener, like the windows 146 00:17:23,340 --> 00:17:33,940 Netcat did. In this version I had to do a while loop on the Netcat listener. The reason I 147 00:17:34,360 --> 00:17:37,640 did this, is because the listener would listen to one inbound connection. So if you 148 00:17:37,740 --> 00:17:41,120 had a connection to it, it would do everything. If you dropped the connection it would stop the 149 00:17:41,320 --> 00:17:47,880 process and exit. So I set in a do while loop so I could continue to connect to it. 150 00:17:48,000 --> 00:17:56,480 Here we can see that Netcat listen on port 445, anytime you want to connect execute and then bash. 151 00:17:58,580 --> 00:18:07,020 Then again ‑‑ then again here is the Netcat backdoor on Linux. You can use Wget and copy it, 152 00:18:07,140 --> 00:18:12,340 copy it into the user bin so its in path, setup the Ip first tables. The critical thing you 153 00:18:12,440 --> 00:18:20,440 want to know about the listener, we want to disconnect the command line user from the 154 00:18:20,600 --> 00:18:24,680 process. So when they exit their terminal and go and do something else, and log into a different 155 00:18:25,000 --> 00:18:30,020 machine, we still get to that process and that process is not owned by that user. 156 00:18:31,880 --> 00:18:39,160 So I was trying to think of a good way to hide the Netcat to start on boot. I think the best place I 157 00:18:39,160 --> 00:18:43,720 could find was the init.d process. There is a bunch of scripts ‑‑ in there, the start up scripts. 158 00:18:44,220 --> 00:18:54,880 People are less likely to look at that. I constantly look at my RC.local files. If you put it in there it is more than likely to be discovered. 159 00:18:57,000 --> 00:19:01,820 Yet again, use Netcat the version IP address, port, and you connect to it. 160 00:19:02,400 --> 00:19:06,100 With the Linux version it is a little different than the windows version. You're not 161 00:19:06,600 --> 00:19:11,640 going to get the actual command prompt that you're used to. You're going to get a blank 162 00:19:12,140 --> 00:19:17,920 screen that will have a cursor in it. You do have a connection to the batch shell, if you type 163 00:19:18,180 --> 00:19:22,900 LS or something like that. You will see the command output, but not the standard Linux terminal. 164 00:19:23,300 --> 00:19:29,040 This is critical, because you connect to it and think that something is wrong with it 165 00:19:29,180 --> 00:19:35,360 because I'm not seeing the batch prompt. In this version of Netcat, when I was connected it, 166 00:19:35,520 --> 00:19:38,320 I did not see a batch prompt, so something to look out for. 167 00:19:41,060 --> 00:19:46,060 So if we want, so now that we have everything installed and setup, we kind of what to verify it is working. 168 00:19:46,180 --> 00:19:47,980 We have everything that we need. 169 00:19:48,300 --> 00:19:55,180 So I use net stat‑LPTUN. That matches processes to listening ports. 170 00:19:55,820 --> 00:20:04,240 So, here I can see that Netcat is listening on 445 and accepting connections from any IP address. 171 00:20:05,500 --> 00:20:13,340 Or it is listening on all available ‑‑ IP addresses. So now we've got connectivity, and 172 00:20:13,440 --> 00:20:19,480 same thing with it windows box. Now our Linux pranks, right, this is the cool pro scrypt that 173 00:20:19,700 --> 00:20:26,180 I found. If they are using Linux as their main desktop and they browse, you can put this in 174 00:20:26,380 --> 00:20:32,940 line, basically it takes every image that they brows to and turns it up side down. Pretty 175 00:20:33,280 --> 00:20:39,420 awesome. We have a Linux fork bomb. We can take the system to a crawl. We can write to the 176 00:20:39,700 --> 00:20:49,360 user terminal. If the system is local. This is annoying. You can cat random data to the computer 177 00:20:49,360 --> 00:20:55,060 bell sound. Right? So they are connected, everything is going fine, and just a bunch of 178 00:20:55,360 --> 00:20:58,380 garbage and noise comes coming out of their computer. Pretty funny. 179 00:21:00,700 --> 00:21:09,000 Then, so this is a cool little prank. This turns everything in the terminal to ‑‑ bork bork. 180 00:21:09,140 --> 00:21:17,060 It is all formatted the way it is supposed to do, but everything is just bork, bork, bork, bork, bork. 181 00:21:19,440 --> 00:21:32,160 This has been a classic prank at my work. My boss did this to me on my first day. So you send 182 00:21:32,240 --> 00:21:36,160 star wars to their terminal. They are typing along and configure the system. You log‑in 183 00:21:36,160 --> 00:21:45,360 and tell them towel blinking lights .NL and find the process, their PTS instance that they're 184 00:21:45,360 --> 00:21:52,080 connected to and they cannot do anything with that terminal except watch "Star Wars." It is 185 00:21:52,240 --> 00:21:56,400 really annoying. Because you don't own the process either. It is constantly sending stuff to 186 00:21:57,120 --> 00:22:01,760 your terminal. Pretty funny. Another cool thing you can do, you can said fortunes to the 187 00:22:01,760 --> 00:22:07,360 user terminal and use C matrix, which is a matrix screen to their Linux terminal. They are 188 00:22:08,000 --> 00:22:14,080 supposed to be able to type and do stuff. But you can still see the output. but its just clears 189 00:22:14,480 --> 00:22:20,720 and refreshes everything. It is pretty funny. This is kind of cool. You can play with the command bell. 190 00:22:20,720 --> 00:22:24,960 command bell, you know that annoying bell that goes off all of the time when you hit mistake, hit enter, or try 191 00:22:25,220 --> 00:22:30,940 to tab something that is not there. Put that in a loop and have it go off randomly. 192 00:22:30,940 --> 00:22:36,660 They will be like man you need to turn off your command bell, that's pretty bad, all those mistakes that you are making. 193 00:22:40,380 --> 00:22:45,640 Just, again, going over nohup so ‑‑ it is kind of what you want to do, 194 00:22:45,640 --> 00:22:52,320 if you forget to nohup, this is easy, you start the command, you're like, crap, I didn't nohup it 195 00:22:52,560 --> 00:23:00,580 the process it's still being ran by the user, you can then do a control Z, 196 00:23:01,080 --> 00:23:09,440 background the process and the percent disown one, is kind of the equivalent of nohup, but nohup does work better than this. 197 00:23:09,580 --> 00:23:14,100 I do that every once in awhile I'll start a process, it takes forever, I want to go do something else. 198 00:23:14,200 --> 00:23:20,500 So I will disconnect from the process and disown it and it will still run in the background and my terminal session can die. 199 00:23:23,440 --> 00:23:32,160 These are PHP compilers. If you write great pranks in PHP you can compile it and Hide the the code from 200 00:23:32,200 --> 00:23:36,020 users and like with the batch dir and all the other stuff. 201 00:23:37,860 --> 00:23:47,560 So, Netcat. Netcat so we've kinda at this point we've built a backdoor into both Windows and Linux. 202 00:23:47,560 --> 00:23:56,260 We've got way's to get into it but Netcat is kind of rough. We can only connect to it if we are on the LAN, 203 00:23:56,540 --> 00:24:00,220 It's not Encrypted, it's kinda dangerous to leave it open to everyone. 204 00:24:00,420 --> 00:24:06,420 So I don't want to open up a firewall port on my firewall and allow access into it remotely. 205 00:24:06,420 --> 00:24:08,420 Because that would be bad it's not encrypted. 206 00:24:08,420 --> 00:24:12,800 So now what else can we do with this? How could we get passed the 207 00:24:12,800 --> 00:24:16,540 firewall easily and get back to this Netcat instance. 208 00:24:18,300 --> 00:24:21,380 So what we're going to do is setup a persistant SSH Tunnel. 209 00:24:22,620 --> 00:24:30,000 What's were going to do with it, is have it go out from the system and connect back 210 00:24:30,360 --> 00:24:36,440 to a server that we have, somewhere on the internet, use a VPS or whatever. 211 00:24:37,860 --> 00:24:49,120 Then it's going to map a port locally, on that machine to a port locally on the remote machine. 212 00:24:50,040 --> 00:24:58,160 So if they allow SSH out or if they allow a port out they'll maintain a session connection outside to the firewall 213 00:24:58,160 --> 00:25:03,620 to your server and then you can log into your server. 214 00:25:04,080 --> 00:25:06,080 Connect to that port on your server and it tunnels 215 00:25:06,780 --> 00:25:14,820 through the SSH connection back to that users machine. 216 00:25:16,380 --> 00:25:18,900 So this is reverse SSH Tunneling. 217 00:25:20,580 --> 00:25:26,760 So here we use SSH fN-R the R is the remote port. 218 00:25:26,760 --> 00:25:32,720 and we are saying hey we want to loop back on this machine to 22 219 00:25:32,720 --> 00:25:34,720 and then so what that's going to do is 220 00:25:34,720 --> 00:25:36,720 on my remote linux server that's my VPS it's somewhere out 221 00:25:36,720 --> 00:25:42,500 on the internet it's going to put port 10,000 as a listening port 222 00:25:42,660 --> 00:25:46,640 that going to come back and map to SSH on this local machine here. 223 00:25:49,040 --> 00:25:52,520 Here is just kind of a more detailed example of how it works. 224 00:25:53,440 --> 00:25:55,880 So I don't have to use 22 225 00:25:55,880 --> 00:25:57,880 I could just use 226 00:25:57,880 --> 00:25:59,880 So I've got my netcat port listening right? So I could 227 00:25:59,880 --> 00:26:06,880 Take this SSH Instance and map it to my netcat backdoor. 228 00:26:06,880 --> 00:26:13,000 So this point it's now by passing their firewall, I can connect to a linux remote machine. 229 00:26:13,140 --> 00:26:18,620 So if i'm at my friends house I can go home and mess with him. 230 00:26:18,620 --> 00:26:27,580 So I go home Iog into my linux VPS, I connect to the port, come back have acess to the SSH instance. 231 00:26:27,580 --> 00:26:32,660 So you're probably wondering well what about passwords, do I have to enter the password or anything? 232 00:26:33,100 --> 00:26:43,020 If you generate SSH keys, you can take the SSH key and put it on your remote server and allow it 233 00:26:43,020 --> 00:26:51,020 to come, allow that remote connection to just automatically authenticate itself. So you can 234 00:26:51,200 --> 00:26:57,200 use SSH key gen and then do the SSH copy I D‑back to your remote server. So now we can set up 235 00:26:57,280 --> 00:27:04,197 like a Chron job, a scheduled task and have this ‑‑ SSH remote instance run automatically while we're 236 00:27:04,320 --> 00:27:10,903 not there. So on Linux you can use autoSSH to make it persistent. After they 237 00:27:11,040 --> 00:27:21,280 disconnect, the Internet is kind of buggy at times, it disconnects and auto 238 00:27:22,240 --> 00:27:29,600 reauthenticate the connection back to your server. That's great in Linux. You can do the 239 00:27:29,600 --> 00:27:35,600 same thing in windows. There is a command line utility called plink, part of the putty library 240 00:27:35,680 --> 00:27:43,638 you can use to do remote reverse shells back to Linux systems. You can use this to set up an 241 00:27:45,920 --> 00:27:53,504 SSH to reverse shell to your linux instances to your netcat persistence intance. i was 242 00:27:53,600 --> 00:28:00,516 trying to find the equivalent of auto-ssh for windows 7, My encrypted tunnel came close. but 243 00:28:02,560 --> 00:28:08,560 it has a setup, and a gooey and a system trace it is obvious it is installed. You can make it 244 00:28:09,920 --> 00:28:15,920 portable, but go through a bunch of stuff. That's on my list to do, to expand my presentation. 245 00:28:17,920 --> 00:28:30,080 At that point we set up a backdoor using basic tools. We have not done binary 246 00:28:32,000 --> 00:28:38,000 manipulation, we just have remote access to the system through, just basic admin tools. 247 00:28:39,040 --> 00:28:45,040 Right? So now I'm going to talk a little bit about Metasploit. So it takes all of this, we had 248 00:28:45,120 --> 00:28:54,080 to do the prep work and get the tools in place. It takes less of that and makes it a little bit 249 00:28:54,080 --> 00:29:02,080 more easy to manage. So one of the key to Metasploit you need to understand vulnerabilities, 250 00:29:02,080 --> 00:29:07,330 exploits and payloads. Vulnerabilities are places in which you can take advantage of 251 00:29:07,330 --> 00:29:13,820 something. There is something wrong with something, or something not right. So in this 252 00:29:13,920 --> 00:29:18,837 case, the kind of venerability they usually left their computer unlocked. The exploit is what 253 00:29:18,837 --> 00:29:24,061 you do. The exploiting is you installing stuff on their computer because you have access 254 00:29:24,160 --> 00:29:30,142 to it. It payload in this case would be Netcat, which is on the system to gain access to it 255 00:29:30,240 --> 00:29:41,120 later. So using it we're going to do the same thing, and set up a reverse shell. So we startup 256 00:29:42,080 --> 00:29:48,538 the Metasploit consul, a great way to get metasploit training is through offensive.security- 257 00:29:48,538 --> 00:29:52,320 metasploit unleash, unfortunately I don't have time to develop over that. Basically 258 00:29:52,320 --> 00:29:58,142 just getting the MSF console and then run the MS update and get all of the updates and stuff. So 259 00:29:58,142 --> 00:30:07,742 now let's generate a binary payload instead of using Netcat. So basically what we're going to 260 00:30:07,742 --> 00:30:13,760 do is create a binary that we can e‑mail and sent to somebody, when they execute it, it will 261 00:30:13,760 --> 00:30:20,360 start a reverse shell that we can connect to, like Netcat. Here we're using MS payload with 262 00:30:20,360 --> 00:30:26,028 the windows reverse shell. So that is the payload. We're basically just going to use 263 00:30:26,080 --> 00:30:32,747 Metasploit payload library to generate our binary. Here are the commands to do that. The L 264 00:30:32,800 --> 00:30:39,300 command just shows all of the options available here. In this case, I need to set up a 265 00:30:39,520 --> 00:30:47,061 listening port and a listening host. So the IP address it will listen to, listen on, on our 266 00:30:47,061 --> 00:30:53,874 target machine and the port I want to connect to. Here you can use MS payload is pretty cool. 267 00:30:53,920 --> 00:30:59,920 You can use to it create raw payloads and payloads in C. So you can kind of see how it 268 00:30:59,920 --> 00:31:06,007 works. So here is the command that we're going to run. MS payload, with use a windows 269 00:31:06,080 --> 00:31:11,788 shell, reverse TCP. we set the L-host we set the remote port . So we created our David 270 00:31:11,840 --> 00:31:24,120 Hasselhoff EXE and e‑mail it to our victim, have it available other put it on their system. I 271 00:31:24,120 --> 00:31:27,720 have this great Hasselhoff program you need to check out. 272 00:31:28,480 --> 00:31:42,000 A cool command is file, file lets you verify what type of file is on a Linux system. So I run files to verify, yes this is 273 00:31:42,000 --> 00:31:47,640 a windows executable. So we're going to hit this reverse shell to connect, we're going to give 274 00:31:48,120 --> 00:31:53,320 the user, we're going to have the come back and listen to our instance, right? So at this 275 00:31:53,920 --> 00:31:59,280 point we need to set up a listener on Metasploit to listen to this instance. We are 276 00:31:59,560 --> 00:32:07,480 going to start the MSF console and use the exploit multi handler, and set the L host and 277 00:32:07,520 --> 00:32:12,760 had L port. At this point you're ready to listen for the connection, you send the binary 278 00:32:12,760 --> 00:32:21,160 to the user. They execute it. Here, you is the PS example they execute the binary and then here 279 00:32:21,160 --> 00:32:26,680 in metasploit, you sit here and listen for it to come in, now you have CMB command shell on 280 00:32:26,680 --> 00:32:34,263 their system. Pretty cool. This is a great way. If you want to get into this stuff, this kind 281 00:32:34,263 --> 00:32:41,657 of like the best way to get the most out of your, your time and energy. You can learn something 282 00:32:41,657 --> 00:32:47,600 cool really quickly and then move on to more advance things. So ‑‑ I want to thank everybody 283 00:32:47,680 --> 00:32:58,560 for coming to my talk. This is our code library that I'm building. It has all of the 284 00:32:58,560 --> 00:33:04,140 codes that I have in the presentation, minus some stuff that I need to put in there. Any 285 00:33:04,140 --> 00:33:08,292 time you have a great prank or something you want to, you know, share with the world, we're 286 00:33:08,292 --> 00:33:13,910 going to keep track with a bunch of Linux and windows pranks to send out to people. If you build 287 00:33:13,920 --> 00:33:20,503 something or expand, I would love to have you contribute. And then I also have intros to 288 00:33:20,960 --> 00:33:27,919 backdoors.com, which has the slide presentation, code library, and we'll ‑‑ do some 289 00:33:28,000 --> 00:33:34,666 other cool stuff with that. This is another cool thing you can get to ‑‑ these are one line 290 00:33:34,720 --> 00:33:38,837 reverse shells. If you setup your metasploit listener, you can run the command and have 291 00:33:39,200 --> 00:33:45,950 a connection come back to your listener. If you are interested in VPSs and remote systems there 292 00:33:45,950 --> 00:33:52,920 are great places you can look for VPS. The problem is, there is no one good VPS provider. 293 00:33:52,960 --> 00:33:58,627 They are good for three or four months and then Peter out and then move onto another one. So I 294 00:33:58,720 --> 00:34:06,637 kind of keep up on which ones are new, and what they allow me to do and what they don't. Some 295 00:34:06,720 --> 00:34:12,720 interesting projects with the raspberry pie that is based on the remote SSH reserve tunnel 296 00:34:12,800 --> 00:34:26,560 and using python to create a backdoor. All right. Any questions? Thank you. [ Applause]