nmap and metasploitable

28
NMAP and Metasploitable-II

Upload: mohammed-akbar-shariff

Post on 22-Jan-2018

250 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Nmap and metasploitable

NMAPand

Metasploitable-II

Page 2: Nmap and metasploitable

About Me

Mohammed Akbar Shariff

Cyber Sec Intern – WICS

Graduating M.tech

www.linkedin.com/in/mohammed-akbar-shariff

@akbarshariffak

Page 3: Nmap and metasploitable

Agenda

• Basics of Network

• Metasploitable II

• Introduction to NMAP

• Port Status

• Scan Types

• Host Discovery

• OS Fingerprinting

• Nmap Scripting Engine

Page 4: Nmap and metasploitable

Basics of Netwoks

TCP Header

Page 5: Nmap and metasploitable

Three way Handshake…???

Page 6: Nmap and metasploitable
Page 7: Nmap and metasploitable

TCP Three way handshake

Page 8: Nmap and metasploitable

Metasploitable II

The Metasploitable virtual machine is an intentionally vulnerable version of Ubuntu Linux designed for testing security tools and demonstrating common vulnerabilities.

Page 9: Nmap and metasploitable

What is NMAP?

• Network Mapper - Utility used to identify assets and map them in a network.

• https://github.com/nmap/nmap (Current release is 7.50, 20 year old project and active)

Page 10: Nmap and metasploitable

Why NMAP..??

• Perhaps I can ping sweep?

• How to know which IP’s are alive?

• There are only• 65535(PORTS) *2 (TCP &UDP)*24 ( if class C)

Page 11: Nmap and metasploitable

Nmap Port Status

• OPEN

• CLOSED

• FILTERED

• OPEN|FILTERED

Page 12: Nmap and metasploitable

NMAP port “Status” - Open

•Open - SYN reached the end system, victim responded with

SYN+ACK and Completes the handshake.

Nmap -n -sT -p 80 192.168.56.104

Page 13: Nmap and metasploitable

NMAP port “Status” - Closed

• Closed - SYN reached the end system, responded with RST+ACK. System is accessible and service is still not open on victim. Nmap -n -sT -p 22 192.168.56.104

Page 14: Nmap and metasploitable

NMAP port “Status” - Filtered

• Filtered – Observed when a port does not respond on repeated tries.

Nmap -n -sT -p 445 192.168.56.105

Page 15: Nmap and metasploitable

Scan Types

nmap <options><scan type> <target>

Page 16: Nmap and metasploitable

NMAP Options-iL <filename>: Pass a list of hosts.

-iR <number of Hosts>: Choose random targets.Ex: nmap -Pn -sS -p 80 -iR 0 --open

-p <port ranges> : Port scanning, Only scan specified ports…. -p-

Host Discovery

-sL (List Scan): Simply lists each host of the network(s) specified.

-sn : No port scan and only ping scan

-Pn : Skip ping scan and treat all host to be live

-PS <portlist> : TCP SYN Ping

-n : No DNS resolution

-R : DNS resolution for all targets

-PE; -PP; -PM : ICMP Ping Types.-PA <port list> : TCP ACK ping

-PU <port list> : UDP Ping

Page 17: Nmap and metasploitable

Nmap Scan Types

• -sP (Ping Sweep) – Performs ARP ping and ICMP echo request to determine system is alive.

• -sS (TCP SYN Scan) – Determines a system/port being alive by sending only SYN and waiting for SYN-ACK

• -sU (UDP Scan) – Probes UDP detects system/port is alive when there is a UDP response + ICMP packet Destination unreachable.

• -sT (TCP Connect Scan): Performs connection establishment using system call “connect”

• -sN (Null scan): Does not set any bits (TCP flag header is 0).

• -sF (FIN Scan): Sets just the TCP FIN bit.

• -sX (Xmas scan): Sets the FIN, PSH, and URG flags, lighting the packet up like a Christmas tree.

Page 18: Nmap and metasploitable

OS Fingerprinting• Nmap sends a series of TCP and UDP packets to the remote host and

examines practically every bit in the responses.

• Nmap compares the results to its nmap-os-db database of more than 2,600

known OS fingerprints and prints out the OS details if there is a match.

-O (Enable OS detection)

Page 19: Nmap and metasploitable

Nmap – service Version and Enumeration!

• Nmap-services database is constantly updated with services, finger printing and banners to identify remote ports and operating systems.

• -sV - runs about ~30 Nmap Script Engine (.nse files) to identify and enumerate the service that has been detected earlier.

• -sC – runs “default” ~200 Nmap Script Engine (.nse files) to identify and enumerate the services and provide vulnerabilities identified. Optionally can use - -script option.

Page 20: Nmap and metasploitable

Nmap service Enumeration!• The Difference between the two in Action

TCP scan with Version

-sT + -sV = -sTV

Regular TCP scan

Page 21: Nmap and metasploitable

Nmap Scripting Engine(NSE) –What and Why?

• Nmap Script Engine, written in Lua.

• Sophisticated Version detection and OS detection.

• Example: smb-os-discovery.nse , http-cisco-anyconnect.nse …

• Vulnerability detection.

• Example: tls-ticketbleed.nse, sslv2-drown.nse,..

• Malware detection.

• Example: http-google-malware.nse..

• Vulnerability Exploitation.

• Example: smb-psexec.nse,..

Page 22: Nmap and metasploitable

NSE – what? where?

• -sC and --script uses NSE. There is a default set launched when no option is given. https://nmap.org/nsedoc/categories/default.html

Page 23: Nmap and metasploitable

Nmap Enumeration technique

Notice how the service is not shellEven though Banner shows Shell

Page 24: Nmap and metasploitable

Nmap Enumeration technique

So you need to use –sTV along for Version grab

Page 25: Nmap and metasploitable

Nmap Output Formatting

Greppable

Regular Text

XML

Page 26: Nmap and metasploitable

References

• https://www.nmap.org

• https://null.co.in/

• http://insecure.org/

Page 27: Nmap and metasploitable

QUESTIONS??

Page 28: Nmap and metasploitable

THANK YOU