CVE-2020-35920: Socket2 :net::SocketAddr Vulnerability
MODERATECVE-2020-35920 is a MODERATE (CVSS 5.5) :net::socketaddr vulnerability (CWE-188: Reliance on Data/Memory Layout) affecting Socket2 libraries in the crates.io ecosystem. The issue involves :net::socketaddr. Remediation is available by upgrading affected packages to version 0.3.16, 0.2.36.
CVE-2020-35920 at a Glance
Security Impact
CVSS: 5.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2020-35920
To remediate this vulnerability, upgrade all affected Socket2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade socket2 to 0.3.16
Upgrade net2 to 0.2.36
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for socket2
How to Check if You Are Affected
To determine whether your application is affected by CVE-2020-35920, inspect your project dependencies for Socket2:
inspect dependencies for socket2
Analyze the terminal output to locate any version of Socket2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.16), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-188: Reliance on Data/Memory Layout, where the product makes invalid assumptions about how protocol data or memory is organized at a lower level, resulting in unintended program behavior. In Socket2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-35920 Affected Socket2 Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
socket2
|
crates.io |
< 0.3.16
|
0.3.16
|
|
net2
|
crates.io |
< 0.2.36
|
0.2.36
|
References
Frequently Asked Questions
What is CVE-2020-35920?
Which Socket2 versions are affected?
What version fixes CVE-2020-35920?
Is socket2 affected?
Is net2 affected?
What is the CVSS score of CVE-2020-35920?
What CWE is associated with CVE-2020-35920?
How can I check crates.io dependencies for CVE-2020-35920?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-458v-4hrf-g3m4",
"modified" : "2024-02-12T15:55:27Z",
"published" : "2021-08-25T20:50:37Z",
"aliases" : [ "CVE-2020-35920" ],
"summary" : "socket2 invalidly assumes the memory layout of std::net::SocketAddr",
"details" : "The socket2 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.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "socket2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.3.16"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "net2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.2.36"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-35920"
}, {
"type" : "WEB",
"url" : "https://github.com/deprecrated/net2-rs/issues/105"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/socket2-rs/issues/119"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-lang/socket2-rs"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2020-0078.html"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2020-0079.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-188" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-19T18:53:58Z",
"nvd_published_at" : "2020-12-31T09:15:16Z"
}
}