Vulnerabilities in pkg:nuget/Tgstation.Server.Api

PACKAGE
Advisory Identifier: GHSA-c3h4-9gc2-f7h4
Advisory Summary

CVE-2024-41799 is a HIGH (CVSS 8.4) tgstation-server's dreammaker environment files outside vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Tgstation.Server.Api libraries in the NuGet ecosystem. The issue involves tgstation-server's dreammaker environment files outside the deployment directory can be compiled and ran by insufficiently permissioned users. Remediation is available by upgrading affected packages to version 6.8.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:nuget/Tgstation.Server.Api

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:nuget/Tgstation.Server.Api. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c3h4-9gc2-f7h4 CVE-2024-41799 HIGH tgstation-server's DreamMaker environment files outside the deployment directory can be compiled and ran by insufficiently permissioned users

CVE-2024-41799 at a Glance

CVE Identifier CVE-2024-41799
GHSA Identifier GHSA-c3h4-9gc2-f7h4
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Tgstation.Server.Api
Package Ecosystem NuGet
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2024-41799

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

Tgstation.Server.Api fixed: 6.8.0
Upgrade Tgstation.Server.Api to 6.8.0
Tgstation.Server.Host fixed: 6.8.0
Upgrade Tgstation.Server.Host to 6.8.0
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 Tgstation.Server.Api

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-41799, inspect your project dependencies for Tgstation.Server.Api:

inspect dependencies for Tgstation.Server.Api

Analyze the terminal output to locate any version of Tgstation.Server.Api in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.8.0), 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 Tgstation.Server.Api, 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 _What kind of vulnerability is it? Who is impacted?_ Low permission users using the "Set .dme Path" privilege could potentially set malicious .dme files existing on the host machine to be compiled and executed. These .dme files could be uploaded via tgstation-server (requiring a separate, isolated privilege) or some other means. A server configured to execute in BYOND's trusted security level (requiring a third separate, isolated privilege OR being set by another user) could lead to this escalating into remote code execution via BYOND's shell() proc. The ability to execute this kind of attack is a known side effect of having privileged TGS users, but normally requires multiple privileges with known weaknesses. This vector is not intentional as it does not require control over the where deployment code is sourced from and _may_ not require remote write access to an instance's `Configuration` directory. ### Patches _Has the problem been patched? What versions should users upgrade to?_ This problem is patched by pull request #1835 and fixed in versions 6.8.0 and above. ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ Do not give un-trusted users the Deployment permission to set a .dme path on instances.

CVE-2024-41799 Affected Tgstation.Server.Api Versions

2 component(s)
Fixed Versions:
6.8.0
Product / Package Ecosystem Affected Versions Fixed Version
Tgstation.Server.Api
NuGet
≥ 4.0.0
< 6.8.0
6.8.0
Tgstation.Server.Host
NuGet
≥ 4.0.0
< 6.8.0
6.8.0

References

Frequently Asked Questions

What is CVE-2024-41799?
CVE-2024-41799 is a security vulnerability in Tgstation.Server.Api involving tgstation-server's DreamMaker environment files outside the deployment directory can be compiled and ran by insufficiently permissioned users under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Tgstation.Server.Api versions are affected?
Affected versions include releases prior to 6.8.0 across affected packages: Tgstation.Server.Api, Tgstation.Server.Host.
What version fixes CVE-2024-41799?
Upgrading to 6.8.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Tgstation.Server.Api affected?
Yes, Tgstation.Server.Api is affected in releases prior to 6.8.0. Upgrade your dependency to 6.8.0 or later.
Is Tgstation.Server.Host affected?
Yes, Tgstation.Server.Host is affected in releases prior to 6.8.0. Upgrade your dependency to 6.8.0 or later.
What is the CVSS score of CVE-2024-41799?
CVE-2024-41799 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:H.
What CWE is associated with CVE-2024-41799?
CVE-2024-41799 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-2024-41799?
Run the dependency tree command: 'inspect dependencies for Tgstation.Server.Api'. 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-c3h4-9gc2-f7h4",
  "modified" : "2024-07-29T16:44:15Z",
  "published" : "2024-07-29T16:44:15Z",
  "aliases" : [ "CVE-2024-41799" ],
  "summary" : "tgstation-server's DreamMaker environment files outside the deployment directory can be compiled and ran by insufficiently permissioned users",
  "details" : "### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nLow permission users using the \"Set .dme Path\" privilege could potentially set malicious .dme files existing on the host machine to be compiled and executed. \n\nThese .dme files could be uploaded via tgstation-server (requiring a separate, isolated privilege) or some other means.\n\nA server configured to execute in BYOND's trusted security level (requiring a third separate, isolated privilege OR being set by another user) could lead to this escalating into remote code execution via BYOND's shell() proc.\n\nThe ability to execute this kind of attack is a known side effect of having privileged TGS users, but normally requires multiple privileges with known weaknesses. This vector is not intentional as it does not require control over the where deployment code is sourced from and _may_ not require remote write access to an instance's `Configuration` directory.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nThis problem is patched by pull request #1835 and fixed in versions 6.8.0 and above.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nDo not give un-trusted users the Deployment permission to set a .dme path on instances.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:H/SC:H/SI:L/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Tgstation.Server.Api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "6.8.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Tgstation.Server.Host"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "6.8.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/tgstation/tgstation-server/security/advisories/GHSA-c3h4-9gc2-f7h4"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-41799"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tgstation/tgstation-server/pull/1835"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/tgstation/tgstation-server/commit/374852fe5ae306415eb5aafb2d16b06897d7afe4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/tgstation/tgstation-server"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-29T16:44:15Z",
    "nvd_published_at" : "2024-07-29T15:15:16Z"
  }
}