mirror of
https://github.com/rclone/rclone.git
synced 2026-10-28 14:28:38 -04:00
netstorage: stop a path starting with // moving the remote to another host GHSA-xqmq-v4wj-rw5m CVE-PENDING
The netstorage backend joins the path after `remote:` onto the configured host URL according to the URL standard. A path beginning with `//` is a network-path reference under that standard, so a path such as `//other.example/dir/` replaced the configured host (and port and userinfo) rather than being treated as a path. Every request, including the initial stat, was then signed with the account secret and sent to the substituted host. The signature covers the request path and action but not the host, so the substituted host received signatures valid for replay against the real NetStorage endpoint for the duration of their validity. Use rest.URLJoinRoot, which refuses any root that changes the scheme, host or userinfo of the configured URL.
This commit is contained in:
1 parent
ecd821243f
commit
4f28f4492c
1 file changed
+2
-2
@@ -236,9 +236,9 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("couldn't parse URL %q: %w", opt.Endpoint, err)
|
||||
}
|
||||
u, err := rest.URLJoin(base, rest.URLPathEscape(root))
|
||||
u, err := rest.URLJoinRoot(base, root)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("couldn't join URL %q and %q: %w", base.String(), root, err)
|
||||
return nil, err
|
||||
}
|
||||
client := fshttp.NewClient(ctx)
|
||||
|
||||
|
||||
Reference in new issue
Block a user