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

    Threat Intelligence

    EPSS
    0.09% (38th 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 ID SNYK-RUST-NANOID-7176104
  • published 3 Jun 2024
  • disclosed 3 Jun 2024
  • credit Unknown

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
Expand this section

Snyk

9.4 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    Low
Expand this section

NVD

9.8 critical