Openssl

如何使用 Ubuntu 12.04 的 nmap 掃描心臟出血漏洞?

  • June 30, 2014
[root@notebook ~] lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.4 LTS
Release:    12.04
Codename:   precise
[root@notebook ~] dpkg -l nmap | grep ^ii
ii  nmap                                          5.21-1.1ubuntu1                            The Network Mapper
[root@notebook ~] wget -q https://svn.nmap.org/nmap/scripts/ssl-heartbleed.nse -O /usr/share/nmap/nselib/ssl-heartbleed.nse
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/tls.lua -O /usr/share/nmap/nselib/tls.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/sslcert.lua -O /usr/share/nmap/nselib/sslcert.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/asn1.lua -O /usr/share/nmap/nselib/asn1.lua
[root@notebook ~] wget -q https://svn.nmap.org/nmap/nselib/stdnse.lua -O /usr/share/nmap/nselib/stdnse.lua
[root@notebook ~] nmap -p 443 --script ssl-heartbleed www.ssllabs.com

Starting Nmap 5.21 ( http://nmap.org ) at 2014-06-25 07:49 CEST
NSE: failed to initialize the script engine:
/usr/share/nmap/nselib/stdnse.lua:59: attempt to index field 'socket' (a nil value)
stack traceback:
   /usr/share/nmap/nselib/stdnse.lua:59: in main chunk
   [C]: in function 'require'
   /usr/share/nmap/nse_main.lua:95: in main chunk
   [C]: ?

QUITTING!
[root@notebook ~] cat /usr/share/nmap/nselib/stdnse.lua
...
 50 --- Sleeps for a given amount of time.
 51 --
 52 -- This causes the program to yield control and not regain it until the time
 53 -- period has elapsed. The time may have a fractional part. Internally, the
 54 -- timer provides millisecond resolution.
 55 -- @name sleep
 56 -- @class function
 57 -- @param t Time to sleep, in seconds.
 58 -- @usage stdnse.sleep(1.5)
 59 _ENV.sleep = nmap.socket.sleep;
...

我的問題:有什麼問題?

nmap 之前的許多“wget”是因為 nmap 之前說它缺少模組。

在 6.25 版本中,Nmap 將 Nmap 腳本引擎 (NSE) 的語言從 Lua 5.1 切換到了 Lua 5.2。這意味著您必須至少使用 6.25 版才能使用 nmap.org 上的腳本。

Ubuntu 12.04 僅在其儲存庫中提供 Nmap 5.21,但13.10 之後的任何版本都將具有兼容版本(特別是 6.40)。升級您的作業系統可能無法滿足您的需求,因此您可能希望從原始碼安裝

我整理了一份使用 Nmap 掃描 Heartbleed 的指南,許多人都覺得這很有幫助。

引用自:https://unix.stackexchange.com/questions/139053