CVE-2022-25345: @discordjs/opus Remote Code Execution Vulnerability
HIGHCVE-2022-25345 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-908: Use of Uninitialized Resource) affecting @discordjs/opus libraries in the npm ecosystem. The issue involves uncontrolled resource consumption in @discordjs/opus. Remediation is available by upgrading affected packages to version 0.8.0.
CVE-2022-25345 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2022-25345
To remediate this vulnerability, upgrade all affected @discordjs/opus dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @discordjs/opus@0.8.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @discordjs/opus
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-25345, inspect your project dependencies using npm:
npm ls @discordjs/opus
Analyze the terminal output to locate any version of @discordjs/opus in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.8.0), your application is affected.
Note: The npm ls @discordjs/opus command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-908: Use of Uninitialized Resource, where the product uses or accesses a resource that has not been initialized. In @discordjs/opus, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-25345 Affected @discordjs/opus Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@discordjs/opus
|
npm |
< 0.8.0
|
0.8.0
|
References
Frequently Asked Questions
What is CVE-2022-25345?
Which @discordjs/opus versions are affected?
What version fixes CVE-2022-25345?
Is @discordjs/opus affected?
What is the CVSS score of CVE-2022-25345?
What CWE is associated with CVE-2022-25345?
How can I check npm dependencies for CVE-2022-25345?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rvgf-69j7-xh78",
"modified" : "2023-09-07T18:48:21Z",
"published" : "2022-06-18T00:00:20Z",
"aliases" : [ "CVE-2022-25345" ],
"summary" : "Uncontrolled Resource Consumption in @discordjs/opus",
"details" : "Improperly handled errors in @discordjs/opus cause hard crashes instead of returning the error to user land. All versions of package @discordjs/opus (<= 0.7.0) are vulnerable to Denial of Service (DoS) when trying to encode using an encoder with zero channels, or a non-initialized buffer. This leads to a hard crash due to improperly returning the errors from the invalid inputs.\n\nAs of version 0.8.0, the errors are correctly returned to the user and are no longer throwing hard crashes that cannot be recovered.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@discordjs/opus"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.8.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25345"
}, {
"type" : "WEB",
"url" : "https://github.com/discordjs/opus/commit/406249f3fca484a2af97a34ceb989019efa09bc7"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/discordjs/opus"
}, {
"type" : "WEB",
"url" : "https://github.com/discordjs/opus/blob/3ca4341ffdd81cf83cec57045e59e228e6017590/src/node-opus.cc#L28"
}, {
"type" : "WEB",
"url" : "https://github.com/discordjs/opus/releases/tag/v0.8.0"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-DISCORDJSOPUS-2403100"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-908" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-20T22:30:01Z",
"nvd_published_at" : "2022-06-17T20:15:00Z"
}
}