Table of Contents

Recon: Info Gathering

Review

The six steps/stages of a PenTest…

  1. Pre-Engagement: Planning & Scope
  2. Recon: Information Gathering
  3. Scanning
  4. Exploitation
  5. Post-Exploitation
  6. Post-Engagement: Report

Overview

Outline of the Recon Stage:

  1. OSInt
  2. Passive Recon
  3. Active Recon
  4. Social Engineering
  5. GOALS
    1. Footprinting
    2. Enumeration (build lists!)
      • Potential vectors of attack
      • IP address to scan

Enumeration

This process is essential for an attack to be successful, as wasting time with exploits that either do not work or can crash the system can be a waste of energy.


Practice

First: Make sure you check out the tools in Kali: menu… 01 - Information Gathering…

Then, practice: Find a “client” on BugCrowd.com


[1] OSInt

WhoIs

whois provides information such as email addresses, phone numbers, and possibly even physical addresses associated with a domain name or IP address.

Problem: A major problem with whois lookups today is that the amount of visible data has been greatly reduced in an effort to provide better privacy and protection.

Work-Around: There are services that provide historical whois lookups (kind of like a WayBack Machine for DNS/WhoIs stuff). Examples:

NSLookUp

nslookup is similar to whois but a bit more flexible and focused.

# Basic: 
whois google.com
nslookup google.com

# Reverse:
whois 172.250.191.174
nslookup 172.250.191.174

FOCA

FOCA: Fingerprinting Organizations with Collected Archives

Routing Info

Routing information is network information, and you can find it in public BGP1) route information servers called BGP Looking Glasses.


[2] Passive Recon

Physical: go on site…

Social: talk to someone, phishing, vishing, etc.

Specific Passive Recon Activities:

  1. Target Validation:
    1. whois, nslookup, dnsrecon
  2. Finding Subdomains:
    1. Google Fu, dig, Nmap, Sublist3r, Bluto, crt.sh, etc.
  3. Fingerprinting: What's running on a host? What's open and running?
    1. Nmap, Wappalyzer, WhatWeb, BuiltWith, Netcat
  4. Data Breaches: Most common way to get into someone's junque quickly
    1. HaveIBeenPwned, Breach-Parse, WeLeakInfo

Email Address Gathering

Email Address Gathering, Hunter.io

Gathering Breached Credentials with Breach-Parse

The Harvester


Web Information Gathering

Subdomain Information

Any kind of web hack or bug bounty gig will require you to find out what subdomains are out there related to your upper level domain.

Tool: Sublist3r

Tool: crt.sh (website) | search on %.tesla.com

Tool: OWASP Amass Project (a go-to tool for bug bounty hunters)

Then with a list of subdomains, you can use something like tomnomnom/httprobe to dump in a list of domains and see if they are active.


ID Website Technologies

Tool: BuiltWith

Tool: Wappalyzer plugin for your browser (simpler interface and results than BuiltWith). This is a little more “active” since it hits against the web site a bit.

Tool: WhatWeb * Already built into Kali. Just run it from the command line. * Syntax: whatweb [url]

The more tools you use, the more information you will obtain. Each tool will give you something the others did not.


Burp Suite

This tool is part of Kali, so start it up via the menu.

Set up Firefox:

When you now use Firefox to load a website (like tesla.com) BurpSuite will intercept the calls and information.

Got into the Target tab and you can see all the places information was pulled from.


Social Media

Other tools for OSINT: LinkedIn, Twitter, Facebook


Google Fu

TCM really likes Google.


Google Hacks

The Google Guide

Four of the most useful Google queries:

  1. inurl:[string]: Restricts results to documents containing your string in the URL.
    • Example: inurl:101labs
  2. intitle:[string]: Restricts results to documents containing your string in the web page's title.
    • Example: intitle:apple
  3. site[site | domain]: Restrics results to the site or domain specified.
    • Example: site:.gov
    • Example: site:theology101.net
  4. filetype:[filetype suffix]: Restrics results to documents with the suffix specified.
    • Example: filetype:pdf

[3] Active Recon

Much of active recon involves scanning. So… for right now, see “ Scanning.”

URL Enum

URL enumeration makes a list of URLs in a domain, often showing hidden files and directories.

DNS Enum

DNS enumeration is like an aggressive DNS lookup (think whois on steroids).

Example syntax: dnsenum –enum google.com

SMTP

Simple Mail Transfer Protocol (SMTP): A vintage email sending protocol.

You can gather info on SMTP by telnetting to the service port (25) and grabbing the banner information and then using VRFY and/or EXPN to gather more info. Example sytax:

telnet example.server.com 25

# once connected, type:
VRFY [username]
# or
EXPN [user_alias]

Exploits: SMTP exploits are usually associated with a vulnerable version.

SNMP

You can use SNMP to gather information on a system if you have access to the system and you know the “read” community string (which is often: public).

Tools:

# Example syntax for snmpwalk, assuming 'public' as the community string
snmpwalk -c public -v1 192.168.1.1

[4] Social Engineering

SEToolkit

The Social-Engineer Toolkit (SET) is an open-source penetration testing framework designed for social engineering. SET has a number of custom attack vectors that allow you to make a believable attack quickly.

Watering Hole (simple example): Lure people into a fake Facebook page, harvest their login creds.

Steps:

  1. Start SET
  2. Select 1 from the menu: Social-Engineering Attacks
  3. Select 2 from the menu: Website Attack Vectors
  4. Select 3 from the menu: Credential Harvester Attack Method
  5. Select 2 from the menu: Site Cloner (POST back IP address is the address to which your harvested creds will be sent; it defaults to your current IP; leave it alone unless you have another IP to use.)
  6. Enter the URL you want to clone: https://www.facebook.com/

The target machine needs to enter your attack box IP into their browser… the cloned URL will load… target enters creds… and they register in SET.

1)
Border Gateway Protocol