SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
RIA Security -
                  Broken By Design
                                  Joonas Lehtinen
                                  Vaadin Ltd, CEO




  @joonaslehtinen
  #geecon #vaadin



perjantaina 13. toukokuuta 2011
a system is
                     secure if it is
                   designed to be
                      secure and
                     there are no
                             bugs

perjantaina 13. toukokuuta 2011
no system
                 should be
                 designed to
                 be insecure

perjantaina 13. toukokuuta 2011
not all bugs
                 are security
                 holes


perjantaina 13. toukokuuta 2011
not all
                 security holes
                 are found and
                 exploited

perjantaina 13. toukokuuta 2011
security
                 broken by
                 design?


perjantaina 13. toukokuuta 2011
advertises
                 security holes and
                 makes avoiding
                 them harder

perjantaina 13. toukokuuta 2011
1.                            2.                   3.
   RIA                            Security             Breaking in
   GWT                              • Architecture       • PayMate
                                    • Complexity         • Attacks
   Vaadin                           • Attack surface




perjantaina 13. toukokuuta 2011
Rich
                                    Internet
                                  Application


perjantaina 13. toukokuuta 2011
web                                             3D
platform                                     games


                                  business
                                  software

 web
 pages



                                                     User Interface
                                                        Complexity
perjantaina 13. toukokuuta 2011
Web                             Ajax            Full
      Sites                           Sugar           RIA
                                                       Plugin JavaScript

                PHP                                   Flex        SmartClient

                                      JQuery        Silverlight
                                                                  GWT
                             Wicket                     JavaFX
                                                                     ExtJS
     JSP
                                             Dojo      Client Side
                         JSF
                                                       Server Side
                                       YUI
    Spring MVC
                                                      ZK
                                                             ICEFaces

perjantaina 13. toukokuuta 2011
UI logic runs in browser
                             (as JavaScript or in plugin)


                                      Client Side


                                      Server Side


                  UI logic runs in server
            (framework updates UI in browser)

perjantaina 13. toukokuuta 2011
Google
                                    Web
                                  Toolkit


perjantaina 13. toukokuuta 2011
Google Web Toolkit                Hosted                   Web
                                         Mode                   Browser
                                        Browser




             Subset of                             IE6         Web Server
        java.lang, java.util

                                    Java to        IE7
                 Widgetset        JavaScript
                                   Compiler
                                                  Firefox
                                                            Your Application
       Your Application UI                                       Logic
                                                  Safari


                                                                  DB




perjantaina 13. toukokuuta 2011
Vaadin



perjantaina 13. toukokuuta 2011
Vaadin Framework
   Web Browser                                 Java Server or Portal


      Your                                        Servlet                Servlet /
      Custom                                                             Portlet /
      Theme                                        Vaadin                JSF /
      (optional)
                                                   Widgets               JSP / ...
                                                   (vaadin.jar)          (optional)




      Google Web Toolkit

        Vaadin                    Your             Your User Interface
        Widgets                   Custom
        (Rendering)               Widgets
                                  (optional)
                                                  Your Business Logic




perjantaina 13. toukokuuta 2011
Security

perjantaina 13. toukokuuta 2011
“Web 1.0”
                                                         Visible data
                                                         filtering by
                                                            access
                     Client               5
                                                                            Server           SQL injection

                                     HTML Page
                        DOM       over HttpResponse                  View                4


                                                                                                    3
                                                                                Model

                                    Parameters over
                                     HttpRequest
                                                                Controller
                                                                                     2
                                                                                                 DB
                                          1
                                                        Parameter
                                                       parsing and
                                                        validation

                                                      Authentication




