Session Veracode CWE ID 259
session.setAttribute行中的以下代码中存在CWE ID 259缺陷Session Veracode CWE ID 259,session,credentials,veracode,Session,Credentials,Veracode,session.setAttribute行中的以下代码中存在CWE ID 259缺陷 public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); session.setAttribute("resetPassword", "Gets are
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
HttpSession session = req.getSession();
session.setAttribute("resetPassword", "Gets are not accepted.");
this.getServletContext().getRequestDispatcher("pwReset.jsp").forward(req, resp);
}
需要有关修复此问题的帮助。首先,您必须了解像VeraCode这样的代码分析工具可能会给出误报&您可能需要从安全团队获取一些标志的例外(并且可能不一定有代码修复) CWEID259是关于原始凭证信息的硬编码,比如代码中的密码&这是一种非常糟糕的编码实践 对于您的情况,
session.setAttribute(“resetPassword”,“get不被接受”)
,VeraCode如何知道您正在硬编码原始密码
很可能是因为您将属性命名为resetPassword
因此,黑客修复方法是将此属性名称更改为与wordpassword不相似,但即使在此修复之后,出于所有实际目的,漏洞仍然存在
永久的解决办法是在代码中硬编码/加密密码,或者从代码中移动硬编码密码&利用其他安全机制获取重置密码信息
请阅读潜在缓解措施部分,网址为-