Monday, June 22, 2009

Google Anti-Malware website

Google has launched a new website Anti-Malvertising which is customized search engine. It lists all the incidents related to that particular website in the past when it was used for downloading any malware. The Google Safe Browsing Diagnostic page will show you the following points related to your search:

  • What happened when Google visited sites hosted on this network?
  • Has this network hosted sites acting as intermediaries for further malware distribution?
  • Has this network hosted sites that have distributed malware?
The search engine checks third-party sites that track ad malware.

For example following is the result of a search action:


What happened when Google visited sites hosted on this network?

Of the 725 site(s) we tested on this network over the past 90 days, 127 site(s), including, for example, infinityyachts.in/, geospafitness.com/, aroundalibag.com/, served content that resulted in malicious software being downloaded and installed without user consent.

The last time Google tested a site on this network was on 2009-06-21, and the last time suspicious content was found was on 2009-06-21.

Has this network hosted sites acting as intermediaries for further malware distribution?

Over the past 90 days, we found 1 site(s) on this network, including, for example, unificap.com/, that appeared to function as intermediaries for the infection of 1 other site(s) including, for example, unifiwealth.com/.

Has this network hosted sites that have distributed malware?

Yes, this network has hosted sites that have distributed malicious software in the past 90 days. We found 2 site(s), including, for example, titl-global.com/, unificap.com/, that infected 2 other site(s), including, for example, technocraftgroup.com/, unifiwealth.com/.

So it's very helpful in detecting any website's current status or past infections and past history of serving malware. You may visit that website after tracking how frequent it is infected by a malware.

Reference: http://darkreading.com/securityservices/security/antivirus/showArticle.jhtml;jsessionid=I3MU2OES2DZTOQSNDLPCKH0CJUNN2JVN?articleID=218100360

Friday, June 19, 2009

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


Wednesday, June 17, 2009

Preventing Session Hijacking

What is Session Hijacking
Session Hijacking is an attack that when an attacker takes control of an already validated user.
When an application authenticates a user it assigns a random string called sessionID to the validated user and that sessionID is traversed every time there's an interaction between the logged in user and the application. Generally the sessionID remains valid till the user logs out. After that the particular sessionID becomes invalid. So sessionIDs are very important concept in session based application. SessionIDs itself can be captured by following ways:
  • Prediction
  • Capture
  • Fixation
If an adversary takes hold of the sessionID he can impersonate the real valid user and the application won't have any way to differentiate between the real user and the attacker. This is the general concept of Session Hijacking.

Prevention to Session Hijacking
A combination of following methods can prevent the problem:
  • Use of a long random number or string as the session key. This reduces the risk that an attacker could simply guess a valid session key through trial and error or brute force attacks to prevent Prediction.
  • The sensitive application (such as login page) must use secure communication (such as SSL) to avoid sniffing of session identifiers and user credentials to mitigate Capture.
  • Also the session identifiers can be captured if the application has the XSS (Cross Site Scripting) flaw. So the application must be not vulnerable to XSS to prevent Capture.
  • The application must expire the session identifiers after logout and regenerate new session identifiers after the user ‘authentication only’. This will mitigate the Fixation problem.
  • Register some other variables like some secret random no. like hash of user agent details of the browser can be also fruitful. As there is very rare chance that the user will move to another browser while performing an action while currently logged in to the application. Store that hash of the browser along with sessionID onto the server and match it with every incoming request of the user. If matches proceed , if not, there's high chance that somebody other has logged in currently. Invalidate the session.
  • Mark the cookies as 'HTTPOnly' so that they can't be accessed through XSS.
Although there's no single and sufficient methods to mitigate the problem, above methods and an aware user can save themselves from the attack.

Friday, June 12, 2009

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. :)