https://tryhackme.com/room/netsecchallenge

Task 1 Introduction

Keine Fragen in diesem Task.

Task 2 Challenge Questions

Frage 1:
What is the highest port number being open less than 10,000?

Hier müssen wir den Port Filter von 1 bis 10.000 setzen, da nmap ansonsten nur die bekanntesten 1.000 Ports scannt:

└─$ nmap 10.10.186.199 -p 1-10000    
Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-13 19:15 CEST
Nmap scan report for 10.10.186.199
Host is up (0.058s latency).
Not shown: 9995 closed tcp ports (conn-refused)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
139/tcp  open  netbios-ssn
445/tcp  open  microsoft-ds
8080/tcp open  http-proxy

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

Antwort 1:
8080

Frage 2:
There is an open port outside the common 1000 ports; it is above 10,000. What is it?

Hier müssen wir den Bereich über 10.000 definieren:

└─$ nmap 10.10.186.199 -p 10000-65000
Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-13 19:17 CEST
Nmap scan report for 10.10.186.199
Host is up (0.058s latency).
Not shown: 55000 closed tcp ports (conn-refused)
PORT      STATE SERVICE
10021/tcp open  unknown

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

Antwort 2:
10021

Frage 3:
How many TCP ports are open?

Das können wir aus unseren beiden Scans herauslesen.

Antwort 3:
6

Frage 4:
What is the flag hidden in the HTTP server header?

Hier müssen wir uns mit telnet und der Machine verbinden:

└─$ telnet 10.10.186.199 80
Trying 10.10.186.199...
Connected to 10.10.186.199.
Escape character is '^]'.
GET /index.html HTML/1.1
host: telnet

HTTP/1.0 400 Bad Request
Content-Type: text/html
Content-Length: 345
Connection: close
Date: Thu, 13 Oct 2022 17:20:39 GMT
Server: lighttpd THM{web_server_25352}

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>400 Bad Request</title>
 </head>
 <body>
  <h1>400 Bad Request</h1>
 </body>
</html>
Connection closed by foreign host.

Antwort 4:
THM{web_server_25352}

Frage 4:
What is the flag hidden in the HTTP server header?

Auch hier verbinden wir uns wieder via Telnet:

└─$ telnet 10.10.186.199 22
Trying 10.10.186.199...
Connected to 10.10.186.199.
Escape character is '^]'.
SSH-2.0-OpenSSH_8.2p1 THM{946219583339}

Antwort 4:
THM{946219583339}

Frage 5:
We have an FTP server listening on a nonstandard port. What is the version of the FTP server?

Der nicht-standard-Port ist wohl 10021, auch wenn unser Scan das nicht direkt erkannt hat. Verbinden wir uns via FTP mit diesem Port:

└─$ ftp 10.10.186.199 10021
Connected to 10.10.186.199.
220 (vsFTPd 3.0.3)

Antwort 5:
vsFTPd 3.0.3

Frage 6:
We learned two usernames using social engineering: eddie and quinn. What is the flag hidden in one of these two account files and accessible via FTP?

Hier benutzen wir wieder Hydra und unsere rockyou.txt Wordlist. Wir müssen hier beide Accounts testen, um den Zugang zu erhalten. Fangen wir mit quinn an (oftmals ist es der letzte angegebene Account). Nicht vergessen, wir müssen den speziellen Port mit angeben:

└─$ hydra -l quinn -P /usr/share/seclists/Passwords/Leaked-Databases/rockyou.txt 10.10.186.199 ftp -s 10021
Hydra v9.3 (c) 2022 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-10-13 19:30:55
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344398 login tries (l:1/p:14344398), ~896525 tries per task
[DATA] attacking ftp://10.10.186.199:10021/
[10021][ftp] host: 10.10.186.199   login: quinn   password: andrea
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2022-10-13 19:31:07

Nun können wir uns via FTP verbinden:

└─$ ftp quinn@10.10.186.199 10021
Connected to 10.10.186.199.
220 (vsFTPd 3.0.3)
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||30833|)
150 Here comes the directory listing.
-rw-rw-r--    1 1002     1002           18 Sep 20  2021 ftp_flag.txt
226 Directory send OK.
ftp> get ftp_flag.txt
local: ftp_flag.txt remote: ftp_flag.txt
229 Entering Extended Passive Mode (|||30798|)
150 Opening BINARY mode data connection for ftp_flag.txt (18 bytes).
100% |********************************************************************************************************************|    18        4.65 KiB/s    00:00 ETA
226 Transfer complete.
18 bytes received in 00:00 (0.25 KiB/s)
ftp> 

Nachdem wir die Datei heruntergeladen haben müssen wir sie öffnen und erhalten die Flag.

Antwort 6:
THM{321452667098}

Frage 7:
Browsing to http://10.10.186.199:8080 displays a small challenge that will give you a flag once you solve it. What is the flag?

Mit einem Null-Scan (-sN) haben wir wahrscheinlich die besten Chancen nicht entdeckt zu werden. Ein Null-Scan benutzt keine TCP flag header:

└─$ sudo nmap -sN 10.10.186.199
Starting Nmap 7.93 ( https://nmap.org ) at 2022-10-13 19:37 CEST
Nmap scan report for 10.10.186.199
Host is up (0.056s latency).
Not shown: 995 closed tcp ports (reset)
PORT     STATE         SERVICE
22/tcp   open|filtered ssh
80/tcp   open|filtered http
139/tcp  open|filtered netbios-ssn
445/tcp  open|filtered microsoft-ds
8080/tcp open|filtered http-proxy

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

Es hat geklappt und wir erhalten die Flag:

Antwort 7:
THM{f7443f99}

Task 3 Summary

Keine Fragen in diesem Task.