Heute geht es an die Lösung des Web Enumeration Raum von TryHackMe.

Task 1 Introduction

Frage 1:
Let’s get started

Antwort 1:
Keine Antwort benötigt.

Task 2 Manual Enumeration

Frage 1:
I gotcha!

Antwort 1:
Keine Antwort benötigt.

Task 3 1. Introduction to Gobuster

Frage 1:
No questions

Antwort 1:
Keine Antwort benötigt.

Task 4 1.1. Gobuster Modes

Frage 1:
I get the hang of it!

Antwort 1:
Keine Antwort benötigt.

Task 5 1.2. Useful Wordlists

Frage 1:
No questions

Antwort 1:
Keine Antwort benötigt.

Task 6 1.3. Practical: Gobuster (Deploy #1)

Zuerst müssen wir die Domain „webenum.thm“, zusammen mit der IP der Machine, unserer /echo/hosts Datei hinzufügen. Das geht so:

echo "MACHINE_IP webenum.thm" >> /etc/hosts

Das gilt auch für alle entdeckten Subdomains:

echo "MACHINE_IP mysubdomain.webenum.thm" >> /etc/hosts

Bekommt man hier den Fehler „zsh: permission denied: /etc/hosts“ öffnen wir die hosts-Datei einfach mit einem Editor und fügen ihr alles unter dem bisherigen Inhalt an:

sudo nano /etc/hosts

Frage 1:
Run a directory scan on the host. Other than the standard css, images and js directories, what other directories are available?

Wir starten nun einen Gobuster-Directory-Scan auf die Zielseite, um die Directorys zu finden:

gobuster dir -u webenum.thm -t 64 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

Antwort 1:
public,Changes,VIDEO

Frage 2:
Run a directory scan on the host. In the „C******“ directory, what file extensions exist?

Hierzu lassen wir wieder einen Directory-Scan laufen, allerdings suchen wir jetzt Dateiendungen. Hier geben wir mit der „-x“ Flag einige vor (html, conf, txt, js). Das Verzeichnis hat sich ebenfalls geändert:

gobuster dir -u webenum.thm/Changes -t 64 -x htm,conf,txt,js -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

Als Ergebnis erhalten wir folgende Ausgabe:

===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://webenum.thm/Changes
[+] Method:                  GET
[+] Threads:                 64
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.1.0
[+] Extensions:              html,js,conf,txt
[+] Timeout:                 10s
===============================================================
2022/06/25 14:30:59 Starting gobuster in directory enumeration mode
===============================================================
/changes.conf         (Status: 200) [Size: 24]
/bootstrap.js         (Status: 200) [Size: 151880]

Das führt uns zu folgender Antwort:

Antwort 2:
conf,js

Frage 3:
There’s a flag out there that can be found by directory scanning! Find it!

Wir probieren einfach alle gefundenen Directories in unserem Browser aus:
http://webenum.thm/public/
http://webenum.thm/Changes/
http://webenum.thm/VIDEO/

Und siehe da, im VIDEO Verzeichnis befindet sich die Datei flag.php mit der Lösung:

Antwort 3:
thm{n1c3_w0rk}

Frage 4:
There are some virtual hosts running on this server. What are they?

Hierzu benötigen wir diesmal einen vhost-Scan (SecLists müssen hierfür installiert sein):

gobuster vhost -u http://webenum.thm -t 64 -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt

Als Ergebnis erhalten wir folgende Ausgabe:

===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:          http://webenum.thm
[+] Method:       GET
[+] Threads:      64
[+] Wordlist:     /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt
[+] User Agent:   gobuster/3.1.0
[+] Timeout:      10s
===============================================================
2022/06/25 14:59:44 Starting gobuster in VHOST enumeration mode
===============================================================
Found: learning.webenum.thm (Status: 200) [Size: 13245]
Found: products.webenum.thm (Status: 200) [Size: 4941] 
                                                       
===============================================================
2022/06/25 14:59:52 Finished
===============================================================

Das führt uns zu folgender Antwort:

Antwort 4:
learning,products

Bevor wir weitermachen können, müssen wir unsere Subdomains in die hosts Datei eintragen (siehe Anfang von Task 6). Die hosts Datei sollte jetzt zusätzlich folgenden Inhalt haben:

HIER_DIE_IP_DEINER_MACHINE webenum.thm learning.webenum.thm products.webenum.thm

Frage 5:
There’s another flag to be found in one of the virtual hosts! Find it!

Da die Flags bei THM gewöhnlicherweise als .txt und .php Datei gespeichert wurden nehmen wir diese file-extensions mit in unsere neue Suche. Bei den neuen Subdomains fangen wir erfahrungsgemäß auch hinten an, also mit products.webenum.thm:

gobuster dir -u products.webenum.thm -x txt,php -t 64  -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

Und hier auch schon unser Ergebnis:

===============================================================
Gobuster v3.1.0
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://products.webenum.thm
[+] Method:                  GET
[+] Threads:                 64
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.1.0
[+] Extensions:              txt,php
[+] Timeout:                 10s
===============================================================
2022/06/25 15:09:37 Starting gobuster in directory enumeration mode
===============================================================
/css                  (Status: 301) [Size: 326] [--> http://products.webenum.thm/css/]
/js                   (Status: 301) [Size: 325] [--> http://products.webenum.thm/js/] 
/flag.txt             (Status: 200) [Size: 21]  

Noch eben http://products.webenum.thm/flag.txt in den Browser eingegeben und wir haben unsere Antwort:

Antwort 5:
thm{gobuster_is_fun}

Task 7 2. Introduction to WPScan

Und weiter geht es mit WPScan, einem Word Press Scanner.

Frage 1:
Let’s explore WPScan!

Antwort 1:
Keine Antwort benötigt.

Task 8 2.1. WPScan Modes

Frage 1:
What would be the full URL for the theme „twentynineteen“ installed on the WordPress site: „http://cmnatics.playground“

Antwort 1:
http://cmnatics.playground/wp-content/themes/twentynineteen/

Frage 2:
What argument would we provide to enumerate a WordPress site?

Antwort 2:
enumerate

Frage 3:
What is the name of the other aggressiveness profile that we can use in our WPScan command?

Antwort 3:
passive

Task 9 2.2. Practical: WPScan (Deploy #2)

Bevor wir loslegen können müssen wir unserer hosts-Datei wieder etwas hinzufügen:

HIER_DIE_IP_DEINER_MACHINE wpscan.thm

Für eine genaue Anleitung, siehe Anfang von Task 6.

Frage 1:
Enumerate the site, what is the name of the theme that is detected as running?

Für Themes nehmen wir die t-Flag für –enumerate:

wpscan --url wpscan.thm --enumerate t

Antwort 1:
twentynineteen

Frage 2:
WPScan says that this theme is out of date, what does it suggest is the number of the latest version?

Antwort 2:
2.3

Frage 3:
Enumerate the site, what is the name of the plugin that WPScan has found?

Für Plugins nehmen wir diesmal die p-FLag:

wpscan --url wpscan.thm --enumerate p

Antwort 3:
nextgen-gallery

Frage 4:
Enumerate the site, what username can WPScan find?

Und zu guter Letzt u-Flag für Usernames:

wpscan --url wpscan.thm --enumerate u

Antwort 4:
Phreakazoid

Frage 5:
Construct a WPScan command to brute-force the site with this username, using the rockyou wordlist as the password list. What is the password to this user? 

Hier benötigen wir die rockyou-Passwortliste, diese kommt bereits vorinstalliert mit Kali und befindet sich im /usr/share/wordlists/ Verzeichnis. Eventuell muss die Liste noch entpackt werden( sudo gzip -d /usr/share/wordlists/rockyou.txt.gz ).

wpscan --url wpscan.thm --passwords /usr/share/wordlists/rockyou.txt --usernames Phreakazoid

Antwort 5:
linkinpark

Task 10 3. Introduction to Nikto

Frage 1:
Let’s dive into the world of Nikto

Antwort 1:
Keine Antwort benötigt.

Task 11 3.1. Nikto Modes

Frage 1:
What argument would we use if we wanted to scan port 80 and 8080 on a host?

Antwort 1:
-p 80,8080

Frage 2:
What argument would we use if we wanted to see any cookies given by the web server? 

Antwort 2:
-Display 2

Task 12 3.2. Nikto Practical (Deploy #3)

Kurzer Funfact am Rande: Auf der Maschine läuft ein Blog über Früstückscerealien, einfach die IP der Machine im Browser eingeben 🙂


Frage 1:
What is the name & version of the web server that  Nikto has determined running on port 80?

nikto -h DIE_IP_DEINER_MACHINE -p 80

Als Ergebnis erhalten wir:

└─$ nikto -h DIE_IP_DEINER_MACHINE -p 80
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          DIE_IP_DEINER_MACHINE
+ Target Hostname:    DIE_IP_DEINER_MACHINE
+ Target Port:        80
+ Start Time:         2022-06-26 18:03:53 (GMT2)
---------------------------------------------------------------------------
+ Server: Apache/2.4.7 (Ubuntu)
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Multiple index files found: /index.xml, /index.html
+ Apache/2.4.7 appears to be outdated (current is at least Apache/2.4.37). Apache 2.2.34 is the EOL for the 2.x branch.
+ Server may leak inodes via ETags, header found with file /, inode: 40e0, size: 5a0311fe9980a, mtime: gzip
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS 
+ OSVDB-3092: /sitemap.xml: This gives a nice listing of the site content.
+ OSVDB-3268: /css/: Directory indexing found.
+ OSVDB-3092: /css/: This might be interesting...
+ OSVDB-3268: /images/: Directory indexing found.
+ OSVDB-3233: /icons/README: Apache default file found.
+ 7889 requests: 0 error(s) and 12 item(s) reported on remote host
+ End Time:           2022-06-26 18:11:42 (GMT2) (469 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

Antwort 1:
Apache/2.4.7

Frage 2:
There is another web server running on another port. What is the name & version of this web server?

Hierzu führen wir einen nmap scan aus, um zu sehen wo noch ein web server läuft:

nmap DIE_IP_DEINER_MACHINE

Als Ergebnis erhalten wir folgendes:

└─$ nmap DIE_IP_DEINER_MACHINE         
Starting Nmap 7.92 ( https://nmap.org ) at 2022-06-26 18:18 CEST
Nmap scan report for DIE_IP_DEINER_MACHINE
Host is up (0.047s latency).
Not shown: 989 closed tcp ports (conn-refused)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
1090/tcp open  ff-fms
1091/tcp open  ff-sm
1098/tcp open  rmiactivation
1099/tcp open  rmiregistry
4446/tcp open  n1-fwp
5500/tcp open  hotline
8009/tcp open  ajp13
8080/tcp open  http-proxy
8083/tcp open  us-srv

Nmap done: 1 IP address (1 host up) scanned in 0.84 seconds

Auf Port 8080 läuft noch ein anderer web server „http-proxy“.

Scannen wir diesen Port nun mit nikto:

nikto -h DIE_IP_DEINER_MACHINE -p 8080

Als Ergebnis erhalten wir:

└─$ nikto -h DIE_IP_DEINER_MACHINE -p 8080
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          DIE_IP_DEINER_MACHINE
+ Target Hostname:    DIE_IP_DEINER_MACHINE
+ Target Port:        8080
+ Start Time:         2022-06-26 18:23:33 (GMT2)
---------------------------------------------------------------------------
+ Server: Apache-Coyote/1.1
+ Retrieved x-powered-by header: Servlet/3.0; JBossAS-6
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ OSVDB-39272: /favicon.ico file identifies this app/server as: JBoss Server
+ Allowed HTTP Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS 
+ OSVDB-397: HTTP method ('Allow' Header): 'PUT' method could allow clients to save files on the web server.
+ OSVDB-5646: HTTP method ('Allow' Header): 'DELETE' may allow clients to remove files on the web server.
+ Cookie JSESSIONID created without the httponly flag
+ 7893 requests: 0 error(s) and 9 item(s) reported on remote host
+ End Time:           2022-06-26 18:31:18 (GMT2) (465 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

Antwort 2:
Apache-Coyote/1.1

Frage 3:
What is the name of the Cookie that this JBoss server gives?

Die Antwort erhalten wir ebenfalls durch den obrigen Scan:

Antwort 3:
JSESSIONID

Task 13 4. Conclusion

Frage 1:
I’ll check these out!!

Antwort 1:
Keine Antwort benötigt.