Qwicap and the OWASP Top 10 for 2007

Chris W. Johnson
Information Technology Services
The University of Texas at Austin
September 16, 2009

The Open Web Application Security Project (OWASP) has issued two "top 10" lists of critical web application security flaws, the first in 2004, and another in 2007. Qwicap's development began in 2003, with an early emphasis on automatically providing the security features that I had previously been required to waste time re-implementing for each web application that I created. Therefore, it was not surprising that Qwicap compared favorably with the original edition of the OWASP Top 10. With the arrival of the 2007 edition, and with Qwicap's significant evolution over the intervening years, a fresh comparison of Qwicap's abilities relative to the current top 10 threats is called-for.

Issues Summary

The table below summarizes Qwicap's vulnerability to each of the OWASP Top 10 security issues. The phrase "automatically immune by default" denotes a case in which Qwicap has no in-built vulnerability, but in which a sufficiently determined application developer could, conceivably, create one. (A system able to prevent determined application developers from ever doing the wrong thing would be remarkable, indeed.)

OWASP IssueQwicap Vulnerability Summary
1.Cross-Site Scripting (XSS)Automatically immune by default.
2.Injection FlawsAutomatically immune by default.
3.Malicious File ExecutionAutomatically immune by default.
4.Insecure Direct Object ReferenceImmune by default to direct file references. No other object type is directly supported. Also, Qwicap's application structure eliminates most cases that would ordinarily tempt a developer to expose a direct object reference of any other kind.
5.Cross-Site Request Forgery (CSRF/XSRF)Automatically immune by default.
6.Information Leakage and Improper Error HandlingAutomatically immune by default.
7.Broken Authentication and Session ManagementAutomatically immune by default.
8.Insecure Cryptographic StorageNot applicable. Qwicap does not provide storage services.
9.Insecure CommunicationsSecure communication (HTTPS) is a standard feature of application servers, but developers must choose to use it.
10.Failure to Restrict URL AccessAutomatically immune by default.

Issues in Detail

In the material below, the italicized quotes, and the bold/italic protection suggestions, are all from the 2007 edition of the OWASP Top 10 document, ©2002-2007 OWASP Foundation.

1. Cross-Site Scripting (XSS)

"XSS flaws occur whenever an application takes user supplied data and sends it to a web browser without first validating or encoding that content. XSS allows attackers to execute script in the victim's browser which can hijack user sessions, deface web sites, possibly introduce worms, etc." See the Wikipedia "cross-site scripting" article for more information.

There are a number of recommended practices:

2. Injection Flaws

"Injection flaws, particularly SQL injection, are common in web applications. There are many types of injections: SQL, LDAP, XPath, XSLT, HTML, XML, OS command injection and many more. Injection occurs when user-supplied data is sent to an interpreter as part of a command or query. Attackers trick the interpreter into executing unintended commands via supplying specially crafted data."

Qwicap does not have database or directory layers, so the only type of injections it could be subject to are HTML and XML. Its protections against those are the same as its protections against cross-site scripting attacks, as discussed above.

3. Malicious File Execution

"Malicious file execution vulnerabilities are found in many applications. Developers will often directly use or concatenate potentially hostile input with file or stream functions, or improperly trust input files. On many platforms, frameworks allow the use of external object references, such as URLs or file system references. When the data is insufficiently checked, this can lead to arbitrary remote and hostile content being included, processed or invoked by the web server."

The only case in which a client may specify a file for Qwicap to act upon is the case of the standard HTTP "GET" command. Requests for files outside of the web application, or for potentially sensitive files within it (the files within the "WEB-INF" subdirectory), are caught and disallowed by the Servlet engine, e.g. Tomcat, so they never even reach Qwicap.

Developers writing Qwicap web applications could create their own malicious file execution vulnerabilities, but they'd have to invest some effort in doing so, and even those efforts might be blocked by the Java security manager, if their server has it enabled. Leaving that aside, Qwicap's design would complicate attempts to exploit such vulnerabilities, because it includes strong validation of user input (as recommended), and it requires all user input to be accompanied by a combination of page- and form-specific nonces, which means that no attempt at exploitation could be made with a static data set, because such a data set would lack the correct nonces.

4. Insecure Direct Object Reference

