Files
ctf/2019/mitre/cleanroom.md
T

59 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Clean room
---
(50 Linux) The year is 30xx. Clyde is trapped in an interdimensional transport
module. The Federation has captured the module and has prepared to dock. The
captain of the Federation lander has instructed the henchmen to bring Clyde in
to Federation custody. As a precaution they will place Clyde in a clean room to
remove any radiation. Luckily, youve hacked into the landers mainframe. Help
Clyde escape!
---
```sh
ssh ctf@138.247.13.108
```
## Desarrollo
Al ingresar al servidor se intentó listar los contenidos del directorio actual,
pero se obtuvo un error:
```sh
-rbash: ls: command not found
```
Revisando la variable `$PATH` se encontró que `/home/ctf/bin` era el único
directorio donde `bash` buscaría binarios, así que se revisaron los
contenidos del directorio `/home/ctf/bin` usando `echo /home/ctf/bin/*`, el
directorio contenía una copia del comando `tee`.
Primero se intentó sobreescribir el valor de `$PATH` sin éxito (variable de
sólo lectura), se procedio intentar sobreescribir el valor de `$PATH` usando
`tee`:
```sh
echo "export PATH='/usr/bin:/bin:/usr/local/bin'" | tee .profile ; bash
```
Esto no devolvía error alguno, sin embargo no funcionó.
Después de listar los contenidos de algunos directorios (con `tee`), se
intentó ejecutar una `bash` desde los argumentos de `ssh`, lo cual resultó
exitoso, ya que no se leyeron las configuraciones del archivo `.profile`, el
cual definía `$PATH`. Finalmete se buscó el archivo con la flag, empezando
desde la raíz.
```sh
ssh ctf@138.247.13.108 bash
find / -iname *flag* 2> /dev/null
```
Dentro de `/root` se encontró el archivo con la flag.
```
MCA{ieHaisoh4eif2ae}
```