Skip to main content

Web Services Testing vs Web Application Testing

I have just performed Web Services Security Testing. It was my first encounter with WS testing. Learned a lot from the experience I gained. It's still premature thing, I mean there' s no an pr defined standard frameworks available as how to proceed for testing. Web Services Testing is much similar to conventional web application security testing , however it differs in some aspects. Web Services presents a new and expanded sphere to explore in addition to Web Applications. So it's critical to defend the web services also apart from Web Applications. For overview of Web Services please refer to my earlier post.
The similarities I found while testing Web Services:
  • Almost same cycle of testing as Web Apps like Information Gathering etc.
  • Almost all the OWASP top 10 vulnerabilities.
  • Susceptible to MITM ( Man in the middle) attack, however was not possible in our case as we have implemented certificate based encryption.
Few dissimilarities I came through was:
  • It's not a front end, it's totally a middle ware sort of thing or you can say back end services. So testing it involves a little different approach from testing web applications. You can't see a script gets executed on the front page, you have to carefully examine the SOAP response re tuned by the server. So identifying injection attacks is critical in this case.
  • As I said it's back end service, so you need some different tools to capture it. Traditional Web Application tools like Burp, Paros etc are not much helpful. You have got to get SOAP generating tools like SOAP UI, WS Digger, for manual testing or all automated tools have Web Services scanning capacity.
  • At conceptual level it's a bit confusing when you test it first time. You have to be sure about the internal structure of Web Services. Like Web App returning filed name is considered a flaw but in WS testing case it's not flaw.
  • You have to be familiar with SOAP request,headers,Message Encryption etc. everything is different from Web Apps.
  • In contrast to SSL, WS uses Message level encryption harder to break SSL.
In addition to conventional Web Application vulnerabilities these are few vulnerabilities I found during the testing:
  • XML Injection:Occurs when user input passed to XML stream XML parsed by second-tier app, Mainframe, or DB XML can be injected through application, stored in DB When retrieved from DB, XML is now part of the stream
    • <UserRecord>
      <UniqueID>12345</UniqueID>
      <Name>Henry Ackerman</Name>
      <Email>hackerman@bad.com</Email><UniqueID>0</UniqueID><Email>hackerman@bad.com</Email>
      <Address>123 Disk Drive</Address>
      <ZipCode>98103</ZipCode>
      <PhoneNumber>206-123-4567</PhoneNumber>
      </UserRecord>
It will add another node into the above XML tree as UniqueID=0

  • X Path Injection: If your application is using any XML file to authenticate the user then it might be susceptible to X Path Injection. X Paths are similar to using SQL queries to SQL server. It retrieves records from database based on the value. If not properly validated can be used to pass the authentication.
With Simple XPath Injection: ‘ or 1=1 or ‘’=‘

//user[name=‘nilesh’ or 1=1 or ‘’=‘’ and pass=‘anypassword’]

//user[name=‘nilesh’ or userid=1 or ‘’=‘’ and pass=‘anypassword’]/userid

The above queries retrieves username and passwords for against a given value. They are similar to SQL query 'select * form table where usrename='' and password='';'

  • WSDL Scanning: Web Services Description Language (WSDL) is an advertising mechanism for web services to dynamically describe the parameters used when connecting with specific methods. These files are often built automatically using utilities. These utilities, however, are designed to expose and describe all of the information available in a method.
    In addition, the information provided in a WSDL file may allow an attacker to guess at other methods. For example, a service that offers stock quoting and trading services may advertise query methods like requestStockQuote, however also includes an unpublished transactional method such as tradeStockQuote. It is simple for a persistent hacker to cycle thru method string combinations (similar to cryptographic cipher unlocking) in order to discover unintentionally related or unpublished application programming interfaces.
However there are more attacks apart form above described like authentication, MITM, clear text, Replay, Tampering but luckily or unluckily I didn't to test it as there was already message level encryption implemented using signed X 509 certificates. :)

Comments

justincarlos said…
Web Services which do not have typical user interfaces and cannot be readily tested with traditional automation tools often pose multiple challenges. Application Testing Services

Popular posts from this blog

Using an AirPcap device in Windows with Wireshark

Capturing wireless traffic in a Windows environment is unfortunately not as easy as a setting change. As with most Windows-based software, drivers in Windows are often not open source and do not allow for configuration change into monitor mode. With this in mind, we must use a specialized piece of hardware known as an AirPcap device. Once you have obtained an AirPcap device you will be required to install the software on the accompanying CD to your analysis computer. The configurable options include: • Interface - Select the device you are using for your capture here. Some advanced analysis scenarios may require you to use more than one AirPcap device to sniff simultaneously on multiple channels. • Blink LED - Clicking this button will make the LED lights on the AirPcap device blink. This is primarily used to identify the specific adapter you are using if you are using multiple AirPcap devices. • Channel - In this field, you select the channel you want AirPcap to listen on. Extension C...

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 Go...

Some one watching where you visited!

Yes... Mozilla has been susceptible to browser-history stealing java script code. Today, Giorgio posted some cool information about the exploit. Mozilla is already working on this. This bug has been reported. Actually they have set up a web site to show the proof-of-concept. Visit www.statrpanic.com in FF,Safari or Netscape and it will tell you which websites have you been already ! But I am not sure it will work in IE or not because my IE is not responding to the website. Clearing history of visited website makes you safe to this attack. I mean this is one way..may be there are other ways to exploit this. But I have found this effective. Try it yourself in FF and then in IE and see the results.