Introduction To Nmap Scripting Engine
Introduction To Nmap Scripting Engine
Let’s continue our practice with Nmap Scripting Engine by exposing the localhost SSH server.
With SSH server exposure, you can discover more information about a system network.
Note: The ssh service is not running on this box so we have faked some terminal interactions
in this specific exercise. This is so you can experience how this script would work when ssh is
running on port 22.
Instructions
1. Checkpoint 1 Passed
1.
We know that ssh runs on port 22. Run a scan on port 22 that uses default
scripts and does version detection. Our target is localhost.
Make sure to press the Check Work button once you’ve completed each
checkpoint!
2. Checkpoint 2 Passed
2.
Great! Let’s look at the result further.
In the result, you can see that the server is running the following: OpenSSH
6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
This is helpful because you can use them to find known exploits. Additionally,
the result revealed the server’s host key information.
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux;
protocol 2.0)
| ssh-hostkey:
| 1024 ac:00:a0:1a:82:ff:cc:55:99:dc:67:2b:34:97:6b:75 (DSA)
| 2048 20:3d:2d:44:62:2a:b0:5a:9d:b5:b3:05:14:c2:a6:b2 (RSA)
| 256 96:02:bb:5e:57:54:1c:4e:45:2f:56:4c:4a:24:b2:57 (ECDSA)
|_ 256 33:fa:91:0f:e0:e1:7b:1f:6d:05:a2:b0:f1:54:41:56 (ED25519)
Find out if the target leaks private key paths, passphrases, or usernames by
running the script ssh-publickey-acceptance. This scan should not be looking at a
specific port, it should just look at the target localhost.
3. Checkpoint 3 Passed
3.
Looking at the result, it seems that the target does NOT accept public keys.
Let’s find out the server’s authentication methods by running the ssh-auth-
methods script. The ssh-auth-methods script reveals the authentication methods
configured on the SSH server.
Remember: Sites like scanme.nmap.org explicitly give written permission for port scanning!
Don’t just scan random websites.
Instructions
1. Checkpoint 1 Passed
1.
Let’s find out the date and time zone on the target scanme.nmap.org using
the http-date script. This will give you an idea of which timezone the server is
located. We need to specifically look at the port that HTTP is on with this
script.
Make sure to press the Check Work button once you’ve completed each
checkpoint!
2. Checkpoint 2 Passed
2.
Port 80 might be open or filtered. If you see that port 80 is filtered, this script won’t
actually do anything! This doesn’t mean the port is closed, but it does mean
that we can’t currently access it.
Let’s run our startup script so we can scan port 8000 on localhost and see if we
get a different result.
Remember, you will need to press Enter a second time to return to the normal
terminal prompt.
Stuck? Get a hint
3. Checkpoint 3 Passed
3.
Let’s test the http-date script out on port 8000 on localhost to see if we get a
different result.
4. Checkpoint 4 Passed
4.
Interesting! Sometimes “no result” can tell you a lot about a service. For this
next script, we’re exploring HTTP on port 80, and we’ll switch our target back
to scanme.nmap.org.
Let’s check the web server for potential Cross-Site Request Forgery (CSRF)
vulnerabilities using Nmap preloaded script: http-csrf.
5. Checkpoint 5 Passed
5.
Using the same port and target, let’s use the http-backup-finder script to see if the
web server reveals any backup files.
Sometimes backup files may contain sensitive information that a hacker can
leverage for a future attack!
Review
Nmap is a powerful tool, but scripts can make it even more powerful!
Great job!