shopxp pinglun.asp文件SQL注入漏洞分析

博主推荐【腾讯云】爆款2核2G云服务器首年40元

漏洞存在于/admin/pinglun.asp 文件

<!--#include file="xp.asp"-->
<html><head><title><%=webname%>--用户评论</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../img_shopxp/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" bgcolor="#D9E6FF">
<%dim shopxpptid,action
pinglunid=request.QueryString("id")
action=request.QueryString("action")
if action="save" then
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shopxp_pinglun where pinglunid="&pinglunid,conn,1,3
rs("huifu")=HTMLEncode2(trim(request("huifu")))
rs("huifudate")=now()
rs.update
rs.close
set rs=nothing

…………………/*省略*/…………………..
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shopxp_pinglun where pinglunid="&pinglunid,conn,1,3
%>

首先看到 引用了xp.asp文件,

 <!--#include file="database_name.asp" -->
<%
dim conn,connstr,db
startime=timer()
db="../shopxp/"&dataname&"" '数据库
on error resume next '尝试连数据库,一直到超时,但可以加强SQL注入过滤
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'connstr="DBQ="+server.mappath(""&db&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>

这个文件的作用是获取数据库连接对象,继续回到/admin/pinglun.asp 文件,

pinglunid=request.QueryString("id")
action=request.QueryString("action")

获取id的值赋给pinglunid,跟进pinglunid,走到

<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shopxp_pinglun where pinglunid="&pinglunid,conn,1,3
%>

可以看到没有过滤就被带入到数据库,接下来在下面打印出了查询结果,导致一个SQL漏洞注入产生。

漏洞作者:zpino

原创文章转载请注明:转载自 七行者博客

本文固定链接: https://www.qxzxp.com/4280.html

shopxp pinglun.asp文件SQL注入漏洞分析:目前有1 条留言

  1. 0楼
    康孝希:

    哪个呦,发这么好的文章,顶你

    2016-01-09 19:18 [回复]

发表评论

9 + 7 =

快捷键:Ctrl+Enter