advanced network scanning with nmap 6 - rmllschedule2012.rmll.info/img/pdf/2012_rmll_nmap.pdf ·...

35
Advanced network scanning with Nmap 6 Henri Doreau [email protected] 13 th LSM - Geneva 2012

Upload: truongthuan

Post on 26-Sep-2018

278 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Advanced network scanning with Nmap 6

Henri [email protected]

13th LSM - Geneva 2012

Page 2: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Outline

1 Project presentationIntroduction

2 Nmap Scripting EnginePresentationInternalsUsage

3 Nmap 6 new featuresIPv6 supportPerformance improvementsCompanion toolsNSE

4 Ongoing developmentsUpcoming featuresProject

2/33

Page 3: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Outline

1 Project presentationIntroduction

2 Nmap Scripting EnginePresentationInternalsUsage

3 Nmap 6 new featuresIPv6 supportPerformance improvementsCompanion toolsNSE

4 Ongoing developmentsUpcoming featuresProject

3/33

Page 4: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Nmap Security Scanner

Full-featured Network scanner

Port scanner

Version and OS fingerprinting

Lua scripting engine

Companion tools (zenmap, ncat, nping, ndiff...)

4/33

Page 5: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Nmap Security Scanner

Vibrant community

Fingerprint DBs

CPEs

Scripts and NSE libraries

5/33

Page 6: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Nmap Security Scanner

Hollywood movie star

6/33

Page 7: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Outline

1 Project presentationIntroduction

2 Nmap Scripting EnginePresentationInternalsUsage

3 Nmap 6 new featuresIPv6 supportPerformance improvementsCompanion toolsNSE

4 Ongoing developmentsUpcoming featuresProject

7/33

Page 8: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Introduction

Built-in lua scripting engine

Network exploration

Sophisticated version detection

Vulnerability detection

Scan results post-processing

8/33

Page 9: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

NSE development

Script collection growth

9/33

Page 10: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Script phases

Four execution modes

Prerules

Service

Host

Postrules

NSE Pre-scan1 Host enumeration2 Host discovery3 Reverse DNS resolution4 Port scan5 Version detection / RPC grind6 OS fingerprinting7 Traceroute8 Script scan9 Output

NSE Post-scan

10/33

Page 11: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Script structure

When to run?

h o s t r u l e = f u n c t i o n ( hos t )r e t u r n hos t . d i r e c t l y c o n n e c t e d

end

p o r t u l e = s h o r t p o r t . h t tp

⇒ script can have several rule and action functions

11/33

Page 12: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Sample output

Nmap scan r e p o r t f o r scanme . nmap . org ( 7 4 . 2 0 7 . 2 4 4 . 2 2 1 )PORT STATE SERVICE VERSION22/ tcp open s sh OpenSSH 5 .3 p1 Debian 3ubuntu780/ tcp open ht tp Apache ht tpd 2 . 2 . 1 4 ( ( Ubuntu ) )| ht tp− t i t l e : Go ahead and ScanMe !S e r v i c e I n f o : OS : L inux ; CPE : cpe : / o : l i n u x : k e r n e l

Host s c r i p t r e s u l t s :| f i r e w a l k :| HOP HOST PROTOCOL BLOCKED PORTS| 0 192 . 1 68 . 0 . 1 5 tcp 139| 10 64 . 6 2 . 2 5 0 . 6 tcp 135 ,445

12/33

Page 13: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Design

NSE parallelism

Single nmap thread

lua coroutines

⇒ Lightweight and efficient non-blocking mechanism

⇒ Script writers get parallelism for free

⇒ No concurrent memory access concerns ever

13/33

Page 14: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Adaptive workflow

Two ways to invoke scripts

Point and shoot

nmap −− s c r i p t samba−vu ln−cve−2012−1182 <t a r g e t >nmap −− s c r i p t +mongodb− i n f o −p80 <t a r g e t >

