What is the l-Tag DKIM Vulnerability, and What Can be Done to Mitigate Risk?

Learn more about this vulnerability, why the l-tag has been discouraged, and what you can do to prevent bad actors from taking advantage of it.
valimail dkim vulnerability

On Friday, May 17, 2024, Estonian security researchers published a blog post of work they’ve recently done that highlights a long-known vulnerability in DomainKeys Identified Mail (DKIM) and its impact on Brand Indicators for Message Identification (BIMI) and Domain-based Message Authentication, Reporting, and Conformance (DMARC). The research is important as this vulnerability is exploitable today. However, for more than a decade (13 years!) usage of this l= tag has been strongly discouraged on security grounds. No one should be using it. This is significant because some sending platforms being used by prominent brands are using the l= tag under the hood, making it possible for a modified email to pass DMARC and show a legitimate BIMI logo.

While brands do not have direct control over how platforms utilize DKIM and may sign with the l= tag on their behalf, they can and should validate that emails sent in their name—including marketing and transactional emails—are free and clear of this tag. The research shows that some sending platforms did not heed this warning, putting some big brands at risk through no fault of their own. 

If you’re not familiar, BIMI is an email specification that lets senders display branded logos next to emails in recipients’ inboxes. Despite these findings, BIMI is and remains an important email authentication tool and fosters long-term brand trust. The lesson here is for senders to mitigate the risk of exploitation of this vulnerability by following industry best practices, which we describe below. 

We know you still may have a lot of questions on the vulnerability so we’ve pulled together some information on the issue, including what steps major inbox providers are taking to mitigate this risk.

What is the vulnerability?

DKIM is an email protocol that allows a domain to take responsibility for a message and do so in a way that can be validated by the receiving server. This taking of responsibility is done by inserting a header, called a DKIM-Signature, into an email message. The header’s contents include two cryptographic hashes – one a hash of selected other headers from the message, and the other of the body contents – and other information that the receiving server can use to validate the hashes. If the hashes validate, then the receiving server can be confident that the hashed content has not changed since the DKIM-Signature header was inserted, and it can treat the message just as it would any other message handled by the signing domain.

When it comes to hashing the message body, the default behavior is to hash the entire message body. However, DKIM offers the signer the option of only hashing part of the message body, starting from the first byte to whatever number of bytes the signer chooses. When it does so, the signer will include in the DKIM-Signature header a key-value pair of l (lowercase ell) and the number of bytes used to construct the hash (e.g., l=2048 for a hash made from the first 2K bytes of the message). Signers might want to do this in cases where the signed message is sent to a mailing list, for example; mailing lists sometimes alter message content by adding footers with subscription information, and altered messages will fail DKIM validation checks when delivered by the mailing list server to a list subscriber’s domain. By using the the l= tag, the signer tries to ensure that the message still passes DKIM validation checks, working on the theory that any content alteration that the mailing list server does will come after the bytes that made up the body hash.

Unfortunately, mailing list servers aren’t the only hosts out there that might want to alter a message and still have it pass DKIM validation checks. The DKIM RFC, released in September, 2011, notes in a section titled ‘Misuse of Body Length Limits (“l=” Tag)’ that the tag “enables attacks in which an intermediary with malicious intent can modify a message to include content that solely benefits the attacker”. 

Put another way, if a message that is DKIM-signed only incorporates part of the message body in the body hash, then a bad actor can get a copy of the message, alter it so that it contains their content, but still passes DKIM, and send the message to victims all day long. Even though the DKIM RFC specifically advises signers to be “extremely wary of using this tag,” and suggests that receivers “might wish to ignore signatures that use the tag”, the author found that the tag is in limited use and is being actively exploited today.

With email encompassing hundreds of millions of domains sending hundreds of billions of messages each week, the 3,040 domains and millions of messages the researcher demonstrated shows a real problem that can hopefully be easily addressed. We applaud this disclosure and hope the l-tag is rapidly deprecated.

