SlideShare a Scribd company logo
1 of 23
Download to read offline
Dissecting Java Server Faces for Penetration
                    Testing




Aditya K Sood (Cigital Labs) & Krishna Raja (Security Compass)

                                  Version 0.1
                              August 25, 2011

                                   Abstract
       This paper sheds light on the findings of security testing of Java Server
   Faces (JSF). JSF has been widely used as an open source web framework
   for developing efficient applications using J2EE. JSF is compared with
   ASP.NET framework to unearth potential security flaws.




                                        1
Contents
1 Acknowledgments                                                                  3

2 Overview                                                                         4

3 Inside JSF Framework                                                             5
  3.1 JSF Security Architecture . . . . . . . . . . . . . . . . . . . . . .        5
       3.1.1 JSF Faces-Config.xml and Web.xml . . . . . . . . . . . .               6

4 Penetration Testing JSF Framework                                                7
  4.1 JSF ViewState Anatomy . . . . . . . . . . . . . . . . . .       . . .   .    7
      4.1.1 Differential Behavior - ViewState in ASP.NET and           JSF     .    7
  4.2 Scrutinizing Padding - Testing Oracle . . . . . . . . . . .     . . .   .    9
      4.2.1 Experiment - Fuzzing Oracle . . . . . . . . . . . .       . . .   .   11
  4.3 JSF Anti CSRF - Truth Behind the Scenes . . . . . . . .         . . .   .   11
      4.3.1 Implementing CSRF Protection - The Right Way .            . . .   .   13
  4.4 Security Descriptors Fallacy - Configuration . . . . . . .       . . .   .   14
      4.4.1 Secure Way of Configuring Security Descriptors . .         . . .   .   15
  4.5 JSF Version Tracking and Disclosure . . . . . . . . . . . .     . . .   .   16
  4.6 JSF Data Validation . . . . . . . . . . . . . . . . . . . . .   . . .   .   16
      4.6.1 JSF 1.2 Validation . . . . . . . . . . . . . . . . . .    . . .   .   16
      4.6.2 JSF 2.0 Validation . . . . . . . . . . . . . . . . . .    . . .   .   17
      4.6.3 Custom Validations . . . . . . . . . . . . . . . . .      . . .   .   18

5 Conclusion                                                                      20

6 About the Authors                                                               21

7 References                                                                      22




                                       2
1     Acknowledgments
We would like to thank couple of our friends and security researchers who helped
us in shaping this paper.

    • Giorge Maone (NoScript)
    • Juliano Rizzo (Netifera)

    In addition, we would also like to thank Gary McGraw for providing useful
insight into the paper. A sincere gratitude to all the researchers who are engaged
in constructive research for the security community. Lastly, we sincerely want
to thank our security teams at SecNiche Security Labs and Security Compass
respectively for supporting us in doing security research.




                                        3
2    Overview
In present times, software security has become an indispensable part of software
development life cycle. The penetration testing approach varies with respect to
web development frameworks and platforms. With the advent of advanced level
of attacks, it has become crucial to raise the standards of penetration testing.
An aggressive security testing approach is required to detect the inherent vulner-
abilities and to develop robust security solutions in order to thwart sophisticated
attacks. Owing to the seamless pace of security research, a plethora of vulnera-
bilities are being unearthed in web frameworks and software. Thus, for effective
penetration testing, the security model and web framework architecture should
be dissected appropriately.

   OWASP has been used widely as the de facto standard of penetration testing
of web applications and frameworks with its Top 10 attack vectors. However,
the penetration testing methodology should not be constrained to this standard
and must cover the advanced set of attack vectors that should be tested to val-
idate the strength of web frameworks.

    This paper is divided into two parts. In the first part, we discuss the internals
of JSF, a Java based web application framework and its inherent security model.
In the second part, we discuss about the security weaknesses and applied security
features in the JSF. In addition, we also raise a flag on the security issues present
in JSF in order to conduct effective penetration testing.




                                         4
3     Inside JSF Framework
Java Server Faces (JSF) is an industry standard and a framework for building
component-based user interfaces for web applications. JSF has certain standards
and is implemented using Reference Implementation (RI) by Sun Microsystems,
Apache MyFaces and Oracles ADF Faces. JSF primarily consists of Java Beans,
Event Driven development and JSF component tree.

    With the advent of JSF, the control has been handed over to the devel-
opers for implementing security features such as authorization. As a result of
this change, it has become more crucial for the developers to understand the
implementation of security controls in JSF framework. A good security design
practice requires that authorization (security controls) should be handled at a
central location (Servlet Filter associated with the application front controller).
JSF has built-in extension points provided by the JSF architecture. As JSF
has no proprietary security architecture, the security has to be imposed in a
customized fashion. This is usually done in two ways

    • The developer can design a custom ViewHandler that adds security checks
      for createView and restoreView. However, it is not considered as the best
      security practice because there is no guarantee that the custom security
      ViewHandler is executed before the default ViewHandler. This leads to
      security exceptions while handling requests from the web clients
    • The developer can design a phaseListener that adds security definitions to
      restoreView and invokeAction phases. This can be implemented in JSF
      faces-config.xml file or the developer can do it dynamically by writing a
      customPhase listener.

3.1    JSF Security Architecture
JSF is used for designing web based rich internet applications over the J2EE
framework. Java applications are mostly designed using Model, View, and Con-
troller (MVC) architecture due to the need for real time deployment. J2EE
security can be implemented through Java Authentication and Authorization
Service (JAAS) and container-managed security. JAAS implements fine-grained
access control through external Java permission classes, which provides user with
a list of resources and allowed actions. Before J2EE, the security controls were
implemented within the logic itself. J2EE framework has a declarative security
mechanism in which security controls are applied through web.xml deployment
descriptors which in turn are handled by the J2EE container at runtime. In
container managed security, controls are applied using authorization which is
explicitly enforced on the URL patterns (requests that are issued by the web
client).
    Generally, the controller is responsible for implementing security controls
whereas the view and model part are used for hiding information and applying
logic based on the access roles of the user respectively. However, a good design


                                        5
practice suggests that the security should be implemented over all three layers.
as presented in figure 1.




           Figure 1: MVC - Model View and Controller Architecture


   JSF has implemented the concept of validators which can be used to verify
user input at a view level and model level.

3.1.1   JSF Faces-Config.xml and Web.xml
The rich life cycle of various individual phases are explicitly specified in the faces-
config.xml file. Some of the events included in the file are Restore View, Apply
Request Values, Process Validation, Update Model Values, Invoke Application,
and Render Response. Developers should always consider the fact that faces-
config.xml file has no mention of security and all security constraints must be
specified in web.xml file.




                                          6
4       Penetration Testing JSF Framework
In this section, we are going to present the variation in the applied security
model in JSF frameworks, security weaknesses and the right way to test them.

4.1       JSF ViewState Anatomy
JSF uses ViewState functionality as similar to ASP.NET. However, there are
certain differences in the way JSF and ASP.NET handle ViewState. Generally,
as we all know, the ViewState parameter is used to maintain the state of HTTP
request specific to a web page. This functionality proves beneficial, but it re-
quires appropriate implementation in the deployed environment. It has been
noticed that ViewState analysis of ASP.NET and JSF is misunderstood.

4.1.1      Differential Behavior - ViewState in ASP.NET and JSF
There are number of differences in ViewState implementation in JSF and ASP.NET
which should be taken into consideration while performing analysis of the View-
State. These are discussed as follows

    • JSF does not encrypt the ViewState parameters by default. JSF works on
      the concept of serialization and compression. In general scenarios, once the
      information is serialized, it is compressed using the GZIP algorithm before
      being pushed onto a base-64 encoder. Mojarra displays this behavior,
      whereas latest versions of Apache My faces perform encryption by default
      but MAC is not enabled (prone to padding oracle attack).
    • Compression plays a critical role in optimizing requests in JSF and this
      is primarily implemented through the ”com.sun.faces.compressViewState”
      context parameter. JSF also uses the ”com.sun.faces.compressJavaScript”
      context parameter to remove the whitespaces in rendering JavaScript.
      However, this parameter does not have much impact on security testing.
    • In Apache JSF and Mojarra (SUNs RI), the encryption of ViewState is
      only possible through explicit declaration in the Java Naming and Dec-
      laration Interface (JNDI) using a password string as presented in listing
      1.
        <env−e n t r y >
         <env−e n t r y −name>com . sun . f a c e s . C l i e n t S t a t e S a v i n g P a s s w o r d </env−
             e n t r y −name>
         <env−e n t r y −type>j a v a . l a n g . S t r i n g </env−e n t r y −type>
         <env−e n t r y −v a l u e >[ P r o v i d e Random Value ] </ env−e n t r y −v a l u e >
        </env−e n t r y >
                     Listing 1: Implementing Encryption using JNDI

    • In ASP.NET applications, session state is enabled by default which re-
      quires session cookies to navigate through browser sessions, which is well


                                                      7
understood. In ASP.Net, the ”ViewStateEncryptionMode.Auto” mode is
     set by default which decides whether a specific web page has to have an
     encrypted ViewState or not in order to reduce the processing load. How-
     ever, it is always advised to encrypt the full ViewState in every webpage
     by declaring the ”<%@Page ViewStateEncryptionMode=”Always” %>”
     property. This ensures that ViewState data could not be retrieved.
   • In ASP.NET, Message Authentication Code (MAC) is also computed by
     default and appended in the base 64 encoding in order to avoid the tam-
     pering of ViewState with arbitrary data. The biggest problem in imple-
     menting MAC is that it has to be explicitly specified on the webpage with
     the ”enabledViewStateMac” parameter to be true otherwise MAC is not
     enabled by default. It is advised that the MAC key should be larger in size
     in order to reduce the attack surface. Usually, the GUID of the machine
     is used as a MAC key.

    Some of the generic ViewState decoders which fail in JSF may work fine in
ASP.NET ViewState decoding. ViewState decoder designed by plural-sight [2]
fails for JSF and works fine for ASP.NET as it only works in .NET environment.
Figure 2 shows that tool raises red alert while handling JSF ViewState and
should not be used for the analysis of JSF ViewState.




                 Figure 2: ViewState Decoder Fails for JSF




                                       8