⇒ No silent dependencies

Aim oriented

nmap −− s c r i p t ” http−∗ and not b ru t e ” <t a r g e t >

14/33

Page 15: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Script categories

Grouped by categories

default

intrusive

external

...

see http://nmap.org/nsedoc

15/33

Page 16: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Outline

1 Project presentationIntroduction

2 Nmap Scripting EnginePresentationInternalsUsage

3 Nmap 6 new featuresIPv6 supportPerformance improvementsCompanion toolsNSE

4 Ongoing developmentsUpcoming featuresProject

16/33

Page 17: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Full IPv6 support

Long standing wish

All features (provided it makes any sense)

All supported platforms

YEAH!!!

17/33

Page 18: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Full IPv6 support

Long standing wish

All features (provided it makes any sense)

All supported platforms

YEAH!!!

17/33

Page 19: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Brand new OS fingerprinting engine

Innovative approach: machine learning techniques

Reduced dataset

Increased adaptiveness

Very accurate

⇒ See http://nmap.org/book/osdetect

18/33

Page 20: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

IPv6 support

Honestly, who cares?

The future is already there!

19/33

Page 21: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

IPv6 support

Honestly, who cares?

The future is already there!

19/33

Page 22: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Enhanced performances

Three main axis of improvement

Memory footprint

High performance and scalable I/O notification facities

Application-specific optimizations (NSE)

cf. Scanning the Internet, by Fyodor

20/33

Page 23: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Nping

Reimplementation of the venerable hping2

Modern, high performance tool

Leverages nmap libraries

Provides new packet craftingclasses to nmap

21/33

Page 24: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Nping Echo mode

Replacement for ping+tcpdump

1 nping in server mode on target

2 client probes the target

3 server returns captured probes to the client(s) as encryptedpayloads

22/33

Page 25: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Zenmap tologoy tab

Finally: actual network maps from the network mapper!

23/33

Page 26: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Better web scanning

Big focus on web technologies

Pipelining

Built-in web crawler

Caching

Web-specific security checks

24/33

Page 27: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

NSE frameworks

Implemented as NSE libraries

brute

Parallel network authenticationcracking module.

credentials

Leverage and report discoveredcredentials.

vulns

Consistent vulnerability reports andefficient post-processing.

25/33

Page 28: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Outline

1 Project presentationIntroduction

2 Nmap Scripting EnginePresentationInternalsUsage

3 Nmap 6 new featuresIPv6 supportPerformance improvementsCompanion toolsNSE

4 Ongoing developmentsUpcoming featuresProject

26/33

Page 29: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Upcoming: web scanning

Continued effort on HTTP

Implement latest performance-related protocols and paradigms

WebSocket mode to ncat

27/33

Page 30: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Upcoming: extend NSE

Expand the role and features of NSE

Leveraging native libraries from lua

NSE-based port scanning

Re-implementing older code within NSE

Adapting NSE to the companion tools

28/33

Page 31: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Upcoming: misc

but also...

Combining IP v4/v6 scans

Improving scalability

Scanning through proxies

Remote checks through authenticated SSH connections

Updater

29/33

Page 32: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Get involved!

Your own awesome idea!

...and code? ;)

30/33

Page 33: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Development

Increasing development pace

2011 was the most active year ever in the project history!(ohloh.net).

8th consecutive Google Summer of Code

31/33

Page 34: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Happy birthday nmap!

15th birthday this year (Sept. 1st)

32/33

Page 35: Advanced network scanning with Nmap 6 - RMLLschedule2012.rmll.info/IMG/pdf/2012_rmll_nmap.pdf · Advanced network scanning with Nmap 6 Henri Doreau henri.doreau@gmail.com 13th LSM

Project presentation Nmap Scripting Engine Nmap 6 new features Ongoing developments Conclusion

Questions?

http://nmap.org

[email protected] (it’s cool, join!)

33/33