【问题标题】:How do I fix cwe-80 xss in jsp?如何在 jsp 中修复 cwe-80 xss?
【发布时间】:2019-10-02 18:48:27
【问题描述】:
<% 
String ans = ""; 
ans = SpecialCharacter.getEscapeString((String)request.getAttribute("ans"));
%>

<input type="text" class="txt long" name="ans" id="ans" maxlength="48" value="${ans}"/>

我有类似上面的代码,并且我已经使用模板文字来替换值,但 veracode 扫描仍然显示它存在 xss 漏洞。在这种情况下我该如何解决?

【问题讨论】:

标签: java jsp xss


【解决方案1】:

使用OWASP Java Encoder使用&lt;input type="text" class="txt long" name="ans" id="ans" maxlength="48" value="&lt;%= Encode.forHtmlAttribute(ans)%&gt;" /&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-05
    • 1970-01-01
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多