FinitHicDeo1 - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

nmap
curl
nikto
gobuster
nc
wget

Inhaltsverzeichnis

Reconnaissance

In diesem Abschnitt führen wir die ersten Schritte der Aufklärung durch, um Informationen über das Zielsystem zu sammeln. Dies ist entscheidend, um potenzielle Angriffsvektoren zu identifizieren.

┌──(root㉿CCat)-[~]
└─# ARP-Scan
192.168.2.116 08:00:27:b1:e6:85 PCS Systemtechnik GmbH

Der ARP-Scan zeigt die IP-Adresse und die MAC-Adresse des Zielsystems. Die Angabe "PCS Systemtechnik GmbH" deutet auf den Hersteller der Netzwerkkarte hin.

┌──(root㉿CCat)-[~]
└─# /etc/hosts
192.168.2.116 FinitHicDeo1.vln

Die /etc/hosts-Datei ordnet die IP-Adresse dem Hostnamen "FinitHicDeo1.vln" zu. Dies ermöglicht die Verwendung des Hostnamens anstelle der IP-Adresse.

┌──(root㉿CCat)-[~]
└─# nmap -sS -sC -sV -A -p- $IP -Pn --min-rate 5000 | grep open
80/tcp open http Gunicorn 20.0.1 3000/tcp open ppp?

Dieser Nmap-Befehl sucht nach offenen Ports und filtert die Ausgabe nach Zeilen, die "open" enthalten. Die Ergebnisse zeigen, dass die Ports 80 (HTTP) und 3000 offen sind.

┌──(root㉿CCat)-[~]
└─# nmap -sS -sC -sV -A -p- $IP -Pn --min-rate 5000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-10-09 21:01 CEST
Nmap scan report for FinitHicDeo1.vln (192.168.2.116)
Host is up (0.00014s latency).
Not shown: 65533 closed tcp ports (reset)
PORT     STATE SERVICE VERSION
80/tcp   open  http    Gunicorn 20.0.1
|_http-title: Site doesn't have a title (text/html; charset=utf-8).
|_http-server-header: gunicorn/20.0.1
3000/tcp open  ppp?
| fingerprint-strings: 
|   GenericLines, NULL:  
|     -->>Welcome to this Amazing Game!!!!
|     ->It is an old code-breaking mind game. Flag is hidden in this format : "flag{carp3_d13m_8462}"
|     ->Reference: https://en.wikipedia.org/wiki/Bulls_and_Cows
|     Users have to guess a flag value. For every character that the user guessed correctly in the correct place, they have a 
|     bulls
|     every character, the user guessed correctly in the wrong place is a 
|     cows
|     every guess, you will see how many 
|     cows
|     bulls
|_    have. nce the user guesses the
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.8
Network Distance: 1 hop

Nmap führt einen umfassenden Scan des Zielsystems durch.

  • -sS: TCP-SYN-Scan (Stealth Scan)
  • -sC: Führt Standard-Skripte zur Erkennung von Diensten aus.
  • -sV: Erkennt die Version der laufenden Dienste.
  • -A: Aktiviert aggressive Scan-Optionen (OS-Erkennung, Versionserkennung, Skriptausführung, Traceroute).
  • -p-: Scannt alle 65535 Ports.
  • $IP: Variable für die Ziel-IP-Adresse.
  • -Pn: Verhindert Ping-Anfragen, behandelt alle Hosts als "up".
  • --min-rate 5000: Sendet Pakete mit einer minimalen Rate von 5000 pro Sekunde.
Die Ergebnisse zeigen, dass Port 80 (HTTP) offen ist und ein Gunicorn-Webserver läuft. Port 3000 scheint ein Spiel zu sein, bei dem man einen Code knacken muss (Bulls and Cows).

HTTP-Header Verbose mit Port-Scan
Port gefunden! 80

* Host FinitHicDeo1.vln:80 was resolved.
* IPv6: (none)
* IPv4: 192.168.2.116
*   Trying 192.168.2.116:80...
* Connected to FinitHicDeo1.vln (192.168.2.116) port 80
> HEAD / HTTP/1.1
> Host: FinitHicDeo1.vln
> User-Agent: curl/8.9.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Server: gunicorn/20.0.1
< Date: Wed, 09 Oct 2024 19:04:50 GMT
< Connection: keep-alive
< Content-Length: 3798
< Content-Type: text/html; charset=utf-8
< Last-Modified: Tue, 08 Dec 2020 18:22:15 GMT
< Cache-Control: public, max-age=43200
< Expires: Thu, 10 Oct 2024 07:04:50 GMT
< ETag: "1607451735.0458326-3798-1942948137"
< 

* Connection #0 to host FinitHicDeo1.vln left intact

Dieser Abschnitt zeigt die HTTP-Header, die vom Server zurückgegeben werden, wenn eine HEAD-Anfrage an die Root-URL gesendet wird. Die wichtigen Informationen sind:

  • Server: gunicorn/20.0.1: Der Server ist Gunicorn.
  • Content-Type: text/html; charset=utf-8: Der Inhalt ist HTML.
  • ETag: "1607451735.0458326-3798-1942948137": Der ETag-Header könnte zur Inode-Leakage ausgenutzt werden (CVE-2003-1418).

Web Enumeration

In diesem Abschnitt untersuchen wir die Webanwendung genauer, um versteckte Dateien, Verzeichnisse und potenzielle Schwachstellen aufzudecken.

┌──(root㉿CCat)-[~]
└─# Nikto v2.5.0
+ Target IP:          192.168.2.116
+ Target Hostname:    192.168.2.116
+ Target Port:        80
+ Start Time:         2024-10-09 21:04:49 (GMT2)