Netifera group has also released a tool termed as POET [3] which should
be used for testing ViewState in JSF. Figure 2 shows the successful decoding
of ViewState in JSF. However, some of the data is gzipped which can be fur-
ther unzipped fully. Even this information raises an alert about the insecure
implementation of ViewState in JSF.




                 Figure 3: Successful Decoding of ViewState


    One can also use the Deface [4],[5] tool for testing ViewState in JSF which
is released by SpiderLabs for aggressive testing of JSF framework.

4.2    Scrutinizing Padding - Testing Oracle
With the advent of new technologies, more sophisticated attack patterns are
being noticed in the routine life. Last year, the discovery of padding oracle at-
tacks [6] has dismantled the implementation of encryption in web frameworks.


                                       9
Due to the padding problem, it is possible to decrypt the ViewState effectively.
In certain versions of ASP.NET, it is possible to download the web.config file on
the local machine by decrypting the content of files using padding oracle attacks.
This is implemented by exploiting the encrypted string that is passed to Scrip-
tResource.axd and WebResource.axd and padding it appropriately. Microsoft
released patches for the insecure cryptographic implementation in ASP.NET due
to padding oracle attacks [10]. It was noticed that some of the applied patches
were not correct and robust. Figure 3 shows how exactly the robustness of
applied patch can be verified.
    As demonstrated at IEEE Security Symposium this year, it is possible to
build rogue requests using padding oracle which can be further exploited to
query sensitive information from the web server. This has proved the fact that
erroneous implementation of cryptography [7] can seriously dismantle the system
and the web is no exception.




Figure 4: Checking Validity of Applied Patch [WebResource.axd/ ScriptRe-
source.axd]


   This can be successfully done through Padbuster [8] tool in ASP.NET.
However, this tool and its variant successfully work for vulnerable versions of
ASP.NET, provided insecure encryption is applied. This tool has also been
added in the latest version of Backtrack penetration testing framework.

    The padding oracle attacks can be successfully conducted in JSF. The first
step is that encryption is not applied in ViewState by default (Mojarra frame-
works). Even if encryption is applied in certain deployed JSF frameworks
(Apache MyFaces) , the integrity is not protected using MAC as discussed
earlier by default. This is the most frivolous flaw that is impacting JSF at


                                       10
a large scale. A number of websites using JSF in a real time environment are
still vulnerable and are running in default insecure state. The ViewState en-
cryption strength in JSF can be checked using POET as discussed. The tool
verifies whether the encryption is applied or not. If it is applied, then it has an
inbuilt module to decrypt the ViewState using oracle padding. The tool follows
the concept of tampering a single byte in the encrypted JSF ViewState (last
block) to verify whether ViewState padding is done appropriately or not based
on HTTP error fingerprinting. JSF usually ignores the inserted block during
serialization which helps the tool to go on decrypting the ViewState without
any hassles. The practical usage of tool can be seen here [9].

4.2.1   Experiment - Fuzzing Oracle
We conducted a number of tests on one of the vulnerable websites to show the
impacts of the padding oracle. The tests are based on manual fuzzing. The aim
is to present the variation in the error responses when encrypted ViewState is
tampered. One thing that should be taken into account while performing this
test is that ViewState has to be encrypted. The test should not be executed
against ViewState that is compressed using GZIP. In addition, the ViewState
should be fuzzed using multiples of 8 because the block size that is used in CBC
encryption has a similar technique. The nature of a response to a padded buffer
varies between applications.

   Step 1: Injecting random buffer in ViewState as a multiple of 8. Figure 5
shows how the application reacts.

   Step 2: At this point, we got a crypto padding error in step 2, on contin-
uous playing around with padding in ViewState; we received different error as
presented in figure 6.

   Considering this scenario, one can continue fuzzing the request, until it is
accepted by the application. There is a typical way of doing padding in CBC
and that can be used in all scenarios as discussed here [11]. One can opt for
various methods to pad CBC encryption.

4.3     JSF Anti CSRF - Truth Behind the Scenes
In reality, JSF does not have an aggressive built-in CSRF protection. Anti
CSRF support is required for protection against Cross Site Request Forging
(CSRF) attacks. However, the implementation of anti CSRF depends a lot on
the design of he in the required framework. ViewState is used for preserving the
state of web pages and can be used in conjunction with another configuration
parameters to prevent CSRF attacks. However, one can perform certain logic
tests to initially detect whether the application is vulnerable to CSRF attacks
or not.



                                       11
Figure 5: Fuzzing Request / Error in Block Size



    Generally, if the ViewState is implemented on the server side, then it is a
good security practice that the application should send a ViewState ID token as
a hidden element in the HTML tag so that it can accompany legitimate requests
from the client side. If the application is only implementing ViewState on the
server side and is not using any ViewState ID, then it is possible that CSRF is
not handled appropriately. Tokens generated by using ”javax.faces.ViewState”
(sequential) are easy to guess if not encrypted properly.

<i n p u t t y p e=” h id de n ” name=” j a v a x . f a c e s . ViewState ” i d=” j a v a x . f a c e s .
       ViewState ” v a l u e=” j i d 2 ”/>
             Listing 2: Implementing ViewState Tracking on Server Side

    As presented in listing 2, the j id2 parameter is set for the ViewState track-
ing on the server side. The attacker designs the next request in that session with
ViewState id as j id3, j id4 and so on which will be treated as legitimate by the
server. In Apache MyFaces ”org.apache.myfaces.NUMBER OF VIEWS IN SESSION”
has a default value of 20 where as IBM Web sphere ”com.sun.faces.numberOfViewsInSession”
has 15. These parameters specify the number of views that are stored in the
session when server side state saving is used.

NOTE: In JSF, it is considered that ViewState can be used to prevent CSRF


                                                    12
Figure 6: Fuzzing Request / Error in Last Block



attacks when collaboratively used with the JSESSIONID. As we have been dis-
cussing, ViewState implementation matters a lot. Now it has become possible to
re encrypt the tampered ViewState and deliver it back to the server. Encrypting
ViewState and sending data over HTTPS are not the protection mechanisms
against CSRF attacks. This has been widely misunderstood in the developer
community.

4.3.1   Implementing CSRF Protection - The Right Way
Strong CSRF implementation in JSF can be implemented as

   • Applying Anti CSRF filters such as ”org.apache.catalina.filters.CsrfPreventionFilter”.
     The inbuilt class uses the ”java.util.Random” if explicitly specified by the
     developer otherwise ”java.security.SecureRandom” will be used by default.
     One can also use OWASP CSRF Guard to integrate third party filters into
     JSF.
   • If the ViewState session Id is to be used with every request then it must
     be strongly encrypted and an appropriate MAC should be applied in order


                                      13
to preserve integrity.
    • It is also possible to design custom CSRF filters with strong functions
      that generate random tokens. This is possible by creating a CSRF Session
      listener class that overrides every request with HTTP listener class and
      appends a random token in every request for a particular session. There
      is also a possibility of adding <s: token> an element in <h:form> the
      tag that automatically initiates the CSRF protection. Framework that
      supports <s: token> are Apache Shale, MyFaces and JBOSS Seam.
    • The real world examples will look like as presented in listing 3
       <i n p u t t y p e=” h id de n ” name=” j i d t 7 : j idt7 CSRFToken ” v a l u e=” 0
              c 7 7 6 0 4 0 f f 7 7 d 3 a f 5 a c c e 4 d 4 c 5 9 a 5 1 4 1 1 e b 9 6 0 b d ” />
                       Listing 3: Implementing CSRF Tokens in JSF


4.4      Security Descriptors Fallacy - Configuration
The declaration of security parameters in web.xml are imperative especially the
security elements that are used for preserving the confidentiality and integrity
of the ViewState. It has been noticed that declaration of ”ALGORTIHM” in
uppercase in ”org.apache.myfaces.ALGORITHM” does not initialize the Initial-
ization Vector (IV) in Apache MyFaces. This is a bad design practice and could
have devastative impacts on the security of a JSF application. The source code
of the ”utils.StateUItils” class (which holds security configuration elements) as
presented in listing 4 which clearly reflects that these parameters have to be ap-
plied in lower case but the documentation of various JSF versions is not written
appropriately and is not inline with the real code. In other words, the docu-
mentation is misleading.

p u b l i c s t a t i c f i n a l S t r i n g INIT PREFIX = ” o r g . apache . my f ac e s . ” ;
p u b l i c s t a t i c f i n a l S t r i n g INIT ALGORITHM = INIT PREFIX + ”
       ALGORITHM” ;
p r i v a t e s t a t i c String findAlgorithm ( ExternalContext ctx ) {

S t r i n g a l g o r i t h m = c t x . g e t I n i t P a r a m e t e r (INIT ALGORITHM) ;
              i f ( a l g o r i t h m == n u l l )
             {
                       a l g o r i t h m = c t x . g e t I n i t P a r a m e t e r (INIT ALGORITHM .
                               toLowerCase ( ) ) ;
             }
 return findAlgorithm ( algorithm ) ;
        }

     . . Truncated              ..
           Listing 4: Explicit Specification - Implementing to Lower Case




                                                      14
4.4.1     Secure Way of Configuring Security Descriptors
The best practice is to declare the configuration parameters in web.xml as pre-
sented in listing 5.
 <c o n t e x t −param>
     <param−name>j a v a x . f a c e s . STATE SAVING METHOD</param−name>
     <param−v a l u e >c l i e n t </param−v a l u e >
</c o n t e x t −param>

<c o n t e x t −param>
                 <param−name>o r g . apache . my f ac es . s e c r e t </param−name>
                 <param−v a l u e >MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz</param−
                      value>
</c o n t e x t −param>

<c o n t e x t −param>
      <param−name>o r g . apache . my f ac es . a l g o r i t h m </param−name>
      <param−v a l u e >AES</param−v a l u e >
</c o n t e x t −param>

<c o n t e x t −param>
      <param−name>o r g . apache . my f ac es . a l g o r i t h m . p a r a m e t e r s </param−name
               >
      <param−v a l u e >CBC/PKCS5Padding</param−v a l u e >
</c o n t e x t −param>

<c o n t e x t −param>
      <param−name>o r g . apache . my f ac es . a l g o r i t h m . i v </param−name>
      <param−v a l u e >NzY1NDMyMTA3NjU0MzIxMA==</param−v a l u e >
