JAVA开发常见安全问题:缺少验证码功能
·
专栏链接
一、数据的校验
二、认证与授权
三、Cookie与会话管理
四、错误处理
五、日志安全
六、未验证的重定向
认证与授权:缺少验证码功能
漏洞描述:
对登录功能需要一些辅助的安全措施来防护攻击者进行暴力破解系统的帐号、密码。常见的比如在登录页面加入验证码功能。
不合规的代码示例:
<form name='f' action='/login/login.action' method='post'>
<table width="100 " border="0" cellspacing="0"
cellpadding="0">
<tr>
<th>用户名:</th>
<td><input type="text" name="textfield" value="" /></td>
</tr>
<tr>
<th width="100px;">密 码:</th>
<td><input type="password" name="password" value=""/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit2" value=" 登 录" /></td>
</tr>
</table>
</form>
合规的代码示例:
<form name='f' action='/login/login.action' method='post'>
<table width="100 " border="0" cellspacing="0" cellpadding="0">
<tr>
<th>用户名:</th>
<td><input type="text" name="textfield" value="" /></td>
</tr>
<tr>
<th width="100px;">密 码:</th>
<td><input type="password" name="password" value=""/></td>
</tr>
<th width="100px;">验证码:</th>
<td><input type="text" name="safecode" id="safecode" value=""/>
</td>
<tr>
<td> </td>
<td><input type="submit" name="Submit2" value=" 登 录" /></td>
</tr>
<img title="点击刷新验证码" alt="刷新" onmouseover="this.style.cursor='pointer'" id="imageCode" name="imageCode" src="/common/image.jsp" onclick="var s=Math.random();this.src='/common/image.jsp?l='+s;" width="90" height="40" />
</table>
</form>
更多推荐



所有评论(0)