CVE-2021-27376
JSON

9.8critical

nb-connect invalidly assumes the memory layout of std::net::SocketAddr

Severity
9.8critical CVSS:3.1 by NVD
Exploit likelihood
1.47% (higher than 74% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-rm4w-6696-r77pRUSTSEC-2021-0021

Description

An issue was discovered in the nb-connect crate before 1.0.3 for Rust. It may have invalid memory access for certain versions of the standard library because it relies on a direct cast of std::net::SocketAddrV4 and std::net::SocketAddrV6 data structures.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
nb-connect (crates.io)before 1.0.3, from 0.0.0-0 before 1.0.3GitHub Advisory Database, RustSec Advisory Database
nb-connect_project nb-connectbefore 1.0.3NVD

All scores

GitHub9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
RustSec Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD7.5high CVSS:2.0AV:N/AC:L/Au:N/C:P/I:P/A:P

Classification

What each source says

CVE List

An issue was discovered in the nb-connect crate before 1.0.3 for Rust. It may have invalid memory access for certain versions of the standard library because it relies on a direct cast of std::net::SocketAddrV4 and std::net::SocketAddrV6 data structures.

GitHub Advisory Database

The nb-connect crate has assumed std::net::SocketAddrV4 and std::net::SocketAddrV6 have the same memory layout as the system C representation sockaddr. It has simply casted the pointers to convert the socket addresses to the system representation. The standard library does not say anything about the memory layout, and this will cause invalid memory access if the standard library changes the implementation. No warnings or errors will be emitted once the change happens.

RustSec Advisory Database

The nb-connect crate has assumed std::net::SocketAddrV4 and std::net::SocketAddrV6 have the same memory layout as the system C representation sockaddr. It has simply casted the pointers to convert the socket addresses to the system representation. The standard library does not say anything about the memory layout, and this will cause invalid memory access if the standard library changes the implementation. No warnings or errors will be emitted once the change happens.

NVD (es)

Se detectó un problema en la crate nb-connect versiones anteriores a 1.0.3 para Rust. Puede tener acceso a memoria no válido para determinadas versiones de la biblioteca estándar porque se basa en una transmisión directa de las estructuras de datos de las funciones std::net::SocketAddrV4 y std::net::SocketAddrV6

References

Sources

SourceRecordLicence
CVE ListCVE-2021-27376 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-rm4w-6696-r77p changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0021 changed 2023-11-08CC0-1.0
NVDCVE-2021-27376 changed 2026-06-17Public domain