Advanced Reconnaissance with Recon-ng (Part IV)

Now the goal is to gather information about the network infrastructure and not about the users.

Network reconnaissance

  • Create a new workspace

workspace create SANS

  • Now you have two workspaces:

Listing workspaces

  • To insert the company, you can use an alternative way:

db insert companies SANS~SANS Institute

Inserting company name and description

  • To insert the domain, type

db insert domains sans.org

  • And repeat to add a second domain.


Inserting domain names

Now we are going to use different modules because we want to reach a different goal.

  • Let’s start trying to get the Private Enterprise Numbers (PEN)

Using the pen module

This doesn’t seem to be really useful. Let’s delete all these new domains.

  • List the rows on the domains table and delete the useless ones

Deleting the useless domains

Let’s try to use the given domains to find hosts.

  • There are a number of modules capable of doing that:

Listing the "domains to hosts" modules

Not all of them return results for every scenario so I’ll just list the ones that produce something for the given domains:

Bing Hostname Enumerator

Running the Bing Hostname Enumerator module

Certificate Transparency Search

Running the Certificate Transparency Search module

Google Hostname Enumerator

Running the Google Hostname Enumerator module

HackerTarget Lookup

Running the HackerTarget Lookup module

Mail eXchange (MX) and Sender Policy Framework (SPF) Record Retriever

Running the MX Record Retriever module

ThreatCrowd DNS lookup

Running the ThreatCrowd DNS lookup module

ThreatMiner DNS lookup

Running the ThreatMiner DNS lookup module

We can also try to brute force the discovery of new hosts. This is done using a provided wordlist and checking each new combination against the default DNS server.

  • Load the module and check the default options

Loading the brute_hosts module

As you can see, the application is using the file /root/.recon-ng/data/hostnames.txt as a source of strings to be added to the given domain name. You can use other files if you want to.

  • Check the ones available in /usr/share/wordlists

Listing the wordlists available in Kali Linux

  • Check the global options (recon-ng environment) to identify the configured DNS server

goptions list

Checking Recon-ng global options

The choice of the DNS server is important because you’ll probably be blocked before the end of the wordlist due to the excess number of requests.

DNS request being blocked

To change the DNS server you have to exit he current loaded module.

  • Just type:

back

  • Then set the proper option

options set NAMESERVER 1.1.1.1

Changing the DNS server

Run the module with the default configuration

Running the brute_hosts module

  • Maybe now is a good time to take a snapshot before moving on to the next set of modules

snapshots take

Taking a database snapshot

We have now 302 hosts but only two domains.

Let’s populate the domains table with info from the host table

  • Load and run the migrate_host module

Running the migrate_hosts module

As you can see, a number of useless domains are added to the database.

If you don’t like the results, load the previous database from the snapshot

  • List the available snapshots

snapshots list

Listing the snapshots

  • Load the desired snapshot

snapshots load <snapshot name>

Loading the last snapshot

Let’s try to use the “hosts to hosts” modules:

  • List them

Listing the host to hosts modules

Again, not all modules return useful information or can be used due to the lack of proper API keys

Hostname Resolver

Running the Hostname Resolver module

Reverse Resolver

Running the Reverse Resolver module

Now it’s time to evaluate the quality of the information gathered so far. In the previous post I showed how to query the database and how to clean the data.

In this case, try the following queries:

  • Let’s delete al hosts outside the desired domain

db query DELETE FROM hosts WHERE host NOT LIKE "%sans.org"

Deleting unwanted hosts

db query DELETE FROM hosts WHERE host LIKE "*%"

Deleting unwanted hosts

  • Let’s also delete the unwanted domains

db query DELETE FROM domains WHERE domain NOT LIKE "%sans.org"

Deleting unwanted domains

Repeating the use of the previously used “domain to hosts” modules will add another handful of hosts to the database.

There are many repeated entries in the hosts table. However, this is not conclusive because several services can run in the same host and due to the distributed nature of these services, the same service can have more than one IP address.

Let’s get additional info about each host

Geolocation via IPStack

Getting geographical info for each host

Open ports via Binary Edge

Getting info about open ports for each host

Open ports via Censys

Getting info about open ports for each host

Setting the options for the module

Final result: 494 hosts with 510 open ports. Nod bad Winking smile

All this information was gathered without any direct interacting with any of the target machines/domains.

If you decide to use the discovery or the exploitation modules be very careful before doing so because you will be in direct contact with the target machines and that is something that should always be done with the proper authorization.

Exporting and analyzing information

Lets’ export the information in html format

  • Load the proper module

Loading the html module and displaying the options

  • Setting the options

Setting the options for the module

  • Opening the output file

Opening the exported file

If you prefer, you can access all available data in recon-ng in a web-based user interface

  • Exit the application and type

recon-web

Starting recon-web reporting engine

Using the recon-web interface

The major advantage of this analytics engine is the possibility to access all workspaces easily and to have all the info very well organized.

Final conclusion: Recon-ng v5.0.1 is one of the best free tools currently available to conduct an initial analysis on a potential target. With more APIs the results will be even better.


Next post: Advanced Footprinting with Maltego (Part I)

1 comment:

Shayzee said...

Hello Everyone !

USA SSN Leads/Fullz available, along with Driving License/ID Number with good connectivity.

All SSN's are Tested & Verified.

**DETAILS IN LEADS/FULLZ**

->FULL NAME
->SSN
->DATE OF BIRTH
->DRIVING LICENSE NUMBER
->ADDRESS WITH ZIP
->PHONE NUMBER, EMAIL
->EMPLOYEE DETAILS

*Price for SSN lead $2
*You can ask for sample before any deal
*If you buy in bulk, will give you discount
*Sampling is just for serious buyers

->Hope for the long term business
->You can buy for your specific states too

**Contact 24/7**

Whatsapp > +923172721122

Email > leads.sellers1212@gmail.com

Telegram > @leadsupplier

ICQ > 752822040