Skip to content

`net2` invalidly assumes the memory layout of std::net::SocketAddr

Moderate severity GitHub Reviewed Published May 24, 2022 to the GitHub Advisory Database • Updated Jun 14, 2023

Package

cargo net2 (Rust)

Affected versions

< 0.2.36

Patched versions

0.2.36

Description

The net2 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.

References

Published by the National Vulnerability Database Dec 31, 2020
Published to the GitHub Advisory Database May 24, 2022
Reviewed Jun 14, 2023
Last updated Jun 14, 2023

Severity

Moderate
5.5
/ 10

CVSS base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Weaknesses

No CWEs

CVE ID

CVE-2020-35919

GHSA ID

GHSA-c79c-gwph-gqfm

Source code

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.