Reconnaissance is the first phase in the implementation of a hacking. The aim of this phase is to discover as much relevant information as we can from the client’s organization or victim.
Now, depending on whether the interaction with the target is direct or indirect, the reconnaissance can be active or passive.
We say the reconnaissance is passive when we have no direct interaction with the client or victim. For example, we use a search engine like Google and inquire the name of the audited company, in the results we get the name of the client’s website and discover that the web server name is www.enterprisex.com, then we do a DNS search and get that the IP address of that server is 220.127.116.11
In this type of reconnaissance there is a direct interaction with the target or victim. Examples of active reconnaissance:
Ping sweeps to determine the active public computers within a range of IP’s. Connecting to a service port in order to gather a banner and try to determine the software version.
Using social engineering to obtain confidential information.
The hacker’s platform it’s up to you, but if you ask my opinion I prefer to use Kali Linux.
Footprinting with Google
Google is undoubtedly the most widely used due to its classification technology web pages (Page Rank), which allows us to search quickly and accurately. For our reconnaissance example with Google we will begin with the most simple: searching for the company’s name.
In this example we’ll use as victim the Project Scanme by Nmap8. Scanme is a free site maintained by Fyodor, the creator of NMAP port scanner.
(plus symbol): is used to include words that because they are very common are not included on Google search results. For example, say that you want to look for company The X, given that the article “the” is very common, it is usually excluded from the search. If we want this word to be included, then we write our search text like this: Company +The X
(minus symbol): is used to exclude a term from results that otherwise could include it. For example, if we are looking for banking institutions, we could write: banks -furniture
”” (double quotes): if we need to find a text literally, we framed it in double quotes. Example: “Company X”
~ (tilde): placing this prefix to a word will include synonyms thereof. For example, search by ~company X will also include results for organization X
OR: This allows you to include results that meet one or both criteria. For example, “Company X General Manager” OR “Company X System Manager”
site: allow to limit searches to a particular Internet site. Example: General Manager site:companyX.com
link: list of pages that contain links to the url. For example, searching for link:companyX.com gets pages that contain links to company X website.
filetype: or ext: allows you to search by file types. Example: Payment roles + ext:pdf site:empresax.com
allintext: get pages that contain the search words within the text or body thereof. Example: allintext: Company X
inurl: shows results that contain the search words in the web address (URL). Example: inurl: Company X
Of course there are more operators that can be used with Google, but I think these are the most useful.
Returning to our reconnaissance example, we found among the results some pages about the NMAP organization. The one that catches our attention is scanme.nmap.org, this brings us to our next tool: DNS name resolution.
Determining names with nslookup
Now that we know the main site of our client, we can make a DNS query obtain its IP address. In a real case it is possibly to find more than one customer site referenced by Google and therefore we’ll get several IP addresses. Actually, the idea behind getting this first translation is to estimate the range of IP’s that we will need to scan in order to identify additional hosts that could belong to the client.
Assuming that our target is using IPv4 addresses, we could test the whole range of hosts inside the subnet.
The latter is impractical if you try to address Class A or B, since the scanning process could last longer. To determine the range more accurately, we can use other means as looking in Who-Is directories or performing socia engineering attacks. In this example we will made a name query using the nslookup command
DNS resolution with nslookup on Windows
Note: During an audit of any kind it is important to be organized and take notes of our findings. This will allow us to tie up loose ends while revealing more information as we go.
Returning to the nslookup command, we still can learn more from our target. We will use some useful options:
set type = [NS | MX | ALL] to set the query type, NS name service, MX mail service (mail exchanger) and ALL to show everything.
ls [-a | -d] domain enables you to list the addresses for the specified domain (for which the DNS server for that domain must have this option enabled) -a canonical names and aliases, -d all records in the DNS zone.
Maltego is a tool that allows collecting data from an organization easily, through the use of graphic objects and contextual menus that let you apply “transformations”
You can also collect all the artifacts in the form of pdf reports ….like
Visual IP Trace route
During the execution of an external black box hacking is useful to know the
geographical location of a particular target. Imagine for example that we have obtained the names of the mail server and web server of our client and want to know if these services are hosted on the public network managed by the company itself or if instead, they are located in an external hosting as Yahoo Small Business , Gator, or similar. Why do we want to know this? Very simple, if the target servers happen to be held on an external hosting, in the event we managed to break into such equipment, we would actually be hacking the hosting provider, not our client, in which case we could face a possible lawsuit. Because of this, it is strongly recommended to perform a trace route to discover the geographical location of a target host. That way we would be able to decide “to hack or not to hack”.
There are several applications on the market that perform visual traceroute, to name a few: Visual IP Trace, Visual Route. Some of them are free or have paid versions with additional features such as the likelihood of generating reports.
E-mail tracking tools
It is possible that during the execution of an external hacking we come across a case in which our client has outsourced DNS, E-mail and Web services, and everything we do only lead us to the hosting provider.
This implies that at least the ISP has assigned to our client one public IP for
outbound Internet, so there has to be a router or a firewall doing NAT so that internal users can navigate – I’m assuming the client uses IPv4. If this is the case, then getting this public IP address is now our target, let’s see how we can get this through the analysis of an email.
Raised this new goal now we would make our customer send us an email, and only then we will be able to analyze data from the email header in order to determine the source IP address. This is pretty simple since we have been hired by them to run an ethical hacking, so we could send e-mail pretending to show them how the audit is progressing and wait for the response. For this analysis we can use any email tracking tool or we can manually review the email header; but the use of automated tools has the advantage of obtaining a report. It should be mentioned that the email analysis tools not only help to identify an email source IP address, but also show whether the sender is indeed who he says he is, we can use these applications to determine if we’re dealing with a false email or a phishing email.