What does this have to do with BIMI?

BIMI is an emerging email specification that allows brand and domain owners to designate a logo to be shown with their email in messages sent to supporting inbox providers, including Google and Yahoo. BIMI requires that the sending domain have a DMARC policy in place and at enforcement and that the message passes DMARC validation checks. A message passes DMARC validation checks when it passes either SPF or DKIM with a domain that is aligned with the visible From domain of the message.

Among the domains discovered by the author using the l= tag in their DKIM-Signatures are a number that are participating in BIMI. This means that attackers can forge messages that were DKIM signed by these domains, send the forged messages to BIMI-supporting inbox providers, and get their messages shown with the logo of the forged sender. 

This report casts BIMI in a negative light, calling it a weakness of BIMI. However, we don’t believe that’s the case! 

Because BIMI relies on existing authentication mechanisms—SPF, DKIM, and DMARC—it makes any abuse of these significantly more visible. The issue identified here predates BIMI and even DMARC by nearly a decade. BIMI has successfully brought email authentication front and center in a visual form that individuals can see, and as a result, it is now making visible long-standing gaps that still need to be addressed by the email ecosystem.

Usage of the l= tag has been discouraged for over a decade. Now, due to BIMI, the issues with the l= tag have become visible and we believe will lead to the tag being completely deprecated. And the thanks goes to BIMI!

What can be done to mitigate this risk?

The best mitigation step available here is for all inbox providers–BIMI-supporting or not–to take the advice of the DKIM RFC and “ignore signatures that use the tag”.  If a DKIM Signature with the l= tag is ignored, it cannot support a DMARC pass verdict, but this alone is not enough to protect BIMI in this case. It’s still possible for a bad actor to get an SPF pass under some circumstances, and there are inbox providers who support BIMI for whom an SPF pass is enough to validate DMARC and result in a BIMI logo display.

Google has announced that they’re going even further – they’re going to refuse to display a BIMI logo and label the message as suspicious if it contains a DKIM-Signature with an l= tag. Google support articles can be found here:

Google also explicitly tells senders not to use the l= tag on this help page.:

This is the best course of action here, as it not only removes the possibility of a forged message getting a DKIM pass when the l= tag is present, but also makes sure SPF alone can’t support a DMARC pass, either; instead, a valid DKIM signature is still necessary for the DMARC pass and to secure BIMI logo display.

The other obvious mitigation is for sending platforms wanting to have their customers’ logos displayed through BIMI to stop including the l= tag, especially in their marketing and transactional emails, both of which are likely to be sent to individual inboxes, not mailing lists. Such messages shouldn’t be at risk of being modified by legitimate intermediary senders, and so there’s no need for the l= tag to be included. This is advice that’s been out there for over thirteen years, and it should’ve been heeded well before this.

Similarly, DKIM key rotation remains an important security-related best practice. The best fix to ensure that NO inbox provider is able to be fooled by an old message updated with new content is to rotate out and retire the DKIM key used when those messages were sent. If you only update your current configuration, and take no action to rotate out legacy DKIM keys, you will not be fully protecting your brands or customers from this risk.

Protect your brand with BIMI

By ensuring there is no “l= tag” in your DKIM signatures, especially in marketing and transactional emails, you can significantly reduce the risk of logo spoofing and protect your brand reputation. For additional email authentication best practices, DMARC guidance, or help implementing these changes, reach out to Valimail today. We’re here to help you ensure BIMI remains a powerful tool for building trust and brand recognition.

Get started for free
with Monitor

Start your path to DMARC enforcement with a panoramic view of the traffic being sent on your behalf.
No trial offers, credit cards, or obligations.

Explore all Valimail
has to offer

Go one step further than visibility…Take action! Reach DMARC enforcement faster. Stay compliant with evolving sender requirements. All while protecting your brand.

Phishing and BEC protection starts with your domain — verify your DMARC status with the Valimail Domain Checker.