您的位置:首页 > 其它

关于溢出漏洞的真实例子(原创)

2007-03-31 16:12 375 查看
下面是一个小妖投票系统3.30中的一个漏洞:
当href到action=viewcolligate时执行下面的代码:

case "viewcolligate"'查看综合投票结果
id=request.querystring("id")
if not isnumeric(id) then
response.write "<script>alert('操作提示:对不起,没有找到您要查看的信息!');history.back();</script>"
response.end
end if
set rs=conn.execute("select * from hfweb_colligate where id="&id&"")
if not rs.eof then
%>
<%
ci=1
set rs1=conn.execute("select * from hfweb_vote where c_id="&rs("id")&"")
if not rs1.eof then
do while not rs1.eof
%>
<%
//注意:这里执行了一个SQL语句"select sum(item_count) as asum"
set rs3=conn.execute("select sum(item_count) as asum from hfweb_item where vote_id="&rs1("id")&"")
if not rs3.eof then
asum=rs3("asum")
end if
rs3.close
set rs3=nothing
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from hfweb_item where vote_id="&rs1("id")&"",conn,1,1
if not rs2.eof then
do while not rs2.eof
%>

//重点就在这里:这里显示了图片的长度随投票的数量变化而变化,单项投票数item_count/总投票数asum.
<td width="26%">
<%=rs2("item_title")%> </td>
<td width="46%"><img src='a.gif' border='0'><img src='b.gif' border='0' height='8' width='<%=(rs2("item_count")/asum)*300%>'><img src='c.gif' border='0'>
<font color='#A2A2A2'><%=rs2("item_count")%>票</font></td>
<td width="28%"><font color='#A2A2A2'><%
disbf=formatnumber((rs2("item_count")/asum)*100,2)
if disbf<0 then
response.write "0.00"
else
response.write disbf
end if%>%</font></td>
</tr>
<%
rs2.movenext
loop
end if
rs2.close
set rs2=nothing
%>
<%
ci=ci+1
rs1.movenext
loop
end if
rs1.close
set rs1=nothing
%>
<%
end if
rs.close
set rs=nothing
%>

这段代码执行后如果总投票数不为0那么将不会出现溢出,需要重点指出的是计算机会把任何数除以0看成无穷大.所以得到的结果可想而知了吧,如何改才能运行也不用我说了吧,如果有兴趣的朋友可以加我QQ45209737,一起探讨这方面的问题,呵呵.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: