mcms可CSRF后台getshell

- AV AC AU C I A
发布: 2025-04-13
修订: 2025-04-13

### 简要描述: mcms后台某功能getshell,再加上后台没有验证token,所以可以通过csrf直接拿shell ### 详细说明: 先说说后台getshell吧。 后台文件auth.php是设置授权码的地方,我们看其中有一个函数: ``` function m__set_auth() { check_level("A0501"); $config ='../core/config.php'; $cf = file_get_contents($config); $code = isset($_POST['auth']) && !empty($_POST['auth'])?$_POST['auth']:''; if (AUTH_CODE != $_POST['auth']) { set_config('AUTH_CODE', $code, $cf); file_put_contents($config, $cf); } die('{"code":"0","msg":"成功设置授权码"}'); } ``` 验证权限后,获得$_POST[auth],如果与现有的AUTH_CODE不相等,就把$_POST[auth]写进去。我们再来到set_config函数,看是怎么写的: ``` function set_config($name, $value, &$file) { if (!isset($value)) $value = ''; if (preg_match('~"' . $name . '"~', $file)) { $file = preg_replace('~define\("' . $name . '"\s*,\s*"(.*)"\)\s*;~i', 'define("' . $name . '", "' . $value . '");', $file, 1); } else { $file .= chr(13) . chr(10) . 'define("' . $name . '","' . $value . '");'; } } ``` 我们看到,这里设置define里用的是双引号,这样就有了任意代码执行的条件。 比如我们写{${phpinfo()}}试试: [<img...

0%
暂无可用Exp或PoC
当前有0条受影响产品信息