Introduction to Network Penetration Testing



Similar documents
Introduction to Network Penetration Testing

Vulnerability Assessment and Penetration Testing

Penetration Testing with Kali Linux

PTSv2 in pills: The Best First for Beginners who want to become Penetration Testers. Self-paced, online, flexible access

Penetration Testing. NTS330 Unit 1 Penetration V1.0. February 20, Juan Ortega. Juan Ortega, juaorteg@uat.edu. 1 Juan Ortega, juaorteg@uat.

Port Scanning and Vulnerability Assessment. ECE4893 Internetwork Security Georgia Institute of Technology

ITEC441- IS Security. Chapter 15 Performing a Penetration Test

1. LAB SNIFFING LAB ID: 10

Security Threat Kill Chain What log data would you need to identify an APT and perform forensic analysis?


Vulnerability Assessment and Penetration Testing. CC Faculty ALTTC, Ghaziabad

Penetration Testing Report Client: Business Solutions June 15 th 2015

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

Learn Ethical Hacking, Become a Pentester

Network Penetration Testing and Ethical Hacking Scanning/Penetration Testing. SANS Security Sans Mentor: Daryl Fallin

Project 2: Penetration Testing (Phase II)

Penetration Testing Walkthrough

CYBERTRON NETWORK SOLUTIONS

Audience. Pre-Requisites

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

Attack and Penetration Testing 101

Certified Ethical Hacker (CEH)

Penetration Testing Workshop

Make a folder named Lab3. We will be using Unix redirection commands to create several output files in that folder.

Andreas Dittrich, Philipp Reinecke Testing of Network and System Security. example.

Computer Forensics Training - Digital Forensics and Electronic Discovery (Mile2)

Overview of Network Security The need for network security Desirable security properties Common vulnerabilities Security policy designs

If you know the enemy and know yourself, you need not fear the result of a hundred battles.

Nessus. A short review of the Nessus computer network vulnerability analysing tool. Authors: Henrik Andersson Johannes Gumbel Martin Andersson

Using Nessus In Web Application Vulnerability Assessments

Topics in Network Security

INTRODUCTION: PENETRATION TEST A BUSINESS PERSPECTIVE:

Aiming at Higher Network Security Levels Through Extensive PENETRATION TESTING. Anestis Bechtsoudis. abechtsoudis (at) ieee.

Tools for penetration tests 1. Carlo U. Nicola, HT FHNW With extracts from documents of : Google; Wireshark; nmap; Nessus.

CRYPTUS DIPLOMA IN IT SECURITY

SCP - Strategic Infrastructure Security

June 2014 WMLUG Meeting Kali Linux

ABC LTD EXTERNAL WEBSITE AND INFRASTRUCTURE IT HEALTH CHECK (ITHC) / PENETRATION TEST

Nixu SNS Security White Paper May 2007 Version 1.2

CIT 380: Securing Computer Systems

Penetration Testing 2014

Kerem Kocaer 2010/04/14

Build Your Own Security Lab

Black Box Penetration Testing For GPEN.KM V1.0 Month dd "#$!%&'(#)*)&'+!,!-./0!.-12!1.03!0045!.567!5895!.467!:;83!-/;0!383;!

COURSE NAME: INFORMATION SECURITY INTERNSHIP PROGRAM

Penetration Testing: Advanced Oracle Exploitation Page 1

CSE331: Introduction to Networks and Security. Lecture 17 Fall 2006

Evaluation of Penetration Testing Software. Research

Network Attacks and Defenses

Client logo placeholder XXX REPORT. Page 1 of 37

TESTING OUR SECURITY DEFENCES

Linux Network Security

Certified Ethical Hacker Exam Version Comparison. Version Comparison

CSE331: Introduction to Networks and Security. Lecture 32 Fall 2004

Penetration Test Report

Hacking Techniques & Intrusion Detection

Course Content Summary ITN 261 Network Attacks, Computer Crime and Hacking (4 Credits)

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

Foundstone ERS remediation System

Penetration Testing. Presented by

Security Advice for Instances in the HP Cloud

Information Security. Training

Security Mgt. Tools and Subsystems

Network Security Audit. Vulnerability Assessment (VA)

STABLE & SECURE BANK lab writeup. Page 1 of 21

FIREWALLS & NETWORK SECURITY with Intrusion Detection and VPNs, 2 nd ed. Chapter 4 Finding Network Vulnerabilities

Cybernetic Proving Ground

Web App Security Audit Services

Penetration Testing - a way for improving our cyber security

Turn-Key Penetration Testing Labs

