Improper Verification of Cryptographic Signature Affecting nano-id package, versions <0.4.0


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.09% (39th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-RUST-NANOID-7176104
  • published3 Jun 2024
  • disclosed3 Jun 2024
  • creditUnknown

Introduced: 3 Jun 2024

CVE-2024-36400  (opens in a new tab)
CWE-347  (opens in a new tab)

How to fix?

Upgrade nano-id to version 0.4.0 or higher.

Overview

Affected versions of this package are vulnerable to Improper Verification of Cryptographic Signature through the nano_id::base62 and nano_id::base58 functions. An attacker can predict generated IDs and potentially perform brute-force attacks by exploiting the reduced entropy of these IDs.

Note

nano_id::base64 is not affected by this vulnerability.

PoC

use std::collections::BTreeSet;

fn main() {
    test_base58();
    test_base62();
}

fn test_base58() {
    let mut produced_symbols = BTreeSet::new();

    for _ in 0..100_000 {
        let id = nano_id::base58::<10>();
        for c in id.chars() {
            produced_symbols.insert(c);
        }
    }

    println!(
        "{} symbols generated from nano_id::base58",
        produced_symbols.len()
    );
}

fn test_base62() {
    let mut produced_symbols = BTreeSet::new();

    for _ in 0..100_000 {
        let id = nano_id::base62::<10>();
        for c in id.chars() {
            produced_symbols.insert(c);
        }
    }

    println!(
        "{} symbols generated from nano_id::base62",
        produced_symbols.len()
    );
}

CVSS Scores

version 3.1