Search

Find a vulnerability

Search criteria

    Related vulnerabilities

    RUSTSEC-2018-0022 (GHSA-2JQ9-6XX7-3H29)

    Vulnerability from osv_rustsec – Published: 2018-08-22 12:00 – Updated: 2023-06-13 13:10 – Source website
    VLAI
    Summary
    Use of uninitialized memory in temporary
    Details

    Uninit memory is used as a RNG seed in temporary

    The following function is used as a way to get entropy from the system, which does operations on and exposes uninit memory, which is UB.

    fn random_seed(_: &Path, _: &str) -> [u64; 2] {
        use std::mem::uninitialized as rand;
        unsafe { [rand::<u64>() ^ 0x12345678, rand::<u64>() ^ 0x87654321] }
    }
    

    This has been resolved in the 0.6.4 release.

    The crate is not intended to be used outside of a testing environment.

    For a general purpose crate to create temporary directories, tempfile is an alternative for this crate.


    {
      "affected": [
        {
          "database_specific": {
            "categories": [
              "memory-exposure"
            ],
            "cvss": null,
            "informational": null
          },
          "ecosystem_specific": {
            "affected_functions": null,
            "affects": {
              "arch": [],
              "functions": [],
              "os": []
            }
          },
          "package": {
            "ecosystem": "crates.io",
            "name": "temporary",
            "purl": "pkg:cargo/temporary"
          },
          "ranges": [
            {
              "events": [
                {
                  "introduced": "0.3.0"
                },
                {
                  "fixed": "0.6.4"
                }
              ],
              "type": "SEMVER"
            }
          ],
          "versions": []
        }
      ],
      "aliases": [
        "GHSA-2jq9-6xx7-3h29"
      ],
      "database_specific": {
        "license": "CC0-1.0"
      },
      "details": "Uninit memory is used as a RNG seed in temporary\n\nThe following function is used as a way to get entropy from the system, which does operations on and exposes uninit memory, which is UB.\n\n```rust\nfn random_seed(_: \u0026Path, _: \u0026str) -\u003e [u64; 2] {\n    use std::mem::uninitialized as rand;\n    unsafe { [rand::\u003cu64\u003e() ^ 0x12345678, rand::\u003cu64\u003e() ^ 0x87654321] }\n}\n```\n\nThis has been resolved in the 0.6.4 release.\n\nThe crate is not intended to be used outside of a testing environment.\n\nFor a general purpose crate to create temporary directories, [`tempfile`](https://crates.io/crates/tempfile) is an alternative for this crate.",
      "id": "RUSTSEC-2018-0022",
      "modified": "2023-06-13T13:10:24Z",
      "published": "2018-08-22T12:00:00Z",
      "references": [
        {
          "type": "PACKAGE",
          "url": "https://crates.io/crates/temporary"
        },
        {
          "type": "ADVISORY",
          "url": "https://rustsec.org/advisories/RUSTSEC-2018-0022.html"
        },
        {
          "type": "REPORT",
          "url": "https://github.com/stainless-steel/temporary/issues/2"
        }
      ],
      "related": [],
      "severity": [],
      "summary": "Use of uninitialized memory in temporary"
    }