The Trivial Cisco IP Phones Compromise

Author: Sumedt Jitpukdebodin. Organization: ACIS i-secure. ID: My Blog:

CMPT 471 Networking II

CYBER ATTACKS EXPLAINED: PACKET CRAFTING

CSSIA CompTIA Security+ Domain. Network Security. Network Security. Network Security. Network Security. Network Security

SECURITY ADVISORY FROM PATTON ELECTRONICS

Network Segmentation

CEH Version8 Course Outline

Concierge SIEM Reporting Overview

National Endowment for the Arts Evaluation Report. Table of Contents. Results of Evaluation Areas for Improvement Exit Conference...

Presented By: Holes in the Fence. Agenda. IPCCTV Attack. DDos Attack. Why Network Security is Important

Security Awareness For Server Administrators. State of Illinois Central Management Services Security and Compliance Solutions

EXTRA. Vulnerability scanners are indispensable both VULNERABILITY SCANNER

INDUSTRIAL CONTROL SYSTEMS CYBER SECURITY DEMONSTRATION

1 hours, 30 minutes, 38 seconds Heavy scan. All scanned network resources. Copyright 2001, FTP access obtained

Firewalls and Software Updates

INFORMATION SECURITY TRAINING CATALOG (2015)

Hack Your SQL Server Database Before the Hackers Do

Venue. Dates. Certified Ethical Hacker (CEH) boot camp. Inovatec College. Nairobi Kenya (exact hotel name to be confirmed

Demystifying Penetration Testing for the Enterprise. Presented by Pravesh Gaonjur

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

HONEYD (OPEN SOURCE HONEYPOT SOFTWARE)

Ethical Hacking and Attack Tools

Distributed Systems Security

How To Test For Security On A Network Without Being Hacked

Virtually Pwned Pentesting VMware. Claudio

Rapid Vulnerability Assessment Report

Introduction to Network Security Lab 2 - NMap

Windows Remote Access

Project 2: Firewall Design (Phase I)

Transcription:

Introduction to Network Penetration Testing James Shewmaker jims@bluenotch.com Intro to Penetration Testing - 2008 James Shewmaker 1

Outline Definitions and Concepts Key Tools Targets and Scenarios Intro to Penetration Testing - 2008 James Shewmaker 2

What is a Penetration Test? A penetration test (pentest) is a systematic probing of a system A system could be any combination of applications, hosts, or networks Emphasis on how deep one can get into the system Sometimes confused with Audits or Assessments Intro to Penetration Testing - 2008 James Shewmaker 3

Testing Areas What areas can we test? Response / Work flow / Policy Physical Logical Network Host Application Intro to Penetration Testing - 2008 James Shewmaker 4

Why are We Testing Anyway? How do you KNOW your network and systems are secure? Your knowledge is only as good as your last test Your last test is only as good as your weakest link Tools Experience Execution Intro to Penetration Testing - 2008 James Shewmaker 5

Authoritative Permission Permission must be From the proper authority Very specific in detail Unfortunate example Oregon vs. Randal Schwartz, 1995 Mr. Schwartz used a back-door and cracked passwords in the course of his work without explicit permission Intro to Penetration Testing - 2008 James Shewmaker 6

Pentest Targets / Scope Scope is WHAT to test Highlight points of Interest or Value Hosts Service Application Network Internal devices Perimeter devices Where is the low hanging fruit? How deep can we go? Intro to Penetration Testing - 2008 James Shewmaker 7

Pentest Goals Determine target discoverability Assess state of Incident Response Technical skill assessment Policy and procedure practice Document unknown or orphan resources Intro to Penetration Testing - 2008 James Shewmaker 8

Rules of Engagement Establish the HOW of the pentest Decide when to begin and end Set a Date and Time window Don't start at the first opportunity Build the testing team Establish rules for emergency 24x7 Intro to Penetration Testing - 2008 James Shewmaker 9

Key Definitions in Pentesting Attack Vector A path to deliver a payload Leverage using a component to better position or exploit another component Privilege Escalation leveraging a low privilege account to a higher privilege account Remote Vulnerability exploiting from an outside source Local Vulnerability exploiting on the system itself Red Team / Tiger Team offensive team Blue Team defensive team Intro to Penetration Testing - 2008 James Shewmaker 10

Leverage In-Depth Penetration testing is mostly about discovery using leverage We tend to see avenues of attack that can be represented in the OSI network model We will skew the OSI model slightly to fit into our Penetration Methodology 7) Application ( public or private availability, input ) 6) Presentation ( encryption, checksum/checkpoint ) 5) Session ( an exchange, a specific instance of TCP traffic ) 4) Transport ( packaging ) 3) Network ( switching/routing- How to get from one host to another ) 2) Data Link ( local - How to get from one host to another ) 1) Physical ( the CAT5 cable, the USB thumb drive, etc. ) Intro to Penetration Testing - 2008 James Shewmaker 11

