使用fortify 扫描出的HeaderManipulation的漏洞.

HTTP响应截断:数据包含在一个 HTTP 响应头文件里,未经验证就发送给了 Web 用户。

HTTP 响应头文件中包含未验证的数据会引发 cache-poisoning、cross-site scripting、cross-user defacement、page hijacking、cookie manipulation 或 open redirect。
使用fortify 扫描项目代码,报出Header Manipulation的漏洞,在网上找了很长时间,没有怎么具体的解决办法.
针对 Header Manipulation 的解决方法是,确保在适当位置进行输入验证并检验其属性是否正确。

简单一点就是过滤掉特殊字符.代码如下:在这里插入代码片


String regex = "[`~!@#$%^&*()\\+\\=\\{}|:\"?><【】\\/r\\/n]";

Pattern pa = Pattern.compile(regex);

Matcher ma = pa.matcher(filename);

if(ma.find()){

 filename = ma.replaceAll("").trim();

}

更多推荐

使用fortify 扫描出的HeaderManipulation的漏洞.