We're on a time schedule, so I'm going to be taking you through this whirlwind style, so hold on to your butts. I've got about 30 seconds for each of these slides up until I get to the examples, which are the fun part. I really want to get to the fun part. So, louder. Is that better? All right. Okay, so anyway, my name is Johnny Long, and basically the subtitle of this is really about hacking using search engines, going into a search engine, finding information about a site that's exploitable or interesting, otherwise amusing. So, let's go ahead and get started. Maybe. Okay. And just some idea of what we're going to be talking about here. Some of the things that we're going to learn to do with Google is to speak like Lido hackers, you know, because everybody has to know how to do that. We're going to use Google as a transparent proxy server. We're going to use Google to sneak past site security. We're going to use Google to find development sites, and we're also going to use Google to find exploitable files on systems or directories on systems that fall into certain categories, and these categories are going to be the ones that we're going to use. So, let's get started. These are somewhat arbitrary, but based on the stuff that I've found, they fall into operating system vulnerabilities, web server vulnerabilities, sensitive data in files, and sensitive data in directories, and we're going to see examples of all that, and we'll talk briefly about automating the process. The reason I chose Google is pretty straightforward, but Google gives us a lot of options that some search engines don't. As an aside, Yahoo offers the same options because Yahoo is Google. For all intents and purposes, they use the same search engines, but basically, we need some advanced search options. We need some ways to narrow down our hits, because as you're going to see, some of the hits are going to give us too many results to be useful. We need to have a caching feature that shows us downed pages. We need an instant response. We need to get a response quickly for our automated tools to work. We need some translation features, translating documents back into HTML that you might not be able to read natively, like a PDF. PDFs or Excel files, that sort of thing, and also web news, image, and FTP searches, and Google offers all that and more. This is not a new thing. This isn't something that I came up with. This is a bug track post from about two years ago. A guy named Vincent G, however you say that. I'm not French. He came up with this very interesting idea of using Google to find cool stuff, and his post looked like this. Put in index of slash admin. First, you're going to want to go to Google to find sites that have admin directory listings out on the web. Pretty straightforward stuff. The only thing he specifically launched against Google is down there on the fourth example where he uses file type. He was actually going out against Excel files. Basically, what I've done is I've taken this and sort of run with it. First of all, this is very important for any self-respecting hacker, is to use Google in hacker speak. speak. So if you want to use Google in your native language, you have to go here and do your search. Sort of stupid, but you can't resist. There is this book that talks about Google hacking, even though I somewhat disagree with the title. If I had written the book, it wouldn't necessarily be the way it was. It'd be about real hacking. Then I'd be in trouble and I'd need a lawyer like Jennifer Granik. Is she here? Google is a proxy. This is kind of cool. Google offers a translation service, so you can go from English to French, French to English, Spanish, and all that stuff. What happens if you actually take that translation service and turn it back on itself? For example, here's how the normal translation looks. Translating the DEF CON page from English into Spanish gives us a page that looks like this. You can see everything is sort of in Spanish. The URLs that that gives you looks a little bit like this. The part that I'm going to bring your attention to is right at the bottom of the URL there, where we see lang pair equals EN pipe US. I'm sorry, EN ES. This is translating from English to Spanish. What happens if we turn the translation back on itself and translate from English to English? An interesting thing happens. Google does nothing with the page. It assumes you made some sort of mistake and just feeds the page back to you. The beauty is you just proxied that hit off of Google. You used Google as a proxy server. Google grabbed the page for you. Kind of neat. There's a couple places that you can go to get a nice little form to do this in an automated fashion. On Wox.org and also on my site, I've got a little box there so you can bounce off of a Google proxy to browse a site. It is transparent. Keep that in mind for all you proxy freaks out there. It's not going to anonymize you, but it's another step in the chain that could help anonymize you. Finding development sites. This is pretty straightforward. The idea is you want to find corporate web pages or interesting web pages that aren't where they're supposed to be. For example, an anonymous telephone company. Oops. Never mind. Verizon. Basically, this site right here is not on Verizon's web servers. It's on the developer's web servers. The web developers put this page together in order to sell it to Verizon and go, here's what your web page is going to look like. All the code is in there. As we can tell, not only do we find it from Google, we can crawl around that page where we actually found the development code. I actually used Photoshop on this one. Sorry. Crawl around with Google on the site where we actually found the development site, poke around long enough, and eventually you'll find PayDirt in most cases. In this case, PayDirt is the actual source code of the web page. The HTML, the JSP scripts, and the development code. The developers were kind enough to include it all in a tarball. You download the tarball, open up all the source, and basically you've got Verizon's web page. Bypassing authentication. Here's another cool Google trick. The idea is pretty straightforward. We got this company, thinice.com. I hope they're not actually here because it got fixed by itself. I really meant to call, but I sort of forgot. Stuff sort of happens that way. Anyway, thinice.com has this nice little authentication that comes up when you try to browse their web page. Using Google to actually search for information about thinice.com, we find some interesting links. This gives us an idea of what some of the hierarchy looks like on the page. We see a search PHP script and a member PHP script. Searching around a little more, we eventually get to a cached link of thinice.com. If we click on the cached link. It gives us what the web page looks like without authentication. Google actually got past the authentication mechanism. It's not really magic and Google doesn't put values in there and just try something randomly. The authentication mechanism was broken when Google crawled the site and cached it for us. What we're seeing is the results of that. Bottom line is, we're actually past the authentication and now we're seeing not only directories, but again, sources. The source code for the site. Again, this was another example where they were kind enough to include it all in a tarball we could download. This one is fixed. Those of you on the wireless network, be good. Some ideas about finding some files using Google. There's some things that we need to talk about. Basically, some search terms that are unique to Google. You can get information about those on this link, google.com slash APIs. To give you an idea of sort of how to do this, I'm going to show you how this works. A very simple search, like cd ls bash history ssh. It seems like disjointed terms, but anybody that's looked at bash history files knows cd ls ssh are commands that will show up in those history files. Let's do an interesting search. The end result of one of those searches is a live bash history file. This is the file that records commands when somebody's sitting at a command prompt. Why is it on the web? I have no clue, but that's not our problem. It's theirs. Because we're being good and we're not surfing there right now, right? Basically, here we go. We've got this guy. He's actually ssh-ing out to a few sites and telnet-ing out to a few sites. How's that for security? Running trace routes. To take this a little bit farther, don't just stick with the search results. Dig a little bit farther with the web server. You can find some more interesting stuff, like for example, this Nick FTP. Any file, which lists the firewall username and password that his FTP program uses to get out to the net. In addition, we've got his ssh-known-hosts file. Again, all found through Google. This shouldn't be on the web. We will talk more about that site. That was a simple search using disjointed words. A little more complex is using phrases. The beauty is in using phrases that are unique, that are going to get us interesting results. Like this one. Error occurred while processing request. That sounds pretty benign. It's actually a cold fusion error message that generates instead of the pretty HTML that you're used to seeing on a site. The cold fusion error message itself actually has interesting information, like the real host full path where the web server is sitting. Any idea what the operating system is of this particular web server? Yes. You all laughed. That was correct. Now, here's just a hacker's dream, and this one's just too good to be true. Let's do a search for enter unix command, in quotes. I know. You think I'm kidding, right? I'm not. Notice I typed in uname into enter unix command, and it gave me the result. Somebody actually put on the web a CGI interface that lets you type in unix commands. and get results. How convenient is this? This could come in handy. All right. Some special characters that you should probably be aware of. Plus and minus, pretty straightforward. Ands and nots, just like other search engines. A period is a wild card of sorts. I haven't completely figured it out, but most of the time you can use a period like you'd use an asterisk, or I should say a question mark in Unix, meaning any character. The dash, when it's in quotes, doesn't necessarily mean not, like other search engines. What it can mean when it's in quotes is a space. This is all very confusing. I think they did this to confuse us, so we wouldn't figure this out. But we did. To give you an example, here's a simple example of a specific Google search. Using specific Google keywords. The keyword here is site. This says, only search sites that end in .gov. And contain the word boobs. Get your mind out of the gutter. I was talking about politicians. Check out the results. Here we have a gov site, ncwg.cap.gov, talking about inside for access only natural boobs. Those aren't politicians, folks. Or, for example, if you want to use site to do crawling, this doesn't mean DEF CON is vulnerable. It's just an example. Use the site keyword. So we're going to look at DEFCON.org. And we're going to search DEFCON.org for the word DEFCON. The results that we get back give us an idea of how DEFCON.org is mapped out. It gives us an idea of the directories, where some of the files are. It can be pretty handy. Another thing to do is use a site keyword with a common file extension. In this case, we went after a GIF. So site colon .gov space GIF. GIF will give you sites that actually have directory listings where there are GIF files. When you get directory listings, those are good things because you can sort of crawl around. Date searching. I'm going to skip this because we're short on time. In title, however, is another Google-specific search, which is very important. This says, look for the following word in the title of the web page. This says, don't look for the word actually down in the text. This is very important. For example, in URL is basically the same thing, but it's in the URL. Search for a specific word inside the URL. For example, in URL admin gives us one of many hits. This one shows an actual IP map of a very prominent university and how all their workstations are laid out. The second one, in URL admin, says find the word admin in the URL, but also find the words users and mbox on that page in addition to the URL. Here we actually have a mailbox file for an administrator on a site. And the third one, in URL admin with users and passwords. That one's pretty killer. There we actually have usernames and encrypted passwords. We're going to have a lot more examples, so that's why I'm hurrying to get to the good stuff. Here's an interesting one. File type XLS. Let's find Excel spreadsheets that have the words checking account and credit card in them. I mean, this isn't rocket science, folks, but here we go. Credit card balance information, deposits, withdrawals. Actually, the numbers were in there, but I have to do some editing. An interesting side effect to all of this is not just looking for stuff that's dropped dead. Oh, look what I found on this page. But it's sort of harvesting some of the data and using it creatively. For example, we can find operating system and web server versions about our targets using Google. Here's a search in title, welcome to Windows 2000 internet services. Windows 2000 puts that for you in the title of the default web page. So if you search for that, you're going to find sites that are actually running a default web page on a Windows 2000 box. Yes, they are out there. Or under construction. Whatever you do, don't type under construction into Google just the way it is because you'll just get dumped on. It's just going to be ugly. But if you look for under construction in the title and the phrase does not currently have, see the phrase in there, does not currently have a default page, what you're getting is another Windows-based default server. It looks like a normal under construction page, but Microsoft in their infinite wisdom changed the text a little bit. Maybe it was a copyright thing or something. We can actually find servers this way. Or how about this? In title, welcome to IIS 4.0. Where's that Zone H guy? I'm going to talk to him because this is even easier than defacing. IIS 4.0. Scary. At least they installed the option pack, right? Generally, OpenBSD and Apache is a good combination. Scalp, forgot about that one. But it was vulnerable for a little bit. Well, let's say you went out there and you actually found Apache OpenBSD servers when the scalp exploit was released. Not necessarily a good thing to make public if there's a vulnerability. And everybody loves these little powered by things that they put at the bottom of their site. So we use them. Getting a little more into the weeds, since there's so many flavors of different types of web servers, especially Apache, here's a way that you can search for Apache by specific versions, which is very important if you're looking to exploit the site. For example, Apache 1.2.6. Look for in title, test page for Apache, and it worked. They put that little thing there that says it worked. That's their default page. You find that page, you found an Apache 1.2.6 server. How about Apache 1.3.0 to 1.3.9? They changed the page a little bit. It worked. The Apache web server is installed. It was very creative. Helps us narrow down the version number. 1.3.0 to 1.3.9. How about 1.3.11 to 1.3.26? Seeing this instead of the web page you expected. Again, default Apache install boxes. These people were smart enough to install Apache, but weren't smart enough to change the default page. What are the odds that they weren't smart enough to lock it down? Apache 2.0, we get a little more towards the top of the iceberg here as far as security. But again, the default web page. Makes it easier to search for. Another way that we can actually get this information is at the bottom of directory listings. I'm sure you've run into in your surfing web pages that the default page is missing. You get this or the index file is missing and you get a directory listing. At the bottom of the directory listing, the server throws out its tag. Let's use Google to search for that tag. There it is in black and white. Apache 1.3.11 server. Gives us the version number. According to Google, here's some statistics on how many servers are actually running these specific versions of Apache. And have open directory listings for you to browse. Sorry, I formatted it as a number because it looks more impressive with more zeros. 119,000 people running Apache 1.3.6. 151,000 servers running Apache 1.3.3. Not only are they running it, but they're running it with a directory listing open. Good stats. Excel is my friend sometimes. Here's some really esoteric versions of Apache that Google helped me find on the web. Like 1.3.26 plus interserver. How many people are running that one? That's got to have some problems. A lot of these are development. Most of these were beta. But we've got 64,000, 69,000. Lots of targets to choose from. And using the same techniques. Here's some more common Apache versions. Again, that Google helped us find. You don't have to send a single packet to the target to figure out the web server that they're running. Or to do statistical information about it. You just pull it off of Google and use Google's cache. Google's cache gives it to you. You never touch the site. Another way to use Google. Finding targets for vulnerabilities that are released. Finding zero-day targets. It's one thing to have a zero-day exploit, but you've got to have something to use it against. For example, here's a vulnerability that hit the street. Thank you, packet storm. Send a thank you out there. Here we have unhappycgi.txt. And this little guy works against the normal underscore HTML dot CGI script. So basically what we do is we know that this exploit works against that CGI script. Now we just have to find that script on the web. How about a Google search? In URL. Normal underscore HTML dot CGI. 212 sites found running this CGI script the day the exploit's released. That Google finds for us. It doesn't get any easier than that. Script kiddies everywhere rejoice. The other thing that's definitely worth talking about is we've seen some interesting pages. We've seen some interesting examples. But the bottom line is Google just gives us this way of finding interesting files inside sensitive directories and finding sensitive data inside interesting files. And the easiest way to do this is with the directory listings that we just talked about. If you have a directory listing, you get a list of files. If you're looking for a specific file, where better to look than a directory listing? Okay. So this technique. Actually uses the directory listing itself as a way to search for vulnerable files. Look at the syntax here. In title. Index dot of. Remember the dot was a space or any character. What we're looking for is web pages that come back to us and have the words index of in the title. Index of in the title means it's a directory listing. Still with me? Throw another word after the index. The index of like backup. Here's an example of one thing that we get. Here's a site that actually made backup files. Put them in a web accessible directory named backup. And Google crawled them. So now all we have to do is ask Google for that file. We look for the directory listing. Here's a backup directory. And there's the files. See all the names listed down the left-hand side there. Okay. All right. How about another interesting one? In title. Index of dot htpassword. Okay. These are people that have directory listings out there. That means their main web page is missing. The file for their main web page is missing. They got a directory listing when Google browsed them. And this file is sitting in that directory. We'll have more of these to come. The obvious approach to all this is sort of automating the process. You know, it's one thing to sit there at Google and just type your stuff in. Automation for this is just mindless. I mean, it's just incredibly easy. What you do is you take a CGI scanner, any CGI scanner that's got a list of vulnerabilities, CGI-based vulnerabilities, and you steal their list. Okay. You grab out all the interesting files, all the CGI scripts that are vulnerable, and you use that in an automated fashion. Something like this. We have a list of CGI scripts. Okay. Little shell. Okay. Smoke and mirrors. Poof. Okay. Run some shell. That shell script actually works, so I'll fear my coding skills. You get a nice little output that looks something like this. It's basically just a web page that you can browse that lists sites that actually had the vulnerable files in that list. Again, this is from Google. This isn't you sitting down and running a CGI scanner against your target. This is you going out there. This is you going out to Google, automating queries that come back with lists of vulnerable servers that have vulnerable CGI scripts. Of course, when you click on each of these, it takes you to the Google results page, and you just take your pick. Enter Google dorks. My name for it. Idiotic people. Inept or foolish people, as revealed by Google. These are people that you just don't know any better. I don't really want to call them stupid. They're just dorks. They didn't know any better. What I did is I just put a collection of these together and gave a running commentary. Why this is a bad thing. Why it's bad that sites running Microsoft personal web services shouldn't be accessible through Google and be discovered. I put up a little page to categorize that stuff. Taking the automation thing one step further, Michael Zalewski came out with this very interesting article. This article in FRAC 5710 called Rise of the Robots. His theory was there are search engines that are going out there every single day. They're crawling sites. They pick up links on the sites that they crawl, and they follow those links. When they follow those links, they grab more links, and they follow those links to more and more sites. That's basically how robots work. What happens if you put malicious links on your web page? For example, links that are designed to attack other robots. They're sites. CGI scripts are a good example of this. Watering these down a little bit, just to give you an idea of how it works. Some host CGI bin script.pearl, and then we have our little dot dot backslash security problem, which breaks out of the web directory. What happens when a web server comes to your page and sees that link? The default behavior is it's going to follow that link. If it follows that link, it exploited the target. If it was vulnerable. All you did was stand up a web page with vulnerable links. Spiders came along. They crawled it. They picked up a malicious link. They launched it against the target. They did the work for you. That was Zalewski's idea. He tested it, and it worked. Not only did it work, but a lot of web browsers would happily follow links to non-http ports. For example, they would follow links to telnet ports. They would follow links to SSH ports. This wasn't strictly a web problem. Web bots would pick up whatever you gave them in whatever format you gave them, and it would follow them. This method could be used to attack non-web based services. Anyway, the idea there is, if you can do all this through Google, why not automate the process? Upload malicious bots to web servers every time you attack one that changes their web page. Instead of defacing it, you drop attack links to your next targets. You go back to Google after Google has done all this, and you harvest the results from the search engine. Bottom line is, Google did all the work for you and brought the results back. The question is, well, what can you do? Nothing. Thanks for coming. Just kidding. There is some stuff you can do. This really isn't Google's fault. Google is king of the world as far as search engines, and they can really do no wrong. This isn't really a Google problem. Countless people have called them and said, you can't crawl us anymore. We have a robots.txt file. Well, Google doesn't care about those. The bottom line is, you have to be proactive with your own sites. If you've got a site that you want to lock down, a site that you control, that you care about, you need to figure out what Google knows about that site. You need to use these sorts of techniques against your own page to see if you're vulnerable. If you're vulnerable, fix it. Who cares if there's a Google cache in some cases? Just fix your site. The best thing you can do is to watch my web page, because that would make me happy. All right. Just kidding. All right. The grand finale. I think I'm okay on time. I'm aiming to be five minutes early here. Basically, what I'm going to do is I'm going to show you some examples of this technique in action and show you how it works. That was a bad example. Come back. All right. In title, index of page.cfm. What the? Hold on. Technical difficulties. Okay. If you put this Google search in, basically what you get is web servers that have page.cfm, which is exploitable. Okay? You can basically throw an invalid page ID into any of these sites that have this problem, and you can exploit them. Okay? One example of an exploitable site. This one's funny. Index of dead.letter. This is what happens when your mail program dies. It creates dead.letter. You can see here that we're reading somebody's mailbox, and it says, thank you very much, and I can read Chinese. Well, thank you very much. I can read your email. Simple. Easy. Here's a bad one. In title, index of master.password. Somebody that's got a directory listing and has a master.password file sitting in that directory. Translation, that's bad. Bad thing. Let's get a little more complex. In title, index of. We're looking for directory listings again, but we want to look for pwd.db, password, and we don't want to look for pam.conf. The reason I threw that in there is we don't want to look for pwd.db. We don't want to find source dumps for password. If you put this search in without the minus pam.conf, you find all the sites that have the password program source, which we're not interested in. For example, this particular search found us some sites, and one of the files that we could actually find was a group file, a live group file from a government site. Sorry. Throat's getting dry. Trivia question, not to steal the thunder from Hacker Jeopardy. What's the Unix password file called? It's an easy one. Password? P-A-S-S-W-D? Okay. ETSY password. Let's actually find some live examples. In title, index of dot dot ETSY password. The dot dot leaves room for a space and a slash, so we're finding directory listings of ETSY directories that contain password files. Here's one example. What the heck is dot C-L? Okay, here's another example. Index of password from M-I-T. Sorry, I'm jealous. I don't have a degree. Call me bitter. All right. Index of dot dot ETSY password. Yet again. Okay. Another active password file. And again. This time on an org site. And again. Another com site. Okay. And again. This one done a little bit differently. Again, we did the minus pam dot com, but this one's actually a dot gov site. Not only did we get password, we got P-W-D dot D-B, another password format. A group file. And an FTP messages day file from dot gov. Okay. How about another interesting file? Index of ETSY hosts. ETSY host files are always filled with interesting stuff. Okay. So here's an ETSY host file from some site on the, was it the Netherlands? All right. I hear you all whining, but they don't have passwords. Okay. They're all shadowed. All right. Well, let's look for password files that have passwords. There's a lot of passwords in them, just to make you happy. Look for index of ETSY hosts and look at other files in that directory. Here's a password file that's actually got the encrypted passwords in them. Run it through a password cracker. It's on the internet. Google found it. It shouldn't be on the internet, first of all. But it is. Here's another one. In title, index of auth user file dot text. Not only do we have passwords and usernames, but we've got email addresses on this one. Again, live files. This is actually from a shopping cart program. How about WSFTP any files? Host names, user IDs, and encoded passwords. Some poor schmuck's entire list of everywhere he FTPs to, including his usernames and his encoded passwords, which can be broken. How about administrators dot PWD, user IDs and encrypted passwords? I'm not really picking on the UK, but it seems like I've got a lot of examples from there. People dot list files. Usernames, encrypted passwords. Here's a couple examples of pass list files that are actually found on the internet. Again, usernames and encrypted passwords. These can all be cracked. They shouldn't be available to web servers. Okay, another trivia question. Most common UNIX file used for web-based authentication? HT password. Very good. I know, it's easy. How about HT password? These are password files that you can get from Google. These things are supposed to authenticate users that come from your site. Users are not supposed to be able to look at this file. Why? Because the usernames and passwords are in there. The web server is supposed to block this crap. Okay, but this shows us some sites like Harvard actually have problems and can't seem to keep that under control. Other sites have problems, too. Here's another one. User ID, encrypted password. More user IDs and encrypted passwords. Again, these are all web-based authentication files. You use these usernames and these passwords to access these websites. Google found them for us. More. Lots of stuff. Another trivia question. What is the one file in PGP that you want to keep secret? One file. Secret keyring? Secring.pgp? Here's a way to keep it secret. Let's put it on the web. God bless America. Another one from MIT. God bless America. All right. Another trivia question. What is the most sensitive file on a Unix system? Shadow. I hear it out there. ETSY shadow file. How about putting some ETSY shadow files out on the internet? Yes, this one is live. Some more stuff. I hear you all whining and complaining, but the encrypted passwords. How about unencrypted clear text passwords? Would that be good enough for you? Usernames and unencrypted passwords. Index of pass list. This will give it to you. How about Excel files with usernames, password, and email? Clear text, folks. Don't have to run John the Ripper or any of that garbage. Config.php. That's a great one. Username, database host, and clear text password files. Config.php should never come out on the web. It should be blocked at the web server. It should just not be out there. Database clear text passwords. Bad news. It's not just one example. There's quite a few of them and more and more and more. This is not an isolated thing. These things are everywhere. Usernames, hosts, unencrypted password. Last trivia question. The most sensitive and personal nine-digit number. In your life. Social security number. Very good. I'm not going to give you the actual Google phrases that caught these, but I'm just going to give them to you as examples. Excel spreadsheets with a couple names and social security numbers. I used Photoshop to make them a little bit unreadable. There are a couple of these out there. Very isolated or maybe not. How about a couple thousand of these? A few thousand names and social security numbers. Let's make it worse. How about a few thousand more names, social security numbers, and phone numbers? This one actually came from a university. It's a student list. Usernames. We've got usernames in here. We've got socs, phone numbers, names. Sky's the limit. Some links to check out. There are other people that are doing work in this arena. I try to have a little more fun with it. You know, the standard white paper people. Keep an eye on my site. I like to taunt people that have these difficulties on a fairly regular basis and post the results of them on my web page. Feel free to check that out. I'm going to actually not do Q&A. I'm going to do the same thing as the previous speaker and go out by the pool if it's not flooding to save some time. Special thanks to a few people. Jen, Mac, Tramp, Peanut. That's my family. Isn't that nice? Told them I'd do that. Thanks, guys.