perjantaina 13. toukokuuta 2011
Client Side RIA
             All view and
                                                                              Visible data
            controller code
                                                                              filtering by
             is sent to all
                                                                                 access
                 clients
                                  Client                       4                              Server
                                                         Requested data
                                   View                    to view as
                                                          XML / JSON
                                      5
                                                                                                       SQL injection

                                   DOM                                                Model
                                                                                                  3
                                      1

                                                       Changes to model
                              Controller             encoded as parameters
                                                                                                                DB
                                                               2
                                                                               Parameter
                                      Client (and thus
                                                                              parsing and
                                          view and
                                                                             re-validation
                                       controller) can
                                       not be trusted
                                                                             Authentication




perjantaina 13. toukokuuta 2011
Rule #1
                   Never trust the
                     browser
perjantaina 13. toukokuuta 2011
Server Side RIA
                                                                                                            Visible data
                                                                                                            filtering by
                                                                                                               access



                     Client                                     8
                                                                                                        Server               SQL injection
                                  9                                                            7
                                      TerminalAdapter




                                                                             TerminalAdapter
                                                           HTML Page
                                                        over HttpResponse                            View                6


                                                           Automated by                                                             5
                     DOM                                 the RIA framework                                         Model

     Handled by the framework                            Parameters over
                                                          HttpRequest                              Controller
                                  1                                                                                  4
                                                                                               3                                 DB
                                                                2




perjantaina 13. toukokuuta 2011
Rule #2
              Complexity is a
              hiding-place for
               security-flaws
perjantaina 13. toukokuuta 2011
complexity
  Aspect                          Server Side   Client Side
  No access to server resources        -            X
  Web-service API design               -            X
  Communication design                 -            X
  Client-side validation               -            X
  Server-side validation              X             X
  Untrusted runtime                    -            X
  Exposed runtime                      -            X
  Highly dynamic language              -            X
perjantaina 13. toukokuuta 2011
Rule #3
                  Large surface:
                  easy to attack,
                  hard to defend
perjantaina 13. toukokuuta 2011
Attack Surface: Web 1.0

         •        Web page HTML (presentation)

         •        Form parameters

         •        Parameter parsing

         •        Parameter validation

         •        Cross-site scripting (XSS)




perjantaina 13. toukokuuta 2011
Attack Surface: Client Side RIA

         •        Web page DOM (presentation)




                                                                      same as web 1.0
         •        Form parameters (for hybrid solutions)

         •        Parameter parsing

         •        Parameter validation

         •        Cross-site scripting (XSS)

         •        UI logic can be

             •        Evaluated: Black-box changes to white-box!

             •        Changed

         •        Web services - a lot of API is exposed and can be
                  called directly
perjantaina 13. toukokuuta 2011
Attack Surface: Server Side RIA

         •        Web page DOM (presentation)

         •        Form parameters (for hybrid solutions)

         •        Parameter parsing

         •        Parameter validation

         •        Cross-site scripting (XSS)

         •        UI logic can be

             •        Evaluated: Black-box changes to white-box!

             •        Changed

         •        Web services - a lot of API is exposed and can be
                  called directly
perjantaina 13. toukokuuta 2011
Breaking In

perjantaina 13. toukokuuta 2011
Local demo
                       http://localhost:8080/paymate/

                    Online demo
                      http://vaadin.com/web/joonas/wiki/-/wiki/Main/RIA%20Security




                                        [ no relation to paymate.com.au or paypal.com ]



