HistoryEditJSON (OSV)

RUSTSEC-2020-0068

Unexpected panic in multihash from_slice parsing code

Reported
Issued
Package
multihash (crates.io)
Type
Vulnerability
Categories
Keywords
#parsing #panic #untrusted-data
Aliases
References
CVSS Score
7.5 HIGH
CVSS Details
Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Patched
  • >=0.11.3
Affected Functions
Version
multihash::digests::MultihashGeneric::from_bytes
  • <0.11.3
multihash::digests::MultihashRefGeneric::from_slice
  • <0.11.3

Description

In versions prior 0.11.3 it's possible to make from_slice panic by feeding it certain malformed input. It's never documented that from_slice (and from_bytes which wraps it) can panic, and its' return type (Result<Self, DecodeError>) suggests otherwise.

In practice, from_slice/from_bytes is frequently used in networking code (for example in rust-libp2p) and is being called with unsanitized data from untrusted sources. This can allow attackers to cause DoS by causing an unexpected panic in the network client's code.

Advisory available under CC0-1.0 license.