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:
//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='';'
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.
- 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.
- 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>
- <UserRecord>
- 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.
//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.
Comments