逐浪cms SQL注入

技术文章 作者:MCbang 2014-06-15 03:17:20 阅读:130
地址

http://demo.zoomla.cn/Customer.aspx




源码如下

protected void Page_Load(object sender, EventArgs e)

{

if (base.Request.QueryString["type"] != null)

{

if (base.Request.QueryString["type"] == "Seat")

{

this.GetSeat();

}

if (base.Request.QueryString["type"] == "add")

{

this.SetInfo(base.Request.Form.ToString());

}

bool flag1 = base.Request.QueryString["type"] == "answer";

if ((base.Request.QueryString["type"] == "getservice") && (base.Request.QueryString["uid"] != null))

{

this.GetServerInfo(base.Request.QueryString["uid"].ToString(), base.Request.Cookies["Provisional"]["Uid"]); //跟进

}

if (base.Request.QueryString["type"] == "OnlineUsers")

{

this.GetOnlineUsers();

}

bool flag2 = base.Request.QueryString["type"] == "CallMe";

if (base.Request.QueryString["type"] == "msg")

{

this.GetMsg(); //跟进

}

this.DelUser();

}

}




private void GetMsg()

{

StringBuilder builder = new StringBuilder();

DataTable table = this.bcsbll.Select_Where(" CS_Type=0 and CS_OID=" + base.Request.Cookies["Provisional"]["Uid"], " DISTINCT CS_SendID,CS_SendName ", ""); //没处理存在注入

for (int i = 0; i < table.Rows.Count; i++)

{

builder.Append(string.Concat(new object[] { table.Rows[i]["CS_SendID"], ",", table.Rows[i]["CS_SendName"], ";" }));

}

string s = builder.ToString();

if (s.EndsWith(";"))

{

s = s.Substring(0, s.Length - 1);

}

base.Response.Write(s);

}




另一处

private void GetServerInfo(string uid, string sessid)

{

DataTable customerByUid = this.bcsbll.GetCustomerByUid(DataConverter.CLng(uid), sessid); //跟进

StringBuilder builder = new StringBuilder();

if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(sessid))

{

for (int i = 0; i < customerByUid.Rows.Count; i++)

{

if (((customerByUid.Rows[i]["CS_OID"] != null) && (sessid == customerByUid.Rows[i]["CS_OID"].ToString())) && (customerByUid.Rows[i]["CS_SendID"].ToString() == sessid))

{

builder.Append(string.Concat(new object[] { customerByUid.Rows[i]["CS_AddTime"], " 你对", customerByUid.Rows[i]["CS_CtoName"], "说:
  ", customerByUid.Rows[i]["CS_Context"], "
" }));

}

else

{

builder.Append(string.Concat(new object[] { customerByUid.Rows[i]["CS_AddTime"].ToString(), " ", customerByUid.Rows[i]["CS_SendName"], "对你说:
  ", customerByUid.Rows[i]["CS_Context"], "
" }));

}

}

}

base.Response.Write(builder.ToString());

}




public DataTable GetCustomerByUid(int id, string sessid)

{

string strSQL = "";

if (id > 0)

{

string str2 = strSQL;

strSQL = str2 + " (CS_SendID=" + id.ToString() + " or CS_Ctouid=" + id.ToString() + ")";

}

if (!string.IsNullOrEmpty(sessid))

{

strSQL = strSQL + " and CS_OID='" + sessid + "'"; //没处理存在注入

}

DataTable dt = this.SelectWhere(strSQL, " CS_ID,CS_Context,CS_SendName,CS_SendID,CS_CtoName,CS_AddTime,CS_OID ", " CS_AddTime asc");

this.updateType(dt, id, sessid);

return dt;

}




访问
http://demo.zoomla.cn/


添加cookie值




然后访问
http://demo.zoomla.cn/Customer.aspx?type=msg


或者访问

http://demo.zoomla.cn/Customer.aspx?type=getservice&uid=1


cookie构造如下





修复方案:

关注公众号:拾黑(shiheibook)了解更多

[广告]赞助链接:

关注数据与安全,洞悉企业级服务市场:http://www.ijiandao.com/
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/

图库
关注网络尖刀微信公众号
随时掌握互联网精彩
赞助链接