20,000 GitHub projects at risk from Node.js ‘standard-version’ library vulnerability
More than 20,000 GitHub projects rely on the Node.js standard-version utility to implement semantic versioning (semver) and for generating CHANGELOG files for their builds.
A Proof-of-Concept (PoC) published by the GitHub Security Labs team this month reveals the presence of a code injection flaw in standard-versions, which means developers using this library could have inadvertently introduced vulnerabilities in their components.
“The standardVersion function has a command injection vulnerability. Clients of the standard-version library are unlikely to be aware of this, so they might unwittingly write code that contains a vulnerability,” read GitHub’s original PoC advisory.
Dubbed GHSL-2020-111 for lack of CVE, the flaw resides in the fact how commit messages are passed onto the `runExec` function. When passing user-controllable arguments, such as “releaseCommitMessageFormat”, arbitrary code can be injected and passed right into `runExec`, leading to command execution.
GitHub considers this vulnerability carrying a “moderate” severity. Their spokesperson told The Daily Swig, “It is hard to create a complete exploit for this vulnerability because it is a library function that is vulnerable. A complete exploit requires that some client uses that specific library function with user-controlled inputs.”
And yes, they are correct. However, the severity of code injection vulnerabilities really depends on the context and how a vulnerable application is being used in the developer’s environment.
Should a user-supplied input be passed to “standard-version” without much friction or checks in between, there is potential for some serious compromise.
Users and developers using standard-version
are advised to upgrade to version 8.0.1 or above to mitigate this vulnerability.
To fix the flaw, the project has replaced calls to runExec
with a more secure runExecFile
command and added additional validations to the code.
The same GitHub advisory also published a list of CVEs and vulnerabilities similar to this one, as identified in other JS libraries:
CVE-2020-7646,
CVE-2020-7614,
CVE-2020-7597,
CVE-2019-10778,
CVE-2019-10776,
CVE-2018-16462,
CVE-2018-16461,
CVE-2018-16460,
CVE-2018-13797,
CVE-2018-3786,
CVE-2018-3772,
CVE-2018-3746,
CVE-2017-16100,
CVE-2017-16042.
“We have written a CodeQL query, which automatically detects this vulnerability. You can see the results of the query on the standard-version
project here,” read the advisory.
Given the wide potential for use and abuse of open source components, developers are encouraged to stay on top of these security advisories and implement fixes as they are released, in their applications.