SEC Consult SA-20090901-0 :: File disclosure vulnerability in JSFTemplating, Mojarra Scales and GlassFish Application Server v3 Admin console

SEC Consult Security Advisory < 20090901-0 >
              title: File disclosure vulnerability in JSFTemplating,=20
                     Mojarra Scales and GlassFish Application Server v3 Adm=
           products: JSFTemplating (FileStreamer/PhaseListener component)
                     Mojarra Scales
                     GlassFish Application Server v3 Preview (Admin console)
 vulnerable version: JSFTemplating: all versions < v1.2.11
                     Mojarra Scales: all versions < v1.3.2
                     GlassFish: v3 Preview
      fixed version: JSFTemplating: v1.2.11
                     Mojarra Scales: v1.3.2
                     GlassFish: v2 is not affected according to vendor
             impact: critical
              found: 2009-07-01
                 by: J. Greil / SEC Consult /

Vendor description:
Templating for JavaServer=E2=84=A2 Faces Technology plugs into JavaServer=
=E2=84=A2 Faces to
make building pages and components easy.

Creating pages or components is done using a template file. JSFTemplatings
design allows for multiple syntaxes, currently it supports 2 of its own plus
most of the Facelets syntax. All syntaxes support all of JSFTemplatings
features such as PageSession, Events & Handlers, dynamic reloading of page
conent, etc.

also see:=20

Vulnerability overview/description:
The JSFTemplating FileStreamer functionality (when using the PhaseListener),
basically used for including static or dynamic content, such as Yahoo UI API
files with Mojarra Scales, is vulnerable to=20
* file disclosure and also allows an attacker=20
* to retrieve directory listings of the whole server

Furthermore Mojarra Scales and the GlassFish Application Server (v3 Preview)
Admin console are using vulnerable components too.

JSFTemplating/FileStreamer can be exploited to read sensitive application d=
on the whole server depending on the configuration. One tested server allow=
us to access all files on the server (with rights of the webserver user),
another server was restricted to files within the webroot (but including
WEB-INF) - it might depend on the Java Security Model or filesystem rights.

An attacker is able to gain sensitive data such as configuration files
(WEB-INF/web.xml), the whole source code of the application or other sensit=
data on the server.

Furthermore it is possible to retrieve directory listings of directories on
the whole server and the webroot by specifying a directory instead of a fil=

Proof of concept:
The URLs to exploit this vulnerability may differ from server to server. The
vulnerable HTTP parameters are usually named "filename" or "file".

By specifying the following URLs an attacker gains access to sensitive
configuration files, source code or other possibly sensitive files:


By using an empty value for the file/filename parameter, a directory listin=
g of
the webroot is being shown. Directory traversal is also possible but it dep=
on the installation/configuration whether it is possible to access data out=
the webroot.


Vulnerable versions:
* all versions < v1.2.11

Mojarra Scales:
* all versions < v1.3.2

* v3 Preview (Admin console)

According to the vendor, GlassFish v2 does not use vulnerable components.

Vendor contact timeline:
2009-07-07: Contacting the developers of JSFTemplating by email.
2009-07-07: Very fast response from the developers by email and IRC, initial
            attempts to fix the issue were being made
2009-07-08: Agreed on taking a further look into the issue by the end of Ju=
2009-07-30: Contacted the developers again, they need more time
2009-08-10/13: Asked the developers for any news
2009-08-14: Anwser that the fix will make it into next release
2009-08-31: Fixes for JSFTemplating and Mojarra Scales available
2009-09-01: Coordinated release date

Special thanks to Jason and Ken!

* Upgrade to the latest version of JSFTemplating, v1.2.11 has the fix:

CVS commit logs with some information regarding new security features can be
found here:

* Upgrade to the latest version of Mojarra Scales, v1.3.2 has the fix:

* GlassFish: Use the current stable version v2 or see workaround section fo=
r v3.

GlassFish v3 Preview: Use strong passwords for the GlassFish Admin console =
restrict access to the Admin console port (4848).

Advisory URL:

SEC Consult Unternehmensberatung GmbH

Office Vienna
Mooslackengasse 17
A-1190 Vienna

Tel.: +43 / 1 / 890 30 43 - 0
Fax.: +43 / 1 / 890 30 43 - 25
Mail: research at sec-consult dot com

SEC Consult conducts periodical information security workshops on ISO=20
27001/BS 7799 in cooperation with BSI Management Systems. For more=20
information, please refer to

EOF J. Greil / @2009