The Simple Mail Transfer Protocol (SMTP) was introduced in 1982 as a way for two parties to exchange electronic mail using the Internet as a medium. The Internet was much smaller and safer back then, and like many other IT protocols from the early days, SMTP was not developed with security in mind. Over the years, threat actors have found and exploited many attack vectors against SMTP, such as intercepting plaintext email content, engaging in SMTP smuggling, exploiting sender domain impersonation, etc.
In this article, we focus on how you can protect against domain impersonation and, by doing so, reduce the risk of business email compromise (BEC) and increase our domain’s reputation. More specifically, we introduce DomainKeys Identified Mail (DKIM), one of the top three email security protocols that can make it harder for threat actors to abuse your domain for CEO fraud or other types of dangerous phishing emails. We cover different aspects of DKIM, from concepts to high-level implementation, as well as some common mistakes to avoid during this process.
The table below summarizes different aspects of the DKIM protocol and common mistakes to avoid when using DKIM to enhance your email security.
Concept |
Description |
What is DKIM? |
DKIM is an email security protocol that allows the recipient to verify the sender’s identity and the integrity of the email through cryptographic means. |
How does DKIM work? |
DKIM involves having the sender create a cryptographic key pair, publish the public key, and configure the mail server to sign emails digitally. |
Security benefits of DKIM |
DKIM enhances overall email security by verifying email authenticity, ensuring email integrity, and allowing you to maintain independence from your IT infrastructure. |
Monitoring and maintenance |
Monitoring and rotating the key pair by following security best practices are things to consider when using DKIM. |
Common mistakes to avoid |
Common trouble areas when implementing DKIM include misconfiguration, poor authoritative name server security, and not understanding important DKIM limitations. |
In the rest of this article, we will cover the origin of DKIM, how it works, what the implementation workflow looks like, and some common mistakes to avoid during the process. While DKIM is not a silver bullet when it comes to email security, it can certainly boost your overall email security and domain reputation.
DKIM is one of the leading email authentication protocols and was published in September 2011 in RFC 6376. The goal of this RFC was to provide the domain owners and email recipients with the means to sign and verify emails, respectively.
To achieve this goal, DKIM relies on public-key cryptography. The domain owner generates a cryptographic key pair, makes the public key available to everyone on the Internet, and uses the private key to digitally sign the email. Everyone on the Internet can then use this public key to verify the digital signature of the signed email. Because the public key can only correctly verify signatures created by its private key counterpart (which only the domain owner possesses), the threat actor cannot impersonate the domain and send signed malicious emails on its behalf.
While technical DKIM setup is covered in detail in a separate article, in this section, we explain the DKIM setup and email delivery in theory to help create an understanding of the overall process and email workflow from the sender to the recipient.
Here’s a description of the process that DKIM follows:
DKIM verification workflow performed by the recipient’s mail server
Implementing DKIM has certain advantages when it comes to email security, or when it is compared with the Sender Policy Framework (SPF). Some of these benefits include the following:
It is worth noting that while there are different secure public key cryptography algorithms that can be used with DKIM, all these protocols will no longer be cryptographically secure once significant breakthroughs are made in quantum computing.
It is important to understand that DKIM, like many other protocols, requires monitoring and periodic maintenance. For example, we saw above that DKIM relies on hashing algorithms to hash the email body and uses cryptographic keys of a certain length. While a hashing algorithm or the key length might be considered secure at the moment, the constant advance of computers makes the risk of hash collisions or cryptographic attacks against crypto-keys even more probable. That is why it is important to periodically reevaluate your DKIM implementation and make the necessary changes.
Furthermore, since DKIM makes use of cryptographic keys, it is a common best practice to periodically rotate these keys, just like passwords or API keys. This way, even if the private key is compromised somehow and you aren’t aware of it, rotating the key pair will make the old private key invalid.
Finally, since your company might also have configured SPF and DMARC, monitoring and maintaining all three protocols separately might be cumbersome. To avoid this, consider using a solution that allows you to easily and swiftly change your DKIM, SPF, and DMARC settings as well as generate health reports about their status.
When implementing DKIM, it is important to keep in mind a few potential pitfalls that might undermine the security that DKIM provides:
DKIM is one of the top three mail security protocols that your company can implement to reduce the risk of domain impersonation in phishing emails. In this article, we covered the DKIM protocol in depth, including its high-level implementation, the security benefits it provides, and common mistakes to avoid when enforcing it. It is important to keep in mind that DKIM is not a fire-and-forget task. Periodic monitoring and maintenance are required to make sure that the email flow is not interrupted and that the cryptographic material used for DKIM follows the security best practices.