+ Server: gunicorn/20.0.1
+ /: Server may leak inodes via ETags, header found with file /, inode: 1607451735.0458326, size: 3798, mtime: 1942948137. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418
+ /: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
+ /: 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. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ : Server banner changed from 'gunicorn/20.0.1' to 'mitmproxy 5.3.0'.
+ OPTIONS: Allowed HTTP Methods: GET, HEAD, OPTIONS .
    + /#wp-config.php#: #wp-config.php# file found. This file contains the database credentials.
+ 8117 requests: 0 error(s) and 6 item(s) reported on remote host
+ End Time:           2024-10-09 21:16:19 (GMT2) (690 seconds)

+ 1 host(s) tested

Nikto ist ein Webserver-Scanner, der auf Schwachstellen und Konfigurationsfehler prüft.

  • Der Server könnte Inodes über ETags leaken (CVE-2003-1418).
  • Es wurden fehlende HTTP-Header (X-Frame-Options, X-Content-Type-Options) festgestellt, die potenzielle Sicherheitsrisiken darstellen.
  • Die Datei /#wp-config.php# wurde gefunden, die möglicherweise Datenbank-Zugangsdaten enthält.

┌──(root㉿CCat)-[~]
└─# gobuster dir -u "http://$IP" -w "/usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt" -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,svg,pem,crt,json,conf,ELF,elf,c,java,lib,cgi,csh,config,deb,desc,exp,eps,diff,icon,mod,ln,old,rpm,js.map,pHtml -b '503,404,403' -e --no-error -k
http://192.168.2.116/static/home.html (Status: 200) [Size: 3798]

Gobuster ist ein Tool zum Auffinden von versteckten Verzeichnissen und Dateien auf einem Webserver. Es wurde die Datei /static/home.html gefunden.

Initial Access

In diesem Abschnitt versuchen wir, uns initialen Zugriff auf das System zu verschaffen.

┌──(root㉿CCat)-[~]
└─# nc -vv 192.168.2.116 3000
FinitHicDeo1.vln [192.168.2.116] 3000 (?) open

  ____                 ___     ____        _ _    ____                      
 / ___|_____      __  ( _ )   | __ ) _   _| | |  / ___| __ _ _ __ ___   ___ 
| |   / _ \ \ /\ / /  / _ \/\ |  _ \| | | | | | | |  _ / _` | '_ ` _ \ / _ \ 
| |__| (_) \ V  V /  | (_>  < | |_) | |_| | | | | |_| | (_| | | | | | |  __/ 
 \____\___/ \_/\_/    \___/\/ |____/ \__,_|_|_|  \____|\__,_|_| |_| |_|\___|

-->>Welcome to this Amazing Game!!!!
->It is an old code-breaking mind game. Flag is hidden in this format : "flag{carp3_d13m_8462}"
->Reference: https://en.wikipedia.org/wiki/Bulls_and_Cows

Users have to guess a flag value. For every character that the user guessed correctly in the correct place, they have a “bulls”. For every character, the user guessed correctly in the wrong place is a “cows”. For every guess, you will see how many “cows” and “bulls” you have. nce the user guesses the correct number, the game is over. However, to simplify this, you can send the same character in one string.

Example:
$ If flag is: acc3p7_y0ur531f
INPUT: 83_aws0m3_n_gud
UTPUT: { User: 83_aws0m3_n_gud || Cow:8 && Bull:0 }
INPUT: acc3p7_y0ur531f
UTPUT: { User: acc3p7_y0ur531f || Cow:0 && Bull:15 }

character in flag: a-z, _, 0-9

commands:
You can see your input logs by :  logs
You can quit the game by       :  exit

Note: Just Play Games at least. ;)

Eine Verbindung zu Port 3000 mit nc zeigt, dass es sich um ein "Bulls and Cows"-Spiel handelt.

┌──(root㉿CCat)-[~]
└─# wget http://192.168.2.116/static/bg.mp3
--2024-10-09 21:43:37--  http://192.168.2.116/static/bg.mp3
Verbindungsaufbau zu 192.168.2.116:80 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 5990227 (5,7M) [audio/mpeg]
Wird in bg.mp3 gespeichert.

bg.mp3                  100%[=>]   5,71M  --.-KB/s    in 0,08s   

2024-10-09 21:43:37 (73,3 MB/s) - bg.mp3 gespeichert [5990227/5990227]

Wir laden die Datei bg.mp3 von der URL http://192.168.2.116/static/bg.mp3 herunter.

TAGMonster In The Field
FesliyanStudios.com ASCAP IPI FesliyanStudios.com ASCAP IPI 2018FesliyanStudios.com ASCAP IP

Dies scheint eine Information über die Musikdatei zu sein, die heruntergeladen wurde.

http://192.168.2.116/static
404 Page Not Found !!!

Der Zugriff auf das Verzeichnis /static führt zu einem 404-Fehler.

$ Hint:
Hey, there are two challenges for you, one at port 80 and another is at port 3000.

# Challenge 1:
The main server is running on port 8080 and we used Gunicorn to redirect the traffic at port 80.
You need to get the flag from the "/flag" page by exploiting the vulnerability.

# Challenge 2:
Visit 3000 port via nc and pass the coding challenge. :)

$ Troubleshooting:
If you face any error just reboot machine. ;)

Dieser Hinweis gibt uns zwei Herausforderungen:

  • Eine Schwachstelle auf Port 80 ausnutzen, um die Flag von der "/flag"-Seite zu erhalten.
  • Das "Bulls and Cows"-Spiel auf Port 3000 lösen.

http://192.168.2.116/flag
albinowax

Der Zugriff auf die "/flag"-Seite gibt den Benutzernamen "albinowax" zurück.

Flags

Flag guess lenght Should be 15
user.txt albinowax
root.txt flag{carp3_d13m_8462}