Example Avenue of Attack Intro to Penetration Testing - 2008 James Shewmaker 12

Leverage In-Depth (continued) Things that may be leveraged public access private/authorized access resources environment assumptions trust relationships standards and assumptions Intro to Penetration Testing - 2008 James Shewmaker 13

Techniques and Tricks Social Engineering Manipulating the user space Physical attacks Stop short of beating the system administrator If you have physical access and can force a reboot, you usually have complete access to the system, for example: Boot backtrack to clear the Windows Administrator password Boot Linux into single-user mode and change the root password Combination attacks Tap the keyboard with a key logging device, tell the administrator I broke in, go check! and when he does, you have his password... Intro to Penetration Testing - 2008 James Shewmaker 14

Techniques and Tricks (continued) Literally any bit of information may be valuable as Recon You may find systems that are expendable to the owner but may contain something you can use You may find read-only access to logs that you can watch (valuable when you try to create errors on purpose) Look for trust relationships Get access to one, and you have some sort of access to the other Look for indirect paths Perhaps the SQL server is not public, but is used by the web server Maybe the SQL server is also used for internal database Constantly adding to your collection of intelligence Intro to Penetration Testing - 2008 James Shewmaker 15

Techniques Summary Explore everything possible, from the largest hosts or applications down to every avenue of input. Look for more holes Look for more applications Look for more clues Penetration is focused on deep, but do not forget wide Use Leverage wherever you can find it Take careful notes Think about assumptions and context, you may be able to manipulate the environment to open up new doors If you run into a dead end, start from what you do know and explore Lower hanging fruit is usually picked first, so start there DO NOT EXCEED THE TEST BOUNDARIES Intro to Penetration Testing - 2008 James Shewmaker 16

Process of Discoverability Each test should be repeatable Different kinds of progression Going from what you know directly to what you do not know (serial) Educated guessing using similar examples seen so far (parallel) Guessing based on gut feeling or even random idea (brute force and usually pointless) Intro to Penetration Testing - 2008 James Shewmaker 17

Typical Penetration Phases Perform Reconnaissance Initial mapping and information gathering, focus on observation Port / Vulnerability Scan Probe applications for potential leverage Manipulate and Exploit Manipulate vulnerabilities and flaws for benefit Bootstrap the Penetration Start the process over again from this new vantage point: Recon, Probe, and Exploit new avenues or objects Intro to Penetration Testing - 2008 James Shewmaker 18

Recon Tools Off site information gathering Google / whois / Maltego / DNS Network mapping nmap / nessus Host fingerprinting queso / p0f Service probing netcat / webscarab Custom scripts to harvest info Intro to Penetration Testing - 2008 James Shewmaker 19

Network Monitoring Tools Discovery new of assets to leverage Identification of testing breakage wireshark dsniff snort Intro to Penetration Testing - 2008 James Shewmaker 20

Perimeter Tools Any packet tool hping (packet crafting) firewalk (firewall testing Mapping out a firewall) Check other perimeter devices Perhaps an IDS that make assumptions about fragmentation? Don t forget to think outside the building Modem pool Wireless Intro to Penetration Testing - 2008 James Shewmaker 21

Application Tools HTTP proxies Use webscarab to modify HTTP traffic Fuzzers Recon but with consequences Try to break the application to learn more about it All attempts are likely logged Designed to test input parameters Type of input (alphanumeric, numbers, or object) Size of input (underflow or overflow) netcat Manually probe responses from application Custom programs or scripts Context and Environment leverage Possible race condition Weak path or file system permissions Intro to Penetration Testing - 2008 James Shewmaker 22

Exploit Tools Test for vulnerability Leverage vulnerability Favorites Hydra (password guessing) Metasploit (modular exploits) Custom (ie: www.milw0rm.com) Intro to Penetration Testing - 2008 James Shewmaker 23

Potential Targets Network Perimeter devices Internal nodes Hosts Public facing Private leveraging Applications Escalated Access Valuable Data Intro to Penetration Testing - 2008 James Shewmaker 24

