TryHackMe: Nmap Writeup

7 min readJul 14, 2020

Continuing with another box on TryHackMe, as the name suggests this time it is Nmap. In my last writeup ( Vulnversity), there was a part where nmap was used but it had a brief role over there. With this room ( Nmap) on THM we can develop our nmap skill further.

What is nmap?

As per Wikipedia (, it a free open-source network scanner which can be used to discover hosts and services on a computer network by sending packets and analyzing responses. But once we start using nmap to it’s fullest, we can see that it can be used for many more things like OS detection, encryptions being used, testing scripts and many more things. Basically, it is one of the most used tools to perfrom reconnaissance on any given target/s.

So, let’s begin with the room now!

[Task 1] Deploy

We need to deploy the machine in order to gain access to it and nothing more is required in this task.

[Task 2] Quiz

In this task, there are a number of questions that arranged in a way that we can get a better grip on the mostly used nmap switches. Remember for any help man nmap is always there.

As this room is pretty straightforward and there is not much to discuss, we can look into each switch's meaning at a somewhat detailed level.

  1. Accessing the Help Menu: -h
  • With nmap -h, we can see all the various switches and their brief description. This can come in handy when we don’t feel like going through the manual and just want to check the switch that we want.

2. Stealth Scan: -sS

nmap -sS <target_ip> 
  • It is the default and most popular type of scan. As the name suggests it can perform the scan in a stealth mode as it never opens a full TCP connection.

3. UDP Scan: -sU

nmap -sU <target_ip> 
  • With this switch, we can perform a scan on the target machine’s UDP ports. This scan works by simply sending a UDP packet to every port on the target machine and analyzing the response.

4. Operating System Detection: -O

nmap -O <target_ip>
  • With this switch, we can directly detect the OS that the target machine is running. Sometimes, nmap is not able to detect the exact OS but it might provide some suspected OSs that might be running on the target.

5. Service Version Detection: -sV

nmap -sV <target_ip>
  • With this switch, we can detect the version of the service running on the open ports. Also, with the help of this information, we can differentiate between truly open ports and filtered ports.

6. Being Talky (Verbose): -v

nmap -v <target_ip> 
  • Sometimes we want to know what is going on in the background of the running scan and in such cases, the verbose switch turns out to be really helpful.

7. Very Verbose: -vv

nmap -vv <target_ip> 
  • This switch provides even greater verbosity and much more detailed insights into the processes running in the background of a scan.

8. Saving Output in XML File: -oX

nmap -oX <target_ip>
  • When performing the scan it can be handy to save the output of the scan so that it can be used in the future to check some major or minor details of the scan.

9. Aggressive Scan: -A

nmap -A <target_ip>
  • When want in-depth details of a scan we can use this switch as it is capable of performing OS detection, version detection, script scanning and traceroute all together.

10. Max Scan Speed: -T5

nmap -T<0–5> <target_ip>
  • We can adjust the speed of the scan using the speed template. These range from 0 to 5 with 0 T4 being the slowest and T5 being the fastest. One thing to keep in mind here is that faster the scan, more are the chances that we can miss on some details in the scan.

11. Specific Port: -p

nmap -p<single port number or range> <target_ip> 
  • With this switch, we can perform scan on a single port like -p80 or over a range of ports like -p100–2000.

12. Scanning All Ports: -p-

nmap -p- <target_ip>
  • While running a scan to detect all the open ports, we need to perform a check on all the ports. And in such a case we can use the switch `-p-` to run the scan over all the ports.

13. Script Scan: --script

nmap --script <scrip_name> <target_ip>
  • Nmap has a large variety of scripts that can check for various vulnerabilities and perform various detections.

14. Running Vulnerability Scripts:--script vuln

nmap --script vuln <target_ip>
  • There are many categories of scripts in nmap that are segregated in various categories like auth, broadcast, exploit, fuzzer, vuln and many others.

15. Scan Without Ping: -Pn

nmap -Pn <target_ip>
  • With this switch, nmap skips the discovery stage which is used to determine active machines for heavier scanning. When this switch is specified, nmap is forced to perform a scan against every target IP address specified.

[Task 3] Nmap Scanning

This section consists of various tasks that are needed to be performed on the actual deployed machine. I’ve explained the switches that are used for each task:

Output for questions 1, 2 and 3. As it seems that the results for all these three questions can be obtained from only one search tester@kali:~$ sudo nmap -sS I've provided it before answering them.

tester@kali:~$ sudo nmap -sS
Nmap scan report for
Host is up (0.17s latency).
Not shown: 997 closed ports
22/tcp open ssh
80/tcp open http
8090/tcp filtered opsmessaging
Nmap done: 1 IP address (1 host up) scanned in 1128.53 seconds
  1. Syn Scan
  • As explained above Syn Scan can be performed with -sS switch.

2. Open Ports

  • On running the previous scan, we get a list of ports from which we can determine the number of open ports.

3. Communication Protocol

  • From the previous scan result itself, we can determine the protocol as it is provided right beside the port number.

For the next 3 questions 4, 5 and 6 as well, only one search would also work and the output of that search is provided below:

tester@kali:~$ sudo nmap -A --script vuln
[sudo] password for tester:
Starting Nmap 7.80 ( ) at 2020-07-14 01:14 IST
Nmap scan report for
Host is up (0.16s latency).
Not shown: 998 closed ports
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.10 (Ubuntu Linux; protocol 2.0)
|_clamav-exec: ERROR: Script execution failed (use -d to debug)
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
|_clamav-exec: ERROR: Script execution failed (use -d to debug)
| http-cookie-flags:
| /:
| httponly flag not set
| /login.php:
|_ httponly flag not set
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-dombased-xss: Couldn't find any DOM based XSS.
| http-enum:
| /login.php: Possible admin folder
| /robots.txt: Robots file
| /config/: Potentially interesting directory w/ listing on 'apache/2.4.7 (ubuntu)'
| /docs/: Potentially interesting directory w/ listing on 'apache/2.4.7 (ubuntu)'
|_ /external/: Potentially interesting directory w/ listing on 'apache/2.4.7 (ubuntu)'
|_http-server-header: Apache/2.4.7 (Ubuntu)
| http-slowloris-check:
| Slowloris DOS attack
| IDs: CVE:CVE-2007-6750
| Slowloris tries to keep many connections to the target web server open and hold
| them open as long as possible. It accomplishes this by opening connections to
| the target web server and sending a partial request. By doing so, it starves
| the http server's resources causing Denial Of Service.
| Disclosure date: 2009-09-17
| References:
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
| vulners:
| cpe:/a:apache:http_server:2.4.7:
| CVE-2017-7679 7.5
| CVE-2018-1312 6.8
| CVE-2017-15715 6.8
| CVE-2014-0226 6.8
| CVE-2017-9788 6.4
| CVE-2019-0217 6.0
| CVE-2020-1927 5.8
| CVE-2019-10098 5.8
| CVE-2020-1934 5.0
| CVE-2019-0220 5.0
| CVE-2018-17199 5.0
| CVE-2017-9798 5.0
| CVE-2017-15710 5.0
| CVE-2016-8743 5.0
| CVE-2016-2161 5.0
| CVE-2016-0736 5.0
| CVE-2014-3523 5.0
| CVE-2014-0231 5.0
| CVE-2019-10092 4.3
| CVE-2016-4975 4.3
| CVE-2015-3185 4.3
| CVE-2014-8109 4.3
| CVE-2014-0118 4.3
| CVE-2014-0117 4.3
| CVE-2018-1283 3.5
|_ CVE-2016-8612 3.3
No exact OS matches for host (If you know what OS is running on it, see ).
TCP/IP fingerprint:
Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
TRACEROUTE (using port 80/tcp)
1 161.35 ms
2 161.12 ms
OS and Service detection performed. Please report any incorrect results at .
Nmap done: 1 IP address (1 host up) scanned in 379.87 seconds

4. Service Version Detection

  • Service detection can be performed using the -sV switch but we also know that -A search can perform multiple detections including service version detection and the output to that is provided above. From the details related to services running on various ports at the beginning of the output, we can see the version of service running on port 22.

5. Find the Flag Not Set

  • The output provided above contains the results of an aggressive -A scan and from that, we can easily see under the details for port 80 that there is the only flag that is not set.

6. Susceptible DoS Attack

  • Under the details for port 80 itself, we can see that nmap has performed some script tests and from that, we can determine the DoS attack to which the machine is susceptible.

With this, we can conclude the Nmap room. This room introduced us with several different switches that we can use with nmap to tweak our scans.

This was just my second writeup based on TryHackMe room. I am uploading all my writeups on GitHub which can be accessed at