<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/140869>140869</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CVE-2022-25883 and CVE-2022-3517 with respect to `mlir/utils/vscode/package-lock.json`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rolfmorel
</td>
</tr>
</table>
<pre>
### Summary
Automated checks by Wiz flag up that packages `semver` and `minimatch` have outdated versions in the `package-lock.json` file for the MLIR VSCode extension which lives inside `llvm-project`. These outdated versions have known CVEs which are classified as "high severity" according to the automated emails we are receiving. Our internal security system considers this a serious enough issue to threaten to disconnect the affected machine from the company network.
Note that normal `llvm-project` builds will not involve building the VSCode extension: Wiz is complaining that these (versions of the) packages are even mentioned in the lock file. However, this does mean that the distributed version of the VSCode extension (presumably) comes with the affected package versions.
### Details
Both CVEs concern Regular Expression Denial of Service (ReDoS) vulnerabilities.
Summaries according to the [National Vulnerability Database](https://nvd.nist.gov/):
CVE-2022-3517:
> A vulnerability was found in the minimatch package. This flaw allows a Regular Expression Denial of Service (ReDoS) when calling the braceExpand function with specific arguments, resulting in a Denial of Service.
CVE-2022-25883:
> Versions of the package semver before 7.5.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the function new Range, when untrusted user data is provided as a range.
Here are the respective summaries by Wiz:
CVE-2022-3517:
> The library minimatch version 3.0.4 was detected in NPM library manager located at /scratch/tpp-llvm-tar/llvm-project-faf5d747f174cc9d714839f0d3bce1a783eac2ac/mlir/utils/vscode/package-lock.json on line 1198 and is vulnerable to CVE-2022-3517, which exists in versions < 3.0.5.
>
> The vulnerability was found in the [Github Security Advisory](https://github.com/advisories/GHSA-f8q6-p94x-37v3) with vendor severity: High ([NVD](https://nvd.nist.gov/vuln/detail/CVE-2022-3517) severity: High).
>
> The vulnerability can be remediated by updating the library to version 3.0.5 or higher, using npm update minimatch.
CVE-2022-25883:
> The library semver version 7.3.7 was detected in NPM library manager located at /scratch/tpp-llvm-tar/llvm-project-faf5d747f174cc9d714839f0d3bce1a783eac2ac/mlir/utils/vscode/package-lock.json on line 1905 and is vulnerable to CVE-2022-25883, which exists in versions >= 7.0.0, < 7.5.2.
>
> The vulnerability was found in the [Github Security Advisory](https://github.com/advisories/GHSA-c2qf-rxjj-qqgw) with vendor severity: High ([NVD](https://nvd.nist.gov/vuln/detail/CVE-2022-25883) severity: High).
>
> The vulnerability can be remediated by updating the library to version 7.5.2 or higher, using npm update semver.
### PoC
All we do is download a checkout of a recent llvm-project version (couple days old as of the creation of the report), in our case as a tar, and unpack it. Our subsequent build does not involve the MLIR VSCode extension, i.e. we do _not_ build it.
As far as we understand, Wiz performs an automated sweep in the background over the checked out files and complains about the contents of `mlir/utils/vscode/package-lock.json` even if the system in question does not have `npm` installed and the files are not used for any build/by any executable.
Manually removing the file from all checkouts seems to have appeased at least one of the vulnerability checkers. We expect that when we obtain a new checkout - and do not delete the lock file - we do get new warnings and machine disconnection threats.
### Impact
Potentially it affects the MLIR VSCode extension that is distributed in the VSCode extension "store". As the CVEs concern Regex DOS and VSCode (mostly) runs locally and without arbitrary network clients, the potential for actual abuse seems low.
### Security vulnerability report
The above was reported as a security vulnerability first (GHSA-g72r-487m-m6hh). That got closed with a request to make it a normal issue. Here we are.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUWE1z2zgS_TXwpUssCvqiDjootjWZqk0mFac8xykQbIqIQYAGQMraX7_VACXLdjaeXGZrq3KIQXx0v37d_VrCe7U3iBu2-MAWN1eiD411G2d13VqH-qq01XHD-Cz9g7u-bYU7sny77YNtRcAKZIPywUN5hD_Vv6HWYg99B6ERATohH8QePbBl7rEd0LFlDsJUtNAqo1oRZENrjRgQbB-qeOWAzitrPCgDoUHaPV410VY-ZN-9NXSqVhqhti5u-vSv37_C_d21rRDwKaChK-DQKNmAVgPSbV5V8Tath3bSOfs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