CVE-2024-34712: Oceanic.js Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-5h5v-hw44-f6gg
CVSS 6.5
CWE-23 CWE-22
Published
Advisory Summary

CVE-2024-34712 is a MODERATE (CVSS 6.5) path traversal vulnerability (CWE-23: Relative Path Traversal) affecting Oceanic.js libraries in the npm ecosystem. The issue involves oceanic allows unsanitized user input to lead to path traversal in urls. Remediation is available by upgrading affected packages to version 1.10.4.

CVE-2024-34712 at a Glance

CVE Identifier CVE-2024-34712
GHSA Identifier GHSA-5h5v-hw44-f6gg
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-23: Relative Path Traversal
Affected Product Oceanic.js
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.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:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2024-34712

To remediate this vulnerability, upgrade all affected Oceanic.js dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

oceanic.js fixed: 1.10.4
npm install oceanic.js@1.10.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls oceanic.js

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-34712, inspect your project dependencies using npm:

npm ls oceanic.js

Analyze the terminal output to locate any version of Oceanic.js in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.4), your application is affected.

Note: The npm ls oceanic.js 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-23: Relative Path Traversal, where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory. In Oceanic.js, 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

### Impact Input to functions such as `Client.rest.channels.removeBan` is not url-encoded, resulting in specially crafted input such as `../../../channels/{id}` being normalized into the url `/api/v10/channels/{id}`, and deleting a channel rather than removing a ban. ### Workarounds * Sanitizing user input, ensuring strings are valid for the purpose they are being used for. * Encoding input with `encodeURIComponent` before providing it to the library. ### References OceanicJS/Oceanic@8bf8ee8373b8c565fbdbf70a609aba4fbc1a1ffe

CVE-2024-34712 Affected Oceanic.js Versions

1 component(s)
Fixed Versions:
1.10.4
Product / Package Ecosystem Affected Versions Fixed Version
oceanic.js
npm
< 1.10.4
1.10.4

References

Frequently Asked Questions

What is CVE-2024-34712?
CVE-2024-34712 is a security vulnerability in Oceanic.js involving Oceanic allows unsanitized user input to lead to path traversal in URLs under CWE-23: Relative Path Traversal.
Which Oceanic.js versions are affected?
Affected versions include releases prior to 1.10.4 across affected packages: oceanic.js.
What version fixes CVE-2024-34712?
Upgrading to 1.10.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is oceanic.js affected?
Yes, oceanic.js is affected in releases prior to 1.10.4. Upgrade your dependency to 1.10.4 or later.
What is the CVSS score of CVE-2024-34712?
CVE-2024-34712 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2024-34712?
CVE-2024-34712 is classified under CWE-23: Relative Path Traversal (The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize sequences such as ".." that can resolve to a location that is outside of that directory.).
How can I check npm dependencies for CVE-2024-34712?
Run the dependency tree command: 'npm ls oceanic.js'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5h5v-hw44-f6gg",
  "modified" : "2024-05-14T20:13:58Z",
  "published" : "2024-05-14T20:13:58Z",
  "aliases" : [ "CVE-2024-34712" ],
  "summary" : "Oceanic allows unsanitized user input to lead to path traversal in URLs",
  "details" : "### Impact\nInput to functions such as `Client.rest.channels.removeBan` is not url-encoded, resulting in specially crafted input such as `../../../channels/{id}` being normalized into the url `/api/v10/channels/{id}`, and deleting a channel rather than removing a ban.\n\n### Workarounds\n* Sanitizing user input, ensuring strings are valid for the purpose they are being used for.\n* Encoding input with `encodeURIComponent` before providing it to the library.\n\n### References\nOceanicJS/Oceanic@8bf8ee8373b8c565fbdbf70a609aba4fbc1a1ffe",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "oceanic.js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.10.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/OceanicJS/Oceanic/security/advisories/GHSA-5h5v-hw44-f6gg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-34712"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/OceanicJS/Oceanic/commit/8bf8ee8373b8c565fbdbf70a609aba4fbc1a1ffe"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/OceanicJS/Oceanic"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-23" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-05-14T20:13:58Z",
    "nvd_published_at" : "2024-05-14T16:17:26Z"
  }
}