</c o n t e x t −param>

 <c o n t e x t −param>
  <param−name>o r g . apache . my f ac es . s e c r e t . cache </param−name>
                 <param−v a l u e >f a l s e </param−v a l u e >
 </c o n t e x t −param>

</web−app>
        Listing 5: Secure Way of Declaring Encryption Parameters in JSF

This point should be taken into account while doing penetration testing so that
enhanced attacks can be tested against the inappropriate implementation of
JSF security.

NOTE: It has been noticed that JSF framework only encrypts ViewState in
order to provide confidentiality but there is no standard implementation of MAC
by default so that the integrity of ViewState is preserved. While we know that
JSF security greatly depends on the web.xml file, the MAC functionality is also
introduced in it. The developer has to explicitly specify the MAC algorithm,
key and caching.
    The parameters that are used nowadays are ”org.apache.myfaces.MAC ALGORITHM”,
”org.apache.myfaces.MAC SECRET” and ” org.apache.myfaces.MAC SECRET.CACHE”
respectively. Always declare all of these parameters in lower case.



                                                 15
4.5      JSF Version Tracking and Disclosure
JSF configuration has inbuilt configuration parameters that are used to disclose
the version of the installed framework. However, it is always taken lightly and
is not fixed by the developers or administrators to avoid leakage of the informa-
tion in HTTP response headers. It has been noticed that version disclosure may
result in detecting critical flaws in JSF applications because publicly available
exploit databases can be used to fingerprint the security vulnerabilities present
in the installed JSF framework.

    In Suns RI JSF implementation, the ”com.sun.faces.disableVersionTracking”
configuration parameter is defined explicitly. By default, it is set to false which
means application running on the web server will throw the JSF version into
the response headers when the web client queries for it. The collaborative
disclosure of web server version and framework version can be devastative from
the developers point of view but it is fruitful for pen testing purposes. JSF
is not immune to security vulnerabilities [12, 13, and 14] as seen in the recent
past. These security issues should be taken into consideration while deploying
JSF applications because information leakage is the basis of a number of web
attacks. We conducted generic tests on several websites that are using JSF and
found that more than 85% of the websites are throwing JSF version number
in their response headers out of which several of them were running old and
vulnerable versions.

4.6      JSF Data Validation
Anyone involved in security understands the importance of proper input vali-
dation. JSF offers a few different techniques for validation in order to prevent
web attacks such as Cross Site Scripting (XSS). Some of the input validation
modules have been available since JSF 1.2, and others are unique to JSF 2.0.

4.6.1     JSF 1.2 Validation
Apache MyFaces and the Apache Tomahawk library provide JSF components
that can allow for data validation within the UI page itself. One of the more
powerful ways of validating input is by leveraging regular expressions via the
¡t:validateRegExpr¿ tag provided by Tomahawk [15]. Consider an example
where we wish to validate a ZIP code. A MyFaces example of data validation
using Tomahawk [16] is presented in listing 6.

<% t a g l i b u r i=” h t t p : / / my fa c es . apache . o r g /tomahawk” p r e f i x=” t ” %
  @                                                                                            >

<h : o u t p u t L a b e l f o r=” z i p 1 ” v a l u e=” Zip ”/>
<t : i n p u t T e x t v a l u e=”#{o r d e r . zipCode } ” i d=” z i p 1 ”>
  <t : v a l i d a t e R e g E x p r p a t t e r n=” d {5} ” message=”ZIP Code”/>
</t : inputText>
                  Listing 6: Generic MyFaces Example - Tomahawk


                                                16
In this particular example, a regular expression is being used to limit the zip
code to five digits. Notice that you can include an error message as well, and all
of this is done within the .xhtml page itself. A similar example using Facelets
[17] is presented in listing 7.

<html . . . xmlns : u i=” h t t p : / / j a v a . sun . com/ j s f / f a c e l e t s ” xmlns : t=” h t t p
    : / / my f ac es . apache . o r g /tomahawk”>

<h : i n p u t T e x t t y p e=” t e x t ” i d=” v a l
   v a l u e=”#{ SimpleBean . v a l }” r e q u i r e d =” t r u e ”>
    <t : v a l i d a t e R e g E x p r p a t t e r n=” [ a−zA−Z ] { 1 , 1 0 0 } ” />
</h : inputText>
                              Listing 7: Generic Facelets Example
    The JSF Reference Implementation (RI), codenamed ”Mojarra”, comes with
its own tag library that also leverages regular expressions. Mojarra’s <mj:
regexValidator> will perform the same operation as discussed above. Further-
more, Mojarra’s tag library is armed with an <mj: creditCardValidator> to
validate the proper format of credit cards [18].

4.6.2      JSF 2.0 Validation
JSF 2.0 contains a collection of tags called validators. These are built in to the
JSF 2.0 core library. JSF developers will find the following tags particularly
useful for data validation:

     • <f:validateLength> : use this to validate that input falls between a mini-
       mum and maximum length
     • <f:validateLongRange> : use this to validate that numeric input falls
       between a minimum and maximum value
     • <f:validateDoubleRange> : similar to validateLongRange, but used for
       double values
     • <f:validateRegex> : use this to leverage regular expression validation

     Here is an example of JSF validators in use as presented in listing 8.

<t r >
  <td>User ID : <td>User ID :
  <h : i n p u t T e x t v a l u e=”#{bidBean2 . u s e r I D } ” r e q u i r e d=” t r u e ”
           r e q u i r e d M e s s a g e=”You must e n t e r a u s e r ID”
   v a l i d a t o r M e s s a g e=”ID must be 5 o r 6 c h a r s ” i d=” u s e r I D ”>

   <f : v a l i d a t e L e n g t h minimum=” 5 ” maximum=” 6 ”/>
   </h : inputText ></td>

  <td><h : message f o r=” u s e r I D ” s t y l e C l a s s=” e r r o r ”/></td>
</t r >
                          Listing 8: Generic Usage of JSF Validators


                                                       17
Notice in the above example that the <h: inputText> contains a required,
requiredMessage and validatorMessage attribute. The required attribute indi-
cates that this value must be input by the end user and an error message is
displayed if it is not provided.

4.6.3     Custom Validations
All of the above approaches work well when the values are not tied closely to
business logic, or if these validators and tag libraries are suitable to perform
the validation we need. Sometimes there is a need to build custom validation
components for data types that arent supported by standard JSF validators
[19].
     In this scenario, the validator attribute of the <h: inputText> tag references
a validator method that is defined within the bean class [20] as presented in
listing 9.
  <t r >
<td>Bid Amount : <td>Bid Amount : $<h : i n p u t T e x t v a l u e=”#{bidBean2 .
        bidAmount} ” r e q u i r e d=” t r u e ”
r e q u i r e d M e s s a g e=”You must e n t e r an a m o u n t
c o n v e r t e r M e s s a g e=”Amount must be a number”
v a l i d a t o r=”#{ bidBean2 . v a l i d a t e B i d A m o u n t }”
i d=”amount”/>

</td>
  <td><h : message f o r=”amount” s t y l e C l a s s=” e r r o r ”/></td>
</t r >
                            Listing 9: Example : Bid Bean Class

   In the BidBean2 class, we would define our custom validation method as