Penetration Testing Styles Styles Black Box (Scenario A) Begin with a clean slate and no insider knowledge Simulates random target approach Crystal Box (Scenario B) Some previous knowledge Specific targets Approaches Internal (usually not Black Box) External (completely outside the firewall) Intro to Penetration Testing - 2008 James Shewmaker 25

Black Box Testing Starting with nothing Reconnaissance What shows up with a network sweep? Anything interesting? Hosts Applications Stop and think about how one might find this target in the first place (Google maybe?) Going deeper and see what else you can find Intro to Penetration Testing - 2008 James Shewmaker 26

Crystal box Testing Tends to involve specific targets Easier to define scope than Black Box Must be even more careful to NOT make bad assumptions Intro to Penetration Testing - 2008 James Shewmaker 27

Aftermath - Now What? Sometimes you have to fix something testing may have broke The test is pointless without careful and precise documentation Documentation is pointless if it is not available Use the test results to plan corrective action Specific patching and configuration Plan for future patches and tests Intro to Penetration Testing - 2008 James Shewmaker 28

Scenario A - Introduction You are a consultant Given a company name, find out everything you can Highlight points of interest along the way Potential risks Working controls No network sniffing No breaking of applications Avoid disturbing production data Intro to Penetration Testing - 2008 James Shewmaker 29

Scenario A Stage 0 GET FINAL, AUTHORITIVE, WRITTEN, AND SIGNED PERMISSION! Intro to Penetration Testing - 2008 James Shewmaker 30

Scenario A Stage 1 Exhaust off site recon opportunities Anyone for dumpster diving? Start with free utility services Google using the company name to find indexed sites using the site:mydomain.com feature to narrow down the results using the filetype:xls to search for data» Could be private» Could be public data but valuable as recon Intro to Penetration Testing - 2008 James Shewmaker 31

Scenario A Stage 1 Continued uptime.netcraft.com Netcraft may have the host type, web server version, and uptime samspade.org Can check for various things isc.sans.org» DNS records Can check an IP for reported info Sometimes every little bit of info helps Note and evaluate the information so far Where can go from what we know to the next level? Intro to Penetration Testing - 2008 James Shewmaker 32

Scenario A Stage 2 DNS will be valuable Does whois tell us that the DNS is hosted elsewhere? Can we do a name transfer or figure out how to enumerate records? Email addresses of administrators in whois Maybe their website or email is on a shared hosting box, how can we tell? Is there any info we can leverage? Remember to keep recon as limited as possible to postpone detection Intro to Penetration Testing - 2008 James Shewmaker 33

Scenario A Stage 3 Skip Network Monitoring, outside the boundaries for this test Check out the perimeter Start a traceroute to the public IP addresses you have so far Note any host or service that shows up, ones that definitely do not exist, and ones that are unknown If you find new services or hosts, conduct initial recon on these new items before proceeding to Stage 4 Intro to Penetration Testing - 2008 James Shewmaker 34

Scenario A Stage 4 Check the reachable hosts and devices with specific tools Craft packets with hping to elicit responses from known and unknown devices Manipulate reachable applications, try to break them manually or with a fuzzer; try to generate error messages Look for new clues that may reveal another private host or other resource you cannot see directly Intro to Penetration Testing - 2008 James Shewmaker 35

Scenario A Overall Results Documentation Process of discovery Tree diagram representing where and how deep the discovery went List of publicly reachable devices and applications List of test conditions and generated errors List of known exploitable conditions Intro to Penetration Testing - 2008 James Shewmaker 36

Pentesting Hands-on Results Initial reconnaissance Service Map of host using nmap Network monitoring Switched network, no benefit Perimeter tests Host is target, perimeter testing is no different than host testing Application tests Testing reveals vulnerabilities Exploit Leverage vulnerability with recon Bootstrap the test to the next level Intro to Penetration Testing - 2008 James Shewmaker 37

Scenario B Introduction Defcon 2005 Capture the Flag prequalification Emphasis on penetration and vulnerability discovery Kickoff: an email with an http link to begin the contest, and a username and password for later use There are eight (8) flags representing valuable data That is all you have to go on! Intro to Penetration Testing - 2008 James Shewmaker 38

Scenario B Stage 0 HTTP link reveals several things Hostname dujour.kenshoto.com Running webserver on port 80 Some content Where does recon stop and preliminary testing start? Sometimes you don t know what you re testing until you break it! Intro to Penetration Testing - 2008 James Shewmaker 39

Scenario B Stage 0 (continued) Recon Host info nmap/netcraft/whois/arin Host services Map them with nmap/nessus/amap We see that there is an HTTP service, we can try exploring Default directories/files View source for clues in comments or other links Intro to Penetration Testing - 2008 James Shewmaker 40

