Skip to content

GHSA-h39g-6x3c-7fq9 Zio has SubFileSystem Path Confinement Bypass via Unresolved `..` Segment

LowCVSS 3.8
Published
Updated
Exploit status
No public exploit known

Description

Summary

SubFileSystem fails to confine operations to its declared sub path when the input path is /../ (or equivalents /../, /..\\). This path passes all validation but resolves to the root of the parent filesystem, allowing directory level operations outside the intended boundary.

Affected Component

Zio.UPath.ValidateAndNormalize
Zio.FileSystems.SubFileSystem

UPath.ValidateAndNormalize has a trailing slash optimisation.

if (!processParts && i + 1 == path.Length)
    return path.Substring(0, path.Length - 1);

When the input ends with / or \, and processParts is still false, the function strips the trailing separator and returns immediately before the .. resolution logic runs. The input /../ triggers this path: the trailing / is the last character, processParts has not been set (because .. as the first relative segment after root is specifically exempted), so the function returns /.. with the .. segment unresolved.

The resulting UPath with FullName = "/.." is absolute, contains no control characters, and no colon so it passes FileSystem.ValidatePath without rejection.

When this path reaches SubFileSystem.ConvertPathToDelegate:

protected override UPath ConvertPathToDelegate(UPath path)
{
    var safePath = path.ToRelative();     // "/..".ToRelative() = ".."
    return SubPath / safePath;            // "/jail" / ".." = "/"  (resolved by Combine)
}

The delegate filesystem receives / (the root) instead of a path under /jail.

Proof of Concept

using Zio;
using Zio.FileSystems;

var root = new MemoryFileSystem();
root.CreateDirectory("/sandbox");
var sub = new SubFileSystem(root, "/sandbox");

Console.WriteLine(sub.DirectoryExists("/../"));           // True (sees parent root)
Console.WriteLine(sub.ConvertPathToInternal("/../"));     // "/" (parent root path)

Impact

The escape is limited to directory level operations because appending a filename after .. (e.g., /../file.txt) causes normal .. resolution to trigger, which correctly rejects the path as going above root. Only the bare terminal /../ (which strips to /..) survives. This means that exploitability is limited, and this vulnerability does not escalate to file read/write.

Upgrade path

1 package: 1 fixed.

PackageAffectedFixed inStatus
nuget Zio(NuGet) < 0.22.2; <= 0.22.1; = 0.1.0; = 0.2.0 +43 more 0.22.2 Fixed

Affected products

ProductAffected versionsFixed in
nuget Zio(NuGet) < 0.22.2 0.22.2
nuget Zio(NuGet) = 0.1.0 No fix listed
nuget Zio(NuGet) = 0.10.0 No fix listed
nuget Zio(NuGet) = 0.11.0 No fix listed
nuget Zio(NuGet) = 0.12.0 No fix listed
nuget Zio(NuGet) = 0.13.0 No fix listed
nuget Zio(NuGet) = 0.14.0 No fix listed
nuget Zio(NuGet) = 0.15.0 No fix listed
nuget Zio(NuGet) = 0.16.0 No fix listed
nuget Zio(NuGet) = 0.16.1 No fix listed
nuget Zio(NuGet) = 0.16.2 No fix listed
nuget Zio(NuGet) = 0.17.0 No fix listed
nuget Zio(NuGet) = 0.17.1 No fix listed
nuget Zio(NuGet) = 0.18.0 No fix listed
nuget Zio(NuGet) = 0.18.1 No fix listed
nuget Zio(NuGet) = 0.19.0 No fix listed
nuget Zio(NuGet) = 0.19.1 No fix listed
nuget Zio(NuGet) = 0.19.2 No fix listed
nuget Zio(NuGet) = 0.2.0 No fix listed
nuget Zio(NuGet) = 0.20.0 No fix listed
nuget Zio(NuGet) = 0.21.0 No fix listed
nuget Zio(NuGet) = 0.21.1 No fix listed
nuget Zio(NuGet) = 0.21.2 No fix listed
nuget Zio(NuGet) = 0.21.3 No fix listed
nuget Zio(NuGet) = 0.22.0 No fix listed
Show 22 more
ProductAffected versionsFixed in
nuget Zio(NuGet) = 0.22.1 No fix listed
nuget Zio(NuGet) = 0.3.0 No fix listed
nuget Zio(NuGet) = 0.3.1 No fix listed
nuget Zio(NuGet) = 0.3.2 No fix listed
nuget Zio(NuGet) = 0.3.3 No fix listed
nuget Zio(NuGet) = 0.3.4 No fix listed
nuget Zio(NuGet) = 0.3.5 No fix listed
nuget Zio(NuGet) = 0.3.6 No fix listed
nuget Zio(NuGet) = 0.4.0 No fix listed
nuget Zio(NuGet) = 0.5.0 No fix listed
nuget Zio(NuGet) = 0.6.0 No fix listed
nuget Zio(NuGet) = 0.7.0 No fix listed
nuget Zio(NuGet) = 0.7.1 No fix listed
nuget Zio(NuGet) = 0.7.2 No fix listed
nuget Zio(NuGet) = 0.7.3 No fix listed
nuget Zio(NuGet) = 0.7.4 No fix listed
nuget Zio(NuGet) = 0.7.5 No fix listed
nuget Zio(NuGet) = 0.7.6 No fix listed
nuget Zio(NuGet) = 0.8.0 No fix listed
nuget Zio(NuGet) = 0.9.0 No fix listed
nuget Zio(NuGet) = 0.9.1 No fix listed
nuget Zio(NuGet) <= 0.22.1 No fix listed

References