The Many Challenges of Secure Messaging

On the surface, Internet messaging services may seem like simple applications. After all, the basic functionality of sending a message between two computers was one of the earliest features of the internet. However, modern messaging services are very complex pieces of software supported by an extensive infrastructure to handle real-time messaging at a massive scale.

As such, security represents a significant concern for messaging systems. Trusted with private conversations, user information, and numerous forms of metadata, these systems must maintain security best practices in their software and infrastructure. Establishing this level of security represents a substantial challenge for any new messaging service.

The Importance of Secure Messaging

When building a new messaging service, developers must build privacy and security into the application from the ground up. Any mistake from the engineering team during development can lead to critical vulnerabilities that enable cross-site scripting (XSS) or SQL injection attacks, which could compromise security. This risk can burden the organization developing the messaging service, as they must secure the application to meet industry standards or risk fines and legal action. This compliance pressure can make using an existing service more attractive.

Malicious actors have multiple techniques for exploiting security flaws in the application’s code or infrastructure to gain unauthorized access to data. They’ll often sell or leak the stolen information — or use it to initiate further attacks against end users.

For example, phishing is a common attack wherein a malicious attacker impersonates another entity, such as the application support team or another user, to gain a legitimate user’s trust. From there, they can deceive the user into sharing additional information, such as login credentials or — in some cases — even material that can be used for blackmail. The more data the attacker gathers from a data breach, the more convincing their phishing attempts become.

Cyber attacks and data breaches diminish a user’s faith in the messaging service and are extremely difficult and costly to resolve. A recent IBM report states that average data breach costs $4.35 million. Most of that cost arises from a loss of business, reparations to the affected users, legal fees, and regulatory fines. The same report also found that misconfigured cloud infrastructure is the root cause of 19 percent of data breaches, with vulnerabilities in third-party software accounting for a further 13 percent.

By writing and maintaining secure code throughout all stages of development, engineering teams can eliminate these vulnerabilities before they can compromise an application’s security. They can also innovate faster without having to worry about the underlying infrastructure.

What It Takes to Make Messaging Secure

The most common way to ensure that private conversations on messaging applications remain private is through end-to-end encryption (E2EE). 

E2EE is the process of encrypting messages to protect them from unwanted access, interception, or tampering. When a user sends a message using an E2EE-protected service, the client software encodes its content using a public key, making it unreadable to third parties. The recipient then uses a private key (to which they have exclusive access) to decrypt the message into a human-readable form.

This process ensures that no one, including the messaging service itself, can see or read the message other than its intended recipient.

Signal Protocol

One of the most popular forms of E2EE is Open Whisper Systems’ Signal Protocol, first developed as TextSecure Protocol in 2013. Since then, many applications have implemented the protocol, including WhatsApp and Messenger’s Secret Conversations.

The first step in the Signal Protocol is to generate three unique sets of keys:

  • A long-term identity key pair
  • A medium-term key pair signed using the private identity key and changed periodically
  • Several single-use keys

The public keys are packaged into a bundle for storage on a secure server. When sending the first message in a conversation, the sender requests the recipient’s bundle from the server. Then, the sender combines the bundle with their unique keys, creating a new session for encrypting messages using Signal’s unique Double Ratchet algorithm.

In cybersecurity, a ratchet is an encryption process wherein developers can calculate future states (chain keys) if they know the original values. Using a single ratchet creates a relatively strong form of encryption. However, if an attacker manages to steal the recipient's sending and receiving chain key, they could calculate and decrypt every future message, rendering the encryption useless.

To reduce this risk, the Signal Protocol uses a second ratchet to make the stolen keys useless after a single exchange, creating “perfect forward secrecy” that keeps private conversations private. The ability to render stolen keys useless after a single use makes the Signal Protocol incredibly secure, which is why it’s become so popular when building messaging applications.

The Signal Protocol is an eloquent but complex solution. Therefore, organizations building their own messaging service must implement it correctly to prevent potential security vulnerabilities.

Taking Extra Steps Toward Better Security

While encryption is the gold standard for protecting a messaging application, there are other means that engineering teams can use to provide additional security. Two of the most common approaches are vulnerability scanning and unit testing.

Vulnerability Scanning

Engineering teams need to ensure their application is free from critical vulnerabilities as early in development as possible. Vulnerability scanning helps prevent these vulnerabilities by using specialized tools that analyze software to detect and report any issues. These scans provide the team with feedback about any flaws in the system, such as an SQL injection vulnerability or insecure server configuration. Team members can then make the necessary changes for a more secure future release.

Unit Testing

Another common step for developers and operations teams is to perform unit tests. This method focuses on testing small “units” of code to ensure every component of an application works as intended. For example, developers can use unit testing to confirm that their messaging service’s E2EE functionality works.

Additional Security Measures

There are several other security features that the users of messaging services can use to make sure that their conversations are kept private and secure. 

Multi-Factor Authentication 

Multi-factor authentication (MFA) is an authentication method that requires a user to enter two or more types of verification before gaining access to an application or account. This approach adds an extra layer of security to the authorization process, helping to make sure that the person trying to access the service is the correct user.

Encrypted Backups

Developers can also secure private conversations using encrypted backups of message logs. Encrypted logs enable users to revisit old conversations without experiencing any performance issues. After encryption, the service stores the backups. This process prevents malicious actors from accessing sensitive user data, even if they do manage to exploit the system and gain access to the backups.

Conclusion

Privacy and security are vital for messaging applications. Millions of global users trust the functionality and security of these systems, while organizations seek to avoid financially and reputationally costly cyber attacks. These attacks can be unpredictable, so staying proactive is the best way to prevent them.

Users place their trust in messaging services as they conduct private conversations, transmit sensitive information, and possess numerous types of metadata. Keeping this information private and secure is vital to retaining users and ensuring a positive user experience.

While building a messenger application is possible, most organizations may find it infeasible due to the costs and complexities of implementing adequate security. For most organizations, using an established solution like WhatsApp is more appropriate.