I'm Lawrence Baldwin, and this presentation is on extreme IP backtracing. Test, test. Okay. I sat through two presentations here earlier and was in the back and couldn't really hear well. Is this a good volume of voice to be able to hear me? All right, good. I'm the developer and operator of the Minet Watchman Distributed Intrusion Detection System, and I collect firewall events from about 1,200, 1,300 firewalls around the world and try to make some sense of it and backtrace addresses when we detect when people have been compromised and try to send them notifications. So I probably backtrace about somewhere around... 25,000 to 30,000 IP addresses a day and try to figure out who the heck owns them. And the rationale for putting this presentation together is to try to impart some of that knowledge, bring visibility to the fact that this process is non-trivial, and maybe encourage people to do more with their firewall logs as well. Okay. So a lot of these events that show up in your firewall logs, your IDS logs, really it's non-trivial tracing some of these IP addresses back to their owner. A lot of times if you do a Whois lookup, you end up with nothing more than ISP. And really what we're hoping to do is that a lot of these systems that people are using to attack other people are not their own systems sitting on their own home DSL. They've broken into someone else's machine, and they're launching attacks from these machines that they're controlling. And we have plenty of those machines out there, CodeRed, Mimba. Based on that, there's two ways really to improve the overall security of the Internet. One goal is reducing the total number of compromised hosts, and the other being to minimize the amount of time that a system remains compromised. And so we have to protect ourselves. We need to let people know, people who have been broken into, we need to let them know, hey, we're seeing this in our logs. And I know a lot of people when they fire up their firewalls and alarm bells start going off like crazy, they get almost as upset as when they receive a piece of spam. Right. Right. Right. What you really have to realize is that probably about 95% of the scanning activity that you might be seeing in your logs isn't coming from a hacker directly, but rather it's really just another victim that's been compromised with something. So it's almost like these pervs are a cry for help rather than something that's intentionally hostile. This quote here is taken from an article written shortly after the February 2000 DDS tax. Authorities pursuing the attackers say the servers they use belong to users that had no idea that their resources were being used to launch attacks. So here's a pretty interesting trace. This was a MyNet Watchman incident. The machine was compromised by the Microsoft spider worm. When we backtraced the IP, it led over to the right server, and you see the net name is GAN. A central reason of GAN RF, and if we actually, if you see the notify contact, the first notify contact is SAM at GAN.RU. So we go over to GAN.RU and run this page through a translator. This is the Nuclear Regulatory Agency of Russia, so pretty nice to know that they are infected. As far as an update on this, the machine was actually, we, we, we notified them, you know, weeks and weeks ago. Um, and as of last week, they were still attacking people, so, uh, I don't know, I don't know what kind of response that, uh, they're, they're planning, but hopefully they, they do something soon. Okay, so, uh, we're gonna start, uh, by, by talking about, um, some of the different tools you can use to backtrace, and some interesting places that, uh, information shows up. Um, we're gonna start with, uh, you know, the first thing that you'd want to do when you're actually tracing something back is actually validate the source IP. Um, before we, before you go off and spend a whole lot of time trying to, trying to figure out who owns, owns an address, it's really a good idea to validate where that actual traffic came from. Just because a packet has a source IP address that could be from address space halfway across the world, there's nothing to stop that packet from having been generated locally by somebody spoofing addresses or some kind of misconfiguration problem or whatnot. So it's certainly a good idea to use either a packet analyzer or router debug commands to actually validate that the packet is actually coming in physically from some remote physical interface. Also, when trying to analyze firewall events in a broadcast network kind of topology such as a cable modem network, it's entirely possible that you'll receive bleed-through traps of traffic that's sourced from addresses that are actually your neighbors on the same cable segment, whether they're using private addresses or maybe even being misconfigured with valid public addresses from other places around the world. So one of the next steps you can take is to eliminate some potential bad IP addresses. In RFC 1812, they mentioned the Martian addresses, and I was looking around to find a consistent definition of what the actual Martian addresses were. These are actually right from the RFC. Some people might argue that link-local and some of the other IANA-reserved stuff belong in this group, but the examples here are directly from the RFC. You've got the broadcast, loopback, multicast, and limited broadcast addresses. And an interesting quote from the RFC is below, a router should not forward any packet that has an input. So you can't just say, oh, this is a valid IP source address, which... I can't tell you the number of times I've had people ask me, you know, why is IP address 224.0.0.5 attacking me? So you can also exclude private addresses, 10.172.16.331, 192.168, there's a class A, B, and C. Slash 12, slash 16. This was a pretty interesting Whois record. Actually, this is from Korea. They actually published a Whois record. If you look at the IP address range, it's for private IP address space. And this came up on a discussion on the nano address, and someone said, what was it? Someone's done an APNIC registration for it, obviously a 1918 private space. Perhaps they're suggesting that spammers, or perhaps all of Korea, be assigned private address space, which are fortunately non-routable. So I mentioned this a couple slides back, but you can also pretty much exclude anything that comes from an IANA address. It's really doubtful that they're attacking you. These are some of the reserved addresses. If you do a lookup for IANA at the Whois servers at the end, you'll get this list. And this is just the list continued. You do have to be a little careful about just dismissing reserved addresses, because those are, of course, subject to change. I know I had been considering a specific address range as being reserved in my database, and then six months later, some new allocations have been given out. So addresses that were previously invalid as source addresses are now invalid. So you've got to be sure to check these IPs on a somewhat frequent basis. You should definitely look for stuff that looks fake. 1.2.3.4 probably isn't attacking you. We also have some examples from Max Visions, White Hats, a document on NMAP decoy addresses. Sometimes those show up in a trace. People try to be really stealthy and you see a trace that has 23.23.23.23 as the source IP. And then you see another packet from 24.24.24. And then you see something from a public address that's totally different. And they're like, huh, I wonder which address you're using there, buddy. So you can do a limited amount of spoof detection on the addresses. It gets really difficult to detect spoofing because ultimately where you receive the packet is somewhere near the edge of the network. And Bob Morris wrote in his TCP IP weaknesses in the 4.2 BSD Linux TCP IP software. This is back in 1985. He describes the weakness, which is basically anybody can fill in the source address, whatever source address they want, similar to snail mail. If you don't have access, physical access to the network, there's really not an easy way to validate whether or not an address that appears to be attacking you is real or not. However, there are some, and these are not extremely reliable, but at least some basic techniques that you can do that might give you some information to decide whether or not an address is spoofed. Because obviously if somebody's spoofing an address, you don't want to be picking up the phone or sending them a nastygram saying, you know, why are you scanning me? Yeah. So here's a technique. It's based on one of the passive fingerprinting techniques, OS fingerprinting techniques, which actually looks at the TTL value. And so when you receive a packet and you check what the TTL was at the point that you received it, there's default TTLs for most OSs, and based on that and the count at where you received it, you can do some deduction as to what type of machine was attacking you, but also perhaps find out if it was a spoofed address. By tracerouting back to that IP, you'll have some idea of the number of hops that it actually takes to get to you from that IP. Asymmetric routing may add a few hops in between, but they should be fairly standard. And so if you subtract the final TTL from the original TTL and then do some guessing as to what kind of OS sent the packet, you can get, it's not totally reliable, but it can give you an idea whether the packet was really spoofed or not. And if you receive a packet and the implied, decrement in TTL implies that that host is like 10 hops away, but when you traceroute to that IP, it's like 40 hops away, I'd say there's probably a pretty good chance that that was a spoofed address. And I don't know if anyone here was in the expo2 talk, but there's actually a list of what the default starting TTL values are for a lot of the major operating systems. Oh, I didn't realize you did it today. It looks like you stole it from him. No, this was actually taken, I looked around for the default TTLs all over the place, and there was this one link on Google that unfortunately was down. So this is from the cache page. I haven't verified all of these, but I have looked into the Windows and the Linux TTLs. And in the slides on the CD-ON, there's actually some details about how you can change your default TTL to be whatever you want it to be. So here's an example of where this type of spoof detection breaks down. You'll notice at hop 10, we jump into 10 dot space, and then at hop 11, we jump into 172 dot space, and then the trace disappears after that. So we really have no idea exactly how many hops away this particular address is. Another way to validate whether or not an IP address is real is to perform route validation on it by looking at BGP route tables. And there's a couple of sites listed here that will basically let you punch in an IP address, and it will come back and tell you what the active route entries are for that address. This is like a really, I've only just started doing this, playing with this, but it's really a powerful concept. Almost every other source of backtracing information is stale and old information, whereas BGP route information is about one of the few sort of active and real-time information. And I can't tell you the number of times when I've taken an address that I have some suspicion about whether or not it's been spoofed or not, plug it into BGP route tables, and it comes back networked, not even in table. So we have an example of that here. Yeah, here's just a quick spoof example. This is a lookup at the area for 182 dot 1 dot 1 dot 2. And of course, no match. And then here's the results of the looking glass. No routes for this IP address, so it's pretty accurate that it's probably spoofed. Of course, the sooner you do this, the more accurate the information is, too. So the team backtrace, there's a couple of tools that are pretty standard tools for doing backtracing. One of them is NSLookup, of course. If you just have an IP address, you want to find out what the reverse DNS name is. Armed with that, you can query for start authority, MX records, things like that that can give you more information about the domain itself. Here's an example, a simple example. In NSLookup, you set the type to pointer, looking at the full address in the in-header augment namespace. And then we look for the SOA for the full address in the in-header augment namespace. And of course, it doesn't find it. So we dropped off the last octet and looked for the start of authority on the class C address. And here it is, located at rr.com. One thing that, in the early stages that I was using this technique, I was actually recursively backing up to even the class B level to do these SOA lookups. And I can assure you that's not a very good idea because you have tons of different ISPs within the same class B address. So you really don't want to go further than going to a class C level. And even that can be touch and go if you're dealing with an address space that's been very finely distributed across multiple providers. Another one of the standard backtracing tools is, of course, the Whois databases. I do my first lookups at Aaron because it'll tell you if it's not in their registry and they'll point you at one of the other NICs if it is. A lot of times the data that you get back, though, from the Whois servers is totally bogus or totally out of date. Here you have some of the advanced query syntax for Aaron. Some of these are kind of fun to play with. Doing full lookups and net lookups you can actually do a net lookup on, say, a class B and it will give you every network in the database that is within that class B. One of the things I wanted to emphasize from the previous slide is very often people will see the email contact address listed in an Aaron record and start shooting email at that person. It's really not a good idea as typically the contact record there is a person who maintains the IP address allocation space, not a person who deals with security issues. So about the only case where you'd want to use that information is if you see a net block that's extremely small, like a class C or below, then it might be safe to try to contact that person directly. If it's a large ISP, you don't want to be sending email to the Aaron contact information. You just want to take the domain portion of that contact address and then, as we'll get into later, try to figure out what mailboxes to use and that sort of thing. So we talked about this. Let's see. Okay, so here's an example. If you look, the contact email is at hotmail.com, which is pretty useful. And the phone number is pretty good. 123-456-7890. So obviously not much is going to be able to get through to any of these numbers. This record really emphasizes the whole problem with who is, in that, yes, you can look up Aaron records and find out net block information, but very often those net block records don't tell you anything about the domain that is responsible for that address space because it sure ain't hotmail.com. And you really can't even, you really have to look at this carefully to realize that Internet America in Dallas, Texas, well, their domain name, it's probably iadfw.net. But doing that in an automated fashion is almost impossible. It requires almost manually reviewing these records and making those associations between IP address and domain names. Okay, so moving on, we have the intermediate backtrace category, some more advanced tools as you move further in the tracing. Recursive who is, if the record isn't in Aaron, it will point you at WIPE or APNIC, who in turn might point you to one of the national registries. So by doing recursive lookups, you can narrow down who actually owns the space. And you can actually cross-check what you find in the IP-based whois records with domain-based whois queries. There are several places to do that. I like the GeekTools proxy a lot. And I just recently stumbled on the youwhois.com so I'm not so sure about the reliability of it, but it seems the universal whois sounds pretty nice. Yeah, cross-checking is very critical because one of my pet peeves about IP whois information is there's absolutely no ramifications whatsoever when somebody allows that information to go stale and out of date, which is the reason why it's so out of date. I mean, I see records constantly where the last update time was like 1994. Or earlier. Whereas with domain whois information, there's real ramifications if you don't put a valid email address in there. You're not going to get notifications about your domain name expiring and you could lose your domain. So very often the domain contact information will actually have much more timely information than what's in the IP whois record. So once you have a domain that you might be pulling out of IP whois, look it up in the domain whois and validate the contact, see if the contact information is as good or possibly more up-to-date. This is an interesting example from a document. I've been getting a ton of spam encouraging me to buy my .us domain name. And NuStar, the people who administer the .us namespace, this is an interesting quote, under current administrative practices, the .us top-level domain not only has no central database that can in turn create information about who is, there's also no mechanism in place for Delegates to provision database information to the central registry. Even if Delegates wish to provide new whois information to the USTLD administrator, that capability is currently non-existent. So we're really not doing anything to fix the problem of being able to trace these events back to an actual owner or administrator of an IP. Once you actually have extracted out a domain name that you believe is responsible, your next step in trying to actually make physical contact is to figure out an actual email box to send it to. And we have the abuse.net site, which is sort of a de facto registry of abuse email addresses. And you can just basically punch in any domain and it'll try to pop back and tell you what mailbox, whether or not it's an abuse at, mailbox security at, or postmaster at, whatever it is. And I think now he's up to about, I think he's got about 140,000 domains in there. This site is more meant for dealing with spam-related issues, but in the large majority of cases, the spam mailbox is essentially the same as any kind of security-related mailbox. Okay, moving on, we have some more advanced techniques, which, first one is, if there's anything that you're not familiar with, If the Whois query doesn't give you the right domain, you can try searching on Google, putting in parts of the information that you got back from Whois. Try adding parts of the actual address, the city, the state. Here's a neat example, something that you don't see all the time. Here's, if you look at the address space for two of these, for each of these records, so it's kind of tough to tell who owns this. iWave.corp sounds a little bit more specific. So here's the full record for iWave Corporation. Again, the contact is at Hotmail, not really helping us out. So, we do a Google search on iWave, adding some address information in there, Vienna, Virginia, and lo and behold, the third link down shows us www.iWave.com. And of course, surfing to that website, you'll notice in the bottom right-hand corner, we actually have a real email box, not at Hotmail. One of the other advanced tools that you can use is rWhois, referral Whois. When I first read through the spec on rWhois, I got extremely excited. I was like, you know, great, here's this much more specific tool of getting down at who owns address space. Because, you know, very often, when you do a straight whois lookup, it's just going to resolve to the service provider and not to the actual end company. And unfortunately, trying to contact a company through a service provider is pretty much a brick wall. You can pretty much be guaranteed that you're not going to have any communication for, like, weeks at a time. So rWhois is basically a mechanism for ISPs to create more granular databases. Unfortunately, only a handful of service providers have implemented their own rWhois servers. Here's just a quick example. This is actually from GeekTools. I know it's a little bit hard to read, but this is just one that, you know, when you do look up it in, it will give you back, you know, a record for Exodus, and then say, you know, for further information, you can visit the rWhois server at Exodus. And the nice thing about the GeekTools proxy is it gives you both records. It will actually automatically go out and pull down the rWhois record and give it to you. So this is the domain record based on what we pulled out of this slide here. This is the domain record. We get hostmaster at pmimaging.com, which is nice. This illustrates why people should use role-based accounts for their contacts. If Jerry Boy leaves the company, you don't want his email address as the contact in your information. A nice generic hostmaster at your company is great to use because whoever takes over as the next hostmaster can receive that email. So that's the main thing about the RFC. So there's other databases besides whois. There's the routing registry on our records. I list the RFC number there if you're interested. The routing registry is similar to the BGP routes, except it's stale and a lot older information. But sometimes you can find nuggets of gold. Here was a successful trade that we actually were able to pull out information with our R. The culprit in this case was clicknetwork. Unfortunately, if we thought IP whois records were out of date, the route records tend to be even a more order of magnitude out of date. So it isn't always a helpful resource, but it's just another possible source to try. So here's what's actually returned on the routing registry. Hostmaster at clicknetwork.com. So then we move into some of the more extreme techniques. You have an IP address. It doesn't do any harm to see what ports they've got offered out to the world. And perhaps there's a banner there that you can read that'll tell you who administers the machine in question. Yeah, I've actually found a surprisingly high percentage of compromised servers are also running mail servers. I'd say it almost seems like almost as high as 25%. Unfortunately, although including a mail banner on your mail server is an RFC requirement, I'd say probably only about 60% of people actually follow that standard, so it's not always effective. So here's an example. You know, this particular machine had 443 open. And so looking at the SSL certificate, you can see on the subject line that's highlighted, latimes.com. Here we're getting some clue as to who might be running this machine. And you can get this to pop up just by doing a, you know, surfing HTTPS, surf right to the IP address. That's attacking it. You know, then this SSL certificate pops up and... So here's an example where we may have gone too far in trying to trace something back. You'll notice that the range for this record is actually almost four addresses wide, four IP addresses wide. So here's the record that's returned by the RIPE server. So we tried connecting it to the machine. It's got FTP open, or one of the FTP. Gee, I wonder how that got cracked. The ultra-secure FTP. So we didn't find anything there, but trying some of the other IP addresses in the range, there's a web server on one of the other addresses, and there it is, puroadultos.com. Click aquí. So click aquí to see las titas de pectiny. So here's the domain record for puroadultos.com, and we do get a webmaster at puroadultos.com as an email address here. So there's times that you trace these back, and by whatever reason, you still have no answer as to who might run this machine. So you can always kind of move out a level, take a step back, and find out who runs the anonymous autonomous system. My objective is always to try to get the backtrace to be as specific as possible so we can make direct contact with whoever is actually responsible for the system. But as Jason said, when that's not possible and you want to at least get a message to someone, you can use the autonomous system. In general, only a larger or midstream ISP is going to have BGP autonomous system number, so you're not going to really be able to get extremely specific in many cases, but at least gives you an avenue to go somewhere. So here's an AS example. This is a BGP looking glass lookup on an IP address, and I've circled the terminating AS record, or the terminating AS number, 6197. And this is the same command that we used previously where we got the known network found. When the network is actually routable, the output will look like this. So here's the full record from Aaron on the autonomous system 6197. The contact here, this is a great example of useful, not useful information. I actually consulted for BellSouth for a number of years in their early days, and when I saw this record, I was dumbfounded that the contact persons listed were working at Siemens, and I was pretty sure there was no logical relationship between Siemens and BellSouth other than that BellSouth occasionally buys a phone switch from Siemens. And so I had kind of, I had actually just punted on this, assumed that it was some kind of error, and unbelievably, about four months later, I was standing on a train platform having come from a meeting, and there was a guy standing next to me holding the same envelope that I had, so I assumed he had been at the same meeting. Just, I had some time to spare, so I went up and chatted with him, and we started talking, and you know, a few minutes into it, find out he works for Siemens, and I was like, what's your name? He was like, Willard Dawson. I'm like, wait a minute, I need to talk to you. So this is like the real example of extreme batch racing. I had to hunt a guy down to a train platform, and this is another good example of the breakdown and problems with the Aaron records. What essentially happened was, he was originally, he did originally work for Bell South, and when the AS number was registered, he used his contact handle. Several years later, he left the company and went to work for Siemens, and he began allocating address space, assigning it to his handle name. Well, there's no mechanism to say, you know, all these addresses that I used to administer, I don't work for that company anymore, so remove those references from me. So, you know, we're sitting here having a person, you know, who doesn't even work for the company anymore, still being the contact, contact person. So, that's what happened in this case. Yes, really, it would have been much nicer if they had a role-based account here. Willard, originally, like you said, he had his email address at Bell South. He, he updated his personal record to show that he was working at Siemens, and here we have an implied relationship between Siemens and Bell South, which really doesn't exist. So, here's another extreme technique you can use if NetBios is enabled on the machine. Send them a wind pop-up message using NetSend. Hello. I haven't quite figured a technique to actually make this be successful. I've probably sent about a hundred of these and I've never had the person contact me, but I have a feeling if they send me a message and the message was crafted in an intriguing way, such as, you know, this is the Microsoft Security Management Center in Washington. Please call us immediately with this phone number. That might work. This is one of my favorite backtraces. It's amazing how people are willing to name their machines things that give away a tremendous amount of information. Here, we did an NBT stat to show that if you wanted to get an iteration of the machine names and the work group name is called a Ducci underscore Dorf. I thought it was Doofus at first, but then I thought it was Dorf. And I happened to also do a trace route to that address and could sort of see from the trace route that it looked like given the CHI that it was probably in the Chicago area. And then just do a Google search for Ducci Dorf in Chicago and bam, law firm of the Ducci Dorf in Blackenship and a bunch of other names. So there's an example where just this little tiny piece of information, if it's unique enough and not like John Smith and you've got a little bit of information, you can actually trace that back to a machine name. Now the sad part of the story is I called up this company just to give them a heads up, got the secretary and said, you know, I need to talk to your security manager or your MIS manager. And she's like, who? No, we don't have one. So I was like, okay, well let me talk to your managing partner. And she's like, okay, and I get Mr. Blankenship on the phone and just very nicely and politely explain to him that it looks like one of those machines has been hacked. You might want to have it checked out. I'm not trying to sell you anything. And his response was like, okay, thanks. Have a nice day. So here's the, we've actually done a little bit of cross checking of the domain record with what we found and found the responsible domain to be adlmb.com. So, you know, sometimes no matter what you do, there's nothing you can find out about an address. So you punt. You find out what is the most directly upstream address from the one you're looking to trace and see where that leads. Sometimes it's only the service provider, but you never know. It's really important to get as close as possible. Here's a trace that, well, it's a record that comes back from the rock of showing that this address space is registered to intercom pro. But the notify contact has a totally different domain. It's tactile.net. So whenever you see disparate, you know, disparate information like that, the people who really want to contact are intercom pro. So we do an mslookup looking for mail exchange records for intercom pro. And as you can see, there are none. No address available for that either. So here's a trace route to the IP. Trace 22 is the IP that, hop 22 is the end of the trace. Hop 21 is the next IP just above it. So we try looking at that for more information. And we find that it's registered to tactile net, which tactile corresponds with the other address that we found. So it looks like tactile.net. So conclusion. It's surprising how many corporations have a isolationist view of the internet. And they're very concerned about protecting themselves on the inside. Very hard firewall, crunchy exterior. Sometimes they actually deploy something that But back when Code Red and Mimba and some of these other ones were hitting, you'd see in the web logs direct evidence of all these machines that were compromised. And most companies really, I mean, they don't make their money tracing these back and being nice to people and letting them know they're broken into. So they really don't do it. And as a result, you have a tremendous number of already broken into machines just waiting for someone to grab control of them and point them, DDOS somebody. Unfortunately, machines that are port scanning you today could be DDOSing you tomorrow. That's the importance of trying to backtrace them. So you do read your logs, I hope. There are services that can help you do it. Lawrence's site, MyNetWatchMember is excellent. DShield is very similar. If you don't like sending your logs outside of your network, you think that that might be insecure somehow, then there are solutions you can deploy internally to watch log century. So that's our presentation. Do we have any questions? The presentation, all the slides are on the CD and if you look at the notes view, I apologize but the notes view is totally screwed up. So if you look at my PowerPoint skills are only this big. So I have on my website jason.net, that's j-a-e-s-a-n dot net. If you go to that site, it will take you into a place where you can actually download the latest and greatest presentation with all the notes fixed on it.