Scenario B Stage 0 Results Nmap says 22/tcp open ssh OpenSSH 3.8.1p1 (protocol 2.0) 80/tcp open http Apache httpd 2.0.53 ((FreeBSD)) 6969/tcp open acmsoda? 19150/tcp open unknown Intro to Penetration Testing - 2008 James Shewmaker 41

Scenario B Stage 1 http://dujour.kenshoto.com/cgi-bin/stage1 Learn more about the application by viewing the source, exploring, and breaking the web application HTML form has a hidden form field named message http://dujour.kenshoto.com/cgibin/stage1?message=aa File Not Found error! We also learn that the application doesn t discern between POST and GET variables Intro to Penetration Testing - 2008 James Shewmaker 42

Scenario B Stage 1 Results Manipulate the CGI link from Stage 0 http://dujour.kenshoto.com/cgibin/stage1?message=/etc/passwd Download /etc/passwd and /etc/passwd.shadow Combine and crack with john and a decent dictionary Meanwhile more recon by leveraging Stage 1 Other key system files (/etc/hosts.allow) Other application files (/usr/local/etc/apache/httpd.conf) Log files (/var/log/messages) User files (/root/.history) Temporary files (/tmp/*) Discover username/password breakme/apple1 and root/fred Intro to Penetration Testing - 2008 James Shewmaker 43

Scenario B Stage 2 ssh breakme@dujour.kenshoto.com Returns binary data and closes connection Appears to be base64 encoded No other new leads Can continue this route or look for lower hanging fruit Let s map the services on the host Don t forget to watch log files with the CGI form Note typical behaviour Note error messages due to your probes Intro to Penetration Testing - 2008 James Shewmaker 44

Scenario B Stage 2 Results Reverse Engineering the Binary reveals clues Useful tools include gdb, strings, and metasploit Binary appears to communicate on port 6969 Vulnerable to overflow Intro to Penetration Testing - 2008 James Shewmaker 45

Scenario B Stage 3 Play with the binary with netcat (using username/password from Stage 0) $ nc -vv dujour.kenshoto.com 6969 Warning: inverse host lookup failed for 206.131.226.59: Unknown host dujour.kenshoto.com [206.131.226.59] 6969 open AUTH:team13:tUqXasJuxM OK Back to trying to break it Try bad username/passwords Try invalid input after authentication Step through the binary with a debugger Helpful tools are gdm and ktrace Find an overflow to leverage Intro to Penetration Testing - 2008 James Shewmaker 46

Scenario B Stage 3 Results Eventually overflow the binary to open up a remote shell Attempt to leverage this new shell Create another account Enable ssh access Hide evidence of penetration? Create misleading evidence? Intro to Penetration Testing - 2008 James Shewmaker 47

Scenario B Stage 4 We have access to the machine, so now what? Privilege Escalation Data discovery Possible avenues Perform forensics on the box for clues to valuable data access Perform monitoring on the box to reveal admin or other user access Brute force additional access Intro to Penetration Testing - 2008 James Shewmaker 48

Scenario B Overall Results Repeated the process, trying all existing accounts and system binaries This scenario had several types of overflows, including heap, stack, and format string overflows in local applications Report includes the extent of how deep we reached into the system Intro to Penetration Testing - 2008 James Shewmaker 49

Conclusions Where do we go from here? Increase penetration testing depth Increase penetration testing scope How can I reliably test production networks and systems? <sarcasm>be sure to let the rest of us know when you find the perfect way </sarcasm> Intro to Penetration Testing - 2008 James Shewmaker 50

Summary Methodology Concepts Precise and Systematic Testing Leverage anything an attacker might have or obtain Tools Like anything else, use what your comfortable with and what would be appropriate for the environment Targets and Scenarios Get Permission and Prepare Documentation Precisely document what you find: good, bad, or seemingly insignificant Aftermath Put the knowledge gained from testing to good use Intro to Penetration Testing - 2008 James Shewmaker 51

For More Information Oregon vs. Randal Schwartz http://www.lightlink.com/spacenka/fors/ The Hacker s Choice http://www.thc.org Metasploit http://www.metasploit.org Nmap http://www.insecure.org IP Address Allocation http://www.ietf.org/rfc/rfc1918.txt http://www.iana.org/assignments/ipv4-address-space Snort http://www.snort.org Ftester http://ftester.sourceforge.net WHAX http://www.iwhax.net Backtrack http://www.remoteexploit.org Intro to Penetration Testing - 2008 James Shewmaker 52