CVE-2024-34712 Oceanic allows unsanitized user input to lead to path traversal in URLs
Attackers can manipulate API URLs to delete Discord channels instead of removing bans due to unsanitized input in the Oceanic library.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2024-34712?
CVE-2024-34712 is a medium-severity path traversal vulnerability in OceanicJS Oceanic, published on 14 May 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
Oceanic is a NodeJS library for interfacing with Discord. Prior to version 1.10.4, 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. Version 1.10.4 fixes this issue. Some workarounds are available. One may sanitize user input, ensuring strings are valid for the purpose they are being used for. One may also encode input with `encodeURIComponent` before providing it to the library.
Which versions are affected by CVE-2024-34712?
2 open source packages ship an affected version, including oceanic.js.
| Package | Affected | Fixed in |
|---|---|---|
oceanic.js npm | All versions | 1.10.4 |
oceanic.js npm | All versions | 1.10.4 |
How do I fix CVE-2024-34712?
Upgrade oceanic.js to 1.10.4 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2024-34712 being exploited?
There is no known exploitation of CVE-2024-34712 in the wild and no public exploit code.
Sources
Also known as GHSA-5h5v-hw44-f6gg.