Monday, May 6, 2013

Before you move to the cloud

The term is new, but concept is not. Throughout the history of computing, IT organizations have been using their own infrastructure to host applications, data, servers etc. Now most of them are renting the infrastructure, with remote servers to host their application or data. Organizations called service providers exist especially to provide, manage and maintain the infrastructure on which their client organization’s application or data are hosted. The client organization gets access controls to manage their applications and data hosted on the remote server. This is the main idea behind cloud computing. More here....

Monday, April 8, 2013

Proxy Chaining

The issue:
While doing one assessment, we faced one issue of our ZAP proxy throwing response ‘401 Unauthorized’ while we were trying to fuzz one application. The application was using NTLM authentication, where the client needs to send the domain name, username and user-password’s hash combination to the server, in order to entertain the requests. NTLM is windows challenge/ response authentication protocol. For more info on NTLM working: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378749%28v=vs.85%29.aspx .
So, we were not able to fuzz the parameters as it was sending back ‘401 Unauthorized’ response, don’t know for what reason despite us providing the windows credentials to ZAP [Fig-1].


 Fig-1

So, we had no other option except trying other similar web proxies. We tried WebScarab and provided Windows authentication by going Tools-> Credentials [Fig-2]
                                                                                   Fig-2
When we again try to capture the request response it was working fine. Then we wanted to fuzz the parameters in one of the URLs. We need to right click on any of the requests on Summary tab and select Use as a fuzz template to send it to Fuzz tab. To our bad luck again, though Webscarab was working fine with windows authentication, in Fuzzing tab, the parameters were not appearing [Fig-3].
                                                                                Fig-3

Now the scenarios were:
·         ZAP was sending unauthorized error while fuzzing, even we had supplied windows credentials
·         Webscarab was throwing issues as the parameters , to be fuzzed, were not being displayed
A bizarre situation indeed!
Proxy chaining:
So, we are going to use something already available in the tools and we can use it effectively to overcome some of the limitations of individual tools. The proxy chain works as follows:
·         The client (browser) will forward the request to Proxy1 (ZAP)
·         Proxy1 will in turn forward it to Proxy2 (Webscarab)
·         Proxy2 will pass it to the server
So, the requirements for performing this action are:
·         The client (browser) will run on the same port as Proxy1 (ZAP), say 8880
·         We shall use Proxy chaining option in Prox1 (ZAP) to forward this request to Proxy2 (Webscarab)
·         We shall configure the same port no. (say 8008) in Proxy1 (ZAP), on which Proxy2 (Webscarab) is running
·         The Proxy2 (Webscarab) will automatically forward the request to the server

Now, the overall scenarios are similar to Fig-4:


                                                                     Fig-4
Setting proxy chain option in ZAP:
Go to Tools-> Options-> Connection-> Use an outgoing proxy server and specify the address as 127.0.0.1 and port as 8008 [Fig-5].

                                                                        Fig-5
Port 8008 is where the next proxy (Webscarab runs). We need not specify it in Webscarab as it’s by default runs at this port.
Now, we all set. Try to access the url in the browser. The browser will forward the request to ZAP on port 8880, ZAP will in turn pass it to Webscarab which is running at port 8008. Webscarab passes this to the server. Chain is complete.
Let’s see how this responds, when we again try to fuzz it in ZAP. Nice, we can now successfully fuzz the parameters, without getting the ‘401 Unauthorized’ response! We now get 200 OK responses [Fig-6].
Conclusion:
So, we saw how we can use proxy chaining to use features of both the proxies, subsequently solving individual tool issues. 



Fig-6

Reference: http://resources.infosecinstitute.com/chaining-web-proxies-to-overcome-limitations/


Monday, February 4, 2013

XSS in Ajax

The following functions needs to be inspected for XSS as they might be 'possible' pointers to XSS. They could be a pointer to possible xss attacks:
eval()
document.write()
innerHTML()
write()

Safe function:
Instead of using innerHTML, one should use innerText()
 
XSS payload in Jason and their effects:
A nice example from iSec Partners:
var inboundJSON = {"people": [
{"name": "Joel", "address": “<script>badStuff();</script>", "phone": “911"}
]
};
someObject.innerHTML(inboundJSON.people[0].address);               // Vulnerable
document.write(inboundJSON.people[0].address);                             // Vulnerable
someObject.innerText(inboundJSON.people[0].address                     // Not Vulnerable

Friday, February 1, 2013

Android Application Assessment

A nice article on a detailed assessment strategy of Android applications. Well explained and comprehensively written.

Article describes different stages in android assessment, tools, methodologies and native tools with screenshots.

You can find the article here: Android Application Assessment


Also have a look at Web application Security Course offered by InfosecInstitute.

Thursday, January 24, 2013

Arbitray File Download

I just stumbled upon one great article.
A nice article about what the arbitrary file download is and how dangerous it would be if exploited. Later the difference between arbitrary file download and LFI/ RFI has been discusses, which is a often confused topic.

What is Arbitrary File Download?
As the name suggests, if the web application doesn’t check the file name required by the user, any malicious user can exploit this vulnerability to download sensitive files from the server.

What is LFI/ RFI:

Often confused, LFI/RFI is different from the Arbitrary File Download vulnerability. However, both are used in combination if directory traversal is turned on in the server. LFI and RFI stands for Local File Inclusion and Remote File Inclusion vulnerability. Both are of similar nature, except the mode of exploitation. Both take advantage of unfiltered input file parameters used by web applications, predominantly PHP. LFI, while exploited uses any local file which is available at the same machine where the web application is hosted, RFI, on the other hand includes any remotely hosted malicious file using URLs.

We can see the major difference here. With LFI/ RFI, the resource is loaded and executed in the context of the current application. But in case of Arbitrary File Download, we are basically abusing the download functionality of a web application, which fails to restrict the user input to a specific directory. The user input goes beyond the directory and is able to download other critical files of the system.

Later a real life scenario has been discussed about how to exploit the vulnerability with pictorial representation.


Finally the countermeasures are described.



Also have a look at Web application Security Course offered by InfosecInstitute.

Monday, January 7, 2013

Anti CSRF header

Recently I came across an application which was preventing crsf attacks using a unique non-traditional approach. In traditional approach the csrf is thwarted by embedding unique random tokens, called nonce, in each sensitive page. But this application, which was making ajax calls and used jQuery, was creating a header to identify the valid and invalid requests altogether. The idea is to generate a custom header, x-session-token in this case, with every request which is considered sensitive and includes any sort of transaction. For example:

xhr.setRequestHeader('x-session-token', csrf_token)
 
At the server level, server checks for this header if found request is fulfilled, otherwise rejected.

We need to use xhr calls for making use of this technique, not useful in regular POST and GET requests. Since, I was not aware of this kind of countermeasures, probably, since most of the applications I did were using standard requests. So, I searched a bit and found even Google also uses this approach predominately. However, it seems not be best approach, where custom headers can also be exploited, but certainly, it raises the bar and simpler approach. And a new thing for my knowledge also!
Reference: https://nealpoole.com/blog/2010/11/preventing-csrf-attacks-with-ajax-and-http-headers/#comment-1675