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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| nb-connect (crates.io) | before 1.0.3, from 0.0.0-0 before 1.0.3 | GitHub Advisory Database, RustSec Advisory Database |
| nb-connect_project nb-connect | before 1.0.3 | NVD |
All scores
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| RustSec Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 7.5high CVSS:2.0 | AV: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
| https://rustsec.org/advisories/RUSTSEC-2021-0021.html | advisory, exploit, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-27376 | advisory | |
| https://github.com/smol-rs/nb-connect/issues/1 | report, web | |
| https://github.com/smol-rs/nb-connect | package | |
| https://crates.io/crates/nb-connect | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-27376 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-rm4w-6696-r77p changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0021 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-27376 changed 2026-06-17 | Public domain |