Results 1 to 2 of 2

Thread: Spring EL injection and XSS concerns

  1. #1
    Join Date
    Apr 2012
    Posts
    4

    Default Spring EL injection and XSS concerns

    All,

    Is the following susceptible to XSS attacks?

    Code:
    <spring:message code="some.message.with.args" arguments="${userInput}"/>
    Assuming that ${userInput} comes directly from the user or from the query string.

    For example, if my URL is as follows: www.mysite.com/q=<script>alert('xss')</script>

    and I do this in my JSP :

    Code:
    <spring:message code="some.message.with.args" arguments="${param.q}"/>
    Is this a XSS vulnerability (i.e., will the script tags be interpreted by the browser)? I believe the answer to be yes.

    Furthermore, I am under the impression that to protect against this, one would do the following:
    Code:
    <spring:message code="some.message.with.args" arguments="${fn:escapeXml(param.q)}"/>
    Does this sound correct?
    Last edited by eeiswerth; Apr 26th, 2012 at 12:08 PM.

  2. #2
    Join Date
    Dec 2008
    Location
    New York City
    Posts
    135

    Default

    http://forum.springsource.org/showth...site-scripting

    Imo, this should be better documented since it's generally a best practice.

    Note, there's some other bad stuff that can happen with spring el (and similar apis) documented at http://www.springsource.com/security/cve-2011-2730

    -Andy
    Andrew Thompson - Linked In

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •