🙄

Proving Grounds Practice Outdated

に公開

列挙

nmap
┌──(kali㉿kali)-[~/oscp/pg/outdated]
└─$ sudo nmap -sC -sV -A -O 192.168.150.232 -p22,80

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 c1:99:4b:95:22:25:ed:0f:85:20:d3:63:b4:48:bb:cf (RSA)
|   256 0f:44:8b:ad:ad:95:b8:22:6a:f0:36:ac:19:d0:0e:f3 (ECDSA)
|_  256 32:e1:2a:6c:cc:7c:e6:3e:23:f4:80:8d:33:ce:9b:3a (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Convert HTML to PDF Online
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose|router
Running: Linux 4.X|5.X, MikroTik RouterOS 7.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3
OS details: Linux 4.15 - 5.19, Linux 5.0 - 5.14, MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3)
Network Distance: 4 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

UDPのスキャンでは有効な情報は見つけられませんでした。

TCP/80


ブラウザでアクセスするとこのようなページが表示されます。
入力するとPDFに変換されるようです。

feroxbuster
┌──(kali㉿kali)-[~/oscp/pg/outdated]
└─$ feroxbuster -u http://192.168.180.232 -w /usr/share/seclists/Discovery/Web-Content/big.txt
                                                                                                                                                            
 ___  ___  __   __     __      __         __   ___
|__  |__  |__) |__) | /  `    /  \ \_/ | |  \ |__
|    |___ |  \ |  \ | \__,    \__/ / \ | |__/ |___
by Ben "epi" Risher 🤓                 ver: 2.11.0
───────────────────────────┬──────────────────────
 🎯  Target Url            │ http://192.168.180.232
 🚀  Threads               │ 50
 📖  Wordlist              │ /usr/share/seclists/Discovery/Web-Content/big.txt
 👌  Status Codes          │ All Status Codes!
 💥  Timeout (secs)        │ 7
 🦡  User-Agent            │ feroxbuster/2.11.0
 💉  Config File           │ /etc/feroxbuster/ferox-config.toml
 🔎  Extract Links         │ true
 🏁  HTTP methods          │ [GET]
 🔃  Recursion Depth       │ 4
 🎉  New Version Available │ https://github.com/epi052/feroxbuster/releases/latest
───────────────────────────┴──────────────────────
 🏁  Press [ENTER] to use the Scan Management Menu™
──────────────────────────────────────────────────
403      GET        9l       28w      280c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
404      GET        9l       31w      277c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
200      GET       33l       55w      856c http://192.168.180.232/index.php
200      GET       33l       55w      856c http://192.168.180.232/
301      GET        9l       28w      319c http://192.168.180.232/config => http://192.168.180.232/config/
200      GET        0l        0w        0c http://192.168.180.232/config/config.php
301      GET        9l       28w      319c http://192.168.180.232/vendor => http://192.168.180.232/vendor/
200      GET        0l        0w        0c http://192.168.180.232/vendor/autoload.php
200      GET       56l      104w     1825c http://192.168.180.232/vendor/composer/installed.json
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/autoload_static.php
200      GET       21l      168w     1070c http://192.168.180.232/vendor/composer/LICENSE
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/ClassLoader.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/autoload_real.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/autoload_psr4.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/platform_check.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/autoload_classmap.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/autoload_namespaces.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/installed.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/composer/InstalledVersions.php
200      GET      394l     1176w     9126c http://192.168.180.232/vendor/mpdf/mpdf/lang2fonts.css
200      GET       20l       50w      425c http://192.168.180.232/vendor/mpdf/mpdf/composer.json
500      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/config_script2lang.php
200      GET       83l      317w     2106c http://192.168.180.232/vendor/mpdf/mpdf/mpdf.css
500      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/config.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/config_lang2fonts.php
200      GET       92l      456w     4840c http://192.168.180.232/vendor/mpdf/mpdf/CREDITS.txt
200      GET        1l       15w      107c http://192.168.180.232/vendor/mpdf/mpdf/compress.php
500      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/config_fonts.php
200      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/graph.php
200      GET      130l      888w     5879c http://192.168.180.232/vendor/mpdf/mpdf/README.txt
200      GET       66l      148w     1143c http://192.168.180.232/vendor/mpdf/mpdf/progbar.css
500      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/config_fonts-distr-without-OTL.php
200      GET      340l     2968w    18009c http://192.168.180.232/vendor/mpdf/mpdf/LICENSE.txt
200      GET        0l        0w        0c http://192.168.180.232/vendor/mpdf/mpdf/mpdf.php
200      GET     3110l    20823w   144804c http://192.168.180.232/vendor/mpdf/mpdf/CHANGELOG.txt
[####################] - 44s    20530/20530   0s      found:33      errors:1      
[####################] - 43s    20479/20479   471/s   http://192.168.180.232/ 
[####################] - 0s     20479/20479   112522/s http://192.168.180.232/config/ => Directory listing (add --scan-dir-listings to scan)
[####################] - 1s     20479/20479   16449/s http://192.168.180.232/vendor/ => Directory listing (add --scan-dir-listings to scan)
[####################] - 0s     20479/20479   115701/s http://192.168.180.232/vendor/mpdf/ => Directory listing (add --scan-dir-listings to scan)
[####################] - 0s     20479/20479   76414/s http://192.168.180.232/vendor/composer/ => Directory listing (add --scan-dir-listings to scan)
[####################] - 1s     20479/20479   39998/s http://192.168.180.232/vendor/mpdf/mpdf/ => Directory listing (add --scan-dir-listings to scan)

CHANGE.LOGの中を見ると、mpdfのバージョンがわかります。

exploitを検索すると以下のような情報が見つかりました。
https://github.com/mpdf/mpdf/issues/356

上記のexploitを利用してユーザ「svc-account」が確認できます。
また、feroxbusterの結果にある「/config/config.php」を読み取ると「svc-account」のパスワードを得られます。

初期アクセス

上記のアカウント情報でSSHアクセスができます。

権限昇格

最初のnmapで自分は見つけられなかったTCP/10000が開いていることがわかります。
linpeasの結果などとあわせて、これがwebminであることがわかりました。

自分の環境では、kaliから10000ポートへのアクセスができなかったため、SSHポートフォワーディングをして接続しました。

sshポートフォワード
┌──(kali㉿kali)-[~/oscp/pg/outdated]
└─$ ssh -L 10000:localhost:10000 svc-account@192.168.180.232
svc-account@192.168.180.232's password: 

kaliの10000ポートにアクセスするとwebminのログイン画面が表示されました。
svc-accountの認証情報でログインできました。

webminはrootで実行されているため、root権限でのコマンド実行が可能です。
「Tools」-「Command Shell」より、root権限での操作が可能であり、proof.txtも取得できます。

Discussion