Well, good morning. How's DEF CON going for you guys? Yeah. Still waking up. How many of you are here with a hangover? How many of you are here still drunk? Right on. All right, we're going to go ahead and get started. My name is Andrew Whitaker. This is Dave Williams. Donald Hackers. So, just start off with some brief introductions. If you've got the program guide, you can read the bio, so I'm not going to do a whole lot of time in any introductions. I'm going to just say briefly about myself. I'm the Director of Enterprise InfoSec for the training camp in InfoSec Academy. We offer courses in licensed penetration testing, so you can actually get an international license to be a professional hacker all over the world. So, that's pretty cool, because as long as you have a license, it's okay to hack, right? And we also offer the Certified Ethical Hacking course as well. I also do a lot of writing. The author of the book, Penetration Testing and Network Defense, it's one of mine. It was for sale over at the EFF table in the vendor area. Last time I checked yesterday, they were all sold out, but I will be doing some book signings immediately after this over in the vendor area. Dave Williams, he started out actually as a security intern for the training camp, and then we hired him on full time. He now supports our information security for our U.S. operations. We have about 10 sites in the United States and several over in Europe. With that, let's go ahead and get started. So, what is this talk about? This talk is called, Corporate Network Spying, How to Spy on Corporate Networks. What this is, this is essentially a training on corporate network spying. This is designed for those beginner to intermediate skills. Now, what you find when you come to a conference like DEF CON, there's going to be some people or some talks that are really designed more for the intermediate to advanced crowd. They're really, really cool, but only about 5% of the people that attend it can fully understand the talk. This is more designed for more of the beginner to intermediate, because what I find is that everybody has to start somewhere. Everybody has to learn about packet capturing and corporate spying. So, this is more designed for that crowd. And I really appreciate talks like Atlas gave that really deal with, okay, where do we start with and how do we get to become more skilled? What this is not, this is not a discussion of some hot new exploit, which may only be theoretical, only work in a lab environment. Okay? We're going to be talking about things that have been tried and true. They work. This is also not going to be an overly technical discussion that only 1% of the techie world will understand. My goal is that everybody here will be able to grasp it no matter what your background is. In fact, I was reading on the DEF CON forum, roughly about 39% of the people that come this year are new to DEF CON this year, which means so this will be a good introduction for you. So, what are we going to be talking about? We're going to be discussing corporate network spying. What is corporate network spying? We're also going to do a rehash of how do you get around the issue of switches when you're spying on local area networks. Now, for a lot of you that might be reviewed, but for some of you that might be brand new. A lot of the techniques I'll be talking about have been spoken at previous DEF CON conferences. Then I'll be demonstrating or showing you snapshots of several tools that are designed to capture specific types of traffic on corporate networks. For example, we'll get into things like mail snarf, which is specifically designed to capture email traffic on a network. Also demonstrate things like an MSN protocol analyzer, which is designed to capture MSN messenger traffic. Then we're going to get into a demo. Now, half this is going to be our presentation. The other half is going to be our demo. Now, our demo, we're going to be able to show you one of the most challenging parts of corporate network spying, which is how do you get onto a remote network and start capturing the traffic. Okay? It's easier to do if you're trying to spy on your corporate network. It's harder to do if you're trying to spy on somebody else's network. Okay? By the way, everything I'm talking about, it's all theoretical, hypothetical. I don't endorse it. That aside, so my lawyers are happy now. But when we talk about corporate network spying on remote networks, it gets much more challenging. So the demo we're going to show you, we're actually going to set up a phishing scam. We're going to set up a phishing scam to get a user to click on a link, download what looks like a legitimate executable file. We're actually going to have them have a, install a practice test software. While the practice test software is being installed off of a website, we're going to be installing a Netcat backdoor Trojan at the same time without the user knowing. Once the Netcat backdoor Trojan is installed, we'll then get into that remote system, and then we will download a command line packet capturing software. We will capture some software. We will upload that back to our attacker machine, and then we will reassemble it. Okay? So we'll be reassembling, for the sake of our demo, we'll be reassembling a JPEG. Okay? So if you ever look at a packet capturing of a JPEG, it's just a bunch of garbage. So I'll actually show you how to reassemble it, and we'll be using a hex editor for that. So definitely take, stick around for a demo, because it should be pretty cool. Let's go ahead and get started. I've already talked about what is network spying. Network spying is basically wiretapping into a network, targeted packet capturing. Now you can do it one of two ways. You can either just try to capture all traffic and then analyze it, which a lot of times, if you're trying to do it remote onto another network, that makes it, a lot of times you're just trying to capture everything, and then sift through it and try to see if you have anything meaningful. The other way is just to try to capture traffic that is meaningful to you, such as passwords, or emails, or what websites people are going to. So some of the tools we'll be demonstrating are only for specific types of traffic. Who does corporate network spying? Well, legitimate would be law enforcement, as well as corporate networks, FBI, NSA. They do a lot of corporate network spying. You also have corporations that have consent. So chances are your boss is probably spying on you, or more likely you're spying on them. And then you also have hacker hobbyists and some corporate espionage going on as well. Just to kind of give you an idea of some of the things the FBI and NSA have been doing in the past. They have been using semantic forests. What semantic forest does, and it's actually been in the news, they haven't mentioned this particular name, but we've been hearing a lot about this in the news. What semantic forest does is it does automatic, you know, capturing of all voice conversations, and then does automatic transcription of all those voice conversations, and indexes it so that it's easy to search. We've been hearing a lot in the news the past year about how the FBI and NSA have been capturing voice conversations. This is what they're generally using. So a tool called semantic forests. Carnivore, also known as DCS-1000, they got rid of that in 2005. They actually started moving away, FBI started moving away from it about 2001. They actually started moving away, FBI started moving away from it about 2001. 2002 to go to some commercial solutions. But what Carnivore did is it allowed you to tap into an ISP, be able to capture traffic. It involved a packet capturing software, a tool called Packeteer, which allowed you to reassemble packets, and Coolminer, which allowed you to search for certain phrases, such as passwords. You also have things like Echelon. Echelon is a cooperation between both the UK and the United States. That allows you to, that allows the FBI, or really the NSA, to be able to capture communication that crosses borders. And you have Magic Lantern, which is another capturing software. Corporations do a lot of spying. For corporations, PC Magazine said that 77% of companies are spying on their employees. I've even seen statistics higher than that. The American Management Association reported, 81% of corporations are spying on their employees' email. You have 42%, according to that survey, that said they were spying on what their employees were doing with instant messaging. So chances are, corporations are going to be monitoring what you're doing. Justifications for that, well some of the justifications are to ensure employee productivity, to ensure the company is void of illegal activity, and to protect trade secrets. If you're a sysadmin, you're probably spying more to make, to see what your boss is up to. So, you also have hacker hobbyists, people that just go around, just look for wireless networks. Look for wireless networks, or I don't know, let's just say hypothetically, maybe you're at a hotel in Vegas. And you start looking for networks, like the one in your room. And you start plugging in, seeing what you can find. Maybe you can find some MAC addresses, maybe you can duplicate your MAC address. And apparently, some of the hotels even shut down your port, if you start duplicating your MAC address. Who knew? So, other examples, you also have corporate espionage. With corporate espionage, a great example of that, Oracle and Microsoft. Some of you may remember this story. Back, I think it was 2000 or 2001, Larry Ellison came out and confessed that he was hiring people to dig through the dumpsters of Microsoft, to see what Microsoft was up to. And so, a lot of companies, big and small, are doing corporate network spying. Law, or legal and ethical competition. So, I think that's a great example of that. And then, the other thing, I'm not going to spend a lot of time on this. Basically, if you don't have consent, you don't have authorization, it's going to get you in trouble if you get caught. So, let's move on to the good stuff. There are a number of commercial solutions. So, if you're in a commercial environment, and you need to start doing corporate spying, there are tools called network forensics analysis tools. Just punch it into a search engine, you'll find a number of tools out there. They tend to be very pricey. The tools I'm going to show you are either open source, or they are relatively inexpensive. And by inexpensive, I mean under $100. All right, so what I want to move into now is talk about sniffing on switch networks. Now, again, for some of you, this is going to be review. But for some of you, you may know one or two methods, but you may not know maybe all of the methods. What you're going to find is that when you start sniffing, or start trying to capture traffic on a switch network, it becomes much more difficult. I'm not going to be introducing anything new. I just want to spend some time so we're all on the same page, knowing what are some of the methods you can do to get around switched environments. First off, what about hub environments? Now, most places are not using hubs anymore. But with a hub environment, if a user, say, user A wants to send traffic to user B in that slide, user C would be able to see it as well. It's called a shared Ethernet environment. Everybody's able to see the traffic. That's an ideal. It's an ideal world for a malicious hacker trying to spy on a corporate network. Everybody's using hubs. In the real world, however, people are going to be using switches. What happens with a switch is when user A sends traffic to user B, well, the switch is going to record the source MAC address in its MAC table. So the switch will see that we got a source MAC coming in on fast Ethernet 01, and it's going to plug that into its MAC table. It's then going to look up the destination address, which is going to be user B, its MAC address, and it's going to see if it has that in its MAC table. At this point, it does not have user B in its MAC table, so it's going to end up flooding it out, both ports, fast Ethernet 02 and fast Ethernet 03. At this point, if a malicious hacker was at user C, user C would be able to see that traffic. What happens, though, when we have user B sending traffic back to user A? When user B sends traffic back to user A, well, the switch will record the source MAC address of user A. User B. And it will look up the destination MAC address. Now, at this point, it has a destination MAC address of user A in its MAC table. As a result, it will only send that traffic out fast Ethernet 01. And user C, our malicious hacker, would not be able to see any of that traffic. That's the problem we're talking about when we mention the challenges of sniffing on a switch network. So there are several solutions. We have ARP poisoning solutions. I'm going to talk about two methods for ARP poisoning. We have MAC duplicating, MAC flooding, and port mirroring. For ARP poisoning, the first method is you're going to be crafting ARP replies. Here's what happens. When user A wants to send traffic to user B, one of the first things user A will do is send out an ARP request, saying, what is the MAC address of user B? Then user B will say, user B is going to reply to that, saying, here is my MAC address. Well, when that ARP request is sent out, it is sent out broadcast, which means user C will see that broadcast, will see that ARP request. And all we're doing in this method is that user C is sending back the same ARP reply, saying, hey, I have that same MAC address. Why don't you send all traffic to user B to me as well? That's the first method of ARP poisoning. There are several tools out there that will do that. Some of the tools also use what's called gratuity. Gratuitous ARP. And what gratuitous ARP means, we don't even wait for a request. We just go ahead and start sending out replies. A lot of times what they may do is scan a network for all the IP addresses and then just start sending out replies for every single IP address. And at that point, our malicious hacker would be able to read all traffic for the entire network. So this is the first method for getting around the issue of switches. We'll jump down here to ARP poisoning method number two. With our poisoning method number two, here what we're mainly concerned about is traffic being sent out to the internet or through a router. So here we see a request. What is the MAC address for a router? And our malicious hacker is going to reply and say, I am also the router. At this point, all traffic sent to and from through the router, it's going to be able to capture that traffic. So this is a good way to be able to see maybe if people are going through a router to log into an email server or go to a website, be able to capture that traffic. Another method is MAC duplicating. Now MAC duplicating is a much more simple method. Here all you're doing is you're finding out what is another host on the network and you're going to duplicate that same MAC address. At this point, the switch can have two entries for the same MAC address. Now this really does depend on the switch. Some switches will allow to have the same MAC address be associated with more than one port. Other switches, they may not, they may alternate. As soon as they see a MAC address on one port, they'll only send traffic out that port. They see it on another port, they'll switch over and only send it out that port. So spoofing MAC addresses is not the most efficient method, but it is a method that you can do. Another method that I find pretty successful with is MAC flooding. What MAC flooding does is, it floods the switch with a number of MAC addresses. Your switch has a limited amount of memory, called content addressable memory, of the number of MAC addresses it can hold. As soon as you fill that up, at that point you're going to flush out all the MAC addresses it knows about. And now you have all these bogus MAC addresses, and essentially you're going to end up turning your switch into a hub. It's just going to send traffic out all ports. The one thing about MAC flooding is, with some lower end switches, it ends up essentially doing a denial of service. And it can actually end up crashing the switch. So, MAC flooding. An example of MAC flooding is a tool called MAC-OF. Here you see the output of MAC-OF. Very simple to run. It's from a Linux prompt. You just type MAC-OF, press enter, and it will begin flooding with, I forget the statistics, but it's something like 100,000 MAC addresses per second. It will begin flooding the switch. Another method you could use for getting around the issue of switch networks is port mirroring. Now port mirroring is actually a very legitimate method that a lot of people use if you have to maybe set up an intruder detection system, or maybe you want to actually legitimately sniff traffic on your network. With port mirroring, Cisco calls it SPAN, switch port analyzer. You're basically setting up your switch so that all traffic on your network will be sent out this port. So it's almost as if one port on your switch is like a hub. It's able to see all traffic. Now if you're a malicious hacker, what you're going to have to do first is compromise the switch to be able to configure switch port analyzer or port mirroring. I have the output here for your Cisco people in the audience. This is how you configure port mirroring on a Cisco switch. Just monitor a session, you give it a number, you specify the source, and then you specify what the destination is. With Cisco, you can not only specify individual ports that you want to capture, but you can even specify entire VLANs that you want to capture. So here I see the example configuration. And all of this is on the CD as well. So if you're trying to write it down, it is on your CDs. So let's move on to talk about some specific packet capturing software. Now I'm going to use the term sniffer a lot. Sniffer is a registered trademark, but it's become just a common term. So forgive me if I use the term sniffer a lot. There's a number of packet capturing software. When I went out to PacketStorm Security, there was over 200 tools, or actually I think it was 198 tools just used for packet capturing. I'm going to be demonstrating some of the more popular tools, some of the open source and free tools. Including WinDump and TCPDump. WinDump and TCPDump, these are command line tools. WinDump, Windows, and TCPDump is Unix and Linux. And Ether Reel or Ethereal, which is now called Wireshark. So WinDump was developed by Loris DiGioanni, Gianluca Verini, and some other Italian people. Forgive me if I pronounce their name wrong. This is TCPDump. It requires a WinCap or libpcap library, so you had to get that installed first. There's a number of options from this. Now why am I talking about a command line tool? Well the benefit of a command line tool is when you want to get access to a system remotely. If I want to get access to a system remotely, I'm probably not going to have a GUI that I can work with. I'm going to want to try to get some type of command line tool on the remote system because it's easier to get a command line than it is to get a GUI. Some examples of what you can do with WinDump. WinDump-D will list off all of your interfaces. WinDump-I will allow you to select which interface you want to start capturing software on. You have some other options there including dash-W which will write to a log file and dash-R which will read from a log file. We'll be demonstrating this later on in our demo. Here you see the output of WinDump. It's not the prettiest output to analyze, but one of the nice things about WinDump and TCPDump is that it can also be read by ethereal, which is now Wireshark. So we're actually not going to be analyzing WinDump output directly. We're going to open it up within Wireshark. And show you that, because it's easier to read within Wireshark. So Wireshark just, I think it was last month, Dave, when it switched over to Wireshark? Yeah, about two months ago, ethereal became Wireshark. Supported by a number of programmers, over 100 programmers. Recognizes over 759 protocols. How many of you have ever used ethereal or Wireshark? It's an awesome, awesome tool. So you're familiar with it. We'll be showing you some output here. Here, just to kind of walk through it, you've got three main panes. The top pane is going to be showing just the overall traffic. The middle pane is going to show you the various headers. And then the bottom pane is going to be all of the hex output. So, I don't know if you guys can see on the screen here, but what we've got here is we're doing a DNS lookup. We've got an A lookup for defcon.org. You can then see that we've got our response. You then see that we're going out to Netcraft. When I did this, I had the Netcraft toolbar. So we see a little Netcraft lookup to make sure that Defcon's not part of a phishing scam. And then you go through and we see the three-way TCP handshake, SYN, SYNACK, and ACK. And then the GET request. Now, what a lot of people may not be familiar with is the fact that you can reassemble your TCP streams. If you right-click on any of your TCP traffic, you can go down to Follow TCP Stream. When you do that, you pull up on your screen, you have the red and the blue. The red is information that was sent out. The sender, the blue, is the receiver. So here we see we're sending out a GET request in the red, and then a response in the blue. You can use Wireshark to do a lot of password sniffing. There are a number of protocols that send their traffic in clear text. Telnet, and POP, and SMTP, just to name a few. But in addition, even those software applications that do try to encode or encrypt their passwords, often times it's very easy to reverse. Such as LAN Manager hashes, which are kind of old now, but LAN Manager hashes are very easy to reverse. Just take the password, split it into seven characters, convert to uppercase, and then run DES again. It's very easy to compare hashes with that. You also have things like VNC and some others that are very easy to crack. So if you're able just to capture some of the passwords, even if they are encoded or encrypted, a lot of times you can use that to then not necessarily reverse the hash, but compare hashes. So one of my most popular tools is Kain Enable. Kain Enable can capture just passwords. It will just look for passwords. Now it can do a lot of other things. But I'm just going to be showing you what it can do for passwords. Kain Enable, here we see an example where it's sniffing and it's able to capture POP passwords. So you're able to see somebody logging into a POP account, victim 14 with a password of defcon 14. Here we're able to see the output of looks like a NTLM session. Somebody was logging into a Windows box. Now here we have the hash, and the hash is not the password. But then we can either do a rainbow table, crack against it, or we can maybe pull it into a tool like what AtStake provides, or some of the other tools that will crack your LAN Manager hash. You can even right click on your LAN Manager hash and choose send to cracker. So begin cracking the password. You can even do Telnet conversations. Telnet is sent clear text. It will capture Telnet conversation in Kain Enable. Again, if you right click, you can go straight to view. It will pull up in a text file all of that Telnet conversation. In this case, we're logging into a router. So it's able to show you that we're logging into a router and the password in this case is let me in. Here we see an example of going out to a website. Logging into two different websites. One is hotpop.com and another is excite.com. By the way, hotpop.com, if you've never been out to it, it's one of my favorite sites. It's basically anonymous email, free email. When you get an email account, a lot of times you've got to put in another email account or some other information to verify you. Hotpop does not require that. It's completely anonymous. Here we're logging into hotpop. It did do some encoding of the username, but we were able to get the password. In comparison, for excite email, we were able to get the username, but not the password. However, it's fairly weak because if you count the number of characters here, it's the same as defcon14. You can see how many characters when you go to excite, how many characters the password is. Here we also see an example. This is FTP and we're able to capture FTP traffic. Here we have anonymous and then a password that was sent through FTP. Another tool you can use is dsniff. Question? Yes, it can do wireless as well. Yes. His question was, can cane enable sniff wireless traffic as well? The answer is yes. Another tool you can use is dsniff. dsniff is cool. It can work on Linux and can work on Mac. I've seen a lot of people with Macs here. You can use dsniff, but it can be used only to listen for passwords. Here we see we just ran it for a while and we were able to see that here we got user defcon. There's the password. Here we got DC Williams. Dave Williams logging in. It will capture your password. If you can get this onto a system, just run it on a network, you can begin capturing passwords. In this case, it's capturing hot passwords. It's also not difficult to be able to write your own packet capturing software to do this. All you do is you just capture the traffic and then just write a filter to only look for the phrase pass or the phrase user. Begin looking for it. Ettercap is another great tool to be able to look to sniff passwords. It has both active and passive capturing capabilities. What do I mean by active and passive? Passive is like in a hub or a wireless environment. It's a shared environment. You just want to capture all of the traffic. Active means it's going to use one of those five techniques I told you about. Either the R poisoning, the MAC duplicating, the MAC flooding, the port mirroring. One of those active attacks. Here we see an output of Ettercap. I'll kind of zoom in here. With Ettercap, you can see it was able to grab a user, Quicksilver, and pass. You can also get people's email traffic. Here we see an example with email traffic. We're able to see, again, a username. Victim14. We jump down here to the password. Defcon14. The neat thing about this is a lot of times what people use for their email password is the exact same password used to log into their Windows machine. If you're hypothetically at a hotel and you're able to capture somebody's email password and you have their IP address, you may then try to connect into the C share. The admin share on that machine using that exact same username and password. A lot of times people will reuse that password. Again, you can right click and go to follow TCP stream. When you right click and follow TCP stream, we have here shown out the user and the password. You can also use it to read email messages. Again, right click and go to follow TCP stream. We can see here we have an email message. This particular email message says, hey, the Defcon conference is coming up. Can we send some feds to it? There's our email message. Sincerely, Victim14 at punkass.com. Here's an analysis of email message but this time using Addercap. Here we got the username and password as well. MailSnarf is another great one. MailSnarf is probably one of the easiest ones to use. You just type MailSnarf and it will sit back and start capturing all mail messages that it sees. Here we see an output of that. To run it, all you do is type MailSnarf and then it will start listening. It listens by default on eth0. There are some switches you can do if you want to specify a different interface. We can see here is the output of the email message just saying testing MailSnarf. Analysis of FTP traffic, walk you through this. Here we have username, Defcon14. Another output here we got password required for Defcon14. This would be the response from the FTP server. Then we have, it tells us it's a Microsoft FTP service. There is the password. Again, it tells us that we're logged in. We can always right click and go to follow TCP service. Here we can see username, password, even does a little MACB which tells me that when this user logged in, they were probably using a MAC going into a Microsoft FTP server. Ettercap can do the same thing. What Ettercap will also do is show you the FTP traffic once a person is logged in. It makes it a little bit easier to see than say Wireshark. Here we see it's just sniffing and it's able to see we're doing a directory listing within the FTP server. It makes it really easy to monitor somebody's FTP server. Of course, once you have the username and password, you can just get in yourself and see what you can find. There's also tools for MSN Messenger traffic. You can always use Wireshark. Here we're using Wireshark to capture your MSN Messenger traffic. Here we got a message saying, hey, we need to send FEDs to the DEF CON conference. Hackers are bad, very bad. We got a response from attacker14 at punkass.com. Attacker14 tells us, no, there's no need to send a FED. I'm sure nobody will do anything illegal there. An even easier tool for capturing your MSN Messenger traffic is you can use MSN Sniffer. There are a number of other tools out there, MSN Protocol Analyzer and some others, but MSN Sniffer works pretty well. MSN Sniffer, you just start running it and down in the bottom window, it will show you all messages just for MSN Messenger. The way to read it is you actually have to start on the bottom because it adds messages up to the top. Here we have it. Is it okay to leave my wireless open? You don't think anyone will use it, do you? And the response, nah, you have nothing to worry about. Where do you live again? You can also use it to capture web traffic. URL Snarf is a great tool for that. URL Snarf, run from a command line. It's also part of the DSniff suite of tools. Just run it from a command line and it will sit back and just capture all of the URLs that a person is viewing. Entercap will also allow you to watch in real time what a person is viewing on the web. I should pull up those web pages. What's that? Oh, instant messaging as well. You can also capture voice conversations. This is really cool. You can capture voice conversations. Cain Enable is a great tool to do that. With Cain Enable, you can capture your voice conversations. Now, in the real world, it's not quite always this simple. For example, with Cisco Voice over IP, a lot of times with Cisco Voice over IP, people will encrypt all of their voice traffic. Most environments hopefully are doing that. When you have voice traffic like Skype, if you're a Skype user, Skype uses AES encryption, so it's very difficult to be able to read your Skype conversations. I got some voice traffic here. I used a soft phone application. It just records it as a WAV file. It records the voice conversation as a WAV file. You just right click and hit play. It will play back the entire voice conversation. If you're going to begin doing this, you want to make sure you have a large enough hard drive. If it's a long conversation, that will end up being a very large WAV file. Now for the fun part of the talk. We're going to get into our demo. Let me introduce what our demo is going to be. What we have here is we have two attacker machines, and we have a victim machine, and then we've got a server hosting a website. Just one minute. What we're going to be doing here is our attacker is going to try to capture traffic on the victim's machine. We're trying to capture traffic being sent to and from the victim machine. In this environment, the victim machine we're going to pretend is on a different network. How are we going to get onto that remote host? I know a lot of times when I do a lot of pen testing, and I also teach our licensed pen testing courses, people are always like, these tools are great, but when you're actually doing a pen test, how do you get onto that remote host? How do you get that packet capturing software on there? You can't really use Wireshark because you can't get on there and install it. It's much harder to do. That's what we're going to walk you through. It's kind of start to finish. We're going to show you, we're going to set up a phishing scam. What the attacker will do here is copy down the trustme.com website, a legitimate website. We're going to copy down that website, and on that website is a executable, a legitimate executable. It happens to be some practice test software. What the attacker is going to do is it's going to take that software, and it's going to bind it with a Netcat Trojan. Then we're going to send an email to the victim saying, hey, go to trustme.com and download this practice test software. The victim will then do that, but while they're downloading the software, they're not going to trustme.com, they'll actually be going to the attacker machine. Then the victim is going to be installing the practice test software, but they'll really be installing the Netcat Trojan in the background. Once they've got the Netcat Trojan on, the attacker can connect into that box and then use TFTP to download a command line sniffer. Once we have a command line sniffer on, we can then begin capturing traffic. We then have to upload that same traffic back to the attacker machine and then analyze it. We're going to be reassembling a JPEG using a hex editor so that we can reassemble the original file. Just to recap the steps we're going to do, the attacker is going to copy down the trustme.com website and it's going to begin hosting it. The attacker is going to bind a backdoor Trojan Netcat with a legitimate executable. The attacker will then send an email to the victim requesting that they download the executable. The victim will install the executable and subsequently, without knowing it, will also install Netcat. The attacker is going to use Netcat to connect into the victim machine. The attacker will then use TFTP to download WinDump onto the victim's machine. The attacker will then capture traffic as victim goes to a website. The attacker will then analyze the traffic sent to and from the victim machine. The attacker will rebuild the graphic in this case a JPEG captured by WinDump using a hex editor. Now what I want to show you here is that being able to spy on a corporate network, a remote network, there's a lot more steps involved. It's not just about running packet capturing software. You really do have a lot more steps involved to get onto the host, capture it, send it back, and then analyze it. If we have time, and I think we will if we can get it working, we'll also demonstrate DriftNet. DriftNet will reassemble those JPEGs in real time rather than have to use a hex editor. At this point we're going to switch off. We're going to go to two monitors. We're going to try to get an attacker machine on one side and we're going to try to get a victim machine on the other. I know we have a lot of steps here. I'm going to go through it very slowly. What I want to show you is that in the real world it's a lot more challenging if you want to be able to sniff traffic in a remote network. There's a lot more steps involved. That's what we're going to be walking you through. The first thing we need to do is on the attacker machine, Dave, if you could go to a web browser and pull up the trustme.com website. This will show you that trustme.com is a website that we have hosted on the server here. You can see it says Certified Ethical Hacking Practice Exam. At Training Camp we create our own practice exams. The website is very simple. It just says click this link to download the Training Camp attacker practice exam. You can click on the link and it will download the executable. What we need to be able to do for our phishing attack is copy down this whole website and then host it locally. At this point, Dave, if you could go out to a command prompt window and it's going to go back to the root of the C drive. We have a utility called wget. wget, if you've never worked with it, it's a great utility to have. It will mirror entire websites for you. He's going to do wget-m for mirror. Then he's going to do dash-r, which is to do a recursive lookup and pull out all websites that are linked from this page. He's going to do a dash-l, which is the number of links you want to do a recursive lookup for. We're just going to say two, but you can really make it whatever you want in this case. Then the website, www.trustme.com At this point, I just copied down our website. If you can highlight it there, Dave, you see it also copied down ceh.exe. That's your executable. We're going to use that practice test software to bind it with the Trojan netcat. At this point, if we could pull up, and I'll show you here that at the root of our C drive, we've got www.trustme.com There's a website that we copied down. If you go inside it, if you want to launch the index.html, we'll see, sure enough, there's our website that we copied down. If you want to close out of that, we'll just run the ceh.exe so that you guys can see this is a legitimate program. It's going to run through the practice test installation. We can even launch it if you want. There it is. There's our practice test. Close out of that. That's the executable. That's the legitimate executable that we want to bind with netcat. One of the first things we need to do is we need to go back into our trustme.com and we need to edit the HTML so that the location for the executable is not going to trustme.com, but it's rather going to our local machine. It's going to edit the HTML here and just put in this machine so that when we host it, the executable is going to be, people will be downloading it from the attacker machine. We'll save that. We're going to close out of that. At this point, what we're going to have to do is bind the trojan. The trojan that we're going to be using actually first do you want to go in there and rename the files first? Okay. First thing that Dave's going to do here is he needs to rename a couple of files. What we're going to be doing when we bind the trojan is we're going to be creating a new setup.exe. We're going to bind netcat to a brand new setup.exe for this practice test software. What we need to do first is make a backup of the original setup.exe. The original setup.exe, we'll just call it z.exe. Setup.exe makes a call to setup.lst. We're just going to make a copy of that and name it z.lst. ... That's just so that when we do our binding it'll work. We're going to create a brand new setup.exe. At this point, we're going to pull up our binding application. We're going to use yet another binder, or YAB. YAB you can get it at areyoufearless.com areyoufearless.com What Dave's going to do is he's going to click on the plus sign to select his file that he wants to bind. He's going to go ahead and browse and he's going to choose the netcat utility. Which we have at the root of our C drive there. There it is. As you go down, we have the target path. We're just going to keep it in the same folder. We also have certain attributes you can set, like you can set a read-only attribute or hidden attribute. We're just going to leave that as is. We also have execution methods. We're going to choose asynchronously. What asynchronously says is it's going to go through and run the setup of the practice test and then run netcat. Sometimes you have problems if you try to do it synchronously and try to do it at the same time. Now we've got netcat set up. Did we add the switches? For execution parameters, we're going to add a dash p for the port number that we're going to use to connect to our victim machine. We'll just choose 50. It's a random number here. We're going to choose a dash e to execute cmd.exe This way, when we connect into our victim host, we'll get a command shell. Then we'll do the dash L. Dash L will set it up to listen for when we connect into it. I think we're good there. Now we're going to add the second file. The second file we're going to be adding is that z.exe. Remember that? That was the setup that we renamed. Now we're going to add that. Put in the path there for ... CEH practice test. Then we'll call it z.exe. Hold on, Dave. We'll just show there is an option there for registry startup methods. We're not going to use it. What's nice about that is if a person restarts their computer, you can have netcat start up every single time by putting it into the registry. It's kind of a nice option there. We'll just go ahead and hit okay there. The next thing we need to do is we're going to go to the options menu. We're going to deselect, melt the stub after execution. We're just going to keep netcat running there. We're just going to keep it. We're not going to erase it afterwards. We're also going to change the icon of our new setup.exe so it looks like a legitimate setup.exe file. Now we're going to go ahead and click the build button. We're going to put it into CEH practice test. We're just going to call it setup.exe. We have until 1150. Thank you though. We're going to go ahead and build the setup.exe. Now we have a new setup.exe that when ran is going to actually call z.exe and do the original installation of the practice test. It's also going to load netcat. In order to get this ready, we need to repackage this. So that it looks like one self-extracting executable. What Dave's going to do now, he's going to do it kind of quickly, but he's going to be going through and he's going to go into Winzip, create a zip file, then we're going to create a self-extracting archive using Winzip. We're using an evaluation version. We're still evaluating it. Love to hear your input. If it's a good software to get, eventually we'll make a decision there. So he's just going through and just creating a new calling setup.exe. He's going through this kind of quickly, but there we go. Cancel out of that. . Alright, so now we got our self-extracting archive. He's then going to put that back in the folder for www.trustme.com. And we're going to rename it we're going to get rid of the old CEH and rename this one to ceh.exe. So now what we need to do is take these files and host it. We're already running IIS on this box. So now we're just going to copy these into the cinetpub wwwroot folder so we can begin hosting this website. Alright. So just to recap, what we've done so far is we've copied down trustme.com, we've copied down the practice test software, we've then created a new setup.exe that would bind netcat with this with the practice test software. We then put it into the cinetpub directory so we're going to begin hosting this website. I'm now going to draw your attention over to the victim machine over on your left. Now over on the victim machine, we've already sent an email to the victim, so Dave if you want to open up Outlook Express check a look at our email here. Now the email message, we've got a message from Bill Gates and the email message says congratulations on winning the new certified ethical hacker practice test from the training camp. Now one of the key signs that you're under a phishing scam is grammatical errors. So if you can spot some grammatical errors in there, we are the please to H-E-R-E. It's usually a sign that you're under a phishing scam. So they are getting better. They're learning about the new thing called spell check. It's a great new technology. But what you'll see is that it says go ahead and click on this at trustme.com. Now we did a very simple phishing scam. If you take one of our classes we show you much more advanced ways to be able to hide what the real website is that you're going to. But here at trustme.com and I don't know if you can see it down the lower left but it does show you what the real IP address is that you're going to. And Dave if you want to go ahead and pull up the source of that email. We're going to properties. We're going to message source. And here we can look at the HTML source for the file. And you'll see that while it says trustme.com what you're really doing is going to in this case 10.1.1.3 is it? Yeah 3. Which is the attacker machine. So the user thinks they're going to trustme.com but they're really going to the attacker machine. Let's close out of that. Well if I'm the victim I say hey cool I got some free practice test software. Let me go ahead and click on it. Pull up the web page and there is our website. Now this is actually on the attacker machine. But the user will think they're on trustme.com. Now in this case it's just showing an IP address but a lot of unsuspecting users will see an IP address and not really think twice about it. So at this point Dave go ahead and let's just go ahead and run our new executable. You saw very quickly you saw that it was extracting the archive. It's now going through. It looks like it's installing the practice test. Pretty cool we got a new practice test. I like that. Now it works. Now Dave if you would go out to a command prompt and run netstat dash a. What netstat dash a will do is tell you what ports are listening and sure enough we have port 50 listening which is used by netcat. So at this point I just installed a practice test software but in the background I installed netcat. So now we're going to go back to the attacker machine so draw your eyes over here to your right. On the attacker machine we can now use netcat to get into the victim machine and download some packet capturing software and begin capturing traffic. So he's using putty. You can use really whatever telnet application that you want to use. Dave just happens to be using putty over here and he's already got it preconfigured to go to the victim machine. So we'll connect. Now at this point even though he's on the attacker machine he's telnetted into the victim machine. And just to verify that if you want to type the word hostname and by typing hostname sure enough we are now on the victim machine. Question? Yeah, yeah exactly. You have just put the victim behind a firewall. Would you want to use the netcat over here and just blow the main shell out? Yeah, let me just mention there are comments there. One of the comments was how do you get what the victim's IP address is? Well you can always look in the web logs. That's one method. And then this other gentleman mentioned well you can also do netcat the reverse way. Which would also be a might even be a more efficient way so that you can get a reverse shell. There are many, many ways to do it. Yeah, now also we also chose port 50. Chances are a lot of firewalls are going to block incoming traffic from port 50. Much more common port might be TCP port 53 inbound because a lot of firewalls do have that open to be able to do zone transfers. So a lot of different ways to do this. We're keeping it relatively simple for the demo. Because what we really want to show is more of the packet capturing. Alright, so here we're on the remote machine. And at this point we're going to do the TFTP. So we're launching a TFTP server. It's Trivial File Transfer Protocol. We're going to use that to be able to download the remote Trojan. And what Dave's going to do is do a TFTP. Actually, yeah, we'll go to the root. TFTP-i to get a binary file. We're going to do a get request windump.exe And of course this is expecting that the firewall will allow you to TFTP outbound. So we're going to get windump. And sure enough the transfer was successful. We see it both in our telnet window as well as up top in our telnet. We were able to transfer windump. Now that we have windump transferred we can do windump-d that will show us what interfaces we have on our victim machine. We see that we have I don't know if you can pull that up a little bit there Dave. So we have windump-d that shows us our interfaces. We have a dialup adapter and we have our network adapter. We're going to use the second one. So we're going to do windump-i for interface two for the network adapter we're going to do dash-s zero. Now what dash-s zero is going to do is that's going to specify what length or how much of the packet we want to capture. It's somewhat counterintuitive because zero you would think you don't want to capture any of the packet. But it's actually whenever you specify zero as your length it's going to end up capturing the entire packet. We want to capture the entire packet because we want to later reassemble it. We're then going to say dash-i I'm sorry dash-c and we'll just say 200. Dash-c is how many packets do you want to capture. So really you could play around with this just so in a basic example here we'll just say 200 packets. And then we're going to do dash-w so we can write this to a log file. We'll call it log.txt We'll go ahead and run that. Now we need to generate some traffic. So over on the victim machine over on your left Dave's going to pull up a web browser. We're just going to go to another one say victim14.com And very simple page here since we're going to be reassembling a graphic, it's just a page with a graphic on it he'll refresh a few times to try to get 200 packets. And sure enough after he refreshed a few times we got 200 packets captured. So WinDump has now stopped. Now that WinDump has stopped we can now send that log file back to the attacker machine. So we'll do a tftp and we're going to specify the IP address of our tftp server and then we're going to put that file. So we're actually controlling the victim machine right now and we're putting our log file back on the attacker machine. Now we see the transfer was successful. Now what we're going to do is we're going to open up actually let's first show that the log.txt file is there. And it's there. So what we're going to do is we're going to open up and within Wireshark or ethereal to be able to show you this traffic that we were able to capture. And we're going to go ahead and be reassembling the graphic. I'm actually going to ask Dave to kind of take over from here. He's really good at reassembling various binaries and traffic. So Dave you want to take it from here and kind of walk through what you're doing? Now that I have the log file there, I'm going to open that up. So I'm going to go down to all files because it's a text file. Scroll over to log file. So now we have the full traffic that was captured on the other machine. You can see Windows update was trying to run over there. I'm just going to search for http traffic since we know that we just wanted to see what they were checking out on the web. So we're going to put in http for a filter. Just hit enter. Now it pops up all the http. You're going to see a lot of the same copy because I refreshed the same image multiple times. Here it's we go to file tcp stream. You're going to see the get headers and then the receive headers. If we start scrolling down here, this is the jpeg. This is what a jpeg looks like in binary form. It doesn't look like much right now unless you're really geeky you won't be able to see what that image is. So what we want to do is we want to reconstruct that. First we're going to just check out the conversation that we received, that we captured. We don't care what was sent from this machine to this server. We just want to get the other information. Now in ftp this is really easy. Doing in ftp you don't have any of this stuff here. This is the http headers. We'll mess up reconstructing the jpeg. Normally in an ftp we just do save as select raw and then name it test.jpeg and then you'll be able to open it up no problem. Since they're using the web and that's usually what most users are going to be using that you're going to want to spy on. We're going to go to raw, save as save it to the desktop test.jpeg Now we're going to leave this open. It'll help us reconstruct the binary in a minute here. We're going to go over to the desktop. Now we have test.jpeg. Now this won't open because all the headers are messed up. There's http headers in there and then they can't see what the actual image is. So what we're going to do is we're going to open this up with a hex editor. I'm going to use winhex. So now you can see here the http headers. Well we want to find out where jpeg starts. So you can see here we have jfif. That's the first recognizable character that's printed out there. But you can see that there's another couple characters here that aren't printable. So what we're going to do is we're going to come here and we're going to count over. One, two, three, four, five, six. So we know we're six over from the first jpeg readable characters. So here's a j. One, two, three, four, five, six. So this is the very start of the jpeg header. Once you start doing some of these reassemblies you'll see that they're always the same. So all jpegs are going to have that as the header. All exes, all WinZip. So we're going to get rid of all this other junk in front of it. So we're going to go up and highlight all of it. Make sure you get everything. You forget a bit and it's not going to reconstruct. So we want to get rid of it. We're going to right click, go to edit, go to remove. It's going to ask if I want to remove it. We're going to say yes. So now the top of our jpeg header is okay. But we'll notice that since I refreshed a bunch of times in that follow TCP stream, there's also a couple other HTTP headers that got thrown in there. So we're going to want to clean them out as well. Sometimes a scroll doesn't work that well if you use a mouse. So we just want to make sure we go all the way to the end, get every bit in there. Edit. Remove. Yes. So now this should be a full jpeg. Now we're going to just save it. We're going to re-save it as test.jpeg. Head back down to the desktop. Open it up. And there's the jpeg the user was using. Now we just did it with a jpeg. That's fairly easy. But the main thing is if a user is downloading a program, an exe or anything else like that from their intranet, we're going to be able to capture that and then assemble it. Using a jpeg is fairly easy to use using DriftNet or other programs, but the exes is really where it gets kind of cool. Awesome. Dave, if you want to try to get at the Linux box showing up there, we can actually show you DriftNet, if we can get that up and working. Just to reiterate what he was mentioning there is that this works not just with jpegs, it works with exes, it works with Word documents, anything that somebody might be transferring across a network. You just have to capture it, figure out where the header is, start, figure out if there's any footers, delete those, and then within a hex editor, and then you have the reassembled file. So here we have our we have a Linux box here where it's actually running a security auditor, which is one of several CDs that we give out for a certified ethical hacking class. So we have about over a thousand software tools that we give you in that class. We got it running? Alright. So what Dave's going to do now is he's going to show you DriftNet. DriftNet does the exact same thing as far as the jpeg reconstruction, but it does it as you're browsing the web. So it's just one other tool that you can show that you can just do this real time without having to reassemble. So Dave's going to go on our Linux box, just type DriftNet. We'll see if we can get this demo to work here. DriftNet is now running. You got to admit for a Linux tool that's probably one of the easiest commands to enter. Just DriftNet. And then over on the victim machine, he just went to that same web page, pulled up that graphic, and DriftNet in real time was able to reconstruct the graphic. It is open source, so you can take a look at the source code see how the author did it. But it shows you that it is possible just to do all of this real time without having to use a hex editor. The real cool thing about this is you sit on someone else's wireless network and you see bits going by, big deal. But you actually want to see where they're going. So now you can actually see what images, what web pages they're hitting. And it gets you a little closer to their experience. Hypothetically speaking. I know we're actually a little bit ahead of time. I don't mind actually ending a little bit early because that gives you time to go and check out Boost, check out some other things. So I don't think anybody's going to get real upset if we do end early. Because that does give you a chance to go experience more of DEF CON. But just to kind of rehash of what we did here, we talked about our packet capturing software. As everybody stands up. Alright, let me conclude it real quick. The point I want to show you is that packet capturing, yes it's an older thing, but yes it's still really, really cool. The biggest challenge is that if you want to spy on a remote network, is finding out ways to get onto that remote host. And I hope I just showed you one way. I'll be at a relatively simple way, but shows you that you do have to find a way to get onto a remote host. In about an hour, I'll be out at the vendor booth, at the EFF vendor booth, be able to sign any books or answer any questions. By the way, just one last point I want to make. How many of you saw our t-shirts? How many of you saw our t-shirts? How many of you saw the business cards? Training Camp, we are sponsoring a hacker challenge. The challenge is still going on. The prize is $1,000. You guys like money? So $1,000 for the prize. We gave out 1,000 shirts. The shirts are gone, but we still have business cards with a challenge on them. And if you follow the challenges, the first person to the end gets $1,000. So the challenge is still going on. I talked to some people last night. They were getting pretty close, but not there yet. So if you want one of those business cards, just grab me or grab Dave, and I'll be happy to give you one of those cards. Questions? I see a question in the back. You have to find out. You have to find out. Find that out, man. How far the rabbit hole goes. Question? Yes, yes, absolutely. The question is, is there a way to poison a host file? Absolutely. There's actually a great book called Windows Microsoft Press Windows Command Line Tools. I forget the exact title. But if you get into this kind of stuff, you definitely want to grab a hold of that book, because Windows 2000, 2003 has like hundreds of command line options. And one thing you can do is from a command line actually poison someone's host file, or you can even change what their DNS server is. So you don't need access to the GUI. You can actually do it straight from a command line, which is really cool. Redirect them to you. Alright, well I'm going to go ahead and end up early, giving you a chance to see some other talks, give you a chance to check out the vendor booth and check out some of the things going on. Thank you for your time.