msgbartop
Those ashame days.
msgbarbottom

17 Apr 06 About Random Code – 随机验证码

这是今天突然间顿悟的,留下来当个纪念。
作了好多网站,也改过好多网站,对于防止程序提交问题上,总是习惯性的找一段生成随机验证码的程序把它最后的结果放在session里面,然后再session里面验证一下是否正确就算万事大吉。今天想想不禁汗颜。

对于这种code,要攻击太容易了。没有验证码就把东西都写到url上用get方式过去刷屏,像上面这样做的就先访问一次页面在session里留下验证码,下次就一直用同一个code就能刷屏了。更绝的,如果你感觉到会出问题,在验证逻辑里把session中的值清空了。那下次随便谁成功提交一次之后就可以用url大法刷你的版了。。

解决办法就是

验证之后,在session变量里面放一个随机值。

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.

Tags: ,


Leave a reply

;) :| :x :twisted: :) 8O :( :roll: :P :oops: :o :mrgreen: :lol: :idea: :D :evil: :cry: 8) :arrow: :? :?: :!: