如何解决留言本漏洞问题

NetFire 2002-11-19 09:08:36
首先我问一下,session可不可以伪装??我的理解,是不能伪装的

另外帮忙看看http://el.swpi.edu.cn/gb的留言本有什么漏洞

我每页都验证了session的值,为什么还有人得到我的管理员密码?注:我的密码复杂程度绝对很高,超过20位的数字、字母+特殊符号
...全文
74 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
NetFire 2002-11-19
  • 打赏
  • 举报
回复
我前面已经验证了阿
littleyy 2002-11-19
  • 打赏
  • 举报
回复
老大 set rs=conn.Execute("select * from user where suid='"&gUID&"' and spwd='"&gPWD&"'")
你怎么还这么用?
NetFire 2002-11-19
  • 打赏
  • 举报
回复
改进后的做法,大家看看有没有错

<%
dim gUID,gPWD,conn,rs,iserror
iserror=0

set conn = Server.CreateObject("adodb.connection")
conn.Open connstr
set rs = Server.CreateObject("adodb.recordset")


gUID=GetForm("adminNick","str","")
gPWD=GetForm("adminPass","str","")
if gUID<>"" and gPWD<>"" then
if instr(gUID,"'")>0 or instr(gUID,";")>0 then
iserror=1
%>
<script language=VBS>
msgbox ("想黑我?要找对地方!我是龌龊,你也比我好不到什么地方去,你不用跳板,我告死你")
location.href = "hacker.asp"
</script>
<%
exit function
end if
if instr(gPWD,"'")>0 or instr(gPWD,";")>0 then
iserror=1
%>
<script language=VBS>
msgbox ("想黑我?要找对地方!我是龌龊,你也比我好不到什么地方去,你不用跳板,我告死你")
location.href = "hacker.asp"
</script>
<%
exit function
end if
set rs=conn.Execute("select * from user where suid='"&gUID&"' and spwd='"&gPWD&"'")
if rs.EOF then
iserror=1
%>
<script language=VBS>
msgbox ("用户名密码错误,请重新登陆")
location.href = "login.asp"
</script>
<%
else
session("admin")=true
end if
rs.CLOSE
set rs=nothing
if iserror=0 and getForm("bottom","str","")="进入" then
conn.close
set conn=nothing
Response.Redirect "index.asp"
end if
end if
%>
genuis 2002-11-19
  • 打赏
  • 举报
回复
我得做法
select password from [user] where username='"&username&"'"

if rs("password")=password and password=rs("password") then

end if
littleyy 2002-11-19
  • 打赏
  • 举报
回复
你验证密码的sql是不是"...where username='"name"' and password='"password"'"
????
这样写有漏洞,请用where username=name
然后把取出的密码和输入的比较
NetFire 2002-11-19
  • 打赏
  • 举报
回复
怎么处理单引号?
Reker熊 2002-11-19
  • 打赏
  • 举报
回复
对了,你处理了单引号吗?

比如密码输入: sd'or'1'='1

—————————————————————————————————
想要游泳的“猪”
Reker熊 2002-11-19
  • 打赏
  • 举报
回复
找不到服务器?

—————————————————————————————————
想要游泳的“猪”
NetFire 2002-11-19
  • 打赏
  • 举报
回复
谢谢各位,我已经解决了,但是不知道该把分数给谁,大家都有份帮忙的阿?:(
pjchuqi 2002-11-19
  • 打赏
  • 举报
回复
for i=1 to len(name)
us=mid(name,i,1)
if us="'" or us="%" or us="<" or us=">" or us="&" then
%>
<SCRIPT LANGUAGE=javascript>
window.alert("请输入正确用户名!");
history.go(-1)
</SCRIPT>
<%
response.end
end if
next
按这种方式处理一下特殊符号试试!
Reker熊 2002-11-19
  • 打赏
  • 举报
回复
更简单一点,屏蔽单引号,如果输入单引号就提示重新输入或者直接将一个单引号替换成为两个单引号

—————————————————————————————————
想要游泳的“猪”
NetFire 2002-11-19
  • 打赏
  • 举报
回复
我按照你说的做,老是出错,我的代码——

<%
dim adminNick, adminPass, Nick, Pass
adminNick = request("adminNick")
adminPass = request("adminPass")

dim conn
set conn = Server.CreateObject("adodb.connection")
conn.Open connstr

dim adminRs,adminSql
set adminRs = Server.CreateObject("adodb.recordset")
adminSql = "select adminPass from admin where adminNick = '" & adminNick & "' "
'Response.Write adminSql
adminRs.Open adminSql,conn

if adminRs("adminPass") <> adminPass and adminPass <> adminRs("adminPass") then

%>
<script language=VBS>
msgbox ("用户名或密码错误,请重新登陆")
location.href = "login.asp"
</script>
<%
else

session("admin") = true
Response.Redirect "index.asp"
%>
<%
end if
%>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