Unified EL is a feature of JSP 2.1 it is a union of JSP 2.0 and JSF expression languages. Expressions enclosed in ${…} are immediately evaluated and printed to the page. Expressions consist of EL implicit objects and bean names defined with jsp:usebean. <br>

+

All EL implicit objects are propagators that can be sunk for XSS as an expression.

+

* param

+

* paramValues

+

* header

+

* headerValues

+

* cookie?

+

+

The examples for each implicit object demonstrates xss.<br>

+

+

'''param'''

+

* References a request parameter by name.

+

* Equivalent to request.getParameter(“asdf”);

+

<pre>

+

Welcome ${param.userName}!

+

</pre>

+

+

'''paramValues'''

+

* A String[] of parameter values.

+

* Equivalent to request.getParameterValues().

+

''Using JSTL tags for this example.''

+

<pre>

+

<c:forEach var='parameter' items='${paramValues}'>

+

<c:out value='${parameter.key}'/> =

+

<c:forEach var='value' items='${parameter.value}'>

+

<c:out value='${value}' escapeXml="false"/><br>

+

</c:forEach>

+

</c:forEach><br>

+

</pre>

+

+

'''header'''

+

* Maps a request header name to a single value.

+

* Equivalent to request.getHeader.

+

<pre>

+

${header.cookie}

+

</pre>

+

+

'''headerValues'''

+

* A String[] array of header values.

+

* The following example is the same as above.

+

<pre>

+

<c:forEach var="head" items="${headerValues}">

+

<c:out value="${head.key}" /> =

+

<c:forEach var="val" items="${head.value}">

+

<c:out escapeXml="false" value="${val}" /><br>

+

</c:forEach>

+

</c:forEach><br>

+

</pre>

+

+

'''cookie'''

+

+

Not sure if there's anything juicy here...

+

+

'''pageScope'''

+

* Maps page-scoped variable names to their values.

+

The following example uses the JSTL <c:set> tag so you know where the tainted variable comes from, I’ll cover c:set details in JSTL core section.

+

<pre>

+

<c:set var="PageScopeVar" value="${param.fwd_last}" scope="page"/>

+

${pageScope.PageScopeVar}

+

</pre>

+

+

'''requestScope'''

+

* Maps request-scoped variable names to their values.

+

* Looks exactly the same as pageScope.

+

<pre>

+

<c:set var="ReqScopeVar" value="${param.fwd_last}" scope="request"/>

+

${requestScope.ReqScopeVar}

+

</pre>

+

+

'''sessionScope'''

+

* Maps session-scoped variable names to their values.

+

* You can create a session variable with c:set as above OR you can use session.setAttribute.

Status

Finished 3/11/08 - in need of review.

Brief Overview of JSP Architecture

JSPs are delivered to a container that provides services like life-cycle management and runtime support.
A JSP gets translated to a servlet class which is instantiated at runtime.
A request headed for a particular JSP will be directed by the container to its corresponding servlet class (aka jsp implementation object).
It then handles requests and generates responses.
The default request response objects are HttpServletRequest and HttpServletResponse.
JSP makes use of implicit objects that can be considered taint sources, sinks and propagators.
I won't discuss further details since that is outside the scope of this project. For further information try this
reference guide.

JSP In Light of Security

There’s not much to say here except that JSPs can act as both a model and view. It can operate fairly well without a distinct service or business layer because it doesn’t quite enforce separation of logic and concerns (hence the advent of development frameworks).

I won’t discuss details of web app design here, but one should understand that lack of separation can have negative effects on web-app stability and security. But even so, lack of input validation can lead to easy security vulns in JSP, namely XSS.

Commonly, JavaBeans are used in conjunction with JSP to store parameters and implement business logic. Most of my examples will use beans to demonstrate taint propagation and proper cleansing.

For more data on design with JSP and servlets, see this best practices article

JSP Standard Actions

Propagators

<jsp:usebean>

Makes a Java Bean available to the rest of the page by instantiating the object and binding it to a variable.

Once you have that you can modify and access it using the jsp setProperty and getProperty tags.

JSP Implicit Objects

There are a handful of objects made available in JSPs which are susceptible to security flaws. Their corresponding java class functions are used as is in scriptlets. All the same security rules should apply.

Unified EL

Unified EL is a feature of JSP 2.1 it is a union of JSP 2.0 and JSF expression languages. Expressions enclosed in ${…} are immediately evaluated and printed to the page. Expressions consist of EL implicit objects and bean names defined with jsp:usebean.
All EL implicit objects are propagators that can be sunk for XSS as an expression.