perjantaina 13. toukokuuta 2011
GWT version
                                              Client-side RIA version                      Vaadin version
                                                                                           Server-side RIA version
                       Running on Client      Client Side Web Toolkit ]
                                                 [ Google RIA                              Server[Side RIA
                                                                                                  IT Mill Toolkit ]



                                               User Inteface
     [ Custom code ]




                                           Web Service API Async

                                             Web Service API
                       Running on Server




                                           Web Service API Impl                              User Inteface
     [ Custom code ]




                                                                          Business Logic



                                                                               DB


perjantaina 13. toukokuuta 2011
Case #1
                                  Injection

perjantaina 13. toukokuuta 2011
perjantaina 13. toukokuuta 2011
SELECT NAME,ID
              FROM ACCOUNT
               WHERE NAME='
             ' OR TRUE OR ''='
           ' AND PASSWORD=''

perjantaina 13. toukokuuta 2011
attack
                 SQL injection


perjantaina 13. toukokuuta 2011
Injection

         •        Cures:
               •        Isolation: Keep data and execution
                        separate
               •        Validation: Reject suspicious data
               •        Escaping: Modify the data to keep it from
                        affecting the execution


                                       Client Side RIA       vulnerable
                                        Server Side RIA      vulnerable

perjantaina 13. toukokuuta 2011
Case #2
                                  Double
                                  validation
perjantaina 13. toukokuuta 2011
Missing double validation

         •        It is often convenient to do some data
                  validation in the user interface logic
         •        Attacker can always bypass any validation
                  done in the browser
         •        Thus everything must be validated (again)
                  in the server!
         •        Lack of double validation is almost impossible
                  to notice in testing or normal use


perjantaina 13. toukokuuta 2011
attack
                 rewriting client-
                 side validation

perjantaina 13. toukokuuta 2011
attack
                 forging http
                 transport

perjantaina 13. toukokuuta 2011
POST Data
4ï¿¿0ï¿¿7ï¿¿http://localhost:8080/paymate/client-
side/com.paymate.gwt.PayMateApplication/ï
¿¿29F4EA1240F157649C12466F01F46F60ï
¿¿com.paymate.gwt.client.PayMateServiceï
¿¿sendMoneyï¿¿Dï¿¿java.lang.Stringï
¿¿joonas@vaadin.comï¿¿1ï¿¿2ï¿¿3ï¿¿4ï¿¿2ï¿¿5ï¿¿6ï
¿¿999999ï¿¿7ï¿¿
  -99999


perjantaina 13. toukokuuta 2011
var xhr = document.body.childNodes[5].contentWindow.XMLHttpRequest;
Override the original XMLHttpRequest implementation
xhr.prototype.originalSend = xhr.prototype.send;
xhr.prototype.send = function(a) {

!      Create UI for our hack tool
       var panel = document.createElement("DIV");
!      panel.innerHTML = "<textarea id='postdata' cols=80 rows=20> "+
         "</textarea><br/><button id='postbutton'>Post</button>";
!      document.body.appendChild(panel);
!      document.getElementById('postdata').value=a;

       Do the sending when the button is pressed
!      var t = this; document.getElementById('postbutton').
       addEventListener("click",function() {
!      ! t.originalSend(document.getElementById('postdata').value);
!      ! document.body.removeChild(panel);
!      }, true);
};
perjantaina 13. toukokuuta 2011
Double validation

         •        Cures:
               •        Never skip server-side validation
               •        Code review is a must - testing does not
                        help
               •        Never think server-validation could be seen
                        as “extra work” that will be added later in
                        the project

                                        Client Side RIA      vulnerable
                                         Server Side RIA    not vulnerable

perjantaina 13. toukokuuta 2011
Case #3
                                  Forging
                                  references
perjantaina 13. toukokuuta 2011
Client




                                                  1. Client asks for service


                                                                               2. Service request is delegated to business logic
                                    Web Service API

                      3. List of accessible object is requested
                                                                      Business Logic Process

                                                                           ref                  ref
         Data Model




                                  Object List                     Object A                    Object B




perjantaina 13. toukokuuta 2011
Client

                                                                        3. More info about object is requested,
                                                                                 with forged reference



               1. Client asks for list of objects,
                   references are returned           ref                       ref


                                           Web Service API          Web Service API

                                                                                     4. Info about wrong object is
                                                                                   retrieved. Data model trusts the
        2. List of accessible object is requested                                              reference!

                                                                                      ref
                  Data Model




                                     Object List             Object A                Object B




perjantaina 13. toukokuuta 2011
attack
                 requesting data
                 with forged ids

perjantaina 13. toukokuuta 2011
Forging references

              •        Cures:
                    •        Never pass any data-model level
                             references to the client
                    •        Do all the access checks for each call
                             from client


                                          Client Side RIA     vulnerable
                                           Server Side RIA   not vulnerable

perjantaina 13. toukokuuta 2011
These bugs are
                 just plain stupid!
                    [our team is smart enough to avoid them]




perjantaina 13. toukokuuta 2011
really?
  I can assure that                                     Yes   No
  I would never do mistakes like these
  Not even under pressure, late at night, on deadline
  And neither would the rest of the team, no-one
  Or the guys working for our off-shore contractor
  And we rigorously double review all of our code
  And trust we would spot 100% of these
  And we review all legacy code too
  We will newer have any “black boxes” in our system

perjantaina 13. toukokuuta 2011
Rule #4
                            There will be
                               bugs
perjantaina 13. toukokuuta 2011
summary


perjantaina 13. toukokuuta 2011
Rule #1
                                  Never trust the browser
                                  Rule #2
                                  More complexity - less security
                                  Rule #3
                                  Large surface is hard to defend
                                  Rule #4
                                  There will be bugs


perjantaina 13. toukokuuta 2011
Questions
               Comments




                                  joon as@vaadin.com
                                      +358-40-5035001
                                       sky pe://joonaslehtinen


perjantaina 13. toukokuuta 2011

Mais conteúdo relacionado

Mais procurados

A Isings Joomla Presentation[1]
A Isings Joomla Presentation[1]A Isings Joomla Presentation[1]
A Isings Joomla Presentation[1]guest4cbfd6
 
Magnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewMagnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewPhilipp Bärfuss
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_eeYogesh Bindwal
 
Community Code: Pega Mobile
Community Code: Pega MobileCommunity Code: Pega Mobile
Community Code: Pega MobileSencha
 
JavaEE 6 and GlassFish v3 at SFJUG
JavaEE 6 and GlassFish v3 at SFJUGJavaEE 6 and GlassFish v3 at SFJUG
JavaEE 6 and GlassFish v3 at SFJUGMarakana Inc.
 
UI innovation with SAP NetWeaver Gateway
UI innovation with SAP NetWeaver GatewayUI innovation with SAP NetWeaver Gateway
UI innovation with SAP NetWeaver GatewayJohn Moy
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudArun Gupta
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overviewodedns
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 
Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Atit Patumvan
 
Java EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureJava EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureIndicThreads
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shahowaspindia
 
Netbeans-platform ref_card
  Netbeans-platform ref_card  Netbeans-platform ref_card
Netbeans-platform ref_cardrajankadam
 

Mais procurados (20)

A Isings Joomla Presentation[1]
A Isings Joomla Presentation[1]A Isings Joomla Presentation[1]
A Isings Joomla Presentation[1]
 
J2ee seminar
J2ee seminarJ2ee seminar
J2ee seminar
 
Magnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - OverviewMagnolia CMS 5.0 - Overview
Magnolia CMS 5.0 - Overview
 
Introduction to java_ee
Introduction to java_eeIntroduction to java_ee
Introduction to java_ee
 
Community Code: Pega Mobile
Community Code: Pega MobileCommunity Code: Pega Mobile
Community Code: Pega Mobile
 
JavaEE 6 and GlassFish v3 at SFJUG
JavaEE 6 and GlassFish v3 at SFJUGJavaEE 6 and GlassFish v3 at SFJUG
JavaEE 6 and GlassFish v3 at SFJUG
 
Imdad resume
Imdad resumeImdad resume
Imdad resume
 
J2ee
J2eeJ2ee
J2ee
 
UNINETT WebApp Park
UNINETT WebApp ParkUNINETT WebApp Park
UNINETT WebApp Park
 
UI innovation with SAP NetWeaver Gateway
UI innovation with SAP NetWeaver GatewayUI innovation with SAP NetWeaver Gateway
UI innovation with SAP NetWeaver Gateway
 
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the CloudTDC 2011: The Java EE 7 Platform: Developing for the Cloud
TDC 2011: The Java EE 7 Platform: Developing for the Cloud
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overview
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADFAnkara JUG Ağustos 2013 - Oracle ADF
Ankara JUG Ağustos 2013 - Oracle ADF
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)Introduction to Java EE (J2EE)
Introduction to Java EE (J2EE)
 
