Vulnerabilities in pkg:golang/github.com/cyphar/filepath-securejoin

PACKAGE
Advisory Summary

GHSA-6xv5-86q9-7xr8 is a MODERATE on windows, paths outside of vulnerability (General Security Weakness) affecting SecureJoin libraries in the Go ecosystem. The issue involves on windows, paths outside of the rootfs could be inadvertently produced. Remediation is available by upgrading affected packages to version 0.2.4.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/cyphar/filepath-securejoin

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/cyphar/filepath-securejoin. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-6xv5-86q9-7xr8 - MODERATE SecureJoin: on windows, paths outside of the rootfs could be inadvertently produced

GHSA-6xv5-86q9-7xr8 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-6xv5-86q9-7xr8
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification General Security Weakness
Affected Product SecureJoin
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-6xv5-86q9-7xr8

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

github.com/cyphar/filepath-securejoin fixed: 0.2.4
Upgrade github.com/cyphar/filepath-securejoin to 0.2.4
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 github.com/cyphar/filepath-securejoin

How to Check if You Are Affected

To determine whether your application is affected by GHSA-6xv5-86q9-7xr8, inspect your project dependencies for SecureJoin:

inspect dependencies for github.com/cyphar/filepath-securejoin

Analyze the terminal output to locate any version of SecureJoin in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.4), 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 General Security Weakness. In SecureJoin, 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 For Windows users of `github.com/cyphar/filepath-securejoin`, until v0.2.4 it was possible for certain rootfs and path combinations (in particular, where a malicious Unix-style `/`-separated unsafe path was used with a Windows-style rootfs path) to result in generated paths that were outside of the provided rootfs. It is unclear to what extent this has a practical impact on real users, but given the possible severity of the issue we have released an emergency patch release that resolves this issue. Thanks to @pjbgf for discovering, debugging, and fixing this issue (as well as writing some tests for it). ### Patches c121231e1276e11049547bee5ce68d5a2cfe2d9b is the patch fixing this issue. v0.2.4 contains the fix. ### Workarounds Users could use `filepath.FromSlash()` on all unsafe paths before passing them to `filepath-securejoin`. ### References See #9.

GHSA-6xv5-86q9-7xr8 Affected SecureJoin Versions

1 component(s)
Fixed Versions:
0.2.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cyphar/filepath-securejoin
Go
< 0.2.4
0.2.4

References

Frequently Asked Questions

What is GHSA-6xv5-86q9-7xr8?
GHSA-6xv5-86q9-7xr8 is a security vulnerability in SecureJoin involving on windows, paths outside of the rootfs could be inadvertently produced under General Security Weakness.
Which SecureJoin versions are affected?
Affected versions include releases prior to 0.2.4 across affected packages: github.com/cyphar/filepath-securejoin.
What version fixes GHSA-6xv5-86q9-7xr8?
Upgrading to 0.2.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cyphar/filepath-securejoin affected?
Yes, github.com/cyphar/filepath-securejoin is affected in releases prior to 0.2.4. Upgrade your dependency to 0.2.4 or later.
What CWE is associated with GHSA-6xv5-86q9-7xr8?
GHSA-6xv5-86q9-7xr8 is classified under General Security Weakness.
How can I check Go dependencies for GHSA-6xv5-86q9-7xr8?
Run the dependency tree command: 'inspect dependencies for github.com/cyphar/filepath-securejoin'. 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-6xv5-86q9-7xr8",
  "modified" : "2023-09-07T12:58:58Z",
  "published" : "2023-09-07T12:58:58Z",
  "aliases" : [ ],
  "summary" : "SecureJoin: on windows, paths outside of the rootfs could be inadvertently produced",
  "details" : "### Impact\nFor Windows users of `github.com/cyphar/filepath-securejoin`, until v0.2.4 it was possible for certain rootfs and path combinations (in particular, where a malicious Unix-style `/`-separated unsafe path was used with a Windows-style rootfs path) to result in generated paths that were outside of the provided rootfs.\n\nIt is unclear to what extent this has a practical impact on real users, but given the possible severity of the issue we have released an emergency patch release that resolves this issue.\n\nThanks to  @pjbgf for discovering, debugging, and fixing this issue (as well as writing some tests for it).\n\n### Patches\nc121231e1276e11049547bee5ce68d5a2cfe2d9b is the patch fixing this issue. v0.2.4 contains the fix.\n\n### Workarounds\nUsers could use `filepath.FromSlash()` on all unsafe paths before passing them to `filepath-securejoin`.\n\n### References\nSee #9.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cyphar/filepath-securejoin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cyphar/filepath-securejoin/security/advisories/GHSA-6xv5-86q9-7xr8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cyphar/filepath-securejoin/pull/9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cyphar/filepath-securejoin/commit/c121231e1276e11049547bee5ce68d5a2cfe2d9b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cyphar/filepath-securejoin"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cyphar/filepath-securejoin/releases/tag/v0.2.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-07T12:58:58Z",
    "nvd_published_at" : null
  }
}