cyber security
network security
recon
nmap
We use:
These are all publicly available records and hence do not alert the target.
Passive recon relies on publicly available knowledge which can be accessed without directly interacting with the target.
WHOIS is a request and response protocol that follows the RFC 3912 specification. A WHOIS server listens on TCP port 43 for incoming requests. The domain registrar is responsible for maintaining the WHOIS records for the domain names it is leasing. The WHOIS server replies with:
You can use nslookup OPTIONS DOMAIN_NAME SERVER
These three main parameters are:
Query | Result |
---|---|
A | IPv4 Addresses |
AAAA | IPv6 Addresses |
CNAME | Canonical Name |
MX | Mail Servers |
SOA | Start of Authority |
TXT | TXT Records |
Dig provides more details than nslookup and its syntax is as shown below
Great goto at dnsdumpster
Great goto at shodan.io
Here is a link to the nmap 101 series.
When no host discovery options are provided, Nmap follows the following approaches to discover live hosts:
To use Nmap to discover online hosts without port-scanning the live systems, you can issue nmap -sn TARGETS
nmap -PR -sn TARGETS
, where -PR indicates that you only want an ARP scan. nmap -PE -sn MACHINE_IP/24.
This scan will send ICMP echo packets to every IP address on the subnet.nmap -PP -sn MACHINE_IP/24
can be used to discover alive hosts on the target subnet.nmap -PM -sn MACHINE_IP/24
Is a scanner built around ARP queries.
arp-scan --localnet
/ arp-scan -l
sends ARP queries to all valid IP addresses on your local networks.
You can also specify the interface as such: sudo arp-scan -I eth0 -l
, this would send ARP queries for all valid IP addresses on the eth0 interface.
Note that the packet capture for arp-scan and nmap -PR -sn yield similar traffic patterns.
Similar to TCP SYN and ACK scans, except that the flag used is -PU
Masscan uses a similar approach to discover the available systems. However, to finish its network scan quickly, it is quite aggressive with the rate of packets it generates.
Use the -R flag to enale this.
Scan type | flags |
---|---|
ARP Scan | sudo nmap -PR -sn MACHINE_IP/24 |
ICMP Echo Scan | sudo nmap -PE -sn MACHINE_IP/24 |
ICMP Timestamp Scan | sudo nmap -PP -sn MACHINE_IP/24 |
ICMP Address Mask Scan | sudo nmap -PM -sn MACHINE_IP/24 |
TCP SYN Ping Scan | sudo nmap -PS22,80,443 -sn MACHINE_IP/30 |
TCP ACK Ping Scan | sudo nmap -PA22,80,443 -sn MACHINE_IP/30 |
UDP Ping Scan | sudo nmap -PU53,161,162 -sn MACHINE_IP/30 |
flag | purpose |
---|---|
no DNS lookup | -n |
reverse-DNS lookup for all hosts | -R |
host discovery only | -sn |
The TCP header flags are:
Port scan type | example command |
---|---|
TCP connect scan | nmap -sT ip |
TCP syn scan | nmap -sS ip |
UDP scan | nmap -sU ip |
flag | purpose |
---|---|
-p- | all ports |
-p1-1023 | ports 1 to 1023 inclusive |
-F | 100 most common ports |
-r | scan ports in consecutive order |
-T<0-5> | paranoid(0), sneaky(1), polite(2), normal(3), aggressive(4), insane(5) |
βmax-rate 50 | rate <=50 packets/sec |
βmin-rate 15 | rate >=15 packets/sec |
βmin-parallelism 100 | at least 100 probes in parallel |
Scan type | Command |
---|---|
TCP Null Scan | sudo nmap -sN [ip] |
TCP FIN Scan | sudo nmap -sF [ip] |
TCP Xmas Scan | sudo nmap -sX [ip] |
TCP Maimon Scan | sudo nmap -sM [ip] |
TCP ACK Scan | sudo nmap -sA [ip] |
TCP Window Scan | sudo nmap -sW [ip] |
Custom TCP Scan | sudo nmap βscanflags URGACKPSHRSTSYNFIN [ip] |
Spoofed Source IP | sudo nmap -S SPOOFED_IP [ip] |
Spoofed MAC Address | βspoof-mac SPOOFED_MAC |
Decoy Scan | nmap -D DECOY_IP,ME 10.10.96.13 |
Idle (Zombie) Scan | sudo nmap -sI ZOMBIE_IP 10.10.96.13 |
Fragment IP data into 8 bytes | -f |
Fragment IP data into 16 bytes | -ff |
option | purpose |
---|---|
βsource-port PORT_NUM | specify source port number |
βdata-length NUM | append random data to reach given length |
βreason | explains how Nmap made its conclusion |
-v | verbose |
-vv | very verbose |
-d | debugging |
-dd | detailed debugging |
options | meaning |
---|---|
-sV | determine service/version info on open ports |
-sV βversion-light | try the most likely probes (2) |
-sV βversion-all | try all available probes (9) |
-O | detect OS |
βtraceroute | run traceroute to target |
βscript=SCRIPTS | Nmap scripts to run |
-sC or βscript=default | run default scripts |
-A | equivalent to -sV -O -sC βtraceroute |
-oN | save output in normal format |
-oG | save output in grepable format |
-oX | save output in XML format |
-oA | save output in normal, XML and Grepable formats |
script category | description |
---|---|
auth | Authentication related scripts |
broadcast | Discover hosts by sending broadcast messages |
brute | Performs brute-force password auditing against logins |
default | Default scripts, same as -sC |
discovery | Retrieve accessible information, such as database tables and DNS names |
dos | Detects servers vulnerable to Denial of Service (DoS) |
exploit | Attempts to exploit various vulnerable services |
external | Checks using a third-party service, such as Geoplugin and Virustotal |
fuzzer | Launch fuzzing attacks |
intrusive | Intrusive scripts such as brute-force attacks and exploitation |
malware | Scans for backdoors |
safe | Safe scripts that wonβt crash the target |
version | Retrieve service versions |
vuln | Checks for vulnerabilities or exploit vulnerable services |
Protocol | Tcp port | Applications | Data security |
---|---|---|---|
FTP | 21 | file transfer | clear text |
HTTP | 80 | www | clear text |
IMAP | 143 | Email MDA | clear text |
POP3 | 110 | Email MDA | clear text |
SMTP | 25 | Email MTA | clear text |
Telnet | 23 | remote access | clear text |
Servers implementing these protocols are subject to different kinds of attacks. To name a few, consider:
For Capturing network packets consider:
For MITM consider:
Ettercap
Bettercap
SSL (Secure Sockets Layer) started when the world wide web started to see new applications, such as online shopping and sending payment information.
Netscape introduced SSL in 1994, with SSL 3.0 being released in 1996. But eventually, more security was needed, and TLS (Transport Layer Security) protocol was introduced in 1999.
They fit into the Presentation Layer of the OSI model.
An existing cleartext protocol can be upgraded to use encryption via SSL/TLS.
Protocol | default port | secured protocol | secured port |
---|---|---|---|
HTTP | 80 | HTTPS | 443 |
FTP | 23 | FTPS | 990 |
SMTP | 25 | SMTPS | 465 |
POP3 | 110 | POP3S | 995 |
IMAP | 143 | IMAPS | 993 |
To establish an SSL/TLS connection, the client needs to perform the proper handshake with the server as shown below based on RFC 6101:
Option | Explanation |
---|---|
-l [username] | username |
-P [path] | path to wordlist |
server service | set server address and service to attack |
-s [port] | use in case of non-default service port # |
-v or -vv | show username and password attempts |
-d | display debugging output |