7- Reconnaissance & Information Gathering
Refer to OneNote for the first part of the chapter
Recon-ng
→ Reconnaissance and OSINT tool that has an interface similar to Metasploit.
→ There are a lot of modules that specializes in different aspects of reconnaissance.
Search marketplace for modules: Here we will look for modules that do recon on
domains as an example.
marketplace search domain
→ The modules that have an asterisk * in the K column (which stands for Key) means they need API keys or
some sort of credentials
Finding info on a module: will use recon/domains-hosts/google_site_web as
example
(this is a module we found in the previous search)
marketplace info recon/domains-hosts/google_site_web
Installing & loading a module: note that I need to load the module whenever I want
to use it.
marketplace install recon/domains-hosts/google_site_web
marketplace load recon/domains-hosts/google_site_web
A module's own info: note that as this point I would be inside the module already
and the terminal would look like the one below
[recon-ng][default][google_site_web] > info
Setting an option and running the module: The number of options to set depends
on the Reconng module in question, here we will set the source to
megacorpone.com as an example
options set SOURCE megacorpone.com
run
→ Google Captcha Error: When Google notices a lot of requests on their search
engine, they might give you an Error (Google CAPTCHA triggered. No bypass
available). You must wait and then try later or change your IP
Database: Recon-ng stored the results of modules in an SQLite database.
I need to go out of the module I'm in and then type show hosts to see all the hosts I
searched and collected information on
back
show hosts
Resolve IP address of all host in my database: There is a module resolves
hostnames for IP. I can choose it's SOURCE value just like before, but since I want
it to resolves the hosts in my database I will leave its value as default and run it
modules install recon/hosts-hosts/resolve
modules load recon/hosts-hosts/resolve
run
→ If we look at our database table called hosts, we can see now that we have the ip
address filled in. So, in a sense you can fill in a complete database of useful
information on your reconnaissance targets.
Several ways to look at leaked information
GitHub page: Some companies especially those who post source code, make
mistakes and leak important information in source code such as credentials, users,
configuration files. You can use GitHub filters to search for something specific
filename:users
→Gitleaks: Gitleaks find potentially sensitive files pushed to public repositories on
Github. It will clone repositories belonging to a user or organization & iterate
through the commit history & flag files that match signatures for potentially sensitive
files.
Shodan Search Engine: Shodan crawls all devices connected to the Internet.
Shodan can find servers, Routers, Switches, IP cameras and IoT devices.
Lebanon country:"LB" --see devices in lebanon that can be exploited
hostname:megacorpone.com --search on the website
Security Headers: Analyses HTTP response headers for domains
securityheaders.com
Qualys SSL Labs: The SSL Server Test analyses SSL/TLS configurations and
compare it to best practices. It can identify weakness in SSL/TLS.
User information Gathering a.ka. User Enumeration
→ The Harvester Tool
This is a command-line tool in Kali that uses different search engines to find email
accounts, subdomain names, IPs, URLs, virtual hosts, employee names related to a
domain among other important information. GitHub Repo can be found here.
theHarvester -d megacorpone.com -b all
-d specifies the target domain
-b specifies the data source to search
-all means search all search engines
Store results in txt file:
theHarvester -d aub.edu.lb -b all>aub.txt
→ Pastebin
Website known to have dumped passwords from breached websites. You can check for
passwords of the emails you got from theHarvester in leaked resources.
To access the dark web, you need a web browser such as Tor.
If you are serious about your anonymity consider using Tails. Tails does not store files
at all so not to keep any trace and tunnels all its traffic on top of the Tor network.
→ Social Media Tools
Social-Searcher : Search engine for social media. Create a free account which
allows you to do a limited number of searches per day.
Twofi: Scans for a user Twitter feed and generate a personalized wordlist used for
passwords. Like most social networking tools, it requires an API key.
userrecon-py: Recognition usernames in 187 social networks
→ Reverse Image Search Engines
Tineye or Google Images: You’ll submit an image to these services to seek out
wherever it came from and how it’s getting used.
→ OSINT Framework
The site: https://osintframework.com/
This is a complete framework compiled of free suggested available tools for you to use
in your information gathering phase.
→ Maltego
Extremely powerful data mining tool that uses numerous search tools and strategies.
Maltego is based on the idea of transforms. It search thousands of online data sources.
A transform can give its data to another transform. The discovered information in
Maltego is presented in scalable graph that you can zoom in/out and pan.