hands-on hacking techniques 101...• an enumeration technique used to glean information about...

66
Hands-On Hacking Techniques 101 University of Petra Faculty of Information Technology Department of Computer Networking Dr. Ali Al-Shemery bsc [at] ashemery [dot] com

Upload: others

Post on 14-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Hands-OnHacking Techniques 101

University of PetraFaculty of Information Technology

Department of Computer Networking

Dr. Ali Al-Shemery

bsc [at] ashemery [dot] com

Page 2: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Basic Information Gathering

Reconnaissance (RECON)

W33K #3 – Part1

Page 3: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Outline

• Intelligence Gathering

• Target Selection

• Open Source Intelligence (OSINT)

• Cooperate / Individual

• Covert Gathering

• Tools

• Footprinting

ashemery.com 3

Page 4: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

With great knowledge, comes successful attacks!

Page 5: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Target Selection

• Identification and Naming of Target

• Consider any Rules of Engagement limitations

• Consider time length for test

• Consider end goal of the test

ashemery.com 5

Page 6: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Open Source Intelligence (OSINT)

• Simply, it’s locating, and analyzing publically (open) available sources of information

• Intelligence gathering process has a goal of producing current and relevant information that is valuable to either an attackeror competitor

- OSINT is not only web searching!

ashemery.com 6

Page 7: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

OSINT – Cont.

• Information Gathering takes three forms:

—Passive

—Semi-passive

—Active

• Used for:

—Corporate

—Individuals

ashemery.com 7

Page 8: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Corporate: Physical

• Locations— Public sites can often be located by using search engines such as:

• Google, Yahoo, Bing, Ask.com, Baidu, Yandex, Guruji, etc

• Relationships

ashemery.com 8

Page 9: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Corporate: Logical

• Business Partners

• Business Clients

• Competitors

• Product line

• Marketing accounts

• Meetings

• Significant company dates

• Job openings

ashemery.com 9

Page 10: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Job Openings Websites

• Bayt, http://bayt.com

• Monster, http://www.monster.com

• CareerBuilder, http://www.careerbuilder.com

• Computerjobs.com, http://www.computerjobs.com

• Indeed, LinkedIn,

• etc

ashemery.com 10

Page 11: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Corporate: Electronic

• Document Metadata

• Marketing Communications

ashemery.com 11

Page 12: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Corporate: Infrastructure Assets

• Network blocks owned

• Email addresses

• External infrastructure profile

• Technologies used

• Purchase agreements

• Remote access

• Application usage

• Defense technologies

• Human capability

ashemery.com 12

Page 13: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Individual: Social Network (SocNet) Profile

• Metadata Leakage

• Tone

• Frequency

• Location awareness

• Social Media Presence

ashemery.com 13

Page 14: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Individual: Internet Presence

• Email Address

• Personal Handles/Nicknames

• Personal Domain Names registered

• Assigned Static IPs/Netblocks

ashemery.com 14

Page 15: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Maltego

• Paterva Maltego is a data mining and information-gathering tool that maps the information gathered into a format that is easily understood and manipulated.

• It saves you time by automating tasks such as email harvesting and mapping subdomains.

ashemery.com 15

Page 18: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

NetGlub

• NetGlub is an open source data mining and information-gathering tool that presents the information gathered in a format that is easily understood, (similar to Maltego)

• Consists of: Master, Slave, and GUI

ashemery.com 18

Page 22: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

TheHarvester

• TheHarvester is a tool, written by Christian Martorella, that can be used to gather e-mail accounts and subdomain names from different public sources (search engines, pgp key servers)

• DEMO:theharvester.py -d uop.edu.jo -l 500 -b google

ashemery.com 22

Page 23: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Social Networks

• Check Usernames - Useful for checking the existence of a given username across 160 Social Networks.— http://checkusernames.com/

ashemery.com 23

Page 24: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Archived Information

