当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2015-092941

漏洞标题:LebiShop商城系统最新版十一处SQL注入六

相关厂商:www.lebi.cn

漏洞作者: xfkxfk

提交时间:2015-01-23 15:34

修复时间:2015-04-23 15:36

公开时间:2015-04-23 15:36

漏洞类型:SQL注射漏洞

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2015-01-23: 细节已通知厂商并且等待厂商处理中
2015-01-26: 厂商已经确认,细节仅向厂商公开
2015-01-29: 细节向第三方安全合作伙伴开放
2015-03-22: 细节向核心白帽子及相关领域专家公开
2015-04-01: 细节向普通白帽子公开
2015-04-11: 细节向实习白帽子公开
2015-04-23: 细节向公众公开

简要描述:

LebiShop商城系统最新版十一处SQL注入六

详细说明:

LebiShop商城系统最新版十一处SQL注入
这里也是需要有商家账号权限
首先注册普通用户账户,然后申请注册商家账户
申请商家用户是默认开发注册的
Shop.Supplier.Ajax.ajax_config文件
第一处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void Bank_Del()
{
if (!base.Power("supplier_bank_list", "收款账号"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("Fid");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_Supplier_Bank.Delete(string.Concat(new object[]
{
"id in (",
id,//注入产生
") and Supplier_id = ",
this.CurrentSupplier.id
}));
Log.Add("删除收款账号", "Bank", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第二处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void BillType_Del()
{
if (!base.Power("supplier_billtype_list", "发票管理"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("Fid");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_Supplier_BillType.Delete(string.Concat(new object[]
{
"id in (",
id,//注入产生
") and Supplier_id = ",
this.CurrentSupplier.id
}));
Log.Add("删除发票类型", "BillType", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第三处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void indeximage_Del()
{
if (!EX_Admin.Power("indeximage_del", "删除店铺幻灯"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("ids");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_Page.Delete(string.Concat(new object[]
{
"id in (",
id,//注入产生
") and Supplier_id=",
this.CurrentSupplier.id
}));
Log.Add("删除店铺幻灯", "Page", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第四处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void Message_Del()
{
if (!base.Power("supplier_message", "站内信"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("ids");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_Message.Delete(string.Concat(new object[]
{
"Supplier_id=",
this.CurrentSupplier.id,
" and id in (",
id,//注入产生
")"
}));
Log.Add("删除站内信", "Message", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第五处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void ServicePanel_Del()
{
if (!base.Power("supplier_servicepanel_list", "客服面板"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("ids");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_ServicePanel.Delete(string.Concat(new object[]
{
"Supplier_id = ",
this.CurrentSupplier.id,
" and id in (",
id,//注入产生
")"
}));
Log.Add("删除客服成员", "ServicePanel", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第六处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void ServicePanel_Group_Del()
{
if (!base.Power("supplier_servicepanel_list", "客服面板"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("ids");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_ServicePanel_Group.Delete(string.Concat(new object[]
{
"Supplier_id = ",
this.CurrentSupplier.id,
" and id in (",
id,//注入产生
")"
}));
Log.Add("删除客服部门", "ServicePanel_Group", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第七处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void ServicePanel_Group_Update()
{
if (!base.Power("supplier_servicepanel_list", "客服面板"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("Uid");
List<Lebi_ServicePanel_Group> models = B_Lebi_ServicePanel_Group.GetList(string.Concat(new object[]
{
"Supplier_id = ",
this.CurrentSupplier.id,
" and id in (",
id,//注入产生
")"
}), "");
foreach (Lebi_ServicePanel_Group model in models)
{
model.Sort = RequestTool.RequestInt("Sort" + model.id, 0);
model.Name = RequestTool.RequestString("Name" + model.id);
B_Lebi_ServicePanel_Group.Update(model);
}
Log.Add("编辑客服部门", "ServicePanel_Group", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第八处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void ServicePanel_Update()
{
if (!base.Power("supplier_servicepanel_list", "客服面板"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("Uid");
List<Lebi_ServicePanel> models = B_Lebi_ServicePanel.GetList(string.Concat(new object[]
{
"Supplier_id = ",
this.CurrentSupplier.id,
" and id in (",
id,//注入产生
")"
}), "");
foreach (Lebi_ServicePanel model in models)
{
model.Sort = RequestTool.RequestInt("Sort" + model.id, 0);
model.Name = RequestTool.RequestString("Name" + model.id);
model.Account = RequestTool.RequestString("Account" + model.id);
B_Lebi_ServicePanel.Update(model);
}
Log.Add("编辑客服成员", "ServicePanel", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第九处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void Transport_Price_Del()
{
if (!base.Power("supplier_transport_list", "配送方式"))
{
base.AjaxNoPower();
return;
}
string id = RequestTool.RequestString("Fid");
if (id == "")
{
base.Response.Write("{\"msg\":\"" + base.Tag("请选择要删除的信息") + "\"}");
return;
}
B_Lebi_Transport_Price.Delete(string.Concat(new object[]
{
"id in (",
id,//注入产生
") and Supplier_id = ",
this.CurrentSupplier.id
}));
Log.Add("删除配送区域", "Transport_Price", id.ToString(), this.CurrentSupplier, id.ToString());
base.Response.Write("{\"msg\":\"OK\"}");
}


第十处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void Transport_Price_Edit()
{
......
else
{
string aids = RequestTool.RequestString("Area_ids");
if (aids == "")
{
aids = "0";
}
List<Lebi_Area> areas = B_Lebi_Area.GetList("id in (" + aids + ")", "");


参数aids在GetList方法中的in条件语句中产生注入
第十一处SQL注入

// Shop.Supplier.Ajax.ajax_config
public void Transport_Price_Update()
{
if (!base.Power("supplier_transport_list", "配送方式"))
{
base.AjaxNoPower();
return;
}
int tid = RequestTool.RequestInt("tid", 0);
string id = RequestTool.RequestString("Uid");
Lebi_Transport tmodel = B_Lebi_Transport.GetModel(tid);
List<Lebi_Transport_Price> models = B_Lebi_Transport_Price.GetList(string.Concat(new object[]
{
"id in (",
id,//注入产生
") and Transport_id=",
tid,
" and Supplier_id = ",
this.CurrentSupplier.id
}), "");
foreach (Lebi_Transport_Price model in models)
{
model.Price = RequestTool.GetFormDecimal("Price" + model.id, 0m);
model.Weight_Start = RequestTool.GetFormDecimal("Weight_Start" + model.id, 0m);
model.Weight_Step = RequestTool.GetFormDecimal("Weight_Step" + model.id, 0m);
model.Price_Step = RequestTool.GetFormDecimal("Price_Step" + model.id, 0m);
B_Lebi_Transport_Price.Update(model);
}
Log.Add("编辑配送区域", "Transport_Price", id.ToString(), this.CurrentSupplier, tmodel.Name);
base.Response.Write("{\"msg\":\"OK\"}");
}


上述SQL注入都是在通过RequestTool.RequestString方法获取参数值
这里只是进行了单引号的转义
然后参数值进入了数据库执行的in条件SQL语句
在in条件语句中没有单引号保护,导致RequestTool.RequestString的处理无效
导致恶意sql语句进入sql条件语句中,最终导致SQL注入产生

漏洞证明:

以第一处sql注入为例
官方demo演示
报出当前数据库信息

http://plus.demo.lebi.cn/supplier/ajax/ajax_config.aspx?__Action=Bank_Del&url=/
Fid=db_name()


1.png


使用SQLmap即可跑出数据

修复方案:

使用RequestTool.RequestInt获取参数,或者给变量加上单引号

版权声明:转载请注明来源 xfkxfk@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:20

确认时间:2015-01-26 15:11

厂商回复:

已统一修复SQL漏洞,感谢

最新状态:

暂无