日期:2014-05-16  浏览次数:21013 次

谁能帮我看看,这个程序为什么有“跨站请求伪造漏洞”
<!--#include file="user_check.asp"-->
<!--#include file="user_config.asp"-->
<!--#include file="../inc/md5.asp"-->
<%
if request.servervariables("REQUEST_METHOD")="POST" Then
dim msg
'写入新的信息
IF request.form("act")="do" then
IF request.form("p2")<>request.form("p3") THEN
msg="两次输入的密码不统一,请核实."
ElSE
dim p1:p1=conn.execute("SELECT [password] FROM [tb_user] WHERE id_user="&id_user)("password")
if p1<>md5(request.form("p1")) THEN
msg="校验密码错误,请输入正确的当前密码"
ELSE
conn.execute("UPDATE [tb_user] SET [password]='"&md5(request.form("p2"))&"' WHERE [id_user]="&id_user)
msg="您的密码已经更新,您下次登陆时,必须使用新的密码."
END if
End if
ELSE
msg="修改帐户密码."
End if
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta content="all" name="robots" />
<meta name="Copyright" content="版权由使用方,程序以及外观本人绝无备份" />
<meta name="description" content="南" />
<meta content="keywords" name="cim blog" />
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<title>个人信息管理</title>
<link rel="stylesheet" href="../../common/style.css" type="text/css" media="all"  />
</head>
<body>
<div id="wap">
<!--#include file="user_head.asp"-->

<div id="content">
<p class="title">修改帐户密码:</p>
<p class="at"><%=msg%></p>

 <div>
 <form action="psw.asp" method="post">
 <ul>
当前密码:<input type="password" name="p1"  /> <br />
更新密码:<input type="password" name="p2"  /> <br />
重复密码:<input type="password" name="p3"  /> <br />
<input type="hidden" name="act" value="do" />
 </ul>
<input type="submit" value="更新">
 </form>
 </div>
 
</div><!--content-->

<!--#include file="user_foot.asp"-->

</div><!--wap-->
</body>
</html>

------解决方案--------------------
没看出有什么问题,你的id_user从哪里搞来的,应该是session/cookie验证之类的吧。如果是get/post提交过来你的就有csrf漏洞了
------解决方案--------------------
是存在这个crsf,你的不是什么大站应该不会有人专门针对你的站来攻击吧。。

哪有那么巧登陆了你的站然后访问了设计攻击你站的网站,而且还填写了原始密码提交表单,如果碰到这种,可以考虑买彩票去了。。呵呵

你要提供安全性就搞个验证码什么的噶。。

你的什么软件提醒的,太nb了点吧。。
------解决方案--------------------
dim id_user:id_user=session("id_user")
dim p1:p1=conn.execute("SELECT [password] FROM [tb_user] WHERE id_user="&id_user)("password")
这就是判定 CSRF 的依据

CSRF攻击依赖下面的假定:
攻击者了解受害者所在的站点
攻击者的目标站点具有持久化授权cookie或者受害者具有当前会话cookie
目标站点