• There are times when we will be unable to access web site information due to the fact that the content may no longer be available from the original source

• Being able to access archived copies of this information allows access to past information

• Perform Google searches using specially targeted search strings: cache:<site.com>

• Use the archived information from the Wayback Machine, http://www.archive.org

ashemery.com 24

Page 25: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Archived Information

25Dr. Ali Al-Shemery @ashemery.com

Page 26: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Metadata leakage

• The goal is to identify data that is relevant to the target corporation

• It may be possible to identify locations, hardware, software and other relevant data from Social Networking posts

• Examples:— ixquick - http://ixquick.com

— MetaCrawler - http://metacrawler.com

— Dogpile - http://www.dogpile.com

— Search.com - http://www.search.com

— Jeffery's Exif Viewer - http://regex.info/exif.cgi

ashemery.com 26

Page 27: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Metadata leakage: FOCA

• FOCA is a tool that reads metadata from a wide range of document and media formats

• FOCA pulls the relevant usernames, paths, software versions, printer details, and email addresses

ashemery.com 27

Page 28: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Metadata leakage:Foundstone SiteDigger

• Foundstone has a tool, named SiteDigger, which allows us to search a domain using specially strings from both the:— Google Hacking Database (GHDB)

— Foundstone Database (FSDB)

ashemery.com 28

Page 29: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Metadata leakage - Foundstone

SiteDigger

29Dr. Ali Al-Shemery @ashemery.com

Page 30: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Metadata leakage: Metagoofil

• Metagoofil is a Linux based information gathering tool designed for extracting metadata of public documents (.pdf, .doc, .xls, .ppt, .odp, .ods) available on the client's websites

• Metagoofil generates an html results page with the results of the metadata extracted, plus a list of potential usernames that could prove useful for brute force attacks

• It also extracts paths and MAC address information from the metadata

# metagoofil

ashemery.com 30

Page 31: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Individual: Physical Location

• Physical Location

ashemery.com 31

Page 32: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Individual: Mobile Footprint

• Phone #

• Device type

• Installed applications

ashemery.com 32

Page 33: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Covert Gathering: Corporate

On-Location Gathering

• Physical security inspections

• Wireless scanning / RF frequency scanning

• Employee behavior training inspection

• Accessible/adjacent facilities (shared spaces)

• Dumpster diving

• Types of equipment in use

Offsite Gathering

• Data center locations

• Network provisioning/provider

ashemery.com 33

Page 34: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Other Gathering Forms

Human Intelligence (HUMINT)

• Methodology always involves direct interaction - whether physical, or verbal

• Gathering should be done under an assumed identity (pretexting)— Key Employees

— Partners/Suppliers

ashemery.com 34

Page 35: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Other Gathering Forms

Signals Intelligence (SIGINT):

• Intelligence gathered through the use of interception or listening technologies

• Example:— Wired/Wireless Sniffer

— TAP devices

ashemery.com 35

Page 36: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Other Gathering Forms

Imagery Intelligence (IMINT):

• Intelligence gathered through recorded imagery, i.e. photography

• IMINT can also refer to satellite intelligence, (cross over between IMINT and OSINT if it extends to Google Earth and its equivalents)

ashemery.com 36

Page 37: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Assignment #2

• Gathering information about a website from Google cache, is it an Active or Passive Recon?

ashemery.com 37

Page 38: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Footprinting

Walking the trails to a target …

W33K #3 – Part2

Page 39: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

External Footprinting

Page 40: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Identify Customer External Ranges

• The major goals of intelligence gathering during a penetration test is to determine hosts which will be in scope

• Common techniques to identify:— WHOIS searches on the domains and the ranges

— reverse DNS lookups

— DNS brute forcing

ashemery.com 40

Page 41: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Passive Recon: WHOIS Lookups

• Determine TLD for the domain, and which WHOIS server contains the information we're after

• WHOIS information is based upon a tree hierarchy

• ICANN (IANA) is the authoritative registry for all of the TLDs