Java J2EE
Java J2EEJava J2EE
Java J2EE
 
Java EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureJava EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The Future
 
J2ee architecture
J2ee architectureJ2ee architecture
J2ee architecture
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shah
 
Netbeans-platform ref_card
  Netbeans-platform ref_card  Netbeans-platform ref_card
Netbeans-platform ref_card
 

Destaque

Database Security Slide Handout
Database Security Slide HandoutDatabase Security Slide Handout
Database Security Slide HandoutAnne Lee
 
Server-Client Hybrid UI
Server-Client Hybrid UIServer-Client Hybrid UI
Server-Client Hybrid UIjojule
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CNjojule
 
Internship Report on Building Construction
Internship Report on Building ConstructionInternship Report on Building Construction
Internship Report on Building ConstructionEsmael Aragaw
 
Building Construction
Building ConstructionBuilding Construction
Building ConstructionWilden How
 

Destaque (6)

Database Security Slide Handout
Database Security Slide HandoutDatabase Security Slide Handout
Database Security Slide Handout
 
Server-Client Hybrid UI
Server-Client Hybrid UIServer-Client Hybrid UI
Server-Client Hybrid UI
 
Id theft handout individual june 2011
Id theft handout individual june 2011Id theft handout individual june 2011
Id theft handout individual june 2011
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
 
