5. Authentication

Note

The Mollom XML-RPC API interface has been deprecated, and is included here for archival purposes.

To develop clients and services that connect to Mollom, use the Mollom REST API.

All requests made to Mollom need to contain authentication information to establish the identify of the site making the request. To control the authenticity of a message and integrity of transmitted information, public and private Mollom keys are necessary. These keys can be obtained from http://mollom.com.

The mechanism that Mollom uses to provide this integrity is based on message authentication codes (MAC). Specifically, Mollom uses a MAC mechanism based on a cryptographic hash function called keyed-hash message authentication code (HMAC), documented at http://www.ietf.org/rfc/rfc2104.txt.

Both the client and the server share a secret key that is used to create an authentication hash based on the combination of a time, a cryptographic nonce and the secret key. Both client and Mollom server hash the string concatenation of time + ':' + nonce + ':' + secret key with the secret key, and if their hashes match, the transmission is validated and authentic. The secret key is explicitly concatenated to the string that is hashed by the HMAC to prevent a possible known plaintext attack on the HMAC.

Replay attacks are prevented by calculating a delta (the difference) between the site's pass time and the time on the Mollom server. Over subsequent calls, this delta is only allowed to change by one minute (but the delta is periodically reset to allow for clock changes). Additionally, a cryptographic nonce (a one-use-only randomly created number) is added. It is advisable to use a large random number or string as the nonce (recommended minimum: a 32-bit random integer). Both the time stamp and the nonce are protected by the HMAC hash.

The HMAC is only used for determining the authenticity of the Mollom user making the calls. The content itself is not protected. There are three reasons for not including the message content in the HMAC:

  1. Many spam comments are very large, and busy sites receive thousands of them a day. Calculating the HMACs of all these messages' contents would become prohibitively computationally intensive.
  2. Due to varying handling methods for new lines and internationalized content on diff erent platforms, this could lead to a significant source of coding errors.
  3. If spammers are out to inject information into Mollom, there are potentially easier ways to go about it. For this reason, the system has several security layers
    built in to prevent spammers compromising the Mollom database. Protecting actual message content in the HMAC would not improve this security.

To implement this authentication mechanism, all requests to Mollom must include at least these four parameters:

  1. public key — The individual public access key used to identify a site.
  2. time — A valid dateTime (http://www.w3.org/TR/xmlschema-2/#dateTime or http://www.w3.org/TR/OTE-datetime). The format usually takes the following form 1978-11-19T04:20:10.000+02000 (yyyy-MM-dd`T'HH:mm:ss.SSSZ) where text between single quotes should not be interpreted.
  3. hash — The HMAC-SHA1 digest (http://www.ietf.org/rfc/rfc2104.txt) of the string concatenation of the specified time + ':' + nonce + ':' + secret key. This is used to validate a site's authenticity.
  4. nonce — The randomly created nonce.

To see example PHP authentication code, please consult the Mollom module for Drupal, available for download on the Mollom website. Open the file mollom.module and search for the functions mollom() and _mollom_authentication(). Examples in other languages are available as well.

If additional security is required, we can consider setting up a SSL certificate and handling requests using a secure transport layer. This would guarantee Mollom users that they are communicating with legitimate Mollom servers and that content traffic is authentic.