Juegos de Guerra "Bandit" Overthewire
Published on August 29, 2023 by Gmichet
LINUX BANDIT
14 min READ
Finalmente los últimos nivel de los juegos “Bandido” de la página OverTheWire
Skills | Enlace |
---|---|
Clonando repositorios de github | git clone |
Listando commits de github | git log -p |
Cambiendo de branch en github | git branch -r |
Listando etiquetas secretas de github | Resolviendo Nivel 30 |
Subir fichero en github | git push |
Spawneando una shell | $shell |
Hay un repositorio de git en ssh://bandit27-git@localhost/home/bandit27-git/repo. La contraseña para el usuario bandit27-git es la misma que para el usuario bandit27.
Clona el repositorio y encuentra la contraseña para el siguiente nivel.
Creamos un directorio temporal
bandit27@bandit:~$ mktemp -d
/tmp/tmp.5oNFeUkKUp
bandit27@bandit:~$ cd /tmp/tmp.5oNFeUkKUp
bandit27@bandit:/tmp/tmp.5oNFeUkKUp$ git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo
Cloning into 'repo'...
The authenticity of host '[localhost]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit27/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit27/.ssh/known_hosts).
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
bandit27-git@localhost's password:
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
bandit27@bandit:/tmp/tmp.5oNFeUkKUp$ ls
repo
bandit27@bandit:/tmp/tmp.5oNFeUkKUp$ cd repo/
bandit27@bandit:/tmp/tmp.5oNFeUkKUp/repo$ ls
README
bandit27@bandit:/tmp/tmp.5oNFeUkKUp/repo$ cat README
The password to the next level is: AVanL161y9rsbcJIsFHuw35rjaOM19nR
Hay un repositorio de git en ssh://bandit28-git@localhost/home/bandit28-git/repo. La contraseña para el usuario bandit28-git es la misma que para el usuario bandit28.
Clona el repositorio y encuentra la contraseña para el siguiente nivel.
Iniciamos:
ssh bandit28@bandit.labs.overthewire.org -p 2220
Creamos un directorio temporal, clonamos el repositorio, accedemos y listamos el “README.md”
bandit28@bandit:/tmp/tmp.dJfhVr6FMi/repo$ cat README.md
# Bandit Notes
Some notes for level29 of bandit.
## credentials
- username: bandit29
- password: xxxxxxxxxx
bandit28@bandit:/tmp/tmp.dJfhVr6FMi/repo$ git log -p
commit 899ba88df296331cc01f30d022c006775d467f28 (HEAD -> master, origin/master, origin/HEAD)
Author: Morla Porla <morla@overthewire.org>
Date: Sun Apr 23 18:04:39 2023 +0000
fix info leak
diff --git a/README.md b/README.md
index b302105..5c6457b 100644
--- a/README.md
+++ b/README.md
@@ -4,5 +4,5 @@ Some notes for level29 of bandit.
## credentials
- username: bandit29
-- password: tQKvmcwNYcFS6vmPHIUSI3ShmsrQZK8S
+- password: xxxxxxxxxx
commit abcff758fa6343a0d002a1c0add1ad8c71b88534
Author: Morla Porla <morla@overthewire.org>
Date: Sun Apr 23 18:04:39 2023 +0000
add missing data
diff --git a/README.md b/README.md
index 7ba2d2f..b302105 100644
--- a/README.md
+++ b/README.md
@@ -4,5 +4,5 @@ Some notes for level29 of bandit.
## credentials
- username: bandit29
-- password: <TBD>
+- password: tQKvmcwNYcFS6vmPHIUSI3ShmsrQZK8S
commit c0a8c3cf093fba65f4ee0e1fe2a530b799508c78
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:39 2023 +0000
initial commit of README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7ba2d2f
Hay un repositorio de git en ssh://bandit29-git@localhost/home/bandit29-git/repo. La contraseña para el usuario bandit29-git es la misma que para el usuario bandit29.
Clona el repositorio y encuentra la contraseña para el siguiente nivel.
Iniciamos:
ssh bandit29@bandit.labs.overthewire.org -p 2220
Lo mismo creamos un directorio temporal, clonamos el repositorio, accedemos y miramos el “README.md”:
bandit29@bandit:/tmp/tmp.EIeKaeHLPV/repo$ cat README.md
# Bandit Notes
Some notes for bandit30 of bandit.
## credentials
- username: bandit30
- password: <no passwords in production!>
bandit29@bandit:/tmp/tmp.EIeKaeHLPV/repo$ git log -p
commit 4bd5389f9f2b9e96ba517aa751ee58d051905761 (HEAD -> master, origin/master, origin/HEAD)
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:40 2023 +0000
fix username
diff --git a/README.md b/README.md
index 2da2f39..1af21d3 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,6 @@ Some notes for bandit30 of bandit.
## credentials
-- username: bandit29
+- username: bandit30
- password: <no passwords in production!>
commit 1a57cf10158f133c4f40ff82251f605a7618631d
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:40 2023 +0000
initial commit of README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2da2f39
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# Bandit Notes
+Some notes for bandit30 of bandit.
+
+## credentials
+
+- username: bandit29
+- password: <no passwords in production!>
+
Un branch (rama) es simplemente una línea de desarrollo separada, lo que significa que es una serie de commits que se han realizado en paralelo con respecto a otra serie de commits.
bandit29@bandit:/tmp/tmp.EIeKaeHLPV/repo$ git branch -r
origin/HEAD -> origin/master
origin/dev
origin/master
origin/sploits-dev
bandit29@bandit:/tmp/tmp.EIeKaeHLPV/repo$ git checkout dev
Branch 'dev' set up to track remote branch 'dev' from 'origin'.
Switched to a new branch 'dev'
bandit29@bandit:/tmp/tmp.EIeKaeHLPV/repo$ git log -p
commit 13e735685c73e5e396252074f2dca2e415fbcc98 (HEAD -> dev, origin/dev)
Author: Morla Porla <morla@overthewire.org>
Date: Sun Apr 23 18:04:40 2023 +0000
add data needed for development
diff --git a/README.md b/README.md
index 1af21d3..a4b1cf1 100644
--- a/README.md
+++ b/README.md
@@ -4,5 +4,5 @@ Some notes for bandit30 of bandit.
## credentials
- username: bandit30
-- password: <no passwords in production!>
+- password: xbhV3HpNGlTIdnjUrdAlPzc2L6y9EOnS
commit 8caf551dba9f9e39bc8ea4163de7902e6fa85f3a
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:40 2023 +0000
add gif2ascii
diff --git a/code/gif2ascii.py b/code/gif2ascii.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/code/gif2ascii.py
@@ -0,0 +1 @@
+
commit 4bd5389f9f2b9e96ba517aa751ee58d051905761 (origin/master, origin/HEAD, master)
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:40 2023 +0000
fix username
diff --git a/README.md b/README.md
index 2da2f39..1af21d3 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,6 @@ Some notes for bandit30 of bandit.
## credentials
- username: bandit30
-- password: <no passwords in production!>
+- password: xbhV3HpNGlTIdnjUrdAlPzc2L6y9EOnS
Hay un repositorio de git en ssh://bandit30-git@localhost/home/bandit30-git/repo. La contraseña para el usuario bandit30-git es la misma que para el usuario bandit30.
Clona el repositorio y encuentra la contraseña para el siguiente nivel.
Iniciamos:
ssh bandit30@bandit.labs.overthewire.org -p 2220
Nuevamente creamos un directorio temporal, clonamos el repositorio, accedemos y miramos el “README.md”:
bandit30@bandit:/tmp/tmp.ZDVDAm3Ol8/repo$ cat README.md
just an epmty file... muahaha
bandit30@bandit:/tmp/tmp.ZDVDAm3Ol8/repo$ git log -p
commit 59530d30d299ff2e3e9719c096ebf46a65cc1424 (HEAD -> master, origin/master, origin/HEAD)
Author: Ben Dover <noone@overthewire.org>
Date: Sun Apr 23 18:04:42 2023 +0000
initial commit of README.md
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..029ba42
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+just an epmty file... muahaha
bandit30@bandit:/tmp/tmp.ZDVDAm3Ol8/repo$ git branch -r
origin/HEAD -> origin/master
origin/master
tag
Las etiquetas son una forma útil de identificar y marcar los hitos importantes de un proyecto.
Miramos si hay etiquetas:
bandit30@bandit:/tmp/tmp.ZDVDAm3Ol8/repo$ git tag
secret
bandit30@bandit:/tmp/tmp.ZDVDAm3Ol8/repo$ git show secret
OoffzGDlzhAlerFJ2cAiz1D41JW1Mhmt
Hay un repositorio de git en ssh://bandit31-git@localhost/home/bandit31-git/repo. La contraseña para el usuario bandit31-git es la misma que para el usuario bandit31.
Clona el repositorio y encuentra la contraseña para el siguiente nivel.
Iniciamos:
ssh bandit31@bandit.labs.overthewire.org -p 2220
Una vez que ya tengas creado el directorio temporal y clonado el repositorio miramos el “README.md”:
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ cat README.md
This time your task is to push a file to the remote repository.
Details:
File name: key.txt
Content: 'May I come in?'
Branch: master
El objetivo es “enviar un fichero al repositorio remoto” y especifican los detalles de fichero.
Primero verificamos en que rama estamos, al parecer estamos en la rama master:
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git branch -r
origin/HEAD -> origin/master
origin/master
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ echo "May I come in?" > key.txt
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ ls
key.txt README.md
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git add key.txt
The following paths are ignored by one of your .gitignore files:
key.txt
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git add key.txt -f
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: key.txt
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git commit -m "Add key.txt"
[master cbc673d] Add key.txt
1 file changed, 1 insertion(+)
create mode 100644 key.txt
bandit31@bandit:/tmp/tmp.zlM5S7XaBA/repo$ git push origin master
The authenticity of host '[localhost]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit31/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit31/.ssh/known_hosts).
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
bandit31-git@localhost's password:
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 325 bytes | 325.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: ### Attempting to validate files... ####
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
remote: Well done! Here is the password for the next level:
remote: rmCBvG56y58BXzv98yZGdO7ATVL5dW8y
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
To ssh://localhost:2220/home/bandit31-git/repo
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://localhost:2220/home/bandit31-git/repo'
remote: Well done! Here is the password for the next level:
remote: rmCBvG56y58BXzv98yZGdO7ATVL5dW8y
Después de todo esto, es hora de otro escape. ¡Buena suerte!
Iniciamos:
ssh bandit32@bandit.labs.overthewire.org -p 2220
En este nivel cuando iniciamos ya estamos dentro del nivel pero ahora la minúsculas están a mayúsculas lo que hace dificil ver y listar las cosas:
WELCOME TO THE UPPERCASE SHELL
>> whoami
sh: 1: WHOAMI: Permission denied
>> $path
sh: 1: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: not found
>> $shell
WELCOME TO THE UPPERCASE SHELL
>> $0
$ ls
uppershell
$ cat /etc/bandit_pass/bandit33
odHo63fHiFqcWWJG9rLiLDtPm45KzUKy
Y por último llegamos al nivel final “bandit33”.
Iniciamos:
ssh bandit33@bandit.labs.overthewire.org -p 2220
Una vez dentro podemos listar y ver el contenido del archivo:
bandit33@bandit:~$ ls
README.txt
bandit33@bandit:~$ cat README.txt
Congratulations on solving the last level of this game!
At this moment, there are no more levels to play in this game. However, we are constantly working
on new levels and will most likely expand this game with more levels soon.
Keep an eye out for an announcement on our usual communication channels!
In the meantime, you could play some of our other wargames.
If you have an idea for an awesome new level, please let us know!