Metasploitable Pentest Report Assignment
Metasploitable Pentest Report Assignment
Assessment 2
Applied Information Assurance
Submitted by:
Registration Number Student Name
IT21001734 H.M.T.M. Herath
Date of Submission:
11/05/2023
1
Table of Contents
1.1 Scope.................................................................................................................. 3
4. Conclusion ......................................................................................................... 39
2
1. Executive Summary
A vulnerability assessment and penetration test were conducted on two domains
including Metasploitable 2 and DVWA web application of Metasploitable 2 to determine
its exposure to a targeted cyber-attack. All tests were conducted in a manner that
simulated a malicious attacker engaged in a cyber-attack against Metasploitable 2 with
the following goals,
Here there are 2 IPs used by me as there was a technical issue. First steps used
192.168.8.126 then after, in the web app testing phase I had to change network adapter
type because web application was not performed correctly.
1.1 Scope
IP address 192.168.8.126 [10.0.2.6]
3
1.2 Methodology
Industry-standard penetration testing tools and frameworks were used for the
vulnerability assessment and penetration test including Nmap, Metasploit Framework,
various information gathering tools, Kali Linux penetration testing tools and automated
vulnerability scanners. Further, standard penetration testing procedure was followed
throughout the process, which is information gathering, vulnerability assessment,
exploitation, and remediation.
1.3 Limitations
Vulnerability assessment and penetration test was conducted only for the in-scope IPs
and domains. Vulnerabilities related to denial of service and mobile applications were
considered out-of-scope.
4
2. Summary of Findings
5
3. Technical Review
3.1 Information Gathering
As the first step of information gathering, the network which needed testing was
discovered. Nmap was used for this purpose.
A basic port scan was performed with Nmap to identify all open ports, services
associated with the ports and versions of the services in the target IP.
6
Figure 2-Open ports and associated services
About 30 open ports could be identified including commonly used ports. So, as the next
step, each of these commonly used ports were enumerated.
Two FTP services could be identified residing in ports 22 and 2121 respectively.
Enumeration was performed for both ports.
As the first step of FTP enumeration, a banner grabbing was performed with Netcat.
7
Figure 3-Banner grabbing (FTP port 21)
FTP service which resides in port 21 could be observed to be running vsFTPD version
2.3.4 and the FTP service resides in port 2121 could be observed to be running ProFTPD
version 1.3.1 which is an FTP server.
Then Searchsploit tool was used to identify any potential exploits available for the
mentioned FTP versions.
8
Figure 7-Testing port 21 for anonymous login
FTP service in port 21 allowed anonymous login, while port 2121 did not.
Then a credential brute forcing was performed using “ftp-brute” Nmap script on both
ports.
9
Figure 10-Credentials Brute forcing on port 2121.
Valid credentials can be found only for the FTP service on port 21.
Then a Wireshark packet capturing was performed on both ports to check unencrypted
credentials passing through the network.
FTP services on both ports were passing credentials as plain text through the network.
Then both FTP services were tested for FTP bounce vulnerability with Nmap.
Neither of FTP services were not vulnerable to FTP bounce vulnerability, which uses.
“PORT” commands to request access to ports indirectly through the use of the victim
machine by an attacker.
10
3.1.4 SSH Enumeration
Secure shell (SSH) service could be identified on the default port 22.
Then an algorithm brute force was performed with “ssh2-enum-algos” Nmap script to
identify supported algorithms by the SSH service.
11
Figure 15-SSH algorithm brute force
Authentication methods for SSH was enumerated with “ssh-auth-methods” Nmap script
and found that both public-key and password are accepted.
Simple Mail Transfer Protocol (SMTP) service could be identified on the default port
25. Users of SMTP were enumerated with “smtp_enum” Metasploit module.
12
Figure 18-Enumerating SMTP users
Some default users in UNIX systems such as mail, postmaster , user and www-data
could be identified.
As the first step of SMB enumeration, enum4linux was used to identify users,
workgroups and Nbtstat information.
13
Figure 19-Enumerating SMB with enum4linux
Then Nmap was utilized with “smb-vuln” script to identify potential vulnerabilities.
SMB services could be identified as not vulnerable to ms10-054 which is SMB pool
overflow vulnerability and ms10-061 which is Microsoft print spooler service
impersonation vulnerability.
As the first step of enumeration, a login brute force was performed for the user root with
“mysql_login” Metasploit module in order to obtain valid credentials because most of
the enumerations on MySQL service require valid credentials. The results revealed that
the user root does not require a password to login to MySQL service.
14
Figure 21-MySQL login brute force on user root
Further enumeration was performed to check whether the found credentials are valid
and to steal information from MySQL service.
Users associated with the MySQL service was enumerated using “mysql_enum” module
of Metasploit.
15
Figure 23-mysql_enum module of Metasploit
Three main users as “debian-sys-maint” , “root” and “guest” could be identified with
their privileges on the MySQL service.
Nmap identified MySQL version as 5.0.51a, and utilizing searchsploit revealed some
exploits that can be used with this particular version.
16
3.1.8 VNC Enumeration
Virtual Network Computing (VNC) service, which is used to remotely control another
computer, could be identified on the default port 5900.
Internet Relay Chat (IRC) service could be identified on the default port 6667.
Nmap script “irc-info” was utilized to gather basic information of the service.
17
Figure 27-Enumerating basic information on IRC
IRC version was identified as Unreal 3.2.8.1 which contains a major vulnerability known
as UnrealIRCD 3.2.8.1 Backdoor Command Execution. So, Nmap’s “ircunrealircd-
backdoor” script was used to confirm the vulnerability.
18
A default Tomcat web server implementation could be identified on port 8180, and
admin login page could be identified in http://192.168.8.194:8180/admin/ path.
As this is a default web server, it is possible that default account credentials for Admin
login page are still in use.
19
3.1.11 Web Application Enumeration
As the first step of enumerating the web application, Nikto was used to scan the web
application to identify existing vulnerabilities and gather critical information.
Nikto could identify many vulnerabilities, flaws and interesting facts associated with the
web application.
As there are hidden directories in web applications which are not visible to normal users,
Gobuster was utilized to brute force hidden directories. Brute forcing was performed
using different wordlists.
20
Figure 332-Brute forcing directories with Gobuster
A firewall fingerprinting was performed using wafw00f tool to identify the web
application firewall, and there wasn’t a WAF involved.
21
Figure 32-WAF fingerprinting
3.2 Internal Network Vulnerability Findings
Scope – 10.0.2.6
Description
A specific port on the victim machine is bound by a bind shell and it listens for an
incoming connection from an attacker machine. In a malicious perspective, this bind
shell acts as a backdoor to the system.
In this machine, an open root bind shell could be identified, listening on port 1524
without any authentication being required. This shell can be used to obtain root access
directly by an attacker with connecting to the port remotely and sending commands
directly. A sign of previous breach is indicated through this bind shell.
Impact
22
Sensitive data of the system may have already breached. In addition, an attacker can
easily gain high privilege access to the system without providing any credentials by
utilizing simple networking tools such as Netcat.
Recommendations
Description
FTP service resides on port 21 is vsFTPD version 2.3.4, which has a backdoor by default,
and it opens a shell on TCP port 6200.
Impact
A reverse shell can be opened by an attacker after the successful exploitation of this
vulnerability, and it leads to total compromise of the system.
Recommendations
• vsFTPD version 2.3.4 is outdated. So, update the vsFTPD to the latest 3.0.4
version.
Description
MySQL database service is probably there for storing sensitive information in the
machine. However, in this machine, the password for MySQL user root is not set.
Further enumeration revealed that user root is the highest privileged user in MySQL
service which has read, update and delete privileges. Further it could identify that many
sensitive information such as passwords of web applications, passwords of other hosts
are stored in the database.
24
Impact
Any remote attacker can gain access to the MySQL database, which leads to the total
compromise of the system. Sensitive information such as passwords for other networks
are stored in MySQL database. So, an attacker will be able to pivot through the network
exploiting each host without any effort.
Recommendations
Description
Virtual Network Computing is widely used for remotely controlling another computer
with the use of a graphical user interface. It should be secured with proper passwords
because it deals with sensitive data. However, authentication password for VNC server
in this machine is set to the value “password” which is not secure.
Impact
Any remote attacker will be able to login to the VNC service and gain access to the
shared computing resources.
Recommendations
25
e) Detected a Backdoor in IRC
Risk Factor High
Type Remote
CVSS Base Score 10
CVE CVE-2010-2075
Description
Internet Relay Chat version used which is UnrealIRCD 3.2.8.1 contains a backdoor by
default. This backdoor was present in the archive file Unreal3.2.8.1 between November
2009 and June 2010.
Impact
This backdoor can be used to exploit the system and escalate privileges, which leads to
total compromise of the system.
Recommendations
Description
Apache Tomcat provides a web server which can run Java code by providing a pure
Java HTTP web server implementation. In this machine, Tomcat web server
implementation running on port 8180 has default credentials in use for the Tomcat
admin web application manager. Both username and password are set to “tomcat”
which is not secure.
26
Impact
A remote attacker can gain access to the Apache Tomcat foothold and then escalate
privileges to root leveraging other vulnerabilities present in the system.
Recommendations
Description
Secure shell establishes a secure remote connection from one Linux host to another. It
is secured with password or public and private keys. However, username and password
for the SSH service running on port 22 in this machine could be obtained via brute
forcing because weak passwords are set as the authentication mechanism to SSH
service. Both username and password are set to “msfadmin” which is not secure.
Impact
A remote attacker can login to machine via SSH using legitimate credentials after
performing brute force and escalate privileges to gain root access which leads to total
compromise of the system.
Recommendations
27
h) Anonymous FTP Login Enabled
Risk Factor Medium
Type Remote
CVSS Base Score 5.3
CVE CVE-1999-0497
Description
FTP service running on port 21 allows anonymous logins. Any remote user can login to
FTP service remotely by providing “anonymous” as the username and providing any
password. It does not require unique credentials.
Impact
Any remote user will be able to access sensitive files made available by the FTP server
after logging in.
Recommendations
Description
As FTP is used to share and store sensitive data of the organization, it should be secured
with a strong password. However, username and password for the FTP service running
on port 21 in this machine could be obtained via brute forcing. Both username and
password are set to the value “user” which is not secure.
28
Impact
A remote attacker can login to FTP server using legitimate credentials and gain access
to sensitive information. If sensitive details such as passwords for other hosts are stored
or shared through FTP, remote attacker will be able to obtain them and pivot through
the network.
Recommendations
• Use a strong username and password for FTP server and refrain from using
default credentials.
• Disable FTP server if it is not needed.
Description
Impact
An attacker can intercept the network traffic using a simple packet capturing tool and
obtain the username and password for FTP service and masquerade as a legitimate user.
Further, any files shared through FTP can be obtained by an attacker. This is called a
man-in-the-middle attack.
Recommendations
29
3.3 Web Application Vulnerability Findings
Scope – http://10.0.2.6/dvwa/
Description
Weak credentials used in Login page in the web application. Username is set to the
value “admin” and password is set to the value “password”, which are default
credentials and not secure.
Impact
An attacker can brute force the credentials with a simple tool like Hydra or attacker can
easily guess the credentials.
Recommendations
• Use a strong username and a password for web application login and refrain
from using default credentials.
• Use two-factor authentication if possible.
b) SQL Injection
Risk Factor High
Type Remote
CVSS Base Score 7.5
Description
A SQL injection vulnerability could be detected in the web application which happens
due to the lack of input sanitization of user supplied queries.
30
Impact
This could allow attackers to execute arbitrary SQL commands and steal data or use the
additional functionality of the database server to take control of more server
components. Further, sensitive information can be leaked which leads to total
compromise of the system.
Recommendations
• Any value supplied by the client needed to be handled as a string value rather than
part of the SQL query. So, using parameterized queries will be the best solution.
Description
A php file could be uploaded to the file upload functionality of the web application
because there are no protections against file extension. which leads to a reverse shell of
the web application. An attacker can escalate privileges with the other vulnerabilities
present.
Impact
As an attacker can obtain a reverse shell of the system, it leads to the total compromise
of the system.
Recommendations
31
Risk Factor High
Type Remote
CVSS Base Score 8.5
Description
Operating system commands could be executed from the web application interface
because of the insufficient use of input sanitization.
Impact
Sensitive data of the system could be compromised because almost all UNIX operating
system commands can be executed via web application interface.
Recommendations
3.4 Exploitation
Scope – 192.168.8.194
32
FTP backdoor was exploited using the Metasploit module available and it gave direct
root access to the system.
33
Figure 38-Exploiting IRC
34
Figure 39-Exploiting Apache Tomcat
35
Figure 40-Brute forcing SSH
Scope – http://10.0.2.6/dvwa
a) Exploiting Weak Credentials Used for Login
Hydra was used to crack the login password of admin and it was successful.
36
Figure 44-Cracking HTTP Login
37
Figure 48-Obaining user passwords using sqlmap.
Those passwords could be easily cracked with the built-in word lists and provided
almost all user passwords in clear text.
A php reverse shell was uploaded to the image uploaded section of the dvwa and got
reverse shell and bypass the security content type using burp.
38
d) Exploiting Command Injection
Operating system commands could be exploited successfully in the “Ping for Free”
website function. Sensitive data could be obtained easily by exploiting it.
4. Conclusion
Vulnerabilities associated with Metasploitable2 system, and its web application were
analyzed and demonstrated though this report. The overall risk associated with the
system is very critical because it is vulnerable to many high severity vulnerabilities
which leads to remote code execution.
Vulnerabilities were categorized into high, medium, and low severity levels for better
reference and most of the vulnerabilities were exploited in order to give the reader an
understanding about how an attacker can compromise the system in a real-life scenario.
Immediate actions should be taken to mitigate these vulnerabilities.
39