presented in listing 10, validateBidAmount():
p u b l i c v o i d validateBidAmount ( F a c e s C o n t e x t c o n t e x t , UIComponent
       componentToValidate ,
UIComponent componentToValidate , O b j e c t v a l u e ) throws
       ValidatorException {

d o u b l e bidAmount = ( ( Double ) v a l u e ) . d o u b l e V a l u e ( ) ;
double previousHighestBid = currentHighestBid ( ) ;

i f ( bidAmount <= p r e v i o u s H i g h e s t B i d )
   {
   FacesMessage message =
                                   new FacesMessage ( ” Bid must be h i g h e r than
                                           current ”
                                + new FacesMessage ( Bid must be h i g h e r than
                                         current + ” h i g h e s t b i d ( $ ”
                                + previousHighestBid + ”) . ”) ;
                                 throw new V a l i d a t o r E x c e p t i o n ( message ) ;
               }
}
                         Listing 10: Custom Bean Validator Class



                                                    18
As we can see, this approach allows more flexibility while validating input
data. The validators play a significant role in curing many security vulnerabili-
ties at the source level.




                                      19
5    Conclusion
In this paper, we have presented the security issues in JSF architecture. Web
frameworks have unique semantics and security models. A thorough under-
standing of the internal architecture of the frameworks is imperative to under-
take productive penetration testing. We have discussed the advance features
that should be tested for complete and extensive penetration testing of JSF.
In general, JSF is similar to ASP.NET from security perspective but differs in
deployment of inherent security controls. Every web framework is required to
be dissected so that step by step testing can be performed in a robust manner.




                                      20
6    About the Authors
Aditya K Sood is a Senior Security Practitioner and PhD candidate at Michi-
gan State University. He has already worked in the security domain for Ar-
morize, COSEINC and KPMG. He is also a founder of SecNiche Security Labs,
an independent security research arena for cutting edge computer security re-
search. He has been an active speaker at industry conferences and already spo-
ken at RSA, HackInTheBox, ToorCon, HackerHalted, Source, TRISC, AAVAR,
EuSecwest, XCON, Troopers, OWASP AppSec USA, FOSS, CERT-IN, etc. He
has written content for Virus Bulletin, HITB Ezine, Hakin9, ISSA, ISACA,
CrossTalk, Usenix Login, and Elsevier Journals such as NESE and CFS. He is
also a co author for debugged magazine.

He is also associated with Cigital Labs for doing applied security research in the
field of software and application security.

Email: adi ks [at] secniche.org

Personal Website: http://www.secniche.org
Company Website : http://www.cigital.com


Krishna Raja is a Senior Application Security Consultant at Security Com-
pass with an extensive background in Java EE application development. He has
performed comprehensive security assessments for financial, government, and
health care organizations across Canada and the United States. Krishna has
carried out the role of security advisor, security analyst, project manager and
trainer. He has given lectures and taught courses at RSA, Source Boston, ISSA
Secure San Diego and OWASP AppSec DC. Krishna graduated from the Uni-
versity of Western Ontario in 2004 with an Honors BSc. in Computer Science
with Software Engineering specialization. He is also an ISC2 Certified Secure
Software Lifecycle Professional (CSSLP).

Email: krish [at] securitycompass.com
Company Website: http://www.securitycompass.com




                                       21
7    References
[1] Apache Java Server Faces, http://myfaces.apache.org/

[2] ViewState Decoder, http://www.pluralsight-training.net/community/media/p/51688.aspx

[3] POET Tool, http://netifera.com/download/poet/poet-1.0.0-win32-x86.jar

[4] Deface Tool, https://github.com/SpiderLabs/deface

[5] Beware of Serialized GUI Objects Bearing Data, http://www.blackhat.com/presentations/bh-
dc-10/Byrne David/BlackHat-DC-2010-Byrne-SGUI-slides.pdf

[6] Padding Oracle Attacks, http://www.usenix.org/event/woot10/tech/full papers/Rizzo.pdf

[7] Cryptography in the Web: The Case of Cryptographic Design Flaws in
ASP.NET, http://www.ieee-security.org/TC/SP2011/PAPERS/2011/paper030.pdf

[8] Automated Padding Oracle Attacks with PadBuster, http://www.gdssecurity.com/l/b/2010/09/14/
automated-padding-oracle-attacks-with-padbuster/

[9] Cracking ViewState Encryption in JSF, http://www.youtube.com/watch?v=euujmKDxmC4

[10] Microsoft Patch Padding Oracle Attacks, http://www.microsoft.com/technet/security/bulletin/ms10-
070.mspx

[11] Using Padding in Encryption, http://www.di-mgt.com.au/cryptopad.html

[12] Sun Java Server Faces Cross-Site Scripting Vulnerability, http://www.securityfocus.com/bid/28192

[13] Apache MyFaces Tomahawk JSF Framework Cross-Site Scripting (XSS)
Vulnerability , http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=544

[14] Sun Glassfish Enterprise Server - Multiple Linked XSS vulnerabilies,
http://dsecrg.com/pages/vul/show.php?id=134

[15] MyFaces Tomahawk, http://myfaces.apache.org/tomahawk/index.html

[16] Tomahawk ValidateRegExpr, http://www.developersbook.com/jsf/myfaces/tomahawk-
tag-reference/tomahawk-validateRegExpr.php#1

[17] Facelets, http://facelets.java.net/

[18] JSF Majorra Extension Tags Validation and Focus, http://java.sys-con.com/node/1031733




                                           22
[19] JSF Validation Tutorial, http://www.mastertheboss.com/web-interfaces/293-
jsf-validation-tutorial.html?showall=1

[20] JSF: Validating User Input, http://courses.coreservlets.com/Course-Materials/pdf/jsf/08-
Validation.pdf




                                      23

More Related Content

What's hot

Comparison - RDBMS vs Hadoop vs Apache
Comparison - RDBMS vs Hadoop vs ApacheComparison - RDBMS vs Hadoop vs Apache
Comparison - RDBMS vs Hadoop vs ApacheSandeepTaksande
 
Protecting browsers’ secrets in a domain environment
Protecting browsers’ secrets in a domain environmentProtecting browsers’ secrets in a domain environment
Protecting browsers’ secrets in a domain environmentItai Grady
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systemsmridul mishra
 
No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...
 No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ... No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...
No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...Amazon Web Services
 
data hiding techniques.ppt
data hiding techniques.pptdata hiding techniques.ppt
data hiding techniques.pptMuzamil Amin
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptAndres Baravalle
 
Introduction to Apache Spark Ecosystem
Introduction to Apache Spark EcosystemIntroduction to Apache Spark Ecosystem
Introduction to Apache Spark EcosystemBojan Babic
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.netBhumivaghasiya
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryWill Schroeder
 
Architecture of a search engine
Architecture of a search engineArchitecture of a search engine
Architecture of a search engineSylvain Utard
 
Eventual Consistency - JUG DA
Eventual Consistency - JUG DAEventual Consistency - JUG DA
Eventual Consistency - JUG DASusanne Braun
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http responseNuha Noor
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Amit Tyagi
 
WEB BASED INFORMATION RETRIEVAL SYSTEM
WEB BASED INFORMATION RETRIEVAL SYSTEMWEB BASED INFORMATION RETRIEVAL SYSTEM
WEB BASED INFORMATION RETRIEVAL SYSTEMSai Kumar Ale
 
Apache Hadoop and HBase
Apache Hadoop and HBaseApache Hadoop and HBase
Apache Hadoop and HBaseCloudera, Inc.
 

What's hot (20)

Caching
CachingCaching
Caching
 
Comparison - RDBMS vs Hadoop vs Apache
Comparison - RDBMS vs Hadoop vs ApacheComparison - RDBMS vs Hadoop vs Apache
Comparison - RDBMS vs Hadoop vs Apache
 
Protecting browsers’ secrets in a domain environment
Protecting browsers’ secrets in a domain environmentProtecting browsers’ secrets in a domain environment
Protecting browsers’ secrets in a domain environment
 
Locks In Disributed Systems
Locks In Disributed SystemsLocks In Disributed Systems
Locks In Disributed Systems
 
Sessions and cookies
Sessions and cookiesSessions and cookies
Sessions and cookies
 
No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...
 No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ... No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...
No Hassle NoSQL - Amazon DynamoDB & Amazon DocumentDB | AWS Summit Tel Aviv ...
 
data hiding techniques.ppt
data hiding techniques.pptdata hiding techniques.ppt
data hiding techniques.ppt
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to Apache Spark Ecosystem
Introduction to Apache Spark EcosystemIntroduction to Apache Spark Ecosystem
Introduction to Apache Spark Ecosystem
 
RichControl in Asp.net
RichControl in Asp.netRichControl in Asp.net
RichControl in Asp.net
 
The Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active DirectoryThe Unintended Risks of Trusting Active Directory
The Unintended Risks of Trusting Active Directory
 
Architecture of a search engine
Architecture of a search engineArchitecture of a search engine
Architecture of a search engine
 
Eventual Consistency - JUG DA
Eventual Consistency - JUG DAEventual Consistency - JUG DA
Eventual Consistency - JUG DA
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
GFS & HDFS Introduction
GFS & HDFS IntroductionGFS & HDFS Introduction
GFS & HDFS Introduction
 
WEB BASED INFORMATION RETRIEVAL SYSTEM
WEB BASED INFORMATION RETRIEVAL SYSTEMWEB BASED INFORMATION RETRIEVAL SYSTEM
WEB BASED INFORMATION RETRIEVAL SYSTEM
 
I hunt sys admins 2.0
I hunt sys admins 2.0I hunt sys admins 2.0
I hunt sys admins 2.0
 
Apache Hadoop and HBase
Apache Hadoop and HBaseApache Hadoop and HBase
Apache Hadoop and HBase
 
Lecture 5: Client Side Programming 1
Lecture 5: Client Side Programming 1Lecture 5: Client Side Programming 1
Lecture 5: Client Side Programming 1
 

Viewers also liked

BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...
BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...
BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...Aditya K Sood
 
PenTest Magazine Teaser - Mobile Hacking
PenTest Magazine Teaser - Mobile HackingPenTest Magazine Teaser - Mobile Hacking
PenTest Magazine Teaser - Mobile HackingAditya K Sood
 
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...Aditya K Sood
 
SyScan 2016 - Remote code execution via Java native deserialization
SyScan 2016 - Remote code execution via Java native deserializationSyScan 2016 - Remote code execution via Java native deserialization
SyScan 2016 - Remote code execution via Java native deserializationDavid Jorm
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Christian Schneider
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...Christopher Frohoff
 
OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesChristopher Frohoff
 

Viewers also liked (8)

BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...
BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...
BruCon (Brussels 2011) Hacking Conference - Botnets and Browsers (Brothers in...
 
PenTest Magazine Teaser - Mobile Hacking
PenTest Magazine Teaser - Mobile HackingPenTest Magazine Teaser - Mobile Hacking
PenTest Magazine Teaser - Mobile Hacking
 
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...
Malvertising - Exploiting Web Advertising | Elsevier Computer Fraud and Secur...
 
SyScan 2016 - Remote code execution via Java native deserialization
SyScan 2016 - Remote code execution via Java native deserializationSyScan 2016 - Remote code execution via Java native deserialization
SyScan 2016 - Remote code execution via Java native deserialization
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
OWASP SD: Deserialize My Shorts: Or How I Learned To Start Worrying and Hate ...
 
OWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling PicklesOWASP AppSecCali 2015 - Marshalling Pickles
OWASP AppSecCali 2015 - Marshalling Pickles
 
Make profit with UI-Redressing attacks.
Make profit with UI-Redressing attacks.Make profit with UI-Redressing attacks.
Make profit with UI-Redressing attacks.
 

Similar to Dissecting Java Server Faces for Penetration Testing

Dissecting jsf pt_aks_kr
Dissecting jsf pt_aks_krDissecting jsf pt_aks_kr
Dissecting jsf pt_aks_krLohit Margoor
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application developmentClarence Ho
 
JSF basics
JSF basicsJSF basics
JSF basicsairbo
 
The 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web FrameworksThe 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web FrameworksKunal Ashar
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptxNourhanTarek23
 
Java Security Overview
Java Security OverviewJava Security Overview
Java Security Overviewwhite paper
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
OWASP Secure Coding Quick Reference Guide
OWASP Secure Coding Quick Reference GuideOWASP Secure Coding Quick Reference Guide
OWASP Secure Coding Quick Reference GuideAryan G
 
ENGS4851_Final_Certified_Report
ENGS4851_Final_Certified_ReportENGS4851_Final_Certified_Report
ENGS4851_Final_Certified_ReportNagendra Posani
 
Integration of Struts & Spring & Hibernate for Enterprise Applications
Integration of Struts & Spring & Hibernate for Enterprise ApplicationsIntegration of Struts & Spring & Hibernate for Enterprise Applications
Integration of Struts & Spring & Hibernate for Enterprise ApplicationsIJMER
 
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGR...
SOURCE CODE ANALYSIS TO REMOVE SECURITY  VULNERABILITIES IN JAVA SOCKET PROGR...SOURCE CODE ANALYSIS TO REMOVE SECURITY  VULNERABILITIES IN JAVA SOCKET PROGR...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGR...IJNSA Journal
 
Vulnerability Management in IT Infrastructure
Vulnerability Management in IT InfrastructureVulnerability Management in IT Infrastructure
Vulnerability Management in IT InfrastructureIRJET Journal
 
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...IJNSA Journal
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectivekalimullahmohd89
 

Similar to Dissecting Java Server Faces for Penetration Testing (20)

Dissecting jsf pt_aks_kr
Dissecting jsf pt_aks_krDissecting jsf pt_aks_kr
Dissecting jsf pt_aks_kr
 
Framework adoption for java enterprise application development
Framework adoption for java enterprise application developmentFramework adoption for java enterprise application development
Framework adoption for java enterprise application development
 
JSF basics
JSF basicsJSF basics
JSF basics
 
Security in Java
Security in JavaSecurity in Java
Security in Java
 
The 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web FrameworksThe 2014 Decision Makers Guide to Java Web Frameworks
The 2014 Decision Makers Guide to Java Web Frameworks
 
Introduction to Spring sec1.pptx
Introduction to Spring sec1.pptxIntroduction to Spring sec1.pptx
Introduction to Spring sec1.pptx
 
Struts
StrutsStruts
Struts
 
Java Security Overview
Java Security OverviewJava Security Overview
Java Security Overview
 
Profiling documentforaltrec
Profiling documentforaltrecProfiling documentforaltrec
Profiling documentforaltrec
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
OWASP Secure Coding Quick Reference Guide
OWASP Secure Coding Quick Reference GuideOWASP Secure Coding Quick Reference Guide
OWASP Secure Coding Quick Reference Guide
 
ENGS4851_Final_Certified_Report
ENGS4851_Final_Certified_ReportENGS4851_Final_Certified_Report
ENGS4851_Final_Certified_Report
 
Integration of Struts & Spring & Hibernate for Enterprise Applications
Integration of Struts & Spring & Hibernate for Enterprise ApplicationsIntegration of Struts & Spring & Hibernate for Enterprise Applications
Integration of Struts & Spring & Hibernate for Enterprise Applications
 
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGR...
SOURCE CODE ANALYSIS TO REMOVE SECURITY  VULNERABILITIES IN JAVA SOCKET PROGR...SOURCE CODE ANALYSIS TO REMOVE SECURITY  VULNERABILITIES IN JAVA SOCKET PROGR...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGR...
 
Jsf
JsfJsf
Jsf
 
Vulnerability Management in IT Infrastructure
Vulnerability Management in IT InfrastructureVulnerability Management in IT Infrastructure
Vulnerability Management in IT Infrastructure
 
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
 
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...
SOURCE CODE ANALYSIS TO REMOVE SECURITY VULNERABILITIES IN JAVA SOCKET PROGRA...
 
SOHIL_RM (1).pptx
SOHIL_RM (1).pptxSOHIL_RM (1).pptx
SOHIL_RM (1).pptx
 
National%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspectiveNational%20 online%20examination%20system%20an%20architectural%20perspective
National%20 online%20examination%20system%20an%20architectural%20perspective
 

More from Aditya K Sood

Emerging Trends in Online Social Networks Malware
Emerging Trends in Online Social Networks MalwareEmerging Trends in Online Social Networks Malware
Emerging Trends in Online Social Networks MalwareAditya K Sood
 
Enfilade: Tool to Detect Infections in MongoDB Instances
Enfilade: Tool to Detect Infections in MongoDB InstancesEnfilade: Tool to Detect Infections in MongoDB Instances
Enfilade: Tool to Detect Infections in MongoDB InstancesAditya K Sood
 
Detecting Ransomware/Bot Infections in Elasticsearch
Detecting Ransomware/Bot Infections in ElasticsearchDetecting Ransomware/Bot Infections in Elasticsearch
Detecting Ransomware/Bot Infections in ElasticsearchAditya K Sood
 
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...Aditya K Sood
 
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...Aditya K Sood
 
Network Security : Book Review : Targeted Cyber Attacks : Aditya K Sood
Network Security : Book Review : Targeted Cyber Attacks : Aditya K SoodNetwork Security : Book Review : Targeted Cyber Attacks : Aditya K Sood
Network Security : Book Review : Targeted Cyber Attacks : Aditya K SoodAditya K Sood
 
Abusing Glype Proxies - Attacks, Exploits and Defences
Abusing Glype Proxies - Attacks, Exploits and DefencesAbusing Glype Proxies - Attacks, Exploits and Defences
Abusing Glype Proxies - Attacks, Exploits and DefencesAditya K Sood
 
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin MagazineNIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin MagazineAditya K Sood
 
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...Aditya K Sood
 
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...Aditya K Sood
 
ToorCon 14 : Malandroid : The Crux of Android Infections
ToorCon 14 : Malandroid : The Crux of Android InfectionsToorCon 14 : Malandroid : The Crux of Android Infections
ToorCon 14 : Malandroid : The Crux of Android InfectionsAditya K Sood
 
DEF CON 20 - Botnets Die Hard - Owned and Operated
DEF CON 20 - Botnets Die Hard - Owned and OperatedDEF CON 20 - Botnets Die Hard - Owned and Operated
DEF CON 20 - Botnets Die Hard - Owned and OperatedAditya K Sood
 
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks Aditya K Sood
 
NGR Bot Analysis Paper
NGR Bot Analysis PaperNGR Bot Analysis Paper
NGR Bot Analysis PaperAditya K Sood
 
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...Aditya K Sood
 
Commercial Cyber Crime - Social Networks Malware
Commercial Cyber Crime - Social Networks MalwareCommercial Cyber Crime - Social Networks Malware
Commercial Cyber Crime - Social Networks MalwareAditya K Sood
 
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...Aditya K Sood
 
OWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareOWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareAditya K Sood
 
Browser Malware Taxonomy
Browser Malware TaxonomyBrowser Malware Taxonomy
Browser Malware TaxonomyAditya K Sood
 
VxWorks - Holistic Security (Art of Testing)
VxWorks - Holistic Security (Art of  Testing)VxWorks - Holistic Security (Art of  Testing)
VxWorks - Holistic Security (Art of Testing)Aditya K Sood
 

More from Aditya K Sood (20)

Emerging Trends in Online Social Networks Malware
Emerging Trends in Online Social Networks MalwareEmerging Trends in Online Social Networks Malware
Emerging Trends in Online Social Networks Malware
 
Enfilade: Tool to Detect Infections in MongoDB Instances
Enfilade: Tool to Detect Infections in MongoDB InstancesEnfilade: Tool to Detect Infections in MongoDB Instances
Enfilade: Tool to Detect Infections in MongoDB Instances
 
Detecting Ransomware/Bot Infections in Elasticsearch
Detecting Ransomware/Bot Infections in ElasticsearchDetecting Ransomware/Bot Infections in Elasticsearch
Detecting Ransomware/Bot Infections in Elasticsearch
 
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
 
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
 
Network Security : Book Review : Targeted Cyber Attacks : Aditya K Sood
Network Security : Book Review : Targeted Cyber Attacks : Aditya K SoodNetwork Security : Book Review : Targeted Cyber Attacks : Aditya K Sood
Network Security : Book Review : Targeted Cyber Attacks : Aditya K Sood
 
Abusing Glype Proxies - Attacks, Exploits and Defences
Abusing Glype Proxies - Attacks, Exploits and DefencesAbusing Glype Proxies - Attacks, Exploits and Defences
Abusing Glype Proxies - Attacks, Exploits and Defences
 
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin MagazineNIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
NIframer - CPanel IFrame Injector (Bash based) - Virus Bulletin Magazine
 
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...
CrossTalk - The Art of Cyber Bank Robbery - Stealing your Money Through Insid...
 
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
 
ToorCon 14 : Malandroid : The Crux of Android Infections
ToorCon 14 : Malandroid : The Crux of Android InfectionsToorCon 14 : Malandroid : The Crux of Android Infections
ToorCon 14 : Malandroid : The Crux of Android Infections
 
DEF CON 20 - Botnets Die Hard - Owned and Operated
DEF CON 20 - Botnets Die Hard - Owned and OperatedDEF CON 20 - Botnets Die Hard - Owned and Operated
DEF CON 20 - Botnets Die Hard - Owned and Operated
 
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks
Hackers on Planet Earth (HOPE - 2012) Advancements in Botnet Attacks
 
NGR Bot Analysis Paper
NGR Bot Analysis PaperNGR Bot Analysis Paper
NGR Bot Analysis Paper
 
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...
Virus bulletin 2011 Conference Paper - Browser Exploit Packs - Exploitation T...
 
Commercial Cyber Crime - Social Networks Malware
Commercial Cyber Crime - Social Networks MalwareCommercial Cyber Crime - Social Networks Malware
Commercial Cyber Crime - Social Networks Malware
 
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...
Virus Bulletin 2011 Conference - Browser Exploit Packs - Death by Bundled Exp...
 
OWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web MalwareOWASP AppSec USA 2011 - Dismantling Web Malware
OWASP AppSec USA 2011 - Dismantling Web Malware
 
Browser Malware Taxonomy
Browser Malware TaxonomyBrowser Malware Taxonomy
Browser Malware Taxonomy
 
VxWorks - Holistic Security (Art of Testing)
VxWorks - Holistic Security (Art of  Testing)VxWorks - Holistic Security (Art of  Testing)
VxWorks - Holistic Security (Art of Testing)
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Dissecting Java Server Faces for Penetration Testing

  • 1. Dissecting Java Server Faces for Penetration Testing Aditya K Sood (Cigital Labs) & Krishna Raja (Security Compass) Version 0.1 August 25, 2011 Abstract This paper sheds light on the findings of security testing of Java Server Faces (JSF). JSF has been widely used as an open source web framework for developing efficient applications using J2EE. JSF is compared with ASP.NET framework to unearth potential security flaws. 1
  • 2. Contents 1 Acknowledgments 3 2 Overview 4 3 Inside JSF Framework 5 3.1 JSF Security Architecture . . . . . . . . . . . . . . . . . . . . . . 5 3.1.1 JSF Faces-Config.xml and Web.xml . . . . . . . . . . . . 6 4 Penetration Testing JSF Framework 7 4.1 JSF ViewState Anatomy . . . . . . . . . . . . . . . . . . . . . . 7 4.1.1 Differential Behavior - ViewState in ASP.NET and JSF . 7 4.2 Scrutinizing Padding - Testing Oracle . . . . . . . . . . . . . . . 9 4.2.1 Experiment - Fuzzing Oracle . . . . . . . . . . . . . . . . 11 4.3 JSF Anti CSRF - Truth Behind the Scenes . . . . . . . . . . . . 11 4.3.1 Implementing CSRF Protection - The Right Way . . . . . 13 4.4 Security Descriptors Fallacy - Configuration . . . . . . . . . . . 14 4.4.1 Secure Way of Configuring Security Descriptors . . . . . . 15 4.5 JSF Version Tracking and Disclosure . . . . . . . . . . . . . . . . 16 4.6 JSF Data Validation . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.1 JSF 1.2 Validation . . . . . . . . . . . . . . . . . . . . . . 16 4.6.2 JSF 2.0 Validation . . . . . . . . . . . . . . . . . . . . . . 17 4.6.3 Custom Validations . . . . . . . . . . . . . . . . . . . . . 18 5 Conclusion 20 6 About the Authors 21 7 References 22 2
  • 3. 1 Acknowledgments We would like to thank couple of our friends and security researchers who helped us in shaping this paper. • Giorge Maone (NoScript) • Juliano Rizzo (Netifera) In addition, we would also like to thank Gary McGraw for providing useful insight into the paper. A sincere gratitude to all the researchers who are engaged in constructive research for the security community. Lastly, we sincerely want to thank our security teams at SecNiche Security Labs and Security Compass respectively for supporting us in doing security research. 3
  • 4. 2 Overview In present times, software security has become an indispensable part of software development life cycle. The penetration testing approach varies with respect to web development frameworks and platforms. With the advent of advanced level of attacks, it has become crucial to raise the standards of penetration testing. An aggressive security testing approach is required to detect the inherent vulner- abilities and to develop robust security solutions in order to thwart sophisticated attacks. Owing to the seamless pace of security research, a plethora of vulnera- bilities are being unearthed in web frameworks and software. Thus, for effective penetration testing, the security model and web framework architecture should be dissected appropriately. OWASP has been used widely as the de facto standard of penetration testing of web applications and frameworks with its Top 10 attack vectors. However, the penetration testing methodology should not be constrained to this standard and must cover the advanced set of attack vectors that should be tested to val- idate the strength of web frameworks. This paper is divided into two parts. In the first part, we discuss the internals of JSF, a Java based web application framework and its inherent security model. In the second part, we discuss about the security weaknesses and applied security features in the JSF. In addition, we also raise a flag on the security issues present in JSF in order to conduct effective penetration testing. 4
  • 5. 3 Inside JSF Framework Java Server Faces (JSF) is an industry standard and a framework for building component-based user interfaces for web applications. JSF has certain standards and is implemented using Reference Implementation (RI) by Sun Microsystems, Apache MyFaces and Oracles ADF Faces. JSF primarily consists of Java Beans, Event Driven development and JSF component tree. With the advent of JSF, the control has been handed over to the devel- opers for implementing security features such as authorization. As a result of this change, it has become more crucial for the developers to understand the implementation of security controls in JSF framework. A good security design practice requires that authorization (security controls) should be handled at a central location (Servlet Filter associated with the application front controller). JSF has built-in extension points provided by the JSF architecture. As JSF has no proprietary security architecture, the security has to be imposed in a customized fashion. This is usually done in two ways • The developer can design a custom ViewHandler that adds security checks for createView and restoreView. However, it is not considered as the best security practice because there is no guarantee that the custom security ViewHandler is executed before the default ViewHandler. This leads to security exceptions while handling requests from the web clients • The developer can design a phaseListener that adds security definitions to restoreView and invokeAction phases. This can be implemented in JSF faces-config.xml file or the developer can do it dynamically by writing a customPhase listener. 3.1 JSF Security Architecture JSF is used for designing web based rich internet applications over the J2EE framework. Java applications are mostly designed using Model, View, and Con- troller (MVC) architecture due to the need for real time deployment. J2EE security can be implemented through Java Authentication and Authorization Service (JAAS) and container-managed security. JAAS implements fine-grained access control through external Java permission classes, which provides user with a list of resources and allowed actions. Before J2EE, the security controls were implemented within the logic itself. J2EE framework has a declarative security mechanism in which security controls are applied through web.xml deployment descriptors which in turn are handled by the J2EE container at runtime. In container managed security, controls are applied using authorization which is explicitly enforced on the URL patterns (requests that are issued by the web client). Generally, the controller is responsible for implementing security controls whereas the view and model part are used for hiding information and applying logic based on the access roles of the user respectively. However, a good design 5
  • 6. practice suggests that the security should be implemented over all three layers. as presented in figure 1. Figure 1: MVC - Model View and Controller Architecture JSF has implemented the concept of validators which can be used to verify user input at a view level and model level. 3.1.1 JSF Faces-Config.xml and Web.xml The rich life cycle of various individual phases are explicitly specified in the faces- config.xml file. Some of the events included in the file are Restore View, Apply Request Values, Process Validation, Update Model Values, Invoke Application, and Render Response. Developers should always consider the fact that faces- config.xml file has no mention of security and all security constraints must be specified in web.xml file. 6
  • 7. 4 Penetration Testing JSF Framework In this section, we are going to present the variation in the applied security model in JSF frameworks, security weaknesses and the right way to test them. 4.1 JSF ViewState Anatomy JSF uses ViewState functionality as similar to ASP.NET. However, there are certain differences in the way JSF and ASP.NET handle ViewState. Generally, as we all know, the ViewState parameter is used to maintain the state of HTTP request specific to a web page. This functionality proves beneficial, but it re- quires appropriate implementation in the deployed environment. It has been noticed that ViewState analysis of ASP.NET and JSF is misunderstood. 4.1.1 Differential Behavior - ViewState in ASP.NET and JSF There are number of differences in ViewState implementation in JSF and ASP.NET which should be taken into consideration while performing analysis of the View- State. These are discussed as follows • JSF does not encrypt the ViewState parameters by default. JSF works on the concept of serialization and compression. In general scenarios, once the information is serialized, it is compressed using the GZIP algorithm before being pushed onto a base-64 encoder. Mojarra displays this behavior, whereas latest versions of Apache My faces perform encryption by default but MAC is not enabled (prone to padding oracle attack). • Compression plays a critical role in optimizing requests in JSF and this is primarily implemented through the ”com.sun.faces.compressViewState” context parameter. JSF also uses the ”com.sun.faces.compressJavaScript” context parameter to remove the whitespaces in rendering JavaScript. However, this parameter does not have much impact on security testing. • In Apache JSF and Mojarra (SUNs RI), the encryption of ViewState is only possible through explicit declaration in the Java Naming and Dec- laration Interface (JNDI) using a password string as presented in listing 1. <env−e n t r y > <env−e n t r y −name>com . sun . f a c e s . C l i e n t S t a t e S a v i n g P a s s w o r d </env− e n t r y −name> <env−e n t r y −type>j a v a . l a n g . S t r i n g </env−e n t r y −type> <env−e n t r y −v a l u e >[ P r o v i d e Random Value ] </ env−e n t r y −v a l u e > </env−e n t r y > Listing 1: Implementing Encryption using JNDI • In ASP.NET applications, session state is enabled by default which re- quires session cookies to navigate through browser sessions, which is well 7
  • 8. understood. In ASP.Net, the ”ViewStateEncryptionMode.Auto” mode is set by default which decides whether a specific web page has to have an encrypted ViewState or not in order to reduce the processing load. How- ever, it is always advised to encrypt the full ViewState in every webpage by declaring the ”<%@Page ViewStateEncryptionMode=”Always” %>” property. This ensures that ViewState data could not be retrieved. • In ASP.NET, Message Authentication Code (MAC) is also computed by default and appended in the base 64 encoding in order to avoid the tam- pering of ViewState with arbitrary data. The biggest problem in imple- menting MAC is that it has to be explicitly specified on the webpage with the ”enabledViewStateMac” parameter to be true otherwise MAC is not enabled by default. It is advised that the MAC key should be larger in size in order to reduce the attack surface. Usually, the GUID of the machine is used as a MAC key. Some of the generic ViewState decoders which fail in JSF may work fine in ASP.NET ViewState decoding. ViewState decoder designed by plural-sight [2] fails for JSF and works fine for ASP.NET as it only works in .NET environment. Figure 2 shows that tool raises red alert while handling JSF ViewState and should not be used for the analysis of JSF ViewState. Figure 2: ViewState Decoder Fails for JSF 8
  • 9. Netifera group has also released a tool termed as POET [3] which should be used for testing ViewState in JSF. Figure 2 shows the successful decoding of ViewState in JSF. However, some of the data is gzipped which can be fur- ther unzipped fully. Even this information raises an alert about the insecure implementation of ViewState in JSF. Figure 3: Successful Decoding of ViewState One can also use the Deface [4],[5] tool for testing ViewState in JSF which is released by SpiderLabs for aggressive testing of JSF framework. 4.2 Scrutinizing Padding - Testing Oracle With the advent of new technologies, more sophisticated attack patterns are being noticed in the routine life. Last year, the discovery of padding oracle at- tacks [6] has dismantled the implementation of encryption in web frameworks. 9
  • 10. Due to the padding problem, it is possible to decrypt the ViewState effectively. In certain versions of ASP.NET, it is possible to download the web.config file on the local machine by decrypting the content of files using padding oracle attacks. This is implemented by exploiting the encrypted string that is passed to Scrip- tResource.axd and WebResource.axd and padding it appropriately. Microsoft released patches for the insecure cryptographic implementation in ASP.NET due to padding oracle attacks [10]. It was noticed that some of the applied patches were not correct and robust. Figure 3 shows how exactly the robustness of applied patch can be verified. As demonstrated at IEEE Security Symposium this year, it is possible to build rogue requests using padding oracle which can be further exploited to query sensitive information from the web server. This has proved the fact that erroneous implementation of cryptography [7] can seriously dismantle the system and the web is no exception. Figure 4: Checking Validity of Applied Patch [WebResource.axd/ ScriptRe- source.axd] This can be successfully done through Padbuster [8] tool in ASP.NET. However, this tool and its variant successfully work for vulnerable versions of ASP.NET, provided insecure encryption is applied. This tool has also been added in the latest version of Backtrack penetration testing framework. The padding oracle attacks can be successfully conducted in JSF. The first step is that encryption is not applied in ViewState by default (Mojarra frame- works). Even if encryption is applied in certain deployed JSF frameworks (Apache MyFaces) , the integrity is not protected using MAC as discussed earlier by default. This is the most frivolous flaw that is impacting JSF at 10
  • 11. a large scale. A number of websites using JSF in a real time environment are still vulnerable and are running in default insecure state. The ViewState en- cryption strength in JSF can be checked using POET as discussed. The tool verifies whether the encryption is applied or not. If it is applied, then it has an inbuilt module to decrypt the ViewState using oracle padding. The tool follows the concept of tampering a single byte in the encrypted JSF ViewState (last block) to verify whether ViewState padding is done appropriately or not based on HTTP error fingerprinting. JSF usually ignores the inserted block during serialization which helps the tool to go on decrypting the ViewState without any hassles. The practical usage of tool can be seen here [9]. 4.2.1 Experiment - Fuzzing Oracle We conducted a number of tests on one of the vulnerable websites to show the impacts of the padding oracle. The tests are based on manual fuzzing. The aim is to present the variation in the error responses when encrypted ViewState is tampered. One thing that should be taken into account while performing this test is that ViewState has to be encrypted. The test should not be executed against ViewState that is compressed using GZIP. In addition, the ViewState should be fuzzed using multiples of 8 because the block size that is used in CBC encryption has a similar technique. The nature of a response to a padded buffer varies between applications. Step 1: Injecting random buffer in ViewState as a multiple of 8. Figure 5 shows how the application reacts. Step 2: At this point, we got a crypto padding error in step 2, on contin- uous playing around with padding in ViewState; we received different error as presented in figure 6. Considering this scenario, one can continue fuzzing the request, until it is accepted by the application. There is a typical way of doing padding in CBC and that can be used in all scenarios as discussed here [11]. One can opt for various methods to pad CBC encryption. 4.3 JSF Anti CSRF - Truth Behind the Scenes In reality, JSF does not have an aggressive built-in CSRF protection. Anti CSRF support is required for protection against Cross Site Request Forging (CSRF) attacks. However, the implementation of anti CSRF depends a lot on the design of he in the required framework. ViewState is used for preserving the state of web pages and can be used in conjunction with another configuration parameters to prevent CSRF attacks. However, one can perform certain logic tests to initially detect whether the application is vulnerable to CSRF attacks or not. 11
  • 12. Figure 5: Fuzzing Request / Error in Block Size Generally, if the ViewState is implemented on the server side, then it is a good security practice that the application should send a ViewState ID token as a hidden element in the HTML tag so that it can accompany legitimate requests from the client side. If the application is only implementing ViewState on the server side and is not using any ViewState ID, then it is possible that CSRF is not handled appropriately. Tokens generated by using ”javax.faces.ViewState” (sequential) are easy to guess if not encrypted properly. <i n p u t t y p e=” h id de n ” name=” j a v a x . f a c e s . ViewState ” i d=” j a v a x . f a c e s . ViewState ” v a l u e=” j i d 2 ”/> Listing 2: Implementing ViewState Tracking on Server Side As presented in listing 2, the j id2 parameter is set for the ViewState track- ing on the server side. The attacker designs the next request in that session with ViewState id as j id3, j id4 and so on which will be treated as legitimate by the server. In Apache MyFaces ”org.apache.myfaces.NUMBER OF VIEWS IN SESSION” has a default value of 20 where as IBM Web sphere ”com.sun.faces.numberOfViewsInSession” has 15. These parameters specify the number of views that are stored in the session when server side state saving is used. NOTE: In JSF, it is considered that ViewState can be used to prevent CSRF 12
  • 13. Figure 6: Fuzzing Request / Error in Last Block attacks when collaboratively used with the JSESSIONID. As we have been dis- cussing, ViewState implementation matters a lot. Now it has become possible to re encrypt the tampered ViewState and deliver it back to the server. Encrypting ViewState and sending data over HTTPS are not the protection mechanisms against CSRF attacks. This has been widely misunderstood in the developer community. 4.3.1 Implementing CSRF Protection - The Right Way Strong CSRF implementation in JSF can be implemented as • Applying Anti CSRF filters such as ”org.apache.catalina.filters.CsrfPreventionFilter”. The inbuilt class uses the ”java.util.Random” if explicitly specified by the developer otherwise ”java.security.SecureRandom” will be used by default. One can also use OWASP CSRF Guard to integrate third party filters into JSF. • If the ViewState session Id is to be used with every request then it must be strongly encrypted and an appropriate MAC should be applied in order 13
  • 14. to preserve integrity. • It is also possible to design custom CSRF filters with strong functions that generate random tokens. This is possible by creating a CSRF Session listener class that overrides every request with HTTP listener class and appends a random token in every request for a particular session. There is also a possibility of adding <s: token> an element in <h:form> the tag that automatically initiates the CSRF protection. Framework that supports <s: token> are Apache Shale, MyFaces and JBOSS Seam. • The real world examples will look like as presented in listing 3 <i n p u t t y p e=” h id de n ” name=” j i d t 7 : j idt7 CSRFToken ” v a l u e=” 0 c 7 7 6 0 4 0 f f 7 7 d 3 a f 5 a c c e 4 d 4 c 5 9 a 5 1 4 1 1 e b 9 6 0 b d ” /> Listing 3: Implementing CSRF Tokens in JSF 4.4 Security Descriptors Fallacy - Configuration The declaration of security parameters in web.xml are imperative especially the security elements that are used for preserving the confidentiality and integrity of the ViewState. It has been noticed that declaration of ”ALGORTIHM” in uppercase in ”org.apache.myfaces.ALGORITHM” does not initialize the Initial- ization Vector (IV) in Apache MyFaces. This is a bad design practice and could have devastative impacts on the security of a JSF application. The source code of the ”utils.StateUItils” class (which holds security configuration elements) as presented in listing 4 which clearly reflects that these parameters have to be ap- plied in lower case but the documentation of various JSF versions is not written appropriately and is not inline with the real code. In other words, the docu- mentation is misleading. p u b l i c s t a t i c f i n a l S t r i n g INIT PREFIX = ” o r g . apache . my f ac e s . ” ; p u b l i c s t a t i c f i n a l S t r i n g INIT ALGORITHM = INIT PREFIX + ” ALGORITHM” ; p r i v a t e s t a t i c String findAlgorithm ( ExternalContext ctx ) { S t r i n g a l g o r i t h m = c t x . g e t I n i t P a r a m e t e r (INIT ALGORITHM) ; i f ( a l g o r i t h m == n u l l ) { a l g o r i t h m = c t x . g e t I n i t P a r a m e t e r (INIT ALGORITHM . toLowerCase ( ) ) ; } return findAlgorithm ( algorithm ) ; } . . Truncated .. Listing 4: Explicit Specification - Implementing to Lower Case 14
  • 15. 4.4.1 Secure Way of Configuring Security Descriptors The best practice is to declare the configuration parameters in web.xml as pre- sented in listing 5. <c o n t e x t −param> <param−name>j a v a x . f a c e s . STATE SAVING METHOD</param−name> <param−v a l u e >c l i e n t </param−v a l u e > </c o n t e x t −param> <c o n t e x t −param> <param−name>o r g . apache . my f ac es . s e c r e t </param−name> <param−v a l u e >MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIz</param− value> </c o n t e x t −param> <c o n t e x t −param> <param−name>o r g . apache . my f ac es . a l g o r i t h m </param−name> <param−v a l u e >AES</param−v a l u e > </c o n t e x t −param> <c o n t e x t −param> <param−name>o r g . apache . my f ac es . a l g o r i t h m . p a r a m e t e r s </param−name > <param−v a l u e >CBC/PKCS5Padding</param−v a l u e > </c o n t e x t −param> <c o n t e x t −param> <param−name>o r g . apache . my f ac es . a l g o r i t h m . i v </param−name> <param−v a l u e >NzY1NDMyMTA3NjU0MzIxMA==</param−v a l u e > </c o n t e x t −param> <c o n t e x t −param> <param−name>o r g . apache . my f ac es . s e c r e t . cache </param−name> <param−v a l u e >f a l s e </param−v a l u e > </c o n t e x t −param> </web−app> Listing 5: Secure Way of Declaring Encryption Parameters in JSF This point should be taken into account while doing penetration testing so that enhanced attacks can be tested against the inappropriate implementation of JSF security. NOTE: It has been noticed that JSF framework only encrypts ViewState in order to provide confidentiality but there is no standard implementation of MAC by default so that the integrity of ViewState is preserved. While we know that JSF security greatly depends on the web.xml file, the MAC functionality is also introduced in it. The developer has to explicitly specify the MAC algorithm, key and caching. The parameters that are used nowadays are ”org.apache.myfaces.MAC ALGORITHM”, ”org.apache.myfaces.MAC SECRET” and ” org.apache.myfaces.MAC SECRET.CACHE” respectively. Always declare all of these parameters in lower case. 15
  • 16. 4.5 JSF Version Tracking and Disclosure JSF configuration has inbuilt configuration parameters that are used to disclose the version of the installed framework. However, it is always taken lightly and is not fixed by the developers or administrators to avoid leakage of the informa- tion in HTTP response headers. It has been noticed that version disclosure may result in detecting critical flaws in JSF applications because publicly available exploit databases can be used to fingerprint the security vulnerabilities present in the installed JSF framework. In Suns RI JSF implementation, the ”com.sun.faces.disableVersionTracking” configuration parameter is defined explicitly. By default, it is set to false which means application running on the web server will throw the JSF version into the response headers when the web client queries for it. The collaborative disclosure of web server version and framework version can be devastative from the developers point of view but it is fruitful for pen testing purposes. JSF is not immune to security vulnerabilities [12, 13, and 14] as seen in the recent past. These security issues should be taken into consideration while deploying JSF applications because information leakage is the basis of a number of web attacks. We conducted generic tests on several websites that are using JSF and found that more than 85% of the websites are throwing JSF version number in their response headers out of which several of them were running old and vulnerable versions. 4.6 JSF Data Validation Anyone involved in security understands the importance of proper input vali- dation. JSF offers a few different techniques for validation in order to prevent web attacks such as Cross Site Scripting (XSS). Some of the input validation modules have been available since JSF 1.2, and others are unique to JSF 2.0. 4.6.1 JSF 1.2 Validation Apache MyFaces and the Apache Tomahawk library provide JSF components that can allow for data validation within the UI page itself. One of the more powerful ways of validating input is by leveraging regular expressions via the ¡t:validateRegExpr¿ tag provided by Tomahawk [15]. Consider an example where we wish to validate a ZIP code. A MyFaces example of data validation using Tomahawk [16] is presented in listing 6. <% t a g l i b u r i=” h t t p : / / my fa c es . apache . o r g /tomahawk” p r e f i x=” t ” % @ > <h : o u t p u t L a b e l f o r=” z i p 1 ” v a l u e=” Zip ”/> <t : i n p u t T e x t v a l u e=”#{o r d e r . zipCode } ” i d=” z i p 1 ”> <t : v a l i d a t e R e g E x p r p a t t e r n=” d {5} ” message=”ZIP Code”/> </t : inputText> Listing 6: Generic MyFaces Example - Tomahawk 16
  • 17. In this particular example, a regular expression is being used to limit the zip code to five digits. Notice that you can include an error message as well, and all of this is done within the .xhtml page itself. A similar example using Facelets [17] is presented in listing 7. <html . . . xmlns : u i=” h t t p : / / j a v a . sun . com/ j s f / f a c e l e t s ” xmlns : t=” h t t p : / / my f ac es . apache . o r g /tomahawk”> <h : i n p u t T e x t t y p e=” t e x t ” i d=” v a l v a l u e=”#{ SimpleBean . v a l }” r e q u i r e d =” t r u e ”> <t : v a l i d a t e R e g E x p r p a t t e r n=” [ a−zA−Z ] { 1 , 1 0 0 } ” /> </h : inputText> Listing 7: Generic Facelets Example The JSF Reference Implementation (RI), codenamed ”Mojarra”, comes with its own tag library that also leverages regular expressions. Mojarra’s <mj: regexValidator> will perform the same operation as discussed above. Further- more, Mojarra’s tag library is armed with an <mj: creditCardValidator> to validate the proper format of credit cards [18]. 4.6.2 JSF 2.0 Validation JSF 2.0 contains a collection of tags called validators. These are built in to the JSF 2.0 core library. JSF developers will find the following tags particularly useful for data validation: • <f:validateLength> : use this to validate that input falls between a mini- mum and maximum length • <f:validateLongRange> : use this to validate that numeric input falls between a minimum and maximum value • <f:validateDoubleRange> : similar to validateLongRange, but used for double values • <f:validateRegex> : use this to leverage regular expression validation Here is an example of JSF validators in use as presented in listing 8. <t r > <td>User ID : <td>User ID : <h : i n p u t T e x t v a l u e=”#{bidBean2 . u s e r I D } ” r e q u i r e d=” t r u e ” r e q u i r e d M e s s a g e=”You must e n t e r a u s e r ID” v a l i d a t o r M e s s a g e=”ID must be 5 o r 6 c h a r s ” i d=” u s e r I D ”> <f : v a l i d a t e L e n g t h minimum=” 5 ” maximum=” 6 ”/> </h : inputText ></td> <td><h : message f o r=” u s e r I D ” s t y l e C l a s s=” e r r o r ”/></td> </t r > Listing 8: Generic Usage of JSF Validators 17
  • 18. Notice in the above example that the <h: inputText> contains a required, requiredMessage and validatorMessage attribute. The required attribute indi- cates that this value must be input by the end user and an error message is displayed if it is not provided. 4.6.3 Custom Validations All of the above approaches work well when the values are not tied closely to business logic, or if these validators and tag libraries are suitable to perform the validation we need. Sometimes there is a need to build custom validation components for data types that arent supported by standard JSF validators [19]. In this scenario, the validator attribute of the <h: inputText> tag references a validator method that is defined within the bean class [20] as presented in listing 9. <t r > <td>Bid Amount : <td>Bid Amount : $<h : i n p u t T e x t v a l u e=”#{bidBean2 . bidAmount} ” r e q u i r e d=” t r u e ” r e q u i r e d M e s s a g e=”You must e n t e r an a m o u n t c o n v e r t e r M e s s a g e=”Amount must be a number” v a l i d a t o r=”#{ bidBean2 . v a l i d a t e B i d A m o u n t }” i d=”amount”/> </td> <td><h : message f o r=”amount” s t y l e C l a s s=” e r r o r ”/></td> </t r > Listing 9: Example : Bid Bean Class In the BidBean2 class, we would define our custom validation method as presented in listing 10, validateBidAmount(): p u b l i c v o i d validateBidAmount ( F a c e s C o n t e x t c o n t e x t , UIComponent componentToValidate , UIComponent componentToValidate , O b j e c t v a l u e ) throws ValidatorException { d o u b l e bidAmount = ( ( Double ) v a l u e ) . d o u b l e V a l u e ( ) ; double previousHighestBid = currentHighestBid ( ) ; i f ( bidAmount <= p r e v i o u s H i g h e s t B i d ) { FacesMessage message = new FacesMessage ( ” Bid must be h i g h e r than current ” + new FacesMessage ( Bid must be h i g h e r than current + ” h i g h e s t b i d ( $ ” + previousHighestBid + ”) . ”) ; throw new V a l i d a t o r E x c e p t i o n ( message ) ; } } Listing 10: Custom Bean Validator Class 18
  • 19. As we can see, this approach allows more flexibility while validating input data. The validators play a significant role in curing many security vulnerabili- ties at the source level. 19
  • 20. 5 Conclusion In this paper, we have presented the security issues in JSF architecture. Web frameworks have unique semantics and security models. A thorough under- standing of the internal architecture of the frameworks is imperative to under- take productive penetration testing. We have discussed the advance features that should be tested for complete and extensive penetration testing of JSF. In general, JSF is similar to ASP.NET from security perspective but differs in deployment of inherent security controls. Every web framework is required to be dissected so that step by step testing can be performed in a robust manner. 20
  • 21. 6 About the Authors Aditya K Sood is a Senior Security Practitioner and PhD candidate at Michi- gan State University. He has already worked in the security domain for Ar- morize, COSEINC and KPMG. He is also a founder of SecNiche Security Labs, an independent security research arena for cutting edge computer security re- search. He has been an active speaker at industry conferences and already spo- ken at RSA, HackInTheBox, ToorCon, HackerHalted, Source, TRISC, AAVAR, EuSecwest, XCON, Troopers, OWASP AppSec USA, FOSS, CERT-IN, etc. He has written content for Virus Bulletin, HITB Ezine, Hakin9, ISSA, ISACA, CrossTalk, Usenix Login, and Elsevier Journals such as NESE and CFS. He is also a co author for debugged magazine. He is also associated with Cigital Labs for doing applied security research in the field of software and application security. Email: adi ks [at] secniche.org Personal Website: http://www.secniche.org Company Website : http://www.cigital.com Krishna Raja is a Senior Application Security Consultant at Security Com- pass with an extensive background in Java EE application development. He has performed comprehensive security assessments for financial, government, and health care organizations across Canada and the United States. Krishna has carried out the role of security advisor, security analyst, project manager and trainer. He has given lectures and taught courses at RSA, Source Boston, ISSA Secure San Diego and OWASP AppSec DC. Krishna graduated from the Uni- versity of Western Ontario in 2004 with an Honors BSc. in Computer Science with Software Engineering specialization. He is also an ISC2 Certified Secure Software Lifecycle Professional (CSSLP). Email: krish [at] securitycompass.com Company Website: http://www.securitycompass.com 21
  • 22. 7 References [1] Apache Java Server Faces, http://myfaces.apache.org/ [2] ViewState Decoder, http://www.pluralsight-training.net/community/media/p/51688.aspx [3] POET Tool, http://netifera.com/download/poet/poet-1.0.0-win32-x86.jar [4] Deface Tool, https://github.com/SpiderLabs/deface [5] Beware of Serialized GUI Objects Bearing Data, http://www.blackhat.com/presentations/bh- dc-10/Byrne David/BlackHat-DC-2010-Byrne-SGUI-slides.pdf [6] Padding Oracle Attacks, http://www.usenix.org/event/woot10/tech/full papers/Rizzo.pdf [7] Cryptography in the Web: The Case of Cryptographic Design Flaws in ASP.NET, http://www.ieee-security.org/TC/SP2011/PAPERS/2011/paper030.pdf [8] Automated Padding Oracle Attacks with PadBuster, http://www.gdssecurity.com/l/b/2010/09/14/ automated-padding-oracle-attacks-with-padbuster/ [9] Cracking ViewState Encryption in JSF, http://www.youtube.com/watch?v=euujmKDxmC4 [10] Microsoft Patch Padding Oracle Attacks, http://www.microsoft.com/technet/security/bulletin/ms10- 070.mspx [11] Using Padding in Encryption, http://www.di-mgt.com.au/cryptopad.html [12] Sun Java Server Faces Cross-Site Scripting Vulnerability, http://www.securityfocus.com/bid/28192 [13] Apache MyFaces Tomahawk JSF Framework Cross-Site Scripting (XSS) Vulnerability , http://labs.idefense.com/intelligence/vulnerabilities/display.php?id=544 [14] Sun Glassfish Enterprise Server - Multiple Linked XSS vulnerabilies, http://dsecrg.com/pages/vul/show.php?id=134 [15] MyFaces Tomahawk, http://myfaces.apache.org/tomahawk/index.html [16] Tomahawk ValidateRegExpr, http://www.developersbook.com/jsf/myfaces/tomahawk- tag-reference/tomahawk-validateRegExpr.php#1 [17] Facelets, http://facelets.java.net/ [18] JSF Majorra Extension Tags Validation and Focus, http://java.sys-con.com/node/1031733 22
  • 23. [19] JSF Validation Tutorial, http://www.mastertheboss.com/web-interfaces/293- jsf-validation-tutorial.html?showall=1 [20] JSF: Validating User Input, http://courses.coreservlets.com/Course-Materials/pdf/jsf/08- Validation.pdf 23