How to fix Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) with error message?

后端 未结 5 1959
野趣味
野趣味 2020-12-10 19:29

We use web control adapter in our login page. Recently we run VeraCode on our web application. In following function, we got CWE80, Improper Neutralization of Script-Related

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 19:53

    A function call contains an HTTP response splitting flaw. Writing unsanitized user-supplied input into an HTTP header allows an attacker to manipulate the HTTP response rendered by the browser, leading to cache poisoning and crosssite scripting attacks.

    Issue Code

    strMessage=CLASSCONSTANTNAME+className+MESSAGENAME+message; LOGGER.info(strMessage);

    Fixed Code

    strMessage=CLASSCONSTANTNAME+className+MESSAGENAME+message; LOGGER.info(ESAPI.encoder().encodeForHTML(strMessage));

    moredetail

提交回复
热议问题