assignement 4
assignement 4
1. Now, the next goal is to find the password to log into the level 1.
2. We are going to use the ls command to list all the files in the current directory.
3. The file storing the password for level 1 is readme.
4. Now, we use the cat command to read the content of the file.
5. The password retrieved for level 1 is given ZjLjTmM6FvvyRnrb2rfNWOZOTa6ip5If
6. Now, using the exit command to log out of the bandit0 level.
Commands used: ls, cat, exit
_________________________________________________________________________________________
LEVEL 1:
The password for the next level is stored in a file called - located in the home directory.
2. Now, the next goal is to find the password to log into the level 2.
3. We, are going to use the ls command to list all the files in the current directory.
4. The file storing the password for level 2 is “-“.
5. Now, we need to use the cat command but the file name starts with a special character and the
regular command won’t work so we use cat ./- or cat < -
6. The password retrieved for level2is given ZjLjTmM6FvvyRnrb2rfNWOZOTa6ip5If
7. Now, using the exit command to log out of the bandit1 level.
Commands used: ls, cat, exit
Aamna Abbas BEIS-05 (A)
_________________________________________________________________________________________
LEVEL 2:
The password for the next level is stored in a file called spaces in this filename located in the home
directory.
2. Now, the next goal is to find the password to log into the level 3.
3. We are going to use the ls command to list all the files in the current directory.
4. The file storing the password for level 3 is “spaces in the filename”.
5. Now, we need to use the cat command but the file name has spaces in it and the regular command
won’t work so we use cat “spaces in this filename” or ‘spaces in this filename’
6. The password retrieved for level 3 is given MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
7. Now, using the exit command to log out of the bandit2 level.
Commands used: ls, cat, exit
_________________________________________________________________________________________
LEVEL 3:
The password for the next level is stored in a hidden file in the inhere directory.
2. Now, the next goal is to find the password to log into the level 4.
3. We are going to be using the cd command to change the directory to inhere.
4. We are going to use the ls command to list all the files in the inhere directory.
5. We did not see any file so it must mean that the file where the password is stored is hidden.
6. We use the command ls -a to find the hidden file.
7. The hidden file named …Hiding-From-You is shown.
8. Now, we need to use the cat command to see the password.
9. The password retrieved for level 4 is given 2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ
10. Now, using the exit command to log out of the bandit3 level.
Commands used: ls, cd, ls -a, cat, exit
_________________________________________________________________________________________
LEVEL 4:
The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your
terminal is messed up, try the “reset” command.
1. Now, the next goal is to find the password to log into the level 5.
2. We are going to be using the cd command to change the directory to inhere.
3. We are going to use the ls command to list all the files in the inhere directory.
4. Now, we are going to use the file command to find the type of the file.
5. However, it is a very monotonous work so we use a for loop to check all of these at once.
Command used: for i in $(ls); do file ./$i ; done
6. Now, the only human readable file is the file named -file07.
7. Now, using the cat command to find the password.
8. The password retrieved for level 5 is given 4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw
Aamna Abbas BEIS-05 (A)
9. Now, using the exit command to log out of the bandit4 level.
Commands used: ls, file, cd, cat, exit
_________________________________________________________________________________________
LEVEL 5:
The password for the next level is stored in a file somewhere under the inhere directory and has all
of the following properties:
human-readable
1033 bytes in size
not executable
2. Now, the next goal is to find the password to log into the level 6.
3. We are going to be using the cd command to change the directory to inhere.
4. We are going to use the ls command to list all the files in the inhere directory.
5. As, we used ls 19 further directories were shown each having 9 more files.
6. It would be very time consuming to use the regular commands to find the file size using du command,
file type using file so we use a special command to find the file having all the properties shown above.
Command used: file . -type f -size 1033c -readable -not -executable -readable
7. We have the found the file having the following path in the inhere directory.
Path followed: ./maybehere07/.file2
8. Now, using the cat command to find the password.
Aamna Abbas BEIS-05 (A)
_________________________________________________________________________________________
LEVEL 6:
The password for the next level is stored somewhere on the server and has all of the following
properties:
owned by user bandit7
owned by group bandit6
33 bytes in size
1. Now, the next goal is to find the password to log into the level 7.
2. As the file is on the server somewhere and we don’t know the name so we can’t use ls command.
3. We use the following command to find the file having the following properties.
4. find / -type f -size 33c -user bandit7 -group bandit6
5. A lot of files having errors are being shown so in order to find only the useful files we use
2</dev/null
6. The path to the file containing the password is found that is
/var/lib/dpkg/info/bandit7.password
7. Now, using the cat command to find the password.
8. The password retrieved for level 7 is given morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj.
9. Now, using the exit command to log out of the bandit6level.
Commands used: find, exit, cat
Aamna Abbas BEIS-05 (A)
_________________________________________________________________________________________
LEVEL 7:
The password for the next level is stored in the file data.txt next to the word millionth.
2. Now, the next goal is to find the password to log into the level 8.
3. We use the grep command to find the word ‘millionth’ in the file, the grep command also shows the
words next to it and out password stored is shown.
4. grep “millionth” data.txt
5. The password retrieved for level 8 is given dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc
6. Now, using the exit command to log out of the bandit7 level.
Commands used: grep, exit, ls
______________________________________________________________________________________
LEVEL 8:
The password for the next level is stored in the file data.txt and is the only line of text that occurs only
once.
1. Now, the next goal is to find the password to log into the level 9.
2. Firstly, we use the ls command to list all the files.
Aamna Abbas BEIS-05 (A)
_________________________________________________________________________________________
LEVEL 9:
The password for the next level is stored in the file data.txt in one of the few human-readable strings,
preceded by several ‘=’ characters.
1. Now, the next goal is to find the password to log into the level 9.
2. We know that the file only has a few human readable lines and the rest is data, we use strings
command to separate the human readable lines from raw data.
3. Grep command is used to find the lines where “=” is used.
4. Command used: strings data.txt | grep “=”
5. The password retrieved for level 10 is given FGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey.
6. Now, using the exit command to log out of the bandit9 level.
Commands used: strings, grep, exit
Aamna Abbas BEIS-05 (A)
LEVEL 10:
The password for the next level is stored in the file data.txt, which contains base64 encoded data
1. Now, the next goal is to find the password to log into the level 11.
2. Firstly, we use the cat command to output the data stored in the file.
3. We receive data in the encrypted form, using base64 encryption and the decrypted version would
have the password stored.
Command used: base64 -d data.txt.
4.The password retrieved for level 11 is given dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
5.Now, using the exit command to log out of the bandit10 level.
Commands used: cat, base64, exit
Question – 2. Join the adventure on TryHackMe's Advent of Cyber 2023 room. Here there are a number of
tasks and you have to practice only one task as mentioned against your names in the attached list. Submit
step by step walkthrough. You will have to present in the class about the challenge and what you learnt. (30
mks)
https://tryhackme.com/r/room/adventofcyber2024
Introduction:
In this task, we have two main operations: Operation Blue and Operation Red.
Operation Blue: We have identified a vulnerability related to Remote Code Execution (RCE) and will
use Security Operations Centers (SOC) log analysis to identify which IP address performed the web
shell on the Frosty Pines server.
Operation Red: We will learn how the shell was uploaded to the server to gain access to the server's
system.
Previous Knowledge:
To solve this, you should have a basic understanding of:
1. ELK (Elasticsearch, Logstash, Kibana), especially Kibana Query Language (KQL) for log analysis.
2. RCE (Remote Code Execution)
3. Web Shell
Key Terms:
ELK: A stack of open-source products – Elasticsearch, Logstash, and Kibana – used for searching,
analyzing, and visualizing log data in real-time.
KQL: Kibana Query Language used to query data in Kibana.
RCE: Remote Code Execution, a type of vulnerability that allows an attacker to run arbitrary code on
a target machine.
Web Shell: A script that enables remote administration of a machine, allowing the execution of
commands on the server.
Steps of Operation Blue:
This part focuses on investigating the attack using log analysis tools. Key things to capture include:
BLUE: Where was the web shell uploaded to?
Answer format: /directory/directory/directory/filename.php
BLUE: What IP address accessed the web shell?
Data Provided:
1. Access Kibana
Navigate to MACHINE_IP:5601 to investigate the attack.
Answer the blue questions by analyzing the logs in Kibana.
2.Select ELK Collection
Review the logs of the attack on Frosty Pines Resorts by selecting the "frostypines-resorts" collection within
ELK.
Aamna Abbas BEIS-05 (A)
Use the date and time range between 11:30 and 12:00 on October 3rd, 2024 when reviewing the logs.
Detailed Steps:
1.Start the AttackBox and Target Machine
2.Open Firefox and enter the IP address of the Kibana server. The following screen will appear.
9.Filter by Client IP
10.Identify the IP that tried to run commands using the shell.php file.
1.Firstly, inorder to access the Frosty Pines Resorts website (http://frostypines.thm), you will need to reference
it in your hosts file. On the AttackBox, this can be done by executing the following command in a terminal:
Echo “MACHINE_IP frostypines.thm” >> /etc/hosts
2. Now , we open the frosty pines web portal onto the firefox server as shown below.
3. There are no file uploads on the home page, so we go to the rooms page where we still cant upload
anything.
4. We go to the login page where we can try to insert our default credentials.
Aamna Abbas BEIS-05 (A)
6. Now, we go to the add a new room page, where we see an option to upload a file.
Aamna Abbas BEIS-05 (A)
7. Now, we will use the command line to save the code as shell.php on desktop.
8. Inorder to execute the file, it is very necessary for us to know the location of the fie, for that purpose
we use F12 key to have access to the development tools. Now, we will go to the network where we can
find the file shell.php and its address as well.
9. Now, we use the address of this file and try to access it at the server.
Frostypines.thm/media/images/room/shell.php
10. Now, we use the ls command to find the files around us and we find the flag.xt file.
11. Now, we use the cat command to find the content and the flage is captured as
Conclusion:
In this task, we successfully conducted two main operations: Operation Blue and Operation Red.
Operation Blue: focused on identifying a vulnerability related to Remote Code Execution (RCE). Through
Security Operations Centers (SOC) log analysis in Kibana, we identified where the web shell was uploaded
and pinpointed the IP address that accessed it.
Operation Red: concentrated on understanding how the shell was uploaded to gain system access. We
navigated the Frosty Pines Resorts web portal, identified the upload point, and determined the shell's location.
By executing the shell, we accessed the server, located the flag.txt file, and retrieved its contents.
Throughout this task, we applied our understanding of ELK (Elasticsearch, Logstash, Kibana), Kibana Query
Language (KQL), and web shells. This practical experience reinforced our knowledge and demonstrated the
importance of thorough log analysis and vulnerability assessment in cybersecurity operations.
_________________________________________________________________________________________
Question – 3. Tabulate a Cyber security policy (1-2 pages) as mentioned against your name for MCS. You may
take help from NIST guidelines (Search them).
This policy establishes guidelines to protect the University’s IT systems, networks, and user devices from viruses,
spyware, and other forms of malicious software. It aligns with the NIST Cybersecurity Framework to ensure the
integrity, confidentiality, and availability of the University's data. This policy applies to all students, faculty, staff,
contractors, and other users of university systems, networks, and devices.
2. Protection Measures
The University adopts a multi-layered approach to cybersecurity, following the NIST Cybersecurity Framework
(CSF)’s five key functions: Identify, Protect, Detect, Respond, and Recover.
a. Identify
Asset Management: Maintain an inventory of all hardware, software, and devices in use. Prioritize systems
handling sensitive data for enhanced protection.
Risk Assessment: Regularly assess vulnerabilities across university systems to identify risks related to viruses and
spyware.
b. Protect
Antivirus and Anti-malware Software
1. Install and update antivirus/anti-malware software on all devices to detect and block malicious software.
2. Enable automatic updates and schedule regular scans to ensure real-time protection.
Software Updates and Patch Management
1. Keep operating systems, applications, and antivirus software updated to close security vulnerabilities.
2. Implement a patch management program to ensure timely deployment of security patches.
Email Security
1. Scan all incoming emails for viruses, malicious attachments, and links.
2. Use email filtering tools to detect phishing and educate users on how to recognize suspicious emails.
Secure Browsing and External Devices
1. Use browsers with security features like phishing filters, pop-up blockers, and HTTPS.
2. Scan external devices (USB drives, etc.) for malware before connecting to university systems.
2. Remind users regularly about safe browsing and file downloading practices.
c. Detect
Continuous Monitoring
1. Implement network and endpoint monitoring to detect signs of viruses and spyware.
2. Use intrusion detection systems (IDS) and automated tools to identify suspicious activities.
Log Management
1. Collect and review logs from devices, security tools, and network traffic to detect malware infections early.
Anomaly Detection
1. Identify unusual behavior, such as unauthorized data transfers or unexpected network activity, that may signal
an infection.
d. Respond
Incident Response Plan
1. Develop and maintain an incident response plan for virus and spyware outbreaks.
2. If an infection occurs, disconnect affected systems immediately to prevent further spread.
Containment and Remediation
Use antivirus and anti-malware tools to remove infections.
Restore systems from clean backups and ensure all traces of the infection are eradicated.
Communication
1. Notify affected users and departments promptly with instructions for remediation and protection.
2. Provide updates throughout the response process.
Post-Incident Analysis
1. Review the incident to understand the cause, evaluate the response, and update security measures as necessary.
e. Recover
Backup and Restoration
1. Regularly back up critical data and ensure secure storage for easy restoration after an infection.
2. Restore data and systems from backups to minimize disruptions and data loss.
Continuous Improvement
Aamna Abbas BEIS-05 (A)
1. After each incident, assess and enhance virus and spyware protection measures.
2. Update training materials, detection tools, and incident response plans based on lessons learned.