• Middle East WHOIS lookup (registrar): RIPE NCC, http://www.ripe.net/lir-services/member-support/info/list-of-members/mideast

ashemery.com 41

Page 42: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Passive Recon: NetCraft

• Internet monitoring company that monitors uptimes and provides server operating system detection.

• Site Report returns information such as:— IP address

— Name servers

— Reverse DNS

— Netblock owner

— DNS admin

— Domain registry

• http://toolbar.netcraft.com

ashemery.com 42

Page 43: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Passive Recon: URLs

• Extract list of URLs from a web page— list-urls.py (no longer available in KALI)

• Search for files in a domain— goofile.py

— FOCA

ashemery.com 43

Page 44: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Online Tools

• Central Ops, http://centralops.net/

• Wayback Machine: http://archive.org/

• Zone-h Defacement Archive, http://zone-h.org/

• Domain Tools, http://www.domaintools.com/

• DNS Stuff, http://www.dnsstuff.com

• MX Toolbox, http://mxtoolbox.com

• RIPE, http://www.ripe.net/data-tools/db

• WHOIS, http://www.whois.com/whois/

• WHOIS, http://www.whois.sc/

• What Is My IP, http://www.whatismyip.com/

• InterNIC, http://www.internic.net/

ashemery.com 44

Page 45: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Google for Pentesting

• Check Johnny Long’s presentation @Blackhat …

• Google Dorks, http://www.exploit-db.com/google-dorks/

• Google Hacking Database (GHDB), http://www.hackersforcharity.org/ghdb

ashemery.com 45

Page 46: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

ShodanHQ

• ShodanHQ.com is a computer search engine

• Examining the response of the devices it contacts on the Internet. Information gathered such as:— Target OS, Web server software version

— Checks if default user/pass are being used

— Can identify webcam, firewalls, and VoIP devices

— Can identify network printers

• Need Help? www.shodanhq.com/browse

• Registration is required to make the most effective use of the site

ashemery.com 46

Page 47: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Active Footprinting

• Port Scanning (later…)

ashemery.com 47

Page 48: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

DNS Discovery

• Performed by looking at the WHOIS records for the domain's authoritative nameserver.

• Variations of the main domain name should be checked, and the website should be checked for references to other domains which could be under the target's control.

ashemery.com 48

Page 49: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

DNS Discovery: DNS Types

• A Host’s IP address.

• MX Host/domain’s mail exchanger(s)

• NS Host or domain’s name server(s)

• CNAME Host’s canonical name allowing additional names or aliases

• SOA Authority for the domain

• RP Responsible person

• PTR Pointer to a canonical name, used for reverse lookups

ashemery.com 49

Page 50: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Zone Transfers

• DNS zone transfer, also known as AXFR, is a type of DNS transaction.

• It is a mechanism designed to replicate the databases containing the DNS data across a set of DNS servers.

• Zone transfer comes in two flavors, full (AXFR) and incremental (IXFR).

• Tools commonly used: host, dig, nslookup, and nmap

ashemery.com 50

Page 51: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Reverse DNS

• Reverse DNS can be used to obtain valid server names in use within an organizational.

• There is a caveat that it must have a PTR (reverse) DNS record for it to resolve a name from a provided IP address.

ashemery.com 51

Page 52: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Forward DNS

• AKA “DNS Brute Forcing”

• Not only zone transfers!

• Discover additional host names that are not commonly known. — fierce

— dnsenum

— dnsrecon

File extensions removed in KALI.

ashemery.com 52

Page 53: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

SMTP Bounce Back

• AKA Non-Delivery Report/Receipt (NDR), a (failed) Delivery Status Notification (DSN) message, a Non-Delivery Notification (NDN) or simply a bounce, is an automated electronic mail message from a mail system informing the sender of another message about a delivery problem

• Done by simply creating a bogus address ([email protected]) within the target's domain

