CVE-2020-8174: napi_get_value_string_*() allows various kinds of memory corruption
A flaw was found in nodejs. Calling napigetvaluestringlatin1(), napigetvaluestringutf8(), or napigetvaluestringutf16() with a non-NULL buf, and a bufsize of 0 will cause the entire string value to be written to buf, probably overrunning the length of the buffer.
Other sources
Calling napigetvaluestringlatin1(), napigetvaluestringutf8(), or napigetvaluestringutf16() with a non-NULL buf, and a bufsize of 0 will cause the entire string value to be written to buf, probably overrunning the length of the buffer.
A exploit has not been reported and it may be difficult but the following is suggested:
All users of LTS Node.js versions should update to the versions announced in this security post. This will address the issue for any non pre-built add-on.
Maintainers who support EOL Node.js versions and/or build against a version of Node.js that did not support N-API internally should update to use the new versions of node-addon-api 1.x and 2.x that will be released soon after this announcement.
The N-API version matrix shows which versions of Node.js in which this support was added.
— Node.Js
Calling napigetvaluestringlatin1(), napigetvaluestringutf8(), or napigetvaluestringutf16() with a non-NULL buf, and a bufsize of 0 will cause the entire string value to be written to buf, probably overrunning the length of the buffer.
Reference: https://nodejs.org/en/blog/vulnerability/june-2020-security-releases/
— Red Hat
napigetvaluestring() allows various kinds of memory corruption in node < 10.21.0, 12.18.0, and < 14.4.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/rh-nodejs12-nodejsto a version that resolves this vulnerability.Fixed in 0:12.18.2-1.el7 - Upgrade
Upgrade
redhat/rh-nodejs10-nodejsto a version that resolves this vulnerability.Fixed in 0:10.21.0-3.el7 - Upgrade
Upgrade
redhat/nodejsto a version that resolves this vulnerability.Fixed in 10.21.0 - Upgrade
Upgrade
redhat/nodejsto a version that resolves this vulnerability.Fixed in 12.18.0 - Upgrade
Upgrade
redhat/nodejsto a version that resolves this vulnerability.Fixed in 14.4.0 - Upgrade
Upgrade
debian/nodejsto a version that resolves this vulnerability.Fixed in 12.22.12~dfsg-1~deb11u4Fixed in 12.22.12~dfsg-1~deb11u5Fixed in 18.19.0+dfsg-6~deb12u2Fixed in 18.19.0+dfsg-6~deb12u1Fixed in 20.17.0+dfsg-2 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 10.21.0Fixed in 12.18.0Fixed in 14.4.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 10.21.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 12.18.0 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 14.4.0 - Upgrade
Upgrade
alpine/nodejsto a version that resolves this vulnerability.Fixed in 12.20.1-r0 - Upgrade
Upgrade
alpine/nodejsto a version that resolves this vulnerability.Fixed in 12.18.3-r0 - Upgrade
Upgrade
alpine/nodejsto a version that resolves this vulnerability.Fixed in 12.18.0-r0 - Upgrade
Upgrade
alpine/nodejs-currentto a version that resolves this vulnerability.Fixed in 14.4.0-r0 - Upgrade
Upgrade
nodejs/nodeto a version that resolves this vulnerability.Fixed in 10.21.0 - Upgrade
Upgrade
nodejs/nodeto a version that resolves this vulnerability.Fixed in 12.18.0 - Upgrade
Upgrade
nodejs/nodeto a version that resolves this vulnerability.Fixed in 14.4.0
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2020-8174?
CVE-2020-8174 is a vulnerability found in nodejs that allows various kinds of memory corruption.
How does CVE-2020-8174 affect nodejs?
Calling certain functions with a non-NULL buf and bufsize of 0 can cause a buffer overrun.
What is the severity of CVE-2020-8174?
CVE-2020-8174 has a severity value of 8.1 (high).
Which versions of nodejs are affected by CVE-2020-8174?
Nodejs versions < 10.21.0, 12.18.0, and < 14.4.0 are affected by CVE-2020-8174.
How can I fix CVE-2020-8174 in nodejs?
Upgrade to version 10.21.0, 12.18.0, or 14.4.0 or later to fix CVE-2020-8174 in nodejs.