0

There is XSS vulnerability in one of the JSP file, where we have used hidden fields. Thus following hidden fields are vulnerable to xss:

   <input type="hidden" name="input1" value="<%=dummyInputValue%>"/>
   <input type="hidden" name="input2" value="<%=dummyInputValue1%>"/>

where dummyInputValue comes from request object..something like below request.getParameter("dummyInputValue")

I am not sure how to fix this fields to avoid xss vulnerability. Kindly help me on this.

By accessing the following URL (example):

http://localhost:7001/app1/PeopleSearch.jsp?input1=%22%3e%3csCrIpT%3ealert(83676)%3c%2fsCrIpT%3e&input2=dummyValue1

Triggering the XSS requires alt+shift+x (windows) or ctrl+alt+x (max).

rocky
  • 753
  • 2
  • 10
  • 26

1 Answers1

0

I fixed the issue, after reading the comment given by Jozef. XSS is prevented in JSP by using JSTL tag. That is by changing the code as below

<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<input type="hidden" name="input1" value="<c:out value="${dummyInputValue}"/>"/>
rocky
  • 753
  • 2
  • 10
  • 26