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

Ardilla- New tool for finding SQL Injection and XSS

Three Researchers -- MIT's Adam Kiezun , Stanford's Philip Guo , and Syracuse University's Karthick Jayaraman -- has developed a new tool ' Ardilla ' that automatically finds and exploits SQL injection and cross-site scripting vulnerabilities in Web applications. It creates inputs that pinpoint bugs in Web applications and then generates SQL injection and XSS attacks. But for now Ardilla is for PHP -based Web app only. The researchers say Ardilla found 68 never-before found vulnerabilities in five different PHP applications using the tool -- 23 SQL injection and 45 XSS flaws. More information is awaited. For their attack generation techniques refer to their document at: http://www.cs.washington.edu/homes/mernst/pubs/create-attacks-tr054.pdf

File Upload through Null Byte Injection

Sometimes, during file upload we come across situation wherein there would be check on the file extension at the client side as well as server side too. If the application does allow only .jpeg extension to be uploaded, the client side java script checks for the extension of the file before passing the request. We all know that how easily this can be defeated. Some applications, checks for the extension at the server side also. That's not easy to bypass. However there are some ways with which it still can be bypassed. Most of server side scripts are written in high level languages such as Php, Java etc who still use some C/C++ libraries to read the file name and contents. That leads to the problem. In C/C++ a line ends with /00 or which is called Null Byte. So whenever the interpreter sees a null byte at the end of the a string, it stops reading thinking it has reached at the end of the string. This can be used for the bypass. It works for many servers, specially php servers. T

Combining power of Fiddler with Burp

Both are pretty powerful tools when it comes to intercept and modify http communications. But at some point of time, they become even more powerful combo if tied with each other. They complement each other. In a recent pentest I came across a similar situation where in Burp was not able to intercept a specific kind of traffic and Fiddler came to rescue. The application was designed to upload video. The initial communication was straight forward, I mean logging into application, filling up the video details etc. And all these were easily captured by Burp except the point where you hit the Upload Video and it connects to a different server and surprisingly it was not captured by Burp, not sure why, even after repeated attempts. So, I fired Fiddler to see if the it sees this request. But it's a;ways to play with requests using Burp due to it's various functionalities like, Intruder, Repeaters etc. But it was necessary to capture this request in Burp. So the below steps can be