很多时候,在JSP中我们喜欢用EL表达式输出信息,但是最近发现这个确实存在个问题:XSS即跨域攻击。

下面看个例子:

  <c:out value="${student.name}" />  和 ${student.name}都能输出同样的结果。

  但是有跨域攻击时student.name = <script>alert("hello world!")</script>,${student.name}将会执行,而c:out则不会。

原因:c:out 有个缺省属性escapeXML="true" 将会对特色字符如 '<' '>' '&' 等进行转义,而EL表达式则不会。

相关文章:

  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2021-09-06
  • 2021-05-24
  • 2021-07-31
相关资源
相似解决方案