您当前的位置: 首页 >  安全

AppScan安全漏洞说明及解决方案

发布时间:2019-10-01 21:39:48 ,浏览量:0

阅读文本大概需要5分钟。

0x01:会话cookie中缺少HttpOnly属性

解决方案:向所有会话cookie 添加HttpOnly属性 ,可以在过滤器中统一添加。

HttpServletResponse resp = (HttpServletResponse)response;  
//httponly是微软对cookie做的扩展,该值指定 Cookie 是否可通过客户端脚本访问,   
//解决用户的cookie可能被盗用的问题,减少跨站脚本攻击  
resp .setHeader( "Set-Cookie", "name=value; HttpOnly");  

0x02:跨站点请求伪造

解决方案:识别恶意请求,并有效拒绝这些恶意请求。例如在过滤器统一拦截跨站请求,并直接返回。

HttpServletRequest req = (HttpServletRequest)request;
String referer = req .getHeader("Referer");   //REFRESH  
if(referer!=null && referer.indexOf(basePath)<0){
     req .getRequestDispatcher(req .getRequestURI()).forward(request, response);  
}   

0x03:允许浏览器记住密码,可能导致密码信息泄露(Autocomplete HTML Attribute Not Disabled for Password Field )

解决方案:在密码输入框(type="password")设置为不自动填充

密  码:  

0x04:HTML 注释敏感信息泄露

解决方案:删除注释信息。这个漏洞对于那些解析型语言也需要注意,像PHP。

0x05:允许SSL页面使用缓存,可能导致敏感数据泄露(Cacheable SSL Page Found)

解决方案:SSL页面禁用缓存


			

0x06:跨站点脚本编制、SQL 盲注

解决方案:过滤掉用户输入中的危险字符 ,使用统一拦截器,过滤用户脚本数据。

private String filterDangerString(String value) {  
        if (value == null) {  
            return null;  
        }  
        value = value.replaceAll("\\|", "");  
        value = value.replaceAll("&", "&");    
        value = value.replaceAll(";", "");    
        value = value.replaceAll("@", "");    
        value = value.replaceAll("'", "");   
        value = value.replaceAll("\"", "");   
        value = value.replaceAll("\\'", "");  
        value = value.replaceAll("\\\"", "");  
        value = value.replaceAll("<", "<");  
        value = value.replaceAll(">", ">");  
        value = value.replaceAll("\\(", "");   
        value = value.replaceAll("\\)", "");    
        value = value.replaceAll("\\+", "");    
        value = value.replaceAll("\r", "");    
        value = value.replaceAll("\n", "");    
        value = value.replaceAll("script", "");           
        value = value.replaceAll("%27", "");  
        value = value.replaceAll("%22", "");  
        value = value.replaceAll("%3E", "");  
        value = value.replaceAll("%3C", "");  
        value = value.replaceAll("%3D", "");  
        value = value.replaceAll("%2F", "");  
        return value;  
    }  

0x07:会话标识未更新

解决方案:始终生成新的会话,供用户成功认证时登录;防止用户操纵会话标识。请勿接受用户浏览器登录时所提供的会话标识。

在登录验证成功之后调用下面方法

@SuppressWarnings("unchecked")
private void createNewSession(HttpServletRequest request, HttpServletResponse response) throws Exception {
        HttpSession oldSession = request.getSession();
        // get the content of old session.
        Enumeration attributeNames = oldSession.getAttributeNames();
        Map attributeMap = new HashMap();
        while(attributeNames != null && attributeNames.hasMoreElements()){
            String attributeName = attributeNames.nextElement();
            attributeMap.put(attributeName, oldSession.getAttribute(attributeName));
        }
        oldSession.invalidate();
        HttpSession newSession = request.getSession(true);
        // put the content into the new session.
        for (String key : attributeMap.keySet()) {
            newSession.setAttribute(key, attributeMap.get(key));
        }
    }

0x08:使用了Get方式传参,可能导致数据泄露(Query Parameter in SSL Request)

解决方案:尽量使用post方式传参

0x09:不充分账户封锁

解决方案:通过配置用户锁定不能登录,主要就是在登陆接口控制用户的恶意登陆。例如,如果用户输错密码多少次,就锁定用户。

0x10:登录错误消息凭证枚举

解决方案:每次登录失败的错误信息都一样,比如用户名或者密码错误,通过这样的提示进行处理解决即可;不需要明确告诉用户到时是用户名错误还是密码错误。

往期精彩

01 漫谈发版哪些事,好课程推荐

02 Linux的常用最危险的命令

03 精讲Spring Boot—入门+进阶+实例

04 优秀的Java程序员必须了解的GC哪些

05 互联网支付系统整体架构详解

关注我

每天进步一点点

很干!在看吗?☟

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    111451博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0507s