Niveau 20

Niveau 20

Level Goal

To gain access to the next level, you should use the setuid binary in the homedirectory. Execute it without arguments to find out how to use it. The password for this level can be found in the usual place (/etc/bandit_pass), after you have used the setuid binary.

Helpful Reading Material

setuid on Wikipedia

Les choses commencent à devenir intéressantes à partir de ce niveau : la résolution de problème se rapproche plus de la recherche d'exploit que de l'accumulation de commande Linux.

Une fois connecté en tant que bandit19 on peut exécuter le binaire présent :

bandit19@bandit:~$ ls -la
total 28
drwxr-xr-x  2 root     root     4096 May  7  2020 .
drwxr-xr-x 41 root     root     4096 May  7  2020 ..
-rwsr-x---  1 bandit20 bandit19 7296 May  7  2020 bandit20-do
-rw-r--r--  1 root     root      220 May 15  2017 .bash_logout
-rw-r--r--  1 root     root     3526 May 15  2017 .bashrc
-rw-r--r--  1 root     root      675 May 15  2017 .profile
bandit19@bandit:~$ ./bandit20-do
Run a command as another user.
  Example: ./bandit20-do id

On note que le fichier peut être exécuté par bandit19 avec les droits de bandit20. On sait également que le mot de passe qui nous intéresse se situe dans le fichier /etc/bandit_pass/bandit20. Il nous suffit donc d'exécuter :

bandit19@bandit:~$ ./bandit20-do cat /etc/bandit_pass/bandit20
GbKksEFF4yrVs6il55v6gwY5aVje5f0j