{
  "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"
  }
}