Advisory

RUSTSEC-2019-0029

Also known as: CVE-2019-25005, GHSA-j2r6-2m5c-vgh5

Summary

ChaCha20 counter overflow can expose repetitions in the keystream

Details

The ChaCha20 stream cipher can produce a maximum of 2^32 blocks (~256GB)
before the 32-bit counter overflows. Releases of the chacha20 crate prior
to v0.2.3 allow generating keystreams larger than this, including seeking
past the limit. When this occurs, the keystream is duplicated, with failure
modes similar to nonce reuse (i.e. exposure of the XOR of two plaintexts).

The v0.2.3 release now panics in this event, rather than exposing the
duplicated keystream. Note this is a "hot fix" solution to the problem
and future releases will pursue returning an error in this case.

Users of the chacha20poly1305 crate are unaffected by this as this crate
properly asserts the length of the plaintext is less than the maximum allowed
(P_MAX as described in RFC 8439 Section 2.8).

Severity

High Basis: CVSS v3 score 7.5, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Dates

Published
2019-10-22 12:00 UTC
Modified
2023-11-08 04:01 UTC

Affected packages and fixes

chacha20

crates.io · All systems

Affected

  • introduced 0.0.0-0, fixed 0.2.3 (semver)

Fixed versions

0.2.3

Fix

  • Fixed version 0.2.3
    cargo update -p chacha20 --precise 0.2.3

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: RustSec Advisory Database · CC0-1.0

Sources & licences