3 minutes
Bandit 31
OverTheWire
Bandit 31
Bienvenido al nivel 31 de Bandit en OverTheWire
Al iniciar este nivel se nos indica la exisitencia de un repositorio ubicado en ssh://bandit31-git@bandit.labs.overthewire.org/home/bandit31-git/repo a traves del puerto 2220. La contraseña para el usuario bandit31-git es la misma que para bandit29 y la contraseña para el siguiente nivel esta almacenada en el repositorio de git.
Herramientas:
git
Lo primero será bajar el repositorio:
git clone ssh://bandit31-git@bandit.labs.overthewire.org:2220/home/bandit31-git/repo
Nos dejará un fichero llamado repo, accedemos y hacemos ls -la para ver su interior.
Tiene un archivo README, lo leemos y veremos lo siguiente:
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
Nos indican que creemos un archivo llamado key.txt y que lo subamos al repositorio, con el contenido “May I come in?” y a la rama master.
Vamos a ello:
echo 'May I come in?' > key.txt && ls
key.txt README.md
Vale, ahora vamos a subirlo a la rama. Primero hacemos el commit y luego subimos.
git commit key.txt -m "Subir clave"
Devuelve error: pathspec 'key.txt' did not match any file(s) known to git, git no reconoce este fichero, esto esta causado porque el repositorio tienen un archivo oculto llamado “.gitignore” que tiene *.txt.
Este fichero se utiliza para indicar a git que documentos no utilizar. Podemos eliminarlo o agregar el archivo de manera forzada (git add -f key.txt). Creo que la existencia de .gitignore es importante por lo que modificaré *.txt por *.sh. Ahora vamos a agregar el archivo y con el commit de nuevo.
git add key.txt
git commit key.txt -m "Subir clave"
git commit key.txt -m "Subir clave"
[master 8589496] Subir clave
Committer: bandit31-git <kali@DESKTOP-ALO0DNC.localdomain>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 1 insertion(+)
create mode 100644 key.txt
Esta comiteado, vamos a subirlo.
git push origin master
Nos pedirá la contraseña y nos dará la contraseña del siguiente nivel.
git push origin master
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
backend: gibson-1
bandit31-git@bandit.labs.overthewire.org's password:
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 24 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 344 bytes | 344.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 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: pWuj5jBQ6IgVXXXXXXXXXXXXXXXXXX
remote:
remote: .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.
remote:
To ssh://bandit.labs.overthewire.org:2220/home/bandit31-git/repo
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://bandit.labs.overthewire.org:2220/home/bandit31-git/repo'
¡Vamos al siguiente nivel con esta contraseña!
Enlaces de Interes