{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.1",
    "cveMetadata": {
        "state": "PUBLISHED",
        "cveId": "CVE-2022-21658",
        "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "assignerShortName": "GitHub_M",
        "dateUpdated": "2025-04-22T18:32:53.619Z",
        "dateReserved": "2021-11-16T00:00:00.000Z",
        "datePublished": "2022-01-20T00:00:00.000Z"
    },
    "containers": {
        "cna": {
            "title": "Race condition in std::fs::remove_dir_all in rustlang",
            "providerMetadata": {
                "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
                "shortName": "GitHub_M",
                "dateUpdated": "2022-10-16T00:00:00.000Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency. The Rust Security Response WG was notified that the `std::fs::remove_dir_all` standard library function is vulnerable a race condition enabling symlink following (CWE-363). An attacker could use this security issue to trick a privileged program into deleting files and directories the attacker couldn't otherwise access or delete. Rust 1.0.0 through Rust 1.58.0 is affected by this vulnerability with 1.58.1 containing a patch. Note that the following build targets don't have usable APIs to properly mitigate the attack, and are thus still vulnerable even with a patched toolchain: macOS before version 10.10 (Yosemite) and REDOX. We recommend everyone to update to Rust 1.58.1 as soon as possible, especially people developing programs expected to run in privileged contexts (including system daemons and setuid binaries), as those have the highest risk of being affected by this. Note that adding checks in your codebase before calling remove_dir_all will not mitigate the vulnerability, as they would also be vulnerable to race conditions like remove_dir_all itself. The existing mitigation is working as intended outside of race conditions."
                }
            ],
            "affected": [
                {
                    "vendor": "rust-lang",
                    "product": "rust",
                    "versions": [
                        {
                            "version": "< 1.58.1",
                            "status": "affected"
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2"
                },
                {
                    "url": "https://github.com/rust-lang/rust/pull/93110"
                },
                {
                    "url": "https://github.com/rust-lang/rust/pull/93110/commits/32ed6e599bb4722efefd78bbc9cd7ec4613cb946"
                },
                {
                    "url": "https://github.com/rust-lang/rust/pull/93110/commits/406cc071d6cfdfdb678bf3d83d766851de95abaf"
                },
                {
                    "url": "https://github.com/rust-lang/rust/pull/93110/commits/4f0ad1c92ca08da6e8dc17838070975762f59714"
                },
                {
                    "url": "https://blog.rust-lang.org/2022/01/20/cve-2022-21658.html"
                },
                {
                    "name": "FEDORA-2022-1bafa3fc91",
                    "tags": [
                        "vendor-advisory"
                    ],
                    "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BK32QZLHDC2OVLPKTUHNT2G3VHWHD4LX/"
                },
                {
                    "name": "FEDORA-2022-2c73789458",
                    "tags": [
                        "vendor-advisory"
                    ],
                    "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C63NH72Q7UHJM5V3IVYRI7LVBGGFQMSQ/"
                },
                {
                    "name": "FEDORA-2022-1b76e3a192",
                    "tags": [
                        "vendor-advisory"
                    ],
                    "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CKGTACKMKAPRDPWPTU26GYWBELIRFF5N/"
                },
                {
                    "name": "FEDORA-2022-06569a0a60",
                    "tags": [
                        "vendor-advisory"
                    ],
                    "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7JKZDTBMGAWIFJSNWKBMPO5EAKRR4BEW/"
                },
                {
                    "url": "https://support.apple.com/kb/HT213183"
                },
                {
                    "url": "https://support.apple.com/kb/HT213182"
                },
                {
                    "url": "https://support.apple.com/kb/HT213186"
                },
                {
                    "url": "https://support.apple.com/kb/HT213193"
                },
                {
                    "name": "GLSA-202210-09",
                    "tags": [
                        "vendor-advisory"
                    ],
                    "url": "https://security.gentoo.org/glsa/202210-09"
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H",
                        "attackVector": "LOCAL",
                        "attackComplexity": "LOW",
                        "privilegesRequired": "LOW",
                        "userInteraction": "NONE",
                        "scope": "CHANGED",
                        "confidentialityImpact": "NONE",
                        "integrityImpact": "LOW",
                        "availabilityImpact": "HIGH",
                        "baseScore": 7.3,
                        "baseSeverity": "HIGH"
                    }
                }
            ],
            "problemTypes": [
                {
                    "descriptions": [
                        {
                            "type": "CWE",
                            "lang": "en",
                            "description": "CWE-363: Race Condition Enabling Link Following",
                            "cweId": "CWE-363"
                        }
                    ]
                },
                {
                    "descriptions": [
                        {
                            "type": "CWE",
                            "lang": "en",
                            "description": "CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition",
                            "cweId": "CWE-367"
                        }
                    ]
                }
            ],
            "source": {
                "advisory": "GHSA-r9cc-f5pr-p3j2",
                "discovery": "UNKNOWN"
            }
        },
        "adp": [
            {
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2024-08-03T02:46:39.244Z"
                },
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://github.com/rust-lang/rust/pull/93110",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://github.com/rust-lang/rust/pull/93110/commits/32ed6e599bb4722efefd78bbc9cd7ec4613cb946",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://github.com/rust-lang/rust/pull/93110/commits/406cc071d6cfdfdb678bf3d83d766851de95abaf",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://github.com/rust-lang/rust/pull/93110/commits/4f0ad1c92ca08da6e8dc17838070975762f59714",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://blog.rust-lang.org/2022/01/20/cve-2022-21658.html",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "name": "FEDORA-2022-1bafa3fc91",
                        "tags": [
                            "vendor-advisory",
                            "x_transferred"
                        ],
                        "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BK32QZLHDC2OVLPKTUHNT2G3VHWHD4LX/"
                    },
                    {
                        "name": "FEDORA-2022-2c73789458",
                        "tags": [
                            "vendor-advisory",
                            "x_transferred"
                        ],
                        "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C63NH72Q7UHJM5V3IVYRI7LVBGGFQMSQ/"
                    },
                    {
                        "name": "FEDORA-2022-1b76e3a192",
                        "tags": [
                            "vendor-advisory",
                            "x_transferred"
                        ],
                        "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CKGTACKMKAPRDPWPTU26GYWBELIRFF5N/"
                    },
                    {
                        "name": "FEDORA-2022-06569a0a60",
                        "tags": [
                            "vendor-advisory",
                            "x_transferred"
                        ],
                        "url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7JKZDTBMGAWIFJSNWKBMPO5EAKRR4BEW/"
                    },
                    {
                        "url": "https://support.apple.com/kb/HT213183",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://support.apple.com/kb/HT213182",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://support.apple.com/kb/HT213186",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://support.apple.com/kb/HT213193",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "name": "GLSA-202210-09",
                        "tags": [
                            "vendor-advisory",
                            "x_transferred"
                        ],
                        "url": "https://security.gentoo.org/glsa/202210-09"
                    }
                ]
            },
            {
                "metrics": [
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "timestamp": "2025-04-22T15:52:12.198921Z",
                                "id": "CVE-2022-21658",
                                "options": [
                                    {
                                        "Exploitation": "poc"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "partial"
                                    }
                                ],
                                "role": "CISA Coordinator",
                                "version": "2.0.3"
                            }
                        }
                    }
                ],
                "title": "CISA ADP Vulnrichment",
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2025-04-22T18:32:53.619Z"
                }
            }
        ]
    }
}