Meats Ploit Able 2 New
Meats Ploit Able 2 New
net/publication/352102901
CITATIONS READS
0 4,464
1 author:
SEE PROFILE
All content following this page was uploaded by Imrana Abdullahi Yari on 03 June 2021.
1. Report Summary
Management Summary
This report presents the result of the penetration testing and vulnerability assessment of a
Metasploitable virtual machine and its underlying services. A Metasploitable 2 machine is an
Ubuntu Linux (version 8.04) based vulnerable machine developed by Rapid71 in collaboration
with MIT that is tasked to perform internal and external penetration testing and vulnerability
assessment. This machine has been distinguished as posing intentional risks in terms of its security
controls which can be exposed and compromised. The motivation behind this security assessment
was to investigate and confirm the adequacy of controls assigned to the security of the machine by
those responsible for protecting critical and confidential information. The purpose of this
assessment is to identify the Metasploitable machine issues that could affect the system and its
functionality. The procedure employed starts from initial preparation, setting the attack goal,
scope, and requirements. Next, vulnerable services were discovered. Further, the machine was
attacked to test the risk associated with it. Finally, the findings were reported.
The scope of this experiment involves penetration testing of the Metasploitable machine and all
services included in it. The Metasploitable machine is rated at a high-risk level based on the risk
associated with the findings. Moreover, this rating suggests a critical risk of security controls being
traded off with the potential loss of the entire business and the individuals involved. In this
penetration testing, successful findings of the attack demonstrated extreme risk vulnerabilities in
light of the severity of six vulnerabilities found. In general, all the security issues found in this
research are extremely susceptible, which allows the entire system to be compromised. The
findings are achieved successfully by utilizing the techniques, tools, and procedures of the
approach designed in this study. In general, the target system (Metasploitable machine) needs
viable patch integration of suitable security measures such as firewall and intrusion detection
mechanisms to fix the vulnerable services. Moreover, the system likewise needs the solid
validation of access credentials which put the greater part of the active services in danger. The
result obtained is intended to be a general assessment of the Metasploitable machine and its
contents. Therefore, any current version of Ubuntu Linux-based machines possessing similar
system features and weaknesses identified in this study could potentially pose greater susceptibility
to the risks of malicious threats.
1
https://information.rapid7.com/download-metasploitable-2017.html
1
Technical Summary
To evaluate the security of the target system, it is assumed that the Pentester (the authorized person
performing the security assessment) should mimic the procedure of an attacker and attempt to
perform unauthorized activities, acquire important information, and identify the general security
of the machine by playing different checks to find a vulnerability. The testing includes all services
and applications on the target system. Initially, the Fping tool is used to identify the availability of
the target system. Secondly, tools like Nmap and Traceroute are used to determine the open and
active services of the target system. Moreover, Nessus automated vulnerability scanner is used to
scan for the vulnerabilities of the target system. Furthermore, tools like Metasploit framework with
its modules and Netcat were employed to exploit and post exploit the system.
All of the findings (Table 1) eventually provide root access, complete system unauthorized
disclosure of information, modifications, and also disruption of services. But the vulnerability with
the medium impact of exploitation is PHP CGI; this shows that this vulnerability requires some
precondition to escalate to high privilege users like an Admin. However, it permits an attacker to
perform some modifications before post-exploitation. Therefore, the probability of exploiting
lesser and greater vulnerabilities may vary since more emphasis is required to attain a greater
impact of exploitation. For the attack of java RMI and UnreallRCD vulnerabilities to be successful
and achieve complete system compromise, great skills and tools are required, so this type of
vulnerability rarely occurs. The chances to exploit Samba and Vsftpd vulnerabilities are rated
moderate due to some preconditions required to exploit the system. The PHP CGI and VNC weak
password vulnerabilities are very common; this is because some less advanced skills and open
tools are needed to exploit the system.
The overall findings were identified based on vulnerability that was either because of effective
guessable access credentials, missing patches, or because of the absence of system hardening. It is
recommended that the system services ought to be upgraded to the most recent definitions which
contain security patches to fix the discovered vulnerabilities. The weak credentials ought to be
supplanted by solid credentials that cannot be easily guessed.
2. Design of Methodology
The penetration testing methodology used for this study is categorized into the following phases
and sourced from (PCIsec 2015, Saindane 2015, SANS 2012a):
2
Planning & Pre- Attack Phase
Discovery Phase Reporting
Engagement
Interaction Phase
Exploitation Post-
Intelligent Exploitation
Gathering
Vulnerability
Analysis
4
• Mostly occur, in a phenomenon where the exploit to gain root privileges is not achieved in
the previous phase, which causes further vulnerability analysis.
• This phase might require an installation of some tools to gain root access level
• Pentester can analyze further information during post-exploitation. For instance, with an
organization’s permission, using a compromised system to attack further another
vulnerable system within the targeted system.
• Keeping logs of all the processes and findings as is helpful to evident the work done
• Using the post-exploitation phase an attacker can gain persistence in a comprised system
2.4. Reporting
• Is one of the crucial phases that involves preparing a final paper for the organization.
• Consist of executive summary for management and technical support, detailing the results
in an appropriate form.
• It focuses on threat impacts, the level of severity, general findings, recommendations, fixes,
the cost of implementing a resolution, summary, and roadmap.
• A technical report carried out how vulnerability analysis, exploitation, and post-
exploitation is done.
3. Discovery Phase
3.1. Intelligent gathering
Footprinting
Here is assumed that the attacker does not know the IP address of the target machine within a
specified domain. To find the active host that is connected within the subnet network of the target
machine. Figure 1 below illustrates the Fping tool used to find the active systems that are within
the same subnet with the source address. The -A optional command is used to display the address
of the hosts, while -g is used to specify the range of IP addresses.
5
Figure 1: Fping
Figure 1 above shows the results of the findings. The two shown active systems that are connected
to the same class are the target system and the source system IP addresses. Thus, gives an attacker
a clue of live systems within the network.
Scanning
The previous phase assists an attacker in finding the IP address of the target machine. Now to
move further tools like ping, traceroute are used to provides more information about the target
machine. Figure 2 shows the output using ping and traceroute with the IP address, which indicates
that the machine is active and reachable with 30 hops maximum gateways in-between the source
and destination. Thus, such offer a confirmation to the attacker that the system is live and active
and the range of possible distance to reach the target.
6
Figure 2: Ping and Traceroute
An attacker can uniquely identify the different applications and services running on the target or
port that enables sharing of a single physical connection to the packet switch network. Figure 3
below shows the output of the Netcat command used with the optional commands -v to indicates
the open port that the scanning covers, -w tells nc to wait for 1 second if the port is open or close,
-z to operates in 0 i/o modes to ignore a latency victim by the program to account for delays in the
CPU. The 1-1000 are a range of possible ports to scan.
7
Figure 4 below shows the output of ping sweep using Nmap, which utilizes ICMP to syntactically
go up and down host IDs in the target subnet. However, the destination machine may capture the
packets that come in and out of the network as shown in figure 5, using the TCP dump tool.
Moreover, port scanning in figure 6 indicates open ports and service version and their protocols.
Additionally, custom packet crafting (-sS) of the source field data is used as an optional command
for Nmap to spoof the address of the attackers’ machine, so as not to trigger an alarm or arouse
suspiciously. The output of Netcat of figure 3 and Nmap of figure 5 is different due to the
specification of a range of ports to scan.
Figure 4: Nmap
8
Figure 5: tcpdump
Figure 6: Nmap
Enumerating
Here using active connections and open ports service to detect poorly implemented services. Thus,
assist an attacker in building the map of the target network to determine potential weaknesses
(McNab 2007). The nbtscan tool is used to reveal the target NetBIOS hostname, the domain name
of the machine, accessible Mac address, as illustrated in figure 7.
9
Figure 7: nbtscan
To enumerate more, the Metasploit framework is used to find the version of the samba of the
Metasploitable machine as shown in figure 8. Chris mentioned that the NetBIOS name is
vulnerable to several attacks if exposed to an untrusted network or if the UDP port 137 is open and
active (McNab 2007). Also, port 80 is enumerated using Nmap script to find intelligent
information about the target machine, as shown in figure 8.
Figure 8: smb_version
10
Figure 9: HTTP enumeration
11
Figure 10: list of vulnerabilities found
12
4. Attack phase
Primarily based on the findings on the previous phases
4.1. Vulnerability 1: Samba MS-RPC on port 445 Remote Shell Command Execution – CVE
-2007-2447
Description
Samba versions 3.0.0 to 3.0.25 rc3 are inclined with a vulnerability that permits intruders in
executing shell commands in light of the fact the target machine neglects to verify and sanitize
users’ inputs (SecurityFocus 2010a). However, an attacker may influence this problem to run shell
arbitrary commands on the target vulnerable machine with the benefits of the vulnerable samba
application. CVE details 2007-2447 reported this vulnerability with a vulnerability impact score
of 6.0 addressing the medium level impact of exploitation (CVE Details 2015). Another instance
was reported that this vulnerability also affects remote printer and file share management (Samba
2007).
Exploitation
For instance, the previous phase of enumeration has already shown the version of samba which is
3.0.20. This module exploit/multi/samba/usermap_script in Metasploit framework is used to
exploit a command execution vulnerability in samba when utilizing non-default “username map
script” configuration as shown in figure 12. In exploiting this vulnerability no authentication is
required because the configuration option is utilized to map usernames preceding system
verification.
13
Figure 13: shadow file of the target machine
Shell access is used to get the password hashes of the target machine. John dripper password
cracker was then used to crack the password. The cracked password and their username were then
later used to get another user access to the system using SSH as shown in figure 14.
14
Resolution
• To mitigate this issue, patches are available from
https://www.samba.org/samba/history/security.html for vulnerable samba 3.0 through
4.40
• This deformity can be mitigated by expelling all outer script invocations from samba
configuration, such as username map and printer commands (Samba 2007).
• Also, running up to date stable samba can reduce the risk because the latest versions are
integrated with the definitions to solve the previous issues (Samba 2007).
15
Figure 14: exploitation of vstpd
Shell access is utilized to reveal the actual username and password of the Metasploitable machine,
as shown in below figure 15.
Resolution
• The reported CVE-2011-2523 issue associated with VSTFD version 2.3.4 has been fixed
with the later released version 2.3.5-3 and high (SecTrack 2011). The versions are
incorporated with patches that removed the feature of the backdoor.
• The corrected version that has been repaired can be downloaded from
https://security.appspot.com/vsftpd.html
16
exploit/multi/http/php_cgi_arg_injection module of Metasploit framework with PHP interpreter
payload with the required entities. (Calderon 2012).
17
Privilege escalation
Figure 18 below shows the post-exploitation using SSH with exposed username and password
from index.php.
Resolution
• Use of the latest definitions is highly recommended. Alternatively, use of automatic scripts
that can be downloaded from
http://kb.sp.parallels.com/Attachments/20000/Attachments/cve-2012-1823-wa_pp.tgz
• Use of the .htaccees rule and write to a file and then save in apache directory can prevent
those optional parameters from filtering (KbPlesk 2014).
4.4. Vulnerability 4: Java RMI Server on port 1009 Java Code Execution - CVE-2011-3556
Description
The Java Remote Method Invocation (RMI) server has an insecure registry configuration and the
activation service which are the reasons that allow execution of code remotely with high privilege
user permission. This is possible because Java RMI allows the loading of its classes via a remote
protocol (Cisco 2011). The Java RMI method of invoking a call does not require any form of
validation or authentication. An attacker can exploit this weakness by forwarding malicious
packets when the packet is processing to execute codes remotely to the affected version and may
eventually compromise the vulnerable system.
Exploitation
18
The figure 19 below shows the exploitation using exploit/multi/misc/java_rmi_server module of
Metasploit framework to get a shell access with high privilege user.
Resolution
• Disabling class-loading in the AdminServerPlugins.properties file could potentially
prevent the attack (KnowledgeBProg 2016).
• Using a host-based firewall to confine access to the influenced service (Cisco 2011).
19
Figure 20: exploitation of unrealircd
Figure 21 illustrates the access to the MySQL server using the shell to explore more on the attack.
Resolution
• The new versions are patched with the solution. Alternatively, re-downloading and
compiling the exact version that has been mitigated:
20
https://www.unrealircd.org/download
To explore more on the attack, a vnc shell access is used to access MySQL server and then drop
the one of the databases as shown in figure 23.
21
Figure 23: MySQL server
Resolution
• Strong secure password creation with the following rules:
o The password should be long enough
o Includes combination of numbers, upper and lower case, and special characters
o And avoid using obvious passwords like using the username as a password (Owasp
2016)
22
Figure 24: sitemap
23
address of the target system, its availability, and some additional details. NSLookup command is
used to validate the IP address as shown in figure 27.
24
Maltego
An attacker can make use of the Kali Linux tool Maltego to run reconnaissance activity for
information gathering and data mining from all publicly available areas on the internet. Maltego
has a pallete with a domain option to add a domain name and it also supports several sub-features
for transformations, like email, website, DNS, and so on. Figure 28 shows the data gathered from
shu.ac.uk website. The attacker can make use of these findings for social engineering and phishing
attack.
SECTION B
25
• Setting up a safe area to execute incidence response procedure
• Guaranteeing utilities (disaster recovery tools) required are readily and actively available
26
• Proposing areas for change in light of the issues experienced
• Exhibiting to the relevant individual or parties
• Lastly, generating incident response documentation
Reference List
CALDERON, P., May 27, 2012, 2012-last update, Detecting and exploiting vulnerable PHP-CGI
applications. Available: http://www.websec.ca/blog/view/detecting-and-exploiting-php-cgi.
CISCO, 2011-last update, Oracle Java RMI Server Insecure Default Configuration Remote Code
Execution Vulnerability. Available:
https://tools.cisco.com/security/center/viewAlert.x?alertId=23665 [17, May, 2016].
CVE DETAILS, 2015-last update, Lists vulnerability statistics for all versions of Microsoft
Internet Explorer. Available: http://www.cvedetails.com/product/9900/Microsoft-Internet-
Explorer.html?vendor_id=26.
JOHNSON, L., 2013. Computer Incident Response and Forensics Team Management Conducting
a Successful Incident Response. Burlington: Elsevier Science.
KBPLESK, Aug 12, 2014, 2014-last update, Parallels Plesk Panel: PHP-CGI remote code
execution vulnerability (CVE-2012-1823). Available: http://kb.plesk.com/en/116241 [May, 16,
2016].
KNOWLEDGEBPROG, 2016.
How to Prevent Java Rmi Class Loader Exploit With Adminserver.
http://knowledgebase.progress.com/articles/Article/How-to-prevent-Java-RMI-class-loader-
exploit-with-AdminServer edn.
LUTTGENS, J.T., PEPE, M. and PROSISE, C., 2014. Incident response and computer forensics.
Third edition.. edn. McGraw-Hill Education.
27
MCCARTHY, N.K., 2012. The computer incident response planning handbook : executable plans
for protecting information at risk. McGraw-Hill.
MCGREEVY, P., James, 2012. Footprinting: What Is It, Who Should Do It, and Why?
https://www.sans.org/reading-room/whitepapers/auditing/footprinting-it-it-why-62 edn.
MCNAB, C., 2007. Network security assessment. 2nd ed.. edn. Farnham; Sebastopol, Calif.:
O'Reilly.
OWASP, 14 February, 2016, 2016-last update, Password length & complexity. Available:
https://www.owasp.org/index.php/Password_length_%26_complexity [17, May, 2016].
VINES, R., D., 2007. Penetration testing reconnaissance -- Footprinting, scanning and
enumerating. http://searchitchannel.techtarget.com/tip/Penetration-testing-reconnaissance-
Footprinting-scanning-and-enumerating edn.
28