Hackproofing Lotus Domino Web Server: Ngssoftware Insight Security Research
Hackproofing Lotus Domino Web Server: Ngssoftware Insight Security Research
Hackproofing Lotus Domino Web Server: Ngssoftware Insight Security Research
Introduction
Brief This document describes how to secure the web service that comes with Lotus Domino. It is written to show Lotus Domino administrators how an attacker would attempt to subvert the security of a Domino Web server and provide insight into the mind and modus operandi of a Domino hacker. The attacks are explained in detail to aid understanding and include information on how to prevent these attacks. Some of the preventative measures explained here may require upgrades or the application of security patches, whereas others simply require a modification in the Domino Directory or tightening of access control lists What is Lotus Domino and what are Notes Databases Lotus Domino is an Application server designed to aid workgroups and collaboration on projects. It provides services such as SMTP, POP3, IMAP, LDAP, HTTP and a Notes database server. All information is stored in Lotus Notes databases. For example when a mail is sent to a Notes user it is stored in a Notes database. When users use Domino's web service they navigate through Notes databases. These databases are not of the relational type such as Oracle or Microsoft's SQL server, but rather it is document based. Documents are grouped into views and are edited and created through the use of forms. The logical structure of a Notes Database could be described as in Figure 1:
On the left hand side there are views, folders, forms and agents. Folders group views together and views contain documents. As we can see in the diagram View1 can see documents 1 through 3*, View 5 can see documents 4 through 6*, whereas View3 can see all the documents. Views and folders can be considered as high level database objects and documents as low level
Application attacks
Commands which act on the server as a whole
The OpenServer command Example: http://server/?OpenServer This command will list the databases on a Domino Server. This has security implications because being able to list the databases on the system could alert an attacker to the presence of more sensitive databases on the system - for example "customers.nsf". By default database browsing is not allowed and a request for the OpenServer command will elicit a 403 Forbidden response from the server. If the command is successful and you want to disable it open names.nsf and edit the Servers document in the Server view. From the Internet Protocols tab set "Allow HTTP
For all these commands that act on Documents ensure that the ACLs are set correctly to prevent unauthorized tampering.
Special Database Objects Notes database have special database objects. For example the default Navigator, $defaultNav, and the $searchForm template are two examples. Most of these have no security ramifications though it is helpful to know they exist and how they are used. The $icon object Example: http://server/statrep.nsf/$icon?OpenIcon This is the icon for the database. The $help object Example: http://server/statrep.nsf/$help?OpenHelp The $help object describes how to use the database. The $about object Example: http://server/statrep.nsf/$about?OpenAbout This object opens a page that tells you "about" the database. The $icon object Example: http://server/statrep.nsf/$icon This is the icon for the database. The $first object Example: http://server/statrep.nsf/view/$first?OpenDocument This opens the first document in a given view. The $defaultform object Example: http://server/statrep.nsf/$defaultform?OpenForm This returns the first form found in the database.
For any view, hidden or visible, form or agent the NoteID issued to that object is issued starting at around 0x11A and increments in 4. Try it out: Make 10 requests http://server/statrep.nsf/11A http://server/statrep.nsf/11E http://server/statrep.nsf/122 http://server/statrep.nsf/126 http://server/statrep.nsf/12A http://server/statrep.nsf/12E http://server/statrep.nsf/132 http://server/statrep.nsf/136 http://server/statrep.nsf/13A http://server/statrep.nsf/13E and so on. If the NoteID exists the page is returned. It may be a special database object such as $icon or $help, it might be a form or it might be a view. If the NoteID doesn't exist then the server will return an error, "Invalid or nonexistent document". There is one exception to this - if the server returns an "Unknown Command Exception" error then the NoteID belongs to an Agent - you can't call an Agent with its NoteID. By going all the way up from 0x11A to 0xFFF in increments of 4 (only 953 requests) you'll have found the NoteID of every hidden view, visible view, agent, form and special object - thus the higher level database structure can be enumerated. Enumerating Documents Documents also have a NoteID. To get the NoteID of a document open a view with the ReadViewEntries command. http://10.1.1.28/statrep.nsf/3.+Events/?ReadViewEntries The NoteID of every document in this view will be returned in the XML listing. One of the peculiar things with Domino is that if you reference a document that exists in one view you can access it by requesting it through another view. For example go to http://server/statrep.nsf/136?ReadViewEntries select a NoteID at random (136 is the NoteID of the "3. Events" view) and then request it like so: http://server/statrep.nsf/136/8F6 The Event document will be returned. Now request: http://server/statrep.nsf/$Alarms/ Normally with statrep.nsf there will be no documents in that view. However - now request http://server/statrep.nsf/$Alarms/8F6 and the Event document is returned! This means that it is possible to gain access to documents in one view through another and
10
Common Misconfigurations
Often, too many people allow anonymous access to sensitive databases such as the Domino Directory, names.nsf. This database controls the servers configuration and also stores the user database. It would not be a good thing to allow anonymous users to download valid Notes users' userid files - with access to these an attacker will be able to masquerade as that user. Other databases that can commonly and wrongly be accessed include but is not limited to, catalog.nsf, domlog.nsf, log.nsf, statrep.nsf, bookmark.nsf and domcfg.nsf.
User Authentication Domino supports two methods for authenticating users over the web. The first, and default method, is to send a 401 Unauthorized HTTP response back to a client if they attempt to access a resource they are not authorized to do so. This response will cause the users web browser to pop up a window prompting for a user ID and password. With the initial 401 server response also comes a realm the realm describes the protected resource and upon successful authentication every time the user requests anything in that realm (i.e. anything to do with that resource) their browser will automatically send with the request the users credentials. This type of web authentication is known as Basic Authentication and the scheme used to obfuscate the user id and password is base 64 encoding. This is not encryption. A base 64 encoded character string can be easily converted into its original. Anyone with a network sniffer on the wire between the user and the Domino server will be able capture this information. The second type of authentication used if forms based authentication. Here, when a user makes a request for a resource they are not allowed to access the server returns a 200 OK HTTP response but rather than returning the page, it returns a login form. The user would enter their ID and password in this form and submit it. If authentication is successful the server generates a cookie that is used in future requests made by the user. The server maintains a list in memory of all active sessions and uses this cookie for authorization purposes. If no activity has taken place in a given amount of time, half and hour by default then the server times out the session and the user will have to authenticate again. Like with Basic authentication the user id and password are sent over the network wire in clear text and anyone with a sniffer will be able to access this information. With both methods it is suggested that if you are going to allow users to authenticate over the web it should be done over secure socket layer (SSL) as this will prevent anyone from with a sniffer from capturing credentials as the traffic is encrypted. As a side note, with Domino 5.x, SSL version 2 is disabled and only SSL version 3 is. SSL2 should be left disabled as SSL 2 is much more easy to break than SSL3 and if an attack is successful the attacker will be able to derive the servers private key. A Note on Notes Access Control Lists Many times in this document we have drawn attention to setting ACLs correctly. Before we delve into ACLs its important to understand the difference between authentication and authorization. Authentication describes when a user passes over some credentials such as a user ID and password to be allowed access. Authorization describes what that user can do after they have been authenticated. Just because a user has be authenticated does not mean they have the
11
Conclusion
As can be seen there are many issues to tackle before a Domino web server should be exposed to the Internet and what is key to the security of the Domino server and its applications is the correct access controls being set on databases. Whilst this document contains up to date information as of October the 21st 2001 it may be out of date in a week if a new Domino vulnerability is discovered. It is suggested that Domino and Notes administrators keep abreast of current Domino security issues. The Notes website (www.notes.com) contains a wealth of security information and likewise www.dominosecurity.com. Subscribing to security mailing lists such as bugtraq (www.securityfocus.com) can help keep those who need to know in the know. NGSSoftware will also maintain a vigil and we will endeavour to keep our website (www.nextgenss.com) up to date and we have written and provide a security management tool, DominoScan, that is continually updated to help protect Domino web servers. More information about this audit tool is available from the NGSSoftware website. --------------------------------------------------------------------------------------------------------------------------------A NGSSoftware Insight Security Research Publication www.nextgenss.com
12