Ruby/bundler/1.17.3
Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably
Repo Link:
https://rubygems.org/gems/bundler
License:
MIT
8 Security Vulnerabilities
Published date: 2021-12-08T19:51:36Z
CVE: CVE-2021-43809
In bundler
versions before 2.2.33, when working with untrusted and apparently harmless Gemfile
's, it is not expected that they lead to execution of external code, unless that's explicit in the ruby code inside the Gemfile
itself. However, if the Gemfile
includes gem
entries that use the git
option with invalid, but seemingly harmless, values with a leading dash, this can be false.
To handle dependencies that come from a Git repository instead of a registry, Bundler uses various commands, such as git clone
. These commands are being constructed using user input (e.g. the repository URL). When building the
commands, Bundler versions before 2.2.33 correctly avoid Command Injection vulnerabilities by passing an array of arguments instead of a command string. However, there is the possibility that a user input starts with a dash (-
) and is therefore treated as an optional argument instead of a positional one. This can lead to Code Execution because some of the commands have options that can be leveraged to run arbitrary executables.
Since this value comes from the Gemfile
file, it can contain any character, including a leading dash.
Exploitation
To exploit this vulnerability, an attacker has to craft a directory containing a Gemfile
file that declares a dependency that is located in a Git repository. This dependency has to have a Git URL in the form of -u./payload
. This URL
will be used to construct a Git clone command but will be interpreted as the upload-pack argument. Then this directory needs to be shared with the victim, who then needs to run a command that evaluates the Gemfile, such as bundle lock
, inside.
Impact
This vulnerability can lead to Arbitrary Code Execution, which could potentially lead to the takeover of the system. However, as explained above, the exploitability is very low, because it requires a lot of user interaction. It still could put developers at risk when dealing with untrusted files in a way they think is safe, because the exploit still works when the victim tries to make sure nothing can happen, e.g. by manually reviewing the Gemfile
(although they would need the weird URL with a leading dash to not raise any flags).
This kind of attack vector has been used in the past to target security researchers by sending them projects to collaborate on.
Patches
Bundler 2.2.33 has patched this problem by inserting --
as an argument before any positional arguments to those Git commands that were affected by this issue.
Workarounds
Regardless of whether users can upgrade or not, they should review any untrustred Gemfile
's before running any bundler
commands that may read them, since they can contain arbitrary ruby code.
References
https://cwe.mitre.org/data/definitions/88.html
Affected versions:
["2.2.0.rc.2", "2.1.3", "2.1.2", "2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.3", "1.12.1", "1.12.0", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.0", "1.11.0.pre.2", "1.10.6", "1.10.4", "1.10.3", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.1", "1.9.0", "1.9.0.pre.1", "1.9.0.pre", "1.8.6", "1.8.5", "1.8.2", "1.8.0", "1.8.0.pre", "1.7.14", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.7", "1.6.4", "1.6.3", "1.6.1", "1.5.3", "1.5.0", "1.5.0.rc.2", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.3", "1.3.1", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.3", "1.2.1", "1.2.0", "1.2.0.pre.1", "1.1.rc.7", "1.1.rc.6", "1.1.rc.3", "1.1.rc", "1.1.pre.7", "1.1.pre.2", "1.1.pre.1", "1.0.22", "1.0.21", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.11", "1.0.10", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.beta.9", "1.0.0.beta.5", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.22", "0.9.19", "0.9.18", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.7", "0.9.4", "0.9.3", "0.9.2", "0.9.0", "0.9.0.pre5", "0.9.0.pre4", "0.9.0.pre3", "0.9.0.pre2", "0.9.0.pre1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.6.0", "0.5.0", "0.4.1", "0.3.1", "2.2.0.rc.1", "2.1.4", "2.1.1", "2.1.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1", "1.14.0.pre.2", "1.13.3", "1.13.2", "1.13.1", "1.12.5", "1.12.4", "1.12.2", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.11.1", "1.11.0.pre.1", "1.10.5", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.0.rc", "1.8.9", "1.8.8", "1.8.7", "1.8.4", "1.8.3", "1.8.1", "1.7.15", "1.7.13", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.6.9", "1.6.8", "1.6.6", "1.6.5", "1.6.2", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.2", "1.5.1", "1.5.0.rc.1", "1.3.5", "1.3.4", "1.3.2", "1.3.0", "1.3.0.pre.4", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.rc.8", "1.1.rc.5", "1.1.rc.2", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.14", "1.0.13", "1.0.12", "1.0.9", "1.0.0", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.8", "1.0.0.beta.4", "1.0.0.beta.3", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.21", "0.9.20", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.9", "0.9.8", "0.9.6", "0.9.5", "0.9.1", "0.9.1.pre1", "0.8.1", "0.7.0", "0.4.0", "0.3.0", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.2.7", "2.2.8", "2.2.9", "2.2.10", "2.2.11", "2.2.12", "2.2.13", "2.2.14", "2.2.15", "2.2.16", "2.2.17", "2.2.18", "2.2.19", "2.2.20", "2.2.21", "2.2.22", "2.2.23", "2.2.24", "2.2.25", "2.2.26", "2.2.27", "2.2.28", "2.2.29", "2.2.30", "2.2.31", "2.2.32"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2021-05-24T18:12:33Z
CVE: CVE-2020-36327
Bundler 1.16.0 through 2.2.9 and 2.2.11 through 2.2.17 sometimes chooses a dependency source based on the highest gem version number, which means that a rogue gem found at a public source may be chosen, even if the intended choice was a private gem that is a dependency of another private gem that is explicitly depended on by the application.
Affected versions:
["2.2.11", "2.2.12", "2.2.13", "2.2.14", "2.2.15", "2.2.16", "2.2.17", "2.2.0.rc.2", "2.1.3", "2.1.2", "2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "2.2.0.rc.1", "2.1.4", "2.1.1", "2.1.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.2.7", "2.2.8", "2.2.9"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2021-05-10T14:53:59Z
CVE: CVE-2019-3881
Bundler prior to 2.1.0 uses a predictable path in /tmp/
, created with insecure permissions as a storage location for gems, if locations under the user's home directory are not available. If Bundler is used in a scenario where the user does not have a writable home directory, an attacker could place malicious code in this directory that would be later loaded and executed.
Affected versions:
["2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2022-05-14T00:57:16Z
CVE: CVE-2016-7954
Bundler 1.x might allow remote attackers to inject arbitrary Ruby code into an application by leveraging a gem name collision on a secondary source. NOTE: this might overlap CVE-2013-0334.
Affected versions:
["2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.3", "1.12.1", "1.12.0", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.0", "1.11.0.pre.2", "1.10.6", "1.10.4", "1.10.3", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.1", "1.9.0", "1.9.0.pre.1", "1.9.0.pre", "1.8.6", "1.8.5", "1.8.2", "1.8.0", "1.8.0.pre", "1.7.14", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.7", "1.6.4", "1.6.3", "1.6.1", "1.5.3", "1.5.0", "1.5.0.rc.2", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.3", "1.3.1", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.3", "1.2.1", "1.2.0", "1.2.0.pre.1", "1.1.rc.7", "1.1.rc.6", "1.1.rc.3", "1.1.rc", "1.1.pre.7", "1.1.pre.2", "1.1.pre.1", "1.0.22", "1.0.21", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.11", "1.0.10", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1", "1.14.0.pre.2", "1.13.3", "1.13.2", "1.13.1", "1.12.5", "1.12.4", "1.12.2", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.11.1", "1.11.0.pre.1", "1.10.5", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.0.rc", "1.8.9", "1.8.8", "1.8.7", "1.8.4", "1.8.3", "1.8.1", "1.7.15", "1.7.13", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.6.9", "1.6.8", "1.6.6", "1.6.5", "1.6.2", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.2", "1.5.1", "1.5.0.rc.1", "1.3.5", "1.3.4", "1.3.2", "1.3.0", "1.3.0.pre.4", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.rc.8", "1.1.rc.5", "1.1.rc.2", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.14", "1.0.13", "1.0.12", "1.0.9", "1.0.0"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2016-10-06
CVE: 2016-7954
CVSS V2: 7.5
CVSS V3: 9.8
Bundler 1.x might allow remote attackers to inject arbitrary Ruby
code into an application by leveraging a Gem name collision on a
secondary source.
Please note that this vulnerability only applies for Ruby
projects using Bundler < 2.0 with Gemfiles having 2 or more
source lines.
In other words, if the user's Gemfile does not use multiple
sources, this vulnerability can be ignored.
Affected versions:
["2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.3", "1.12.1", "1.12.0", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.0", "1.11.0.pre.2", "1.10.6", "1.10.4", "1.10.3", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.1", "1.9.0", "1.9.0.pre.1", "1.9.0.pre", "1.8.6", "1.8.5", "1.8.2", "1.8.0", "1.8.0.pre", "1.7.14", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.7", "1.6.4", "1.6.3", "1.6.1", "1.5.3", "1.5.0", "1.5.0.rc.2", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.3", "1.3.1", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.3", "1.2.1", "1.2.0", "1.2.0.pre.1", "1.1.rc.7", "1.1.rc.6", "1.1.rc.3", "1.1.rc", "1.1.pre.7", "1.1.pre.2", "1.1.pre.1", "1.0.22", "1.0.21", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.11", "1.0.10", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.beta.9", "1.0.0.beta.5", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.22", "0.9.19", "0.9.18", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.7", "0.9.4", "0.9.3", "0.9.2", "0.9.0", "0.9.0.pre5", "0.9.0.pre4", "0.9.0.pre3", "0.9.0.pre2", "0.9.0.pre1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.6.0", "0.5.0", "0.4.1", "0.3.1", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1", "1.14.0.pre.2", "1.13.3", "1.13.2", "1.13.1", "1.12.5", "1.12.4", "1.12.2", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.11.1", "1.11.0.pre.1", "1.10.5", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.0.rc", "1.8.9", "1.8.8", "1.8.7", "1.8.4", "1.8.3", "1.8.1", "1.7.15", "1.7.13", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.6.9", "1.6.8", "1.6.6", "1.6.5", "1.6.2", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.2", "1.5.1", "1.5.0.rc.1", "1.3.5", "1.3.4", "1.3.2", "1.3.0", "1.3.0.pre.4", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.rc.8", "1.1.rc.5", "1.1.rc.2", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.14", "1.0.13", "1.0.12", "1.0.9", "1.0.0", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.8", "1.0.0.beta.4", "1.0.0.beta.3", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.21", "0.9.20", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.9", "0.9.8", "0.9.6", "0.9.5", "0.9.1", "0.9.1.pre1", "0.8.1", "0.7.0", "0.4.0", "0.3.0"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2018-04-23
CVE: 2019-3881
CVSS V3: 7.0
Bundler prior to 2.1.0 uses a predictable path in /tmp/, created with
insecure permissions as a storage location for gems, if locations under the user's
home directory are not available. If Bundler is used in a scenario where the user
does not have a writable home directory, an attacker could place malicious code
in this directory that would be later loaded and executed.
Affected versions:
["2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2020-09-30
CVE: 2020-36327
CVSS V3: 8.8
Bundler 1.16.0 through 2.2.9 and 2.2.11 through 2.2.17 sometimes chooses a
dependency source based on the highest gem version number, which means that a
rogue gem found at a public source may be chosen, even if the intended choice
was a private gem that is a dependency of another private gem that is
explicitly depended on by the application.
Affected versions:
["2.2.0.rc.2", "2.1.3", "2.1.2", "2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "2.2.0.rc.1", "2.1.4", "2.1.1", "2.1.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.2.7", "2.2.8", "2.2.9", "2.2.11", "2.2.12", "2.2.13", "2.2.14", "2.2.15", "2.2.16", "2.2.17"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
Published date: 2021-12-08
CVE: 2021-43809
CVSS V3: 6.7
In bundler
versions before 2.2.33, when working with untrusted and apparently harmless
Gemfile
's, it is not expected that they lead to execution of external code, unless
that's explicit in the ruby code inside the Gemfile
itself. However, if the Gemfile
includes gem
entries that use the git
option with invalid, but seemingly harmless,
values with a leading dash, this can be false.
To handle dependencies that come from a Git repository instead of a registry, Bundler
uses various commands, such as git clone
. These commands are being constructed using
user input (e.g. the repository URL). When building the commands, Bundler versions
before 2.2.33 correctly avoid Command Injection vulnerabilities by passing an array of
arguments instead of a command string. However, there is the possibility that a user
input starts with a dash (-
) and is therefore treated as an optional argument instead
of a positional one. This can lead to Code Execution because some of the commands have
options that can be leveraged to run arbitrary executables.
Since this value comes from the Gemfile
file, it can contain any character, including
a leading dash.
Exploitation
To exploit this vulnerability, an attacker has to craft a directory containing a
Gemfile
file that declares a dependency that is located in a Git repository. This
dependency has to have a Git URL in the form of -u./payload
. This URL will be used to
construct a Git clone command but will be interpreted as the
upload-pack
argument. Then this directory needs to be shared with the victim, who then needs to run
a command that evaluates the Gemfile, such as bundle lock
, inside.
Impact
This vulnerability can lead to Arbitrary Code Execution, which could potentially lead
to the takeover of the system. However, as explained above, the exploitability is very
low, because it requires a lot of user interaction. It still could put developers at
risk when dealing with untrusted files in a way they think is safe, because the exploit
still works when the victim tries to make sure nothing can happen, e.g. by manually
reviewing the Gemfile
(although they would need the weird URL with a leading dash to
not raise any flags).
This kind of attack vector
has been used in the past
to target security researchers by sending them projects to collaborate on.
Patches
Bundler 2.2.33 has patched this problem by inserting --
as an argument before any
positional arguments to those Git commands that were affected by this issue.
Workarounds
Regardless of whether users can upgrade or not, they should review any untrusted
Gemfile
's before running any bundler
commands that may read them, since they
can contain arbitrary ruby code.
Affected versions:
["2.2.0.rc.2", "2.1.3", "2.1.2", "2.1.0.pre.3", "2.1.0.pre.2", "2.0.2", "2.0.1", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.0.pre.1", "1.16.5", "1.16.0.pre.2", "1.15.3", "1.15.1", "1.15.0.pre.3", "1.15.0.pre.1", "1.14.5", "1.14.3", "1.14.0", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.3", "1.12.1", "1.12.0", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.0", "1.11.0.pre.2", "1.10.6", "1.10.4", "1.10.3", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.1", "1.9.0", "1.9.0.pre.1", "1.9.0.pre", "1.8.6", "1.8.5", "1.8.2", "1.8.0", "1.8.0.pre", "1.7.14", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.7", "1.6.4", "1.6.3", "1.6.1", "1.5.3", "1.5.0", "1.5.0.rc.2", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.3", "1.3.1", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.3", "1.2.1", "1.2.0", "1.2.0.pre.1", "1.1.rc.7", "1.1.rc.6", "1.1.rc.3", "1.1.rc", "1.1.pre.7", "1.1.pre.2", "1.1.pre.1", "1.0.22", "1.0.21", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.11", "1.0.10", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.beta.9", "1.0.0.beta.5", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.22", "0.9.19", "0.9.18", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.7", "0.9.4", "0.9.3", "0.9.2", "0.9.0", "0.9.0.pre5", "0.9.0.pre4", "0.9.0.pre3", "0.9.0.pre2", "0.9.0.pre1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.6.0", "0.5.0", "0.4.1", "0.3.1", "2.2.0.rc.1", "2.1.4", "2.1.1", "2.1.0", "2.1.0.pre.1", "2.0.0", "2.0.0.pre.3", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.16.6", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.1", "1.15.4", "1.15.2", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.2", "1.14.6", "1.14.4", "1.14.2", "1.14.1", "1.14.0.pre.2", "1.13.3", "1.13.2", "1.13.1", "1.12.5", "1.12.4", "1.12.2", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.11.1", "1.11.0.pre.1", "1.10.5", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.0.rc", "1.8.9", "1.8.8", "1.8.7", "1.8.4", "1.8.3", "1.8.1", "1.7.15", "1.7.13", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.6.9", "1.6.8", "1.6.6", "1.6.5", "1.6.2", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.2", "1.5.1", "1.5.0.rc.1", "1.3.5", "1.3.4", "1.3.2", "1.3.0", "1.3.0.pre.4", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.rc.8", "1.1.rc.5", "1.1.rc.2", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.14", "1.0.13", "1.0.12", "1.0.9", "1.0.0", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.8", "1.0.0.beta.4", "1.0.0.beta.3", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.21", "0.9.20", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.9", "0.9.8", "0.9.6", "0.9.5", "0.9.1", "0.9.1.pre1", "0.8.1", "0.7.0", "0.4.0", "0.3.0", "2.2.0", "2.2.1", "2.2.2", "2.2.3", "2.2.4", "2.2.5", "2.2.6", "2.2.7", "2.2.8", "2.2.9", "2.2.10", "2.2.11", "2.2.12", "2.2.13", "2.2.14", "2.2.15", "2.2.16", "2.2.17", "2.2.18", "2.2.19", "2.2.20", "2.2.21", "2.2.22", "2.2.23", "2.2.24", "2.2.25", "2.2.26", "2.2.27", "2.2.28", "2.2.29", "2.2.30", "2.2.31", "2.2.32"]
Secure versions:
[2.2.33, 2.2.34, 2.3.0, 2.3.1, 2.3.10, 2.3.11, 2.3.12, 2.3.13, 2.3.14, 2.3.15, 2.3.16, 2.3.17, 2.3.18, 2.3.19, 2.3.2, 2.3.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.3.27, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 2.4.0, 2.4.1, 2.4.10, 2.4.11, 2.4.12, 2.4.13, 2.4.14, 2.4.15, 2.4.16, 2.4.17, 2.4.18, 2.4.19, 2.4.2, 2.4.20, 2.4.21, 2.4.22, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8, 2.4.9, 2.5.0, 2.5.1, 2.5.10, 2.5.11, 2.5.12, 2.5.13, 2.5.14, 2.5.15, 2.5.16, 2.5.17, 2.5.18, 2.5.19, 2.5.2, 2.5.20, 2.5.21, 2.5.22, 2.5.23, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7, 2.5.8, 2.5.9, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9]
Recommendation:
Update to version 2.6.9.
404 Other Versions