Here are ten Lift answers for the OWASP Top 10 vulnerabilities by David Pollak on Liftweb, Thu, 22 Oct 2009:
- Lift is resistant to XSS attacks. By default pages are composed in
XML rather than Strings. It takes the developer extra work to insert XSS
strings into output rather than having to make sure each String is properly
escaped before being cat’ed to the output.- Lift is resistant to SQL Injection attacks because mapper and JPA do
not compose Strings into SQL statements, but rather bind well typed
parameters into prepared statements. So, if you go the normal path, you get
SQL injection resistance. If you want to manually craft a String to send as
a query, in mapper you have to “sign” the string with the time, date and a
certification that you’ve reviewed the String for SQL Injection problems.- Lift never shells out. You can’t cause a file to be executed from a
Lift app unless your app manually uses Java’s Runtime.execute() call.- By default, Lift creates opaque GUIDs to refer to components on the
server side (whether that’s a function to execute when a form field is
submitted, what to do on an Ajax call, etc.) By default, it’s easier to use
this callback mechanism than advertise a primary key or other sensitive
piece of information. Lift also has the KeyObfuscator which will create a
session-specific mapping of primary keys to opaque ids. Using
KeyObfuscator, you can send JSON objects to the client with stable primary
keys that are obfuscated and not usable outside the current session.- By default Lift’s form fields contain GUIDs that are cryptographically
impossible to predict. It’s not possible to do CSRF because one does not
know the name of form fields (they are not stable)- Lift has different production vs. development mode error messages.
There’s little information that leaks about underlying configurations, even
exceptions, in production mode.- Lift uses the container’s session management (usually JSESSIONID) for
session management. As far as I know, Jetty, Tomcat, Glassfish are secure
in terms of the way they deal with sessions. Of course, anything that’s not
over SSL is vulnerable to a cookie stealing attack.- Crypto key storage is a container-level issue. See #7
- See #7
- Lift’s sitemap is the best and most secure integration of UI and
page-level access. You can look at the sitemap to determine the access
control rules for a given page (it’s declarative) and it’s enforced long
before your page gets accessed.
Liftweb also maintains a “Seven Things” site with six answers to the OWASP Top 10
- A1: Injection – Lift’s Mapper and Record do proper escaping of query strings before they are sent to the backing store.
- A2: XSS – Lift keeps the rendered page as a DOM until very late in the page rendering cycle. This allows Lift to automatically HTML escape Strings before they are sent to the browser.
- A3: Session Management – Lift uses the J/EE container’s session management, allows for generation of new sessions on login, and keeps passwords hashed at all times with per-row salt.
- A4: Direct Object References – Lift forms do not expose direct object references, but instead keep the object references server-side and issues a session-specific token that refers to the objects.
- A5: CSRF – Lift uses session-specific bindings between HTML elements and the server-side behaviors associated with those elements. The bindings cannot be predicted so it’s not possible to issue Cross Site requests that invoke session-specific bindings.
- A8: URL Access – Lift includes SiteMap which provides declarative rules for access to URLs in the application. SiteMap will deny access to URLs unless the criteria is met for accessing the specific URL.