Skip to content
Crypto Disclosed report Advanced CVE-2019-1543

ChaCha20-Poly1305 with long nonces

OpenSSL accepted ChaCha20-Poly1305 nonces of up to 16 bytes even though the specification allows only 12, and it silently discarded the first 4 bytes. This left those bytes unauthenticated, so an attacker could tamper with part of the message, and it made nonce reuse more likely, which could let an attacker decrypt traffic.

jorandirkgreef Follow

Originally disclosed on HackerOne

High 7.4 View original
  • Triaged in 2 months
  • Fixed in 7 months
  • Paid in 7 months
  • Disclosed after 7 months

This report relates to CVE-2019-1543, https://www.openssl.org/news/secadv/20190306.txt, which I reported to the OpenSSL maintainers a few days ago.

OpenSSL accepts nonces for the AEAD cipher ChaCha20-Poly1305 of up to 16-bytes. This support is advertised in the OpenSSL documentation and via the CHACHA_CTR_SIZE (16) constant.

However, the specification for ChaCha20-Poly1305 supports only up to 12-bytes.

If a user passes a 16-byte nonce to OpenSSL, OpenSSL will discard the first 4-bytes of the nonce.

Impact

The maintainers classified the severity of this as LOW since it only affects user applications of OpenSSL, while at the same time recognizing the severity of this for these user applications as MEDIUM (or "serious" and "catastrophic" in the words of two maintainers).

This breaks the guarantees provided by OpenSSL to user applications in two ways:

  1. These first 4-bytes are not authenticated, breaking the integrity guarantees of the AEAD cipher, and allowing an attacker to tamper with 4-bytes of the AEAD message. This in itself is serious for applications which rely on AEAD ciphers to detect message tampering and/or message corruption.

  2. This introduces the likelihood of nonce-reuse, since the most significant 4-bytes of nonce entropy are discarded by OpenSSL, for example, where a user provides a 32-bit nonce counter in a statically allocated 16-byte buffer to OpenSSL. Nonce-reuse is catastrophic for an AEAD cipher such as ChaCha20-Poly1305, as it would allow an attacker to completely decrypt all sensitive information.

The original report as published on HackerOne, by jorandirkgreef. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the library accepted a nonce length beyond the cipher specification and truncated the excess bytes instead of rejecting the input.

Impact

The first 4 bytes of the nonce were not authenticated, allowing an attacker to tamper with 4 bytes of the message, and the discarded entropy made nonce reuse likely, which could let an attacker decrypt all sensitive information; the maintainers rated it LOW because only user applications are affected.

What the attacker needed

Application passes a 16-byte nonce; attacker can tamper with traffic

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A nonce is a one-time number used alongside a key when encrypting data. ChaCha20-Poly1305 is a cipher that also checks the data has not been changed, and it expects a nonce of a fixed short length. OpenSSL let callers supply a longer nonce and quietly threw away the extra part, so that part no longer protected the message and the same nonce could be reused by accident.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.