Internship Report on Building Construction
Internship Report on Building ConstructionInternship Report on Building Construction
Internship Report on Building Construction
 
Building Construction
Building ConstructionBuilding Construction
Building Construction
 

Semelhante a RIA Security - Broken By Design

Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011Arun Gupta
 
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011Arun Gupta
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overviewsbobde
 
Cross-Platform, Native Mobile Development with a DSL
Cross-Platform, Native Mobile Development with a DSLCross-Platform, Native Mobile Development with a DSL
Cross-Platform, Native Mobile Development with a DSLPeter Friese
 
WebBee rapid web app development teck stack
WebBee rapid web app development teck stackWebBee rapid web app development teck stack
WebBee rapid web app development teck stackALDAN3
 
N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)kvz
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewEugene Bogaart
 
2011 The Year of Web apps
2011 The Year of Web apps2011 The Year of Web apps
2011 The Year of Web appsJungHyuk Kwon
 
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010Arun Gupta
 
[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web IntegrationKazuchika Sekiya
 
JUG Darmstadt - Java EE 7 - Auf in die Wolken!
JUG Darmstadt - Java EE 7 - Auf in die Wolken!JUG Darmstadt - Java EE 7 - Auf in die Wolken!
JUG Darmstadt - Java EE 7 - Auf in die Wolken!Markus Eisele
 
Developing Web Application Using J2EE - Nex
Developing Web Application Using J2EE - NexDeveloping Web Application Using J2EE - Nex
Developing Web Application Using J2EE - NexNexSoftsys
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureArun Gupta
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the CloudMarkus Eisele
 
Banking on Enterprise OSGi
Banking on Enterprise OSGiBanking on Enterprise OSGi
Banking on Enterprise OSGiGary Field
 
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Arun Gupta
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and VirgoHristo Iliev
 
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeMaking Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeWesley Hales
 

Semelhante a RIA Security - Broken By Design (20)

Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011Java EE Technical Keynote - JavaOne India 2011
Java EE Technical Keynote - JavaOne India 2011
 
Groke
GrokeGroke
Groke
 
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
Java EE / GlassFish Strategy & Roadmap @ JavaOne 2011
 
Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
Jspx Jdc2010
Jspx Jdc2010Jspx Jdc2010
Jspx Jdc2010
 
Cross-Platform, Native Mobile Development with a DSL
Cross-Platform, Native Mobile Development with a DSLCross-Platform, Native Mobile Development with a DSL
Cross-Platform, Native Mobile Development with a DSL
 
WebBee rapid web app development teck stack
WebBee rapid web app development teck stackWebBee rapid web app development teck stack
WebBee rapid web app development teck stack
 
N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)N(i)2 technical architecture 2.0 (v1 1)
N(i)2 technical architecture 2.0 (v1 1)
 
