php登录 无漏洞,AKCMS 6.0 /akcms/login.php 登录绕过漏洞

该漏洞的问题出现在login.php中,由于编码采用GBK,而对$post_username变量没有进行严格的过滤和转义,导致可以绕过SQL防护,实现注入,下面针对此漏洞进行详细分析。

首先在login.php中第4行

```

if(isset($post_loginsubmit)) {

if($editor = $db->get_by('*', 'admins', "editor='".$db->addslashes($post_username)."'")) {

if(ak_md5($post_password, 0, 2) == $editor['password']) {

if($editor['freeze'] == 1) adminmsg($lan['youarefreeze'], 'index.php', 3, 1);

if(!empty($post_rememberlogin)) {

setlogin($post_username, $thetime + 24 * 3600 * 365 * 10);

} else {

setlogin($post_username);

}

$target = 'index.php';

if(ifthemeuninstalled()) $target = 'index.php?file=theme&action=themeinstall';

adminmsg($lan['login_success'], $target);

} else {

adminmsg($lan['login_failed'], 'index.php?file=login', 3, 1);

}

```

在db->get_by方法中,采用addslashes($post_username)过滤,构造\的方法防止SQL注入,随后在if语句中,调用了common.ini.php中的setlogin函数。第174行

```

function setlogin($adminid, $expire = 0) {

global $dbpw, $dbname, $codekey;

if(!isset($dbpw)) $dbpw = '';

$verify = md5("$adminid|$dbpw|$dbname|$codekey");

aksetcookie('auth', "$adminid|$verify", $expire);

}

```

在post参数中,采用宽字节的方法,假设输入%BF%27,这时会对%27进行过滤,加上\就变成了%bf%5c%27,这样%bf%5c构成了一个宽字符,%27就会被单独解析,导致SQL注入

loading-bars.svg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值