"A direct object reference occurs when a developer exposes a reference to an internal implementation object, such as a file, directory, database record, or key, as a URL or form parameter. An attacker can manipulate direct object references to access other objects without authorization, unless an access control check is in place."

With regard to file references, everything mentioned above in the discussion of "Malicious File Execution" is relevant. With regard to other object references – like database record IDs – because Qwicap provides no database, LDAP, etc. layers, it does not include any support for such references. Also, by always maintaining the complete execution state of its applications (not just the objects it is using, but also the local variables of its executing methods) between hits, developers have no need to embed context or state information in the pages of their applications, since they never have to rebuild that state or context. A database record ID, for instance, can kept in a local variable in the method that is sending related pages to the user (and processing the from data sets produced by those pages). So, the record ID would never leave the server. Placing it in a page would be extra, and entirely unnecessary, work for the developer, and is therefore unlikely to be a strategy that Qwicap developers would employ.

5. Cross-Site Request Forgery (CSRF or XSRF)

"A CSRF attack forces a logged-on victim’s browser to send a request to a vulnerable web application, which then performs the chosen action on behalf of the victim. [....] Applications must ensure that they are not relying on credentials or tokens that are automatically submitted by browsers. The only solution is to use a custom token that the browser will not ‘remember’ and then automatically include with a CSRF attack." See the Wikipedia "cross-site request forgery" article for more information.

There are a number of recommended practices:

6. Information Leakage and Improper Error Handling

"Applications can unintentionally leak information about their configuration, internal workings, or violate privacy through a variety of application problems. Applications can also leak internal state via how long they take to process certain operations or via different responses to differing inputs, such as displaying the same error text with different error numbers. Web applications will often leak information about their internal state through detailed or debug error messages. Often, this information can be leveraged to launch or even automate more powerful attacks."

The following information applies to versions of Qwicap beginning with 1.4b13(TEST-23) of 16-Jan-2008:

7. Broken Authentication and Session Management

"Proper authentication and session management is critical to web application security. Flaws in this area most frequently involve the failure to protect credentials and session tokens through their lifecycle. These flaws can lead to the hijacking of user or administrative accounts, undermine authorization and accountability controls, and cause privacy violations."

Session management is provided to Qwicap by the application server, e.g. Tomcat. Therefore the implementation of session management should be a sound, and well-scrutinized, one.

8. Insecure Cryptographic Storage

"Protecting sensitive data with cryptography has become a key part of most web applications. Simply failing to encrypt sensitive data is very widespread. Applications that do encrypt frequently contain poorly designed cryptography, either using inappropriate ciphers or making serious mistakes using strong ciphers. These flaws can lead to disclosure of sensitive data and compliance violations."

This falls beyond the scope of Qwicap's responsibilities, because Qwicap provides no information storage services.

9. Insecure Communications

"Applications frequently fail to encrypt network traffic when it is necessary to protect sensitive communications. Encryption (usually SSL) must be used for all authenticated connections, especially Internet-accessible web pages, but backend connections as well. Otherwise, the application will expose an authentication or session token. In addition, encryption should be used whenever sensitive data, such as credit card or health information is transmitted. Applications that fall back or can be forced out of an encrypting mode can be abused by attackers."

HTTPS encryption is available, of course, because it is a standard feature of the application servers within which Qwicap applications run.

10. Failure to Restrict URL Access

"Frequently, the only protection for a URL is that links to that page are not presented to unauthorized users. However, a motivated, skilled, or just plain lucky attacker may be able to find and access these pages, invoke functions, and view data. Security by obscurity is not sufficient to protect sensitive functions and data in an application. Access control checks must be performed before a request to a sensitive function is granted, which ensures that the user is authorized to access that function."

Qwicap provides an API for implementing/supporting the authentication and authorization scheme of your choice. That API makes it possible to independently regulate access to the web application itself, and the static content within it. Access control for specific pages (in the sense of non-static pages whose input is acted-upon by the application) is not a feature offered by Qwicap, but, for security (and other) reasons, neither does Qwicap support the concept of discrete pages within a web application being accessed by a static URL, or, generally speaking, by any URL at all. In this respect, Qwicap is immune to this issue.

Normally, there is just one URL for an entire Qwicap web application. The page with which a user is interacting, therefore, is determined by the internal state of the web application, and not by the URL, or anything else over which the user might have direct control.

Valid XHTML 1.0! Valid CSS!