PASSIVE AND ACTIVE RECONNAISSANCE
In this post we will learn about passive and active reconnaissance. Passive reconnaissance lets us gather information about a target without any kind of direct engagement. Active reconnaissance requires us to make some kind of contact with out target.
Some Passive Reconnaissance tools we will explore:
- whois
- nslookup
- dig
- DNSDumpster
- Shodan.io
Some Active Reconnaissance tools we will explore:
- ping
- traceroute
- telnet
- nc
Passive Reconnaissance
- Looking up DNS records from a public DNS server
- Checking job ads related to the target website
- Reading news articles about the target company
- Visiting social media sites of the company or their employees
- Registrar: Via which registrar was the domain name registered?
- Contact information of the registrant.
- Creation, update and expiration fates
- Name Server: Which server to ask to resolve the domain name,
whois
in our terminal. Usage is: whois DOMAIN_NAME
. See below for an example. nslookup
. Use is as follows: nslookup OPTIONS DOMAIN_NAME SERVER
.- OPTIONS: contains the query type (for instance IPv4 or IPv6 addresses, A or AAAA respectively)
- DOMAIN_NAME: the domain name being looked up
- SERVER: is the DNS server that we want to query. Visit here for a list of public DNS servers.
-type=A
tag, but it can also be useful to check IPv6 using the -type=AAAA
tag.: -type=MX
option on order to search for the web servers of a target. We can see that Tryhackme.com's current email configuration uses Google. In this case we would not expect there to be vulnerabilities in the Mail Exchange servers, but it is worth checking a target's Mail Exchange servers (assuming they are within scope). -type=txt
. dig
). Usage is: dig @SERVER DOMAIN_NAME TYPE
.- @Server (optional): is the DNS server that we want to query.
- Domain name
- TYPE: Containts the DNS record type (
MX
for Email Exchange Server, for example.)
- IP Address.
- Hosting company.
- Geographic location.
- Server type and version.
Active Reconnaissance
- Web Browser
- Ping
- Traceroute
- Telnet
- Netcat
https://127.0.0.1:4444.
witll connect to 127.0.0.1 at port 4444 via HTPS protocol. - FoxyProxy: to quickly change the proxy server we use to access the target website. To be used when using tools such as Burp Suite. FoxyProxy
- User-Agent Switch and Manager: Gives us the ability to pretend to be accessing the web page from a different web browser or OS. For example, we can pretend to visit a site using an iPhone, when actually using Mozilla Firefox. User-Agent Switcher
- Wappalyzer: provides insights about the technologies used on the visited websites. Wappalyzer
ping OPTIONS TARGET
. traceroute
traces the route taken by the packets from our system traceroute MACHINE_IP
.However, if the TTL reaches 0, it will be dropped, and an ICMP Time-to-Live exceeded would be sent to the original sender. In the following figure, the system set TTL to 1 before sending it to the router. The first router on the path decrements the TTL by 1, resulting in a TTL of 0. Consequently, this router will discard the packet and send an ICMP time exceeded in-transit error message. Note that some routers are configured not to send such ICMP messages when discarding a packet.
- The number of hops/routers between our system and the target system depends on the time we rune the traceroute. If two traceroute commands are run, even at very similar times, there is no guarantee the packets will follow the same route.
- Some routers return a public IP address. We can examine a few of these routers based on the scope of the penetration test.
- Some routers don't return a reply.
telnet
uses the TELNET protocol for remote administration. The default port used by telnet is 23. Telnet sends all data, including usernames and passwords in cleartext. The secure alternative to to telnet is SSH. IP_ADRESS PORT
, we can connect to any service running on TCP and even exchange a few messages unless it uses encryption.For example, if we wish to discover more information about a web server listening on port 80, we can use:
telnet TARGET_IP
and then GET / HTTP/1.1
. To get information on any other page than the default page, use GET / HTTP/page.html/1.1
. nc
has different applications that can be of great value to a penetration tester. Netcat supports both TCP and UDP protocols. It can function as a client that connects to a listening port, as well as a listener on a port of our choice. Can connect to a port with
nc IP_ADRESS PORT
. For example, nc 10.10.177.51 80
. To get information on the default page via HTTP version 1.1, we input GET / HTTP/1.1
. Finally, we give a hostname host: ANYNAME
. nc OPTIONS PORT
. - The
-p
option must appear just before the port we wish to listen on. - The option
-n
will avoid DNS lookups and warnings. - Port numbers less than 1024 require root privileges to listen on.
- Port number on the server-side and client-side must match.
SERVER_SIDE_IP PORT
.
Comments
Post a Comment