-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(deps): update rust crate gix to 0.62.0 [security] #13760
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
98edb1a
to
1a111ab
Compare
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 11 commits in 48eca1b164695022295ce466b64b44e4e0228b08..6f06fe908a5ee0f415c187f868ea627e82efe07d 2024-04-12 21:16:36 +0000 to 2024-04-16 18:47:44 +0000 - fix(toml): Error on `[project]` in Edition 2024 (rust-lang/cargo#13747) - feat(update): Include a Locking message (rust-lang/cargo#13759) - chore(deps): update rust crate gix to 0.62.0 [security] (rust-lang/cargo#13760) - test(schemas): Ensure tests cover the correct case (rust-lang/cargo#13761) - feat(resolve): Tell the user the style of resovle done (rust-lang/cargo#13754) - Make sure to also wrap the initial `-vV` invocation (rust-lang/cargo#13659) - docs: update `checkout` GitHub action version (rust-lang/cargo#13757) - Recategorize cargo test's `--doc` flag under "Target Selection" (rust-lang/cargo#13756) - Reword sentence describing workspace toml for clarity (rust-lang/cargo#13753) - docs(ref): Update unstable docs for msrv-policy (rust-lang/cargo#13751) - refactor(config): Consistently use kebab-case (rust-lang/cargo#13748) r? ghost
Update cargo 11 commits in 48eca1b164695022295ce466b64b44e4e0228b08..6f06fe908a5ee0f415c187f868ea627e82efe07d 2024-04-12 21:16:36 +0000 to 2024-04-16 18:47:44 +0000 - fix(toml): Error on `[project]` in Edition 2024 (rust-lang/cargo#13747) - feat(update): Include a Locking message (rust-lang/cargo#13759) - chore(deps): update rust crate gix to 0.62.0 [security] (rust-lang/cargo#13760) - test(schemas): Ensure tests cover the correct case (rust-lang/cargo#13761) - feat(resolve): Tell the user the style of resovle done (rust-lang/cargo#13754) - Make sure to also wrap the initial `-vV` invocation (rust-lang/cargo#13659) - docs: update `checkout` GitHub action version (rust-lang/cargo#13757) - Recategorize cargo test's `--doc` flag under "Target Selection" (rust-lang/cargo#13756) - Reword sentence describing workspace toml for clarity (rust-lang/cargo#13753) - docs(ref): Update unstable docs for msrv-policy (rust-lang/cargo#13751) - refactor(config): Consistently use kebab-case (rust-lang/cargo#13748) r? ghost
This PR contains the following updates:
0.61.0
->0.62.0
GitHub Vulnerability Alerts
GHSA-98p4-xjmm-8mfh
Summary
gix-transport
does not check the username part of a URL for text that the externalssh
program would interpret as an option. A specially crafted clone URL can smuggle options to SSH. The possibilities are syntactically limited, but if a malicious clone URL is used by an application whose current working directory contains a malicious file, arbitrary code execution occurs.Details
This is related to the patched vulnerability GHSA-rrjw-j4m2-mf34, but appears less severe due to a greater attack complexity. Since https://github.com/Byron/gitoxide/pull/1032,
gix-transport
checks the host and path portions of a URL for text that has a-
in a position that will causessh
to interpret part of all of the URL as an option argument. But it does not check the non-mandatory username portion of the URL.As in Git, when an address is a URL of the form
ssh://username@hostname/path
, or when it takes the special formusername@hostname:dirs/repo
, this is treated as an SSH URL.gix-transport
will replace some characters inusername
with their%
-based URL encodings, but otherwise passesusername@hostname
as an argument to the externalssh
command. This happens even ifusername
begins with a hyphen. In that case,ssh
treats that argument as an option argument, and attempts to interpret and honor it as a sequence of one or more options possibly followed by an operand for the last option.This is harder to exploit than GHSA-rrjw-j4m2-mf34, because the possibilities are constrained by:
The difficulty of forming an option argument
ssh
accepts, given that characters such as=
,/
, and\
, are URL-encoded,:
is removed, and the argument passed tossh
contains the@
sign and subsequent host identifier, which in an effective attack must be parseable as a suffix of the operand passed to the last option.The inability to include a literal
=
prevents the use of-oNAME=VALUE
(e.g.,-oProxyCommand=payload
). The inability to include a literal/
or\
prevents smuggling in a path operand residing outside the current working directory, incuding on Windows. (Although a~
character may be smuggled in,ssh
does not perform its own tilde expansion, so it does not form an absolute path.)The difficulty, or perhaps impossibility, of completing a connection (other than when arbitrary code execution has been achieved). This complicates or altogether prevents the use of options such as
-A
and-X
together with a connection to a real but malicious server. The reason a connection cannot generally be completed when exploiting this vulnerability is that, because the argumentgix-transport
intends as a URL is treated as an option argument,ssh
treats the subsequent non-option argumentgit-upload-pack
as the host instead of the command, but it is not a valid host name.Although
ssh
supports aliases for hosts, even ifgit-upload-pack
could be made an alias, that is made difficult by the URL-encoding transformation.However, an attacker who is able to cause a specially named
ssh
configuration file to be placed in the current working directory can smuggle in an-F
option referencing the file, and this allows arbitrary command execution.This scenario is especially plausible because programs that operate on git repositories are often run in untrusted git repositories, sometimes even to operate on another repository. Situations where this is likely, such that an attacker could predict or arrange it, may for some applications include a malicious repository with a malicious submodule configuration.
Other avenues of exploitation exist, but appear to be less severe. For example, the
-E
option can be smuggled to create or append to a file in the current directory (or its target, if it is a symlink). There may also be other significant ways to exploit this that have not yet been discovered, or that would arise with new options in future versions ofssh
.PoC
To reproduce the known case that facilitates arbitrary code execution, first create a file in the current directory named
configfile@example.com
, of the formwhere
payload
is a command with an observable side effect. On Unix-like systems, this could bedate | tee vulnerable
or anxdg-open
,open
, or other command command to launch a graphical application. On Windows, this could be the name of a graphical application already in the search path, such ascalc.exe
.(Although the syntax permitted in the value of
ProxyCommand
may vary by platform, this is not limited to running commands in the current directory. That limitation only applies to paths directly smuggled in the username, not to the contents of a separate malicious configuration file. Arbitrary other settings may be specified inconfigfile@example.com
as well.)Then run:
gix clone 'ssh://-Fconfigfile@example.com/abc'
Or:
gix clone -- '-Fconfigfile@example.com:abc/def'
(The
--
is required to ensure thatgix
is really passing the argument as a URL for use ingix-transport
, rather than interpreting it as an option itself, which would not necessarily be a vulnerability.)In either case, the payload specified in
configfile@example.com
runs, and its side effect can be observed.Other cases may likewise be produced, in either of the above two forms of SSH addresses. For example, to create or append to the file
errors@example.com
, or to create or append to its target if it is a symlink:gix clone 'ssh://-Eerrors@example.com/abc'
gix clone -- '-Eerrors@example.com:abc/def'
Impact
As in GHSA-rrjw-j4m2-mf34, this would typically require user interaction to trigger an attempt to clone or otherwise connect using the malicious URL. Furthermore, known means of exploiting this vulnerability to execute arbitrary commands require further preparatory steps to establish a specially named file in the current directory. The impact is therefore expected to be lesser, though it is difficult to predict it with certainty because it is not known exactly what scenarios will arise when using the
gix-transport
library.Users who use applications that make use of
gix-transport
are potentially vulnerable, especially:Release Notes
Byron/gitoxide (gix)
v0.62.0
: gix v0.62Compare Source
Please note that this release contains a security fix originally implemented in
gix-transport
via this PR which preventsssh
options to be smuggled into thessh
command-line invocation with a username provided to a clone or fetch URL.Details can be found in the advisory.
Bug Fixes
into_index_worktree_iter()
now takes an iterator, instead of a Vec.This makes the API more consistent, and one can pass
None
as well.
show submodules in status independently of their active state.
Even inactive submodules are shown in the status by
git status
,so
gix
should do the same.First observed in https://github.com/helix-editor/helix/pull/5645#issuecomment-2016798212
forward
curl
rustls feature fromgix-transport
to avoidcurl
ingix
.This removes the
curl
dependency just for configuring it, and removesa hazard which became evident with reqwest.
Bug Fixes (BREAKING)
topo
more similar toAncestors
, but also renameAncestors
toSimple
Commit Statistics
Thanks Clippy
Clippy helped 1 time to make code idiomatic.
Commit Details
curl
rustls feature fromgix-transport
to avoidcurl
ingix
. (GitoxideLabs/gitoxide@98cfbec)gix-traverse
(GitoxideLabs/gitoxide@1cfeb11)topo
more similar toAncestors
, but also renameAncestors
toSimple
(GitoxideLabs/gitoxide@2a9c178)gix-traverse
(GitoxideLabs/gitoxide@6154bf3)into_index_worktree_iter()
now takes an iterator, instead of a Vec. (GitoxideLabs/gitoxide@18b2921)is_path_excluded()
in documentation (GitoxideLabs/gitoxide@c136329)gix-index
(GitoxideLabs/gitoxide@1e1fce1)v0.61.1
: gix v0.61.1Compare Source
This release also updates
reqwest
to v0.12, bringing hyper 1.0 and a more recentrustls
version.Bug Fixes
Commit Statistics
Commit Details
view details
7018a92
)8fde62b
)curl
into a workspace package (adee500
)369cf1b
)3b34699
)f1bc4cd
)e1fec3c
)Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.