侵入テストチームから、以下の URL が XSS 攻撃を引き起こしていると言われました -
これがdownload_msg.jspの私のコードです
<% String download_msg = null;
if (session == null || session.getAttribute("user") == null) {
download_msg = "Error message";
} else {
download_msg =
(OLSUser)session.getAttribute("user")).getReportInfo().getDownloadMsg();
}
%>
<html>
<head>
<SCRIPT LANGUAGE='JavaScript' SRC='/Test/test.js'></SCRIPT>
<SCRIPT LANGUAGE='JavaScript'>init('StmsReps');</SCRIPT>
<script language="JavaScript">
function redirect() {
if (window.focus)
self.focus();
this.location = "/test/DownloadReport?<%=request.getQueryString()%>";
}
</script>
<title>XSS</title>
</head>
<body marginwidth='0' marginheight='0' onload='javascript:redirect()'>
<table width='90%' height='100%' align='center' border='0' cellspacing='0'
cellpadding='0'>
<tr>
<td align='center' class='header2'> <%= download_msg %></td>
</tr>
</table>
</body>
</html>
jstl は XSS 攻撃を処理できることがわかりました。以下のことを行った場合、それで問題ないでしょうか、それとも何か他のことをする必要がありますか?
<c:out value="<%= download_msg %>" escapeXml="true"/>