Java Enterprise Edition 6 Overview
Java Enterprise Edition 6 OverviewJava Enterprise Edition 6 Overview
Java Enterprise Edition 6 Overview
 
2011 The Year of Web apps
2011 The Year of Web apps2011 The Year of Web apps
2011 The Year of Web apps
 
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
Java EE 6 & GlassFish v3: Paving the path for the future - Spark IT 2010
 
[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration[English version] JavaFX and Web Integration
[English version] JavaFX and Web Integration
 
JUG Darmstadt - Java EE 7 - Auf in die Wolken!
JUG Darmstadt - Java EE 7 - Auf in die Wolken!JUG Darmstadt - Java EE 7 - Auf in die Wolken!
JUG Darmstadt - Java EE 7 - Auf in die Wolken!
 
Developing Web Application Using J2EE - Nex
Developing Web Application Using J2EE - NexDeveloping Web Application Using J2EE - Nex
Developing Web Application Using J2EE - Nex
 
Java EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for futureJava EE 6 and GlassFish v3: Paving the path for future
Java EE 6 and GlassFish v3: Paving the path for future
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the Cloud
 
Banking on Enterprise OSGi
Banking on Enterprise OSGiBanking on Enterprise OSGi
Banking on Enterprise OSGi
 
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
Java EE 6 & GlassFish v3 at Vancouver JUG, Jan 26, 2010
 
Gemini WEB and Virgo
Gemini WEB and VirgoGemini WEB and Virgo
Gemini WEB and Virgo
 
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet BridgeMaking Portals Cool: The Compelling Advantages of a Portlet Bridge
Making Portals Cool: The Compelling Advantages of a Portlet Bridge
 

RIA Security - Broken By Design

  • 1. RIA Security - Broken By Design Joonas Lehtinen Vaadin Ltd, CEO @joonaslehtinen #geecon #vaadin perjantaina 13. toukokuuta 2011
  • 2. a system is secure if it is designed to be secure and there are no bugs perjantaina 13. toukokuuta 2011
  • 3. no system should be designed to be insecure perjantaina 13. toukokuuta 2011
  • 4. not all bugs are security holes perjantaina 13. toukokuuta 2011
  • 5. not all security holes are found and exploited perjantaina 13. toukokuuta 2011
  • 6. security broken by design? perjantaina 13. toukokuuta 2011
  • 7. advertises security holes and makes avoiding them harder perjantaina 13. toukokuuta 2011
  • 8. 1. 2. 3. RIA Security Breaking in GWT • Architecture • PayMate • Complexity • Attacks Vaadin • Attack surface perjantaina 13. toukokuuta 2011
  • 9. Rich Internet Application perjantaina 13. toukokuuta 2011
  • 10. web 3D platform games business software web pages User Interface Complexity perjantaina 13. toukokuuta 2011
  • 11. Web Ajax Full Sites Sugar RIA Plugin JavaScript PHP Flex SmartClient JQuery Silverlight GWT Wicket JavaFX ExtJS JSP Dojo Client Side JSF Server Side YUI Spring MVC ZK ICEFaces perjantaina 13. toukokuuta 2011
  • 12. UI logic runs in browser (as JavaScript or in plugin) Client Side Server Side UI logic runs in server (framework updates UI in browser) perjantaina 13. toukokuuta 2011
  • 13. Google Web Toolkit perjantaina 13. toukokuuta 2011
  • 14. Google Web Toolkit Hosted Web Mode Browser Browser Subset of IE6 Web Server java.lang, java.util Java to IE7 Widgetset JavaScript Compiler Firefox Your Application Your Application UI Logic Safari DB perjantaina 13. toukokuuta 2011
  • 16. Vaadin Framework Web Browser Java Server or Portal Your Servlet Servlet / Custom Portlet / Theme Vaadin JSF / (optional) Widgets JSP / ... (vaadin.jar) (optional) Google Web Toolkit Vaadin Your Your User Interface Widgets Custom (Rendering) Widgets (optional) Your Business Logic perjantaina 13. toukokuuta 2011
  • 18. “Web 1.0” Visible data filtering by access Client 5 Server SQL injection HTML Page DOM over HttpResponse View 4 3 Model Parameters over HttpRequest Controller 2 DB 1 Parameter parsing and validation Authentication perjantaina 13. toukokuuta 2011
  • 19. Client Side RIA All view and Visible data controller code filtering by is sent to all access clients Client 4 Server Requested data View to view as XML / JSON 5 SQL injection DOM Model 3 1 Changes to model Controller encoded as parameters DB 2 Parameter Client (and thus parsing and view and re-validation controller) can not be trusted Authentication perjantaina 13. toukokuuta 2011
  • 20. Rule #1 Never trust the browser perjantaina 13. toukokuuta 2011
  • 21. Server Side RIA Visible data filtering by access Client 8 Server SQL injection 9 7 TerminalAdapter TerminalAdapter HTML Page over HttpResponse View 6 Automated by 5 DOM the RIA framework Model Handled by the framework Parameters over HttpRequest Controller 1 4 3 DB 2 perjantaina 13. toukokuuta 2011
  • 22. Rule #2 Complexity is a hiding-place for security-flaws perjantaina 13. toukokuuta 2011
  • 23. complexity Aspect Server Side Client Side No access to server resources - X Web-service API design - X Communication design - X Client-side validation - X Server-side validation X X Untrusted runtime - X Exposed runtime - X Highly dynamic language - X perjantaina 13. toukokuuta 2011
  • 24. Rule #3 Large surface: easy to attack, hard to defend perjantaina 13. toukokuuta 2011
  • 25. Attack Surface: Web 1.0 • Web page HTML (presentation) • Form parameters • Parameter parsing • Parameter validation • Cross-site scripting (XSS) perjantaina 13. toukokuuta 2011
  • 26. Attack Surface: Client Side RIA • Web page DOM (presentation) same as web 1.0 • Form parameters (for hybrid solutions) • Parameter parsing • Parameter validation • Cross-site scripting (XSS) • UI logic can be • Evaluated: Black-box changes to white-box! • Changed • Web services - a lot of API is exposed and can be called directly perjantaina 13. toukokuuta 2011
  • 27. Attack Surface: Server Side RIA • Web page DOM (presentation) • Form parameters (for hybrid solutions) • Parameter parsing • Parameter validation • Cross-site scripting (XSS) • UI logic can be • Evaluated: Black-box changes to white-box! • Changed • Web services - a lot of API is exposed and can be called directly perjantaina 13. toukokuuta 2011
  • 28. Breaking In perjantaina 13. toukokuuta 2011
  • 29. Local demo http://localhost:8080/paymate/ Online demo http://vaadin.com/web/joonas/wiki/-/wiki/Main/RIA%20Security [ no relation to paymate.com.au or paypal.com ] perjantaina 13. toukokuuta 2011
  • 30. GWT version Client-side RIA version Vaadin version Server-side RIA version Running on Client Client Side Web Toolkit ] [ Google RIA Server[Side RIA IT Mill Toolkit ] User Inteface [ Custom code ] Web Service API Async Web Service API Running on Server Web Service API Impl User Inteface [ Custom code ] Business Logic DB perjantaina 13. toukokuuta 2011
  • 31. Case #1 Injection perjantaina 13. toukokuuta 2011
  • 33. SELECT NAME,ID FROM ACCOUNT WHERE NAME=' ' OR TRUE OR ''=' ' AND PASSWORD='' perjantaina 13. toukokuuta 2011
  • 34. attack SQL injection perjantaina 13. toukokuuta 2011
  • 35. Injection • Cures: • Isolation: Keep data and execution separate • Validation: Reject suspicious data • Escaping: Modify the data to keep it from affecting the execution Client Side RIA vulnerable Server Side RIA vulnerable perjantaina 13. toukokuuta 2011
  • 36. Case #2 Double validation perjantaina 13. toukokuuta 2011
  • 37. Missing double validation • It is often convenient to do some data validation in the user interface logic • Attacker can always bypass any validation done in the browser • Thus everything must be validated (again) in the server! • Lack of double validation is almost impossible to notice in testing or normal use perjantaina 13. toukokuuta 2011
  • 38. attack rewriting client- side validation perjantaina 13. toukokuuta 2011
  • 39. attack forging http transport perjantaina 13. toukokuuta 2011
  • 41. var xhr = document.body.childNodes[5].contentWindow.XMLHttpRequest; Override the original XMLHttpRequest implementation xhr.prototype.originalSend = xhr.prototype.send; xhr.prototype.send = function(a) { ! Create UI for our hack tool var panel = document.createElement("DIV"); ! panel.innerHTML = "<textarea id='postdata' cols=80 rows=20> "+ "</textarea><br/><button id='postbutton'>Post</button>"; ! document.body.appendChild(panel); ! document.getElementById('postdata').value=a; Do the sending when the button is pressed ! var t = this; document.getElementById('postbutton'). addEventListener("click",function() { ! ! t.originalSend(document.getElementById('postdata').value); ! ! document.body.removeChild(panel); ! }, true); }; perjantaina 13. toukokuuta 2011
  • 42. Double validation • Cures: • Never skip server-side validation • Code review is a must - testing does not help • Never think server-validation could be seen as “extra work” that will be added later in the project Client Side RIA vulnerable Server Side RIA not vulnerable perjantaina 13. toukokuuta 2011
  • 43. Case #3 Forging references perjantaina 13. toukokuuta 2011
  • 44. Client 1. Client asks for service 2. Service request is delegated to business logic Web Service API 3. List of accessible object is requested Business Logic Process ref ref Data Model Object List Object A Object B perjantaina 13. toukokuuta 2011
  • 45. Client 3. More info about object is requested, with forged reference 1. Client asks for list of objects, references are returned ref ref Web Service API Web Service API 4. Info about wrong object is retrieved. Data model trusts the 2. List of accessible object is requested reference! ref Data Model Object List Object A Object B perjantaina 13. toukokuuta 2011
  • 46. attack requesting data with forged ids perjantaina 13. toukokuuta 2011
  • 47. Forging references • Cures: • Never pass any data-model level references to the client • Do all the access checks for each call from client Client Side RIA vulnerable Server Side RIA not vulnerable perjantaina 13. toukokuuta 2011
  • 48. These bugs are just plain stupid! [our team is smart enough to avoid them] perjantaina 13. toukokuuta 2011
  • 49. really? I can assure that Yes No I would never do mistakes like these Not even under pressure, late at night, on deadline And neither would the rest of the team, no-one Or the guys working for our off-shore contractor And we rigorously double review all of our code And trust we would spot 100% of these And we review all legacy code too We will newer have any “black boxes” in our system perjantaina 13. toukokuuta 2011
  • 50. Rule #4 There will be bugs perjantaina 13. toukokuuta 2011
  • 52. Rule #1 Never trust the browser Rule #2 More complexity - less security Rule #3 Large surface is hard to defend Rule #4 There will be bugs perjantaina 13. toukokuuta 2011
  • 53. Questions Comments joon as@vaadin.com +358-40-5035001 sky pe://joonaslehtinen perjantaina 13. toukokuuta 2011