[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]: ?

[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;

My question: What is the problem?

The many "wget's" before the nmap is because nmap said before it's missing modules.


In version 6.25, Nmap switched the language of the Nmap Scripting Engine (NSE) from Lua 5.1 to Lua 5.2. This means that you must be using at least version 6.25 in order to use the scripts on nmap.org.

Ubuntu 12.04 only has Nmap 5.21 available in its repositories, but any release after 13.10 will have a compatible version (6.40 specifically). Upgrading your OS may be too much for your needs, so you may want to install from source instead.

I've put together a guide for scanning for Heartbleed with Nmap that many folks have found helpful.

  • please avoid url shorteners – drs Jun 30 '14 at 21:12
  • @drs Thanks for the suggestion and the edit. For posterity, I had been using tinyurl.com/nmap-heartbleed for ease of communication when the Heartbleed issue first came out. – bonsaiviking Jun 30 '14 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.