ashemery.com 53

Page 54: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

SMTP – Tools

• SMTP User Enumerator, smtp-user-enum

smtp-user-enum -M VRFY -U users.txt -t 10.0.0.1

• Swiss Army Knife for SMTP, swaks

• Nmap NSE script, smtp-enum-users.nse

• Others:— Central Ops (Email Dossier), http://centralops.net/co/

— Manually

ashemery.com 54

Page 55: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Banner Grabbing

• An enumeration technique used to glean information about computer systems on a network and the services running its open ports.

• Banner grabbing is used to identify network the version of applications and operating system that the target host are running.

• Usually performed on: HTTP, FTP, and SMTP

• Tools commonly used: Telnet, Nmap, and Netcat

ashemery.com 55

Page 56: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Web Application Discovery

• Identifying weak web applications can be a particularly fruitful activity during a penetration test.

- More on this later

ashemery.com 56

Page 57: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Virtual Host Detection & Enumeration

• Web servers often host multiple "virtual" hosts to consolidate functionality on a single server

• If multiple servers point to the same DNS address, they may be hosted on the same server

• Tools such as Bing search can be used to map an IP address to a set of virtual hosts

—IP:<ip-address-to-search>

ashemery.com 57

Page 58: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Establish External Target List

• Once the activities above have been completed, a list of users, emails, domains, applications, hosts and services should be compiled— Mapping versions

— Identifying patch levels

— Looking for weak web applications

— Identify lockout threshold

— Error Based

— Identify weak ports for attack

— Outdated Systems

— Virtualization platforms vs VMs

— Storage infrastructure

ashemery.com 58

Page 59: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Internal Footprinting

Page 60: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Identify Customer Internal Ranges

• Start by identifying the local subnet, then modify slightly to reach other subnets

• Check routing tables of hosts

• Most popular technique used is checking DHCP servers

ashemery.com 60

Page 61: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Passive Footprinting

• If the tester has access to the internal network, packet sniffing can provide a great deal of information.

• Use techniques like those implemented in p0f to identify systems.# p0f –o cap.txt -i eth0 -M -V -v -p -t

ashemery.com 61

Page 62: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Active Footprinting

• We can perform all the external active footprinting techniques here!

Port Scanning:

• Internal port scanning differs from external port scanning, because of the higher bandwidth available, and the ability to get more accurate response

(Later …)

ashemery.com 62

Page 63: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

Think !

Any ideas for:• Countermeasure• Mitigation• Remediation

ashemery.com 63

Page 64: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

DIY

• Choose a target that you have permission to, maybe yourself and try to gather as much information found publicly as you can.— I’m sure you’ll be amazed with what you’ll discover !!!

ashemery.com 64

Page 65: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

SUMMARY

• We saw what is intelligence gathering

• The OSINT three

• What corporate info to gather

• What individual info to gather

• Understood the covert gathering types

• What is footprinting

• Difference between active and passive footprinting

• Main external and internal footprinting information resources

• How to use Google when performing intelligence gathering

• Discusses mitigation to footprintingashemery.com 65

ashemery.com65

Page 66: Hands-On Hacking Techniques 101...• An enumeration technique used to glean information about computer systems on a network and the services running its open ports. • Banner grabbing

References

• Effective meetings, http://www.businessandthegeek.com/?p=112

• Penetration Testing Standards, http://www.pentest-standard.org/

• FOCA, http://www.informatica64.com/foca/

• Foundstone,

• Johnny Long, Blackhat, Google Hacking for Penetration Testers,

• Exploit-DB, Google Dorks,

• NetGlub,

• Paterva Maltego,

• NetCraft, http://toolbar.netcraft.com/

• Lots of web tools, http://viewdns.info/

• SensePost BiLE Suite, http://www.sensepost.com/labs/tools/misc

• List of DNS Record Types, http://en.wikipedia.org/wiki/List_of_DNS_record_types

ashemery.com 66