CVE-2023-30626: Jellyfin.Controller Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-9p5f-5x8v-x65m
CVSS 8.8
CWE-22
Published
Advisory Summary

CVE-2023-30626 is a HIGH (CVSS 8.8) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Jellyfin.Controller libraries in the NuGet ecosystem. The issue involves directory traversal + file write causing arbitrary code execution. Remediation is available by upgrading affected packages to version 10.8.10.

CVE-2023-30626 at a Glance

CVE Identifier CVE-2023-30626
GHSA Identifier GHSA-9p5f-5x8v-x65m
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Jellyfin.Controller
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 8.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

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

How to Fix CVE-2023-30626

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

Jellyfin.Controller fixed: 10.8.10
Upgrade Jellyfin.Controller to 10.8.10
Verify Direct and Transitive Dependencies

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

inspect dependencies for Jellyfin.Controller

How to Check if You Are Affected

To determine whether your application is affected by CVE-2023-30626, inspect your project dependencies for Jellyfin.Controller:

inspect dependencies for Jellyfin.Controller

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Jellyfin.Controller, 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 Frederic Linn (@FredericLinn) has reported a series of vulnerabilities that can result in directory traversal, file write, and potential remote code execution on Jellyfin instances. The general process involves chaining several exploits including a stored XSS vulnerability and can be used by an unprivileged user. The general process is (using the example of setting an intro video as the payload): * Create a session as a low-priviledged user with a crafted authorization header * Upload an executable that contains a malicious plugin inline via /ClientLog/Document * (Admin hovers over our device in dashboard -> XSS payload gets triggered) * XSS Payload tries to set encoder path to our uploaded "log" file via /System/MediaEncoder/Path * The request fails, but in the process our executable actually runs (I guess for verifying if the path points to a valid ffmpeg version) * The executable will create a plugin folder and place the inlined plugin DLL inside it * The XSS payload shuts down the server via /System/Shutdown (separate CVE in `jellyfin-web`) * After (manually) starting the server, the plugin gets loaded and will: * write a new video into the Jellyfin temp folder and register it * register this video as the new intro * and finally provide a malicious endpoint that simply executes system commands and sends back the results The ability to write arbitrary content to log files was added in #5918 to allow flexibility to client logging. The following two sections detail Frederic's exact determinations regarding the two vulnerabilities. #### Directory traversal and file write I've been reading the codebase here and there for a couple of days and found a directory traversal inside the ClientLogController, specifically /ClientLog/Document. The GetRequestInformation method retrieves the name and version of the client from the HttpContext.User object. Those values are attacker controlled when authenticating against the API. Both values are interpolated into a string, which ultimately ends up as an argument to Path.Combine(). Setting a client name to the relative path "\..\..\..\..\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\test" will write a file with completely attacker controlled content to the executing user's autostart directory. However, because the attacker only partially controls the filename, exploitation proves to be tricky. That's because the resulting file will always end in ".log", which means putting something in the autostart directory is only going to open notepad on startup. I mean, we can at least insult the user :^). Anyway, the next logical step would be to write into Jellyfin's plugins directory, but the sub-directories there (of which the already existing configurations directory conveniently counts as one!) are only getting scanned for ".dll" files. This stops an attacker from providing malicious DLLs that implement the correct interfaces in order to be recognized as legitimate plugins. On Linux, there might be more options. Running as the standard root user inside a container, an attacker could of course write anywhere. There's the very interesting "/etc/cron.d" directory, where an attacker can place cron jobs that get picked up automatically. Those files, however, can't contain a dot. Moreover, inside the container the cronjobs are probably not being executed, as the Jellyfin process should be only one running. For the stored XSS component, see https://github.com/jellyfin/jellyfin-web/security/advisories/GHSA-89hp-h43h-r5pq ### Patches 10.8.10 ### Workarounds N/A ### References A complete write-up is available here: https://gebir.ge/blog/peanut-butter-jellyfin-time/

CVE-2023-30626 Affected Jellyfin.Controller Versions

1 component(s)
Fixed Versions:
10.8.10
Product / Package Ecosystem Affected Versions Fixed Version
Jellyfin.Controller
NuGet
≥ 10.8.0
< 10.8.10
10.8.10

References

Frequently Asked Questions

What is CVE-2023-30626?
CVE-2023-30626 is a security vulnerability in Jellyfin.Controller involving Directory traversal + file write causing arbitrary code execution under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Jellyfin.Controller versions are affected?
Affected versions include releases prior to 10.8.10 across affected packages: Jellyfin.Controller.
What version fixes CVE-2023-30626?
Upgrading to 10.8.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Jellyfin.Controller affected?
Yes, Jellyfin.Controller is affected in releases prior to 10.8.10. Upgrade your dependency to 10.8.10 or later.
What is the CVSS score of CVE-2023-30626?
CVE-2023-30626 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-30626?
CVE-2023-30626 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check NuGet dependencies for CVE-2023-30626?
Run the dependency tree command: 'inspect dependencies for Jellyfin.Controller'. 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-9p5f-5x8v-x65m",
  "modified" : "2023-05-09T16:24:16Z",
  "published" : "2023-04-24T22:39:03Z",
  "aliases" : [ "CVE-2023-30626" ],
  "summary" : "Directory traversal + file write causing arbitrary code execution",
  "details" : "### Impact\nFrederic Linn (@FredericLinn) has reported a series of vulnerabilities that can result in directory traversal, file write, and potential remote code execution on Jellyfin instances. The general process involves chaining several exploits including a stored XSS vulnerability and can be used by an unprivileged user.\n\nThe general process is (using the example of setting an intro video as the payload):\n\n* Create a session as a low-priviledged user with a crafted authorization header\n* Upload an executable that contains a malicious plugin inline via /ClientLog/Document\n* (Admin hovers over our device in dashboard -> XSS payload gets triggered)\n* XSS Payload tries to set encoder path to our uploaded \"log\" file via /System/MediaEncoder/Path\n* The request fails, but in the process our executable actually runs (I guess for verifying if the path points to a valid ffmpeg version)\n* The executable will create a plugin folder and place the inlined plugin DLL inside it\n* The XSS payload shuts down the server via /System/Shutdown (separate CVE in `jellyfin-web`)\n* After (manually) starting the server, the plugin gets loaded and will:\n    * write a new video into the Jellyfin temp folder and register it\n    * register this video as the new intro\n    * and finally provide a malicious endpoint that simply executes system commands and sends back the results\n\nThe ability to write arbitrary content to log files was added in #5918 to allow flexibility to client logging.\n\nThe following two sections detail Frederic's exact determinations regarding the two vulnerabilities.\n\n#### Directory traversal and file write\n\nI've been reading the codebase here and there for a couple of days and found a directory traversal inside the ClientLogController, specifically /ClientLog/Document.\n\nThe GetRequestInformation method retrieves the name and version of the client from the HttpContext.User object.\n\nThose values are attacker controlled when authenticating against the API. Both values are interpolated into a string, which ultimately ends up as an argument to Path.Combine().\n\nSetting a client name to the relative path \"\\..\\..\\..\\..\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\test\" will write a file with completely attacker controlled content to the executing user's autostart directory.\n\nHowever, because the attacker only partially controls the filename, exploitation proves to be tricky. That's because the resulting file will always end in \".log\", which means putting something in the autostart directory is only going to open notepad on startup. I mean, we can at least insult the user :^).\n\nAnyway, the next logical step would be to write into Jellyfin's plugins directory, but the sub-directories there (of which the already existing configurations directory conveniently counts as one!) are only getting scanned for \".dll\" files.\n\nThis stops an attacker from providing malicious DLLs that implement the correct interfaces in order to be recognized as legitimate plugins.\n\nOn Linux, there might be more options. Running as the standard root user inside a container, an attacker could of course write anywhere. There's the very interesting \"/etc/cron.d\" directory, where an attacker can place cron jobs that get picked up automatically. Those files, however, can't contain a dot. Moreover, inside the container the cronjobs are probably not being executed, as the Jellyfin process should be only one running.\n\nFor the stored XSS component, see https://github.com/jellyfin/jellyfin-web/security/advisories/GHSA-89hp-h43h-r5pq\n\n### Patches\n10.8.10\n\n### Workarounds\nN/A\n\n### References\n\nA complete write-up is available here: https://gebir.ge/blog/peanut-butter-jellyfin-time/",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Jellyfin.Controller"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "10.8.0"
      }, {
        "fixed" : "10.8.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin-web/security/advisories/GHSA-89hp-h43h-r5pq"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin/security/advisories/GHSA-9p5f-5x8v-x65m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-30626"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin/pull/5918"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin/commit/82ad2633fdfb1c37a158057c7935f83e1129eda7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jellyfin/jellyfin"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin/blob/22d880662283980dec994cd7d35fe269613bfce3/Jellyfin.Api/Controllers/ClientLogController.cs#L44"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jellyfin/jellyfin/releases/tag/v10.8.10"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-04-24T22:39:03Z",
    "nvd_published_at" : "2023-04-24T21:15:09Z"
  }
}