Wednesday, September 28, 2022

Bandit23

Bandit23


 


bandit level23

ssh server: bandit.labs.overthewire.org port 2220

username: bandit23

password: QYw0Y2aiA672PsMmh9puTQuhoz8SyR2G




Its just like the last challenge we need to find the configuration of the cron job to trace it





This time the scrip 1st read the username in the variable myname of the user running it then enter into /var/spool/$myname/foo

Then scan all the files in the foo directory if the file is owned by bandit23 will run it, but if it wasn't owned by bandit23 will not run it but both ways will delete it.

So all what we need is to put a script in the foo directory, but its better to keep a backup of it, maybe we need to do changes to it. 



Create directory in /tmp into it create the script, which will read the bandit24 password and copy it to out temp directory.



We need to change the directory and the script permeations, to allow bandit24 to read and run the script, and write into the temp directory, also copy the script into the /var/spool/bandit24/fool directory



It's a cron job so all what we need is just wait and the job will run which will call the script into the foo directory and return back with the password




 this is the password for the next level bandit24

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Monday, September 26, 2022

Bandit22

 

Bandit22







bandit level22

ssh server: bandit.labs.overthewire.org port 2220

username: bandit22

password: WdDozAdTM2z9DiFEQ2mGlwngMfj4EZff



Its just like the last challenge we need to find the configuration of the cron job to trace it




Our target cron job is coronjob_bandit23, reading it revels the place of the script that runes


So we go to read the scrip from /usr/bin/cronjob_bandit23.sh



The script at the beginning creates a variable named "myname" and give it the value of the output of the whoami command, then creates another variable name it "mytarget" this variable value is coming from 1st echo "I am user (the value of myname variable)" then calculate the MD5 hash of this text finally cuts only the hash value from the output and submit the password of bandit23 into a file named with the MD5 value at the /tmp. This only happens if the user who running the script is bandit23 not any other user else the hash value would be different than expected and also it will only read the password of the user running the scrip not bandit23

But it is a cron job so its running based on time schedule using bandit23 username all what we need is to know the filename, this easily could be found by emulating the scrip function



This is the file name we only need to read this file



 this is the password for the next level bandit23

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Bandit21

 

Bandit21





bandit level21

ssh server: bandit.labs.overthewire.org port 2220

username: bandit21

password: NvEJF7oVjkddltPSrdKEFOllh9V1IBcq



A new type of challenges this time we are going to execute a cronjob script, 1st of all find the script related to our challenge



1st we read the job configuration under the /etc/cron.d



This configuration shows that it executes a script saved in /usr/bin/cronjob_bandit22.sh



The script reads the bandit22 password from /etc/bandit_pass/bandit22 and send it to a temp directory, so all what we need to read this temp directory



 this is the password for the next level bandit22

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Bandit20

 

Bandit20





bandit level20

ssh server: bandit.labs.overthewire.org port 2220

username: bandit20

password: NvEJF7oVjkddltPSrdKEFOllh9V1IBcq



Just like the last challenge we have a program into the home directory of our user when executing it, it tells us how to get the next level password



Here we need to select a port to connect the suconnect program to it, and on the other side we need to open another terminal and inetiat a listener on the same port this using nc command listener will send the password of bandit20 so that the sucnnect would verify it and reply with the pandit21 password





The listener is sending the password and waiting for the reply, on the other terminal the suconnect is checking that the password sent is matching what stored into it, so it sends the pandit21 in the nc terminal




 this is the password for the next level bandit21

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Bandit19

 

Bandit19




bandit level19

ssh server: bandit.labs.overthewire.org port 2220

username: bandit19

password: VxCazJaVykI6W36BkBU0mJTCM8rR95XT



This level is about running a program that will execute any command with the user ID of bandit20, 1st of all we will try to run the command without any arguments



So and based on this level discerption we need to read the password file which is saved in /etc/bandit_pass/bandit20.

This requires us to run the bandit20-do then tell it to read the file



 this is the password for the next level bandit20

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Monday, September 19, 2022

Bandit18

 

Bandit18





bandit level18

ssh server: bandit.labs.overthewire.org port 2220

username: bandit18

password: hga5tuuCLF6fFzUpnagiMN8ssu9LFrdg



oups it disconnects us 



If we reviewed the wording of the challenge we would find that "someone has modified .bashrc to log you out when you log in with SSH." so we need to request to read the contains of the readme file before we get kicked out of the server


 this is the password for the next level bandit19

tell we meet there


Your comments and feedback are highly appreciated

Thank You


Bandit17

 

Bandit17





bandit level17

ssh server: bandit.labs.overthewire.org port 2220

username: bandit17

password: we don't have a password but we have the private key


So now from the temp location we will ssh to our server using the private key, but before connecting with the private key we need to make it really private which mean if we ls the file now we will find it readable by any one on the server

So we need to change the permeations and access to the file restricting only the owner to the file


now we can connect using this key
$ ssh -i private_key bandit17@localhost -p 2220



And here we are, now we are logged as bandit17

the challenge this time asks us to find the only one line changed in the file password.old to be the password.new


To find the changed line we would use the command diff that finds the differences between two files

$ diff password.old password.new


 this is the password for the next level bandit18

tell we meet there


Your comments and feedback are highly appreciated

Thank You

Bandit26

  Bandit26 bandit level26 ssh server: bandit.labs.overthewire.org port 2220 username:  bandit26 password:  c7GvcKlw9mC7aUQaPx7nwFstuAIBw1o1 ...