Ruby/bundler/1.16.1


Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably

https://rubygems.org/gems/bundler
MIT

8 Security Vulnerabilities

Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile.

Published date: 2021-12-08T19:51:36Z
CVE: CVE-2021-43809
Links:

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.2.0.rc.1", "2.1.4", "2.1.3", "2.1.2", "2.1.1", "2.1.0", "2.1.0.pre.3", "2.1.0.pre.2", "2.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.14.0.pre.2", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.5", "1.12.4", "1.12.3", "1.12.2", "1.12.1", "1.12.0", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.1", "1.11.0", "1.11.0.pre.2", "1.11.0.pre.1", "1.10.6", "1.10.5", "1.10.4", "1.10.3", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.1", "1.9.0", "1.9.0.rc", "1.9.0.pre.1", "1.9.0.pre", "1.8.9", "1.8.8", "1.8.7", "1.8.6", "1.8.5", "1.8.4", "1.8.3", "1.8.2", "1.8.1", "1.8.0", "1.8.0.pre", "1.7.15", "1.7.14", "1.7.13", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.9", "1.6.8", "1.6.7", "1.6.6", "1.6.5", "1.6.4", "1.6.3", "1.6.2", "1.6.1", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc.2", "1.5.0.rc.1", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.5", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.4", "1.3.0.pre.3", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre.1", "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.7", "1.1.rc.6", "1.1.rc.5", "1.1.rc.3", "1.1.rc.2", "1.1.rc", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.7", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre.2", "1.1.pre.1", "1.1.pre", "1.0.22", "1.0.21", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.14", "1.0.13", "1.0.12", "1.0.11", "1.0.10", "1.0.9", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.9", "1.0.0.beta.8", "1.0.0.beta.5", "1.0.0.beta.4", "1.0.0.beta.3", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.22", "0.9.21", "0.9.20", "0.9.19", "0.9.18", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.9", "0.9.8", "0.9.7", "0.9.6", "0.9.5", "0.9.4", "0.9.3", "0.9.2", "0.9.1", "0.9.1.pre1", "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.1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.7.0", "0.6.0", "0.5.0", "0.4.1", "0.4.0", "0.3.1", "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.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Dependency Confusion in Bundler

Published date: 2021-05-24T18:12:33Z
CVE: CVE-2020-36327
Links:

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.2.0.rc.1", "2.1.4", "2.1.3", "2.1.2", "2.1.1", "2.1.0", "2.1.0.pre.3", "2.1.0.pre.2", "2.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "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.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Insecure path handling in Bundler

Published date: 2021-05-10T14:53:59Z
CVE: CVE-2019-3881
Links:

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.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0"]
Secure versions: [2.2.33, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Bundler allows attacker to inject arbitrary code via secondary Gem source

Published date: 2022-05-14T00:57:16Z
CVE: CVE-2016-7954
Links:

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.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.14.0.pre.2", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.5", "1.12.4", "1.12.3", "1.12.2", "1.12.1", "1.12.0", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.1", "1.11.0", "1.11.0.pre.2", "1.11.0.pre.1", "1.10.6", "1.10.5", "1.10.4", "1.10.3", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.1", "1.9.0", "1.9.0.rc", "1.9.0.pre.1", "1.9.0.pre", "1.8.9", "1.8.8", "1.8.7", "1.8.6", "1.8.5", "1.8.4", "1.8.3", "1.8.2", "1.8.1", "1.8.0", "1.8.0.pre", "1.7.15", "1.7.14", "1.7.13", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.9", "1.6.8", "1.6.7", "1.6.6", "1.6.5", "1.6.4", "1.6.3", "1.6.2", "1.6.1", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc.2", "1.5.0.rc.1", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.5", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.4", "1.3.0.pre.3", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre.1", "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.7", "1.1.rc.6", "1.1.rc.5", "1.1.rc.3", "1.1.rc.2", "1.1.rc", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.7", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre.2", "1.1.pre.1", "1.1.pre", "1.0.22", "1.0.21", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.14", "1.0.13", "1.0.12", "1.0.11", "1.0.10", "1.0.9", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0"]
Secure versions: [2.2.33, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Allows an attacker to inject arbitrary code into your application via any secondary Gem source declared in your Gemfile

Published date: 2016-10-06
CVE: 2016-7954
CVSS V2: 7.5
CVSS V3: 9.8
Links:

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.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.14.0.pre.2", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.5", "1.12.4", "1.12.3", "1.12.2", "1.12.1", "1.12.0", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.1", "1.11.0", "1.11.0.pre.2", "1.11.0.pre.1", "1.10.6", "1.10.5", "1.10.4", "1.10.3", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.1", "1.9.0", "1.9.0.rc", "1.9.0.pre.1", "1.9.0.pre", "1.8.9", "1.8.8", "1.8.7", "1.8.6", "1.8.5", "1.8.4", "1.8.3", "1.8.2", "1.8.1", "1.8.0", "1.8.0.pre", "1.7.15", "1.7.14", "1.7.13", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.9", "1.6.8", "1.6.7", "1.6.6", "1.6.5", "1.6.4", "1.6.3", "1.6.2", "1.6.1", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc.2", "1.5.0.rc.1", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.5", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.4", "1.3.0.pre.3", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre.1", "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.7", "1.1.rc.6", "1.1.rc.5", "1.1.rc.3", "1.1.rc.2", "1.1.rc", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.7", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre.2", "1.1.pre.1", "1.1.pre", "1.0.22", "1.0.21", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.14", "1.0.13", "1.0.12", "1.0.11", "1.0.10", "1.0.9", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.9", "1.0.0.beta.8", "1.0.0.beta.5", "1.0.0.beta.4", "1.0.0.beta.3", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.22", "0.9.21", "0.9.20", "0.9.19", "0.9.18", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.9", "0.9.8", "0.9.7", "0.9.6", "0.9.5", "0.9.4", "0.9.3", "0.9.2", "0.9.1", "0.9.1.pre1", "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.1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.7.0", "0.6.0", "0.5.0", "0.4.1", "0.4.0", "0.3.1", "0.3.0"]
Secure versions: [2.2.33, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Insecure path handling in Bundler

Published date: 2018-04-23
CVE: 2019-3881
CVSS V3: 7.0
Links:

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.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0"]
Secure versions: [2.2.33, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Dependency Confusion in Bundler with Implicit Private Dependencies

Published date: 2020-09-30
CVE: 2020-36327
CVSS V3: 8.8
Links:

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.2.0.rc.1", "2.1.4", "2.1.3", "2.1.2", "2.1.1", "2.1.0", "2.1.0.pre.3", "2.1.0.pre.2", "2.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "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.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile

Published date: 2021-12-08
CVE: 2021-43809
CVSS V3: 6.7
Links:

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.2.0.rc.1", "2.1.4", "2.1.3", "2.1.2", "2.1.1", "2.1.0", "2.1.0.pre.3", "2.1.0.pre.2", "2.1.0.pre.1", "2.0.2", "2.0.1", "2.0.0", "2.0.0.pre.3", "2.0.0.pre.2", "2.0.0.pre.1", "1.17.3", "1.17.2", "1.17.1", "1.17.0", "1.17.0.pre.2", "1.17.0.pre.1", "1.16.6", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16.0", "1.16.0.pre.3", "1.16.0.pre.2", "1.16.0.pre.1", "1.15.4", "1.15.3", "1.15.2", "1.15.1", "1.15.0", "1.15.0.pre.4", "1.15.0.pre.3", "1.15.0.pre.2", "1.15.0.pre.1", "1.14.6", "1.14.5", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14.0", "1.14.0.pre.2", "1.14.0.pre.1", "1.13.7", "1.13.6", "1.13.5", "1.13.4", "1.13.3", "1.13.2", "1.13.1", "1.13.0", "1.13.0.rc.2", "1.13.0.rc.1", "1.13.0.pre.1", "1.12.6", "1.12.5", "1.12.4", "1.12.3", "1.12.2", "1.12.1", "1.12.0", "1.12.0.rc.4", "1.12.0.rc.3", "1.12.0.rc.2", "1.12.0.rc", "1.12.0.pre.2", "1.12.0.pre.1", "1.11.2", "1.11.1", "1.11.0", "1.11.0.pre.2", "1.11.0.pre.1", "1.10.6", "1.10.5", "1.10.4", "1.10.3", "1.10.2", "1.10.1", "1.10.0", "1.10.0.rc", "1.10.0.pre.2", "1.10.0.pre.1", "1.10.0.pre", "1.9.10", "1.9.9", "1.9.8", "1.9.7", "1.9.6", "1.9.5", "1.9.4", "1.9.3", "1.9.2", "1.9.1", "1.9.0", "1.9.0.rc", "1.9.0.pre.1", "1.9.0.pre", "1.8.9", "1.8.8", "1.8.7", "1.8.6", "1.8.5", "1.8.4", "1.8.3", "1.8.2", "1.8.1", "1.8.0", "1.8.0.pre", "1.7.15", "1.7.14", "1.7.13", "1.7.12", "1.7.11", "1.7.10", "1.7.9", "1.7.8", "1.7.7", "1.7.6", "1.7.5", "1.7.4", "1.7.3", "1.7.2", "1.7.1", "1.7.1.pre.3", "1.7.1.pre.2", "1.7.1.pre", "1.7.0", "1.6.9", "1.6.8", "1.6.7", "1.6.6", "1.6.5", "1.6.4", "1.6.3", "1.6.2", "1.6.1", "1.6.0", "1.6.0.rc2", "1.6.0.rc", "1.6.0.pre.2", "1.6.0.pre.1", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc.2", "1.5.0.rc.1", "1.4.0.rc.1", "1.4.0.pre.2", "1.4.0.pre.1", "1.3.6", "1.3.5", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.3.0.pre.8", "1.3.0.pre.7", "1.3.0.pre.6", "1.3.0.pre.5", "1.3.0.pre.4", "1.3.0.pre.3", "1.3.0.pre.2", "1.3.0.pre", "1.2.5", "1.2.4", "1.2.3", "1.2.2", "1.2.1", "1.2.0", "1.2.0.rc.2", "1.2.0.rc", "1.2.0.pre.1", "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.7", "1.1.rc.6", "1.1.rc.5", "1.1.rc.3", "1.1.rc.2", "1.1.rc", "1.1.pre.10", "1.1.pre.9", "1.1.pre.8", "1.1.pre.7", "1.1.pre.5", "1.1.pre.4", "1.1.pre.3", "1.1.pre.2", "1.1.pre.1", "1.1.pre", "1.0.22", "1.0.21", "1.0.21.rc", "1.0.20", "1.0.20.rc", "1.0.19.rc", "1.0.18", "1.0.17", "1.0.15", "1.0.14", "1.0.13", "1.0.12", "1.0.11", "1.0.10", "1.0.9", "1.0.7", "1.0.5", "1.0.3", "1.0.2", "1.0.0", "1.0.0.rc.6", "1.0.0.rc.5", "1.0.0.rc.3", "1.0.0.rc.2", "1.0.0.rc.1", "1.0.0.beta.10", "1.0.0.beta.9", "1.0.0.beta.8", "1.0.0.beta.5", "1.0.0.beta.4", "1.0.0.beta.3", "1.0.0.beta.2", "1.0.0.beta.1", "0.9.26", "0.9.25", "0.9.24", "0.9.23", "0.9.22", "0.9.21", "0.9.20", "0.9.19", "0.9.18", "0.9.17", "0.9.16", "0.9.15", "0.9.14", "0.9.13", "0.9.12", "0.9.11", "0.9.10", "0.9.9", "0.9.8", "0.9.7", "0.9.6", "0.9.5", "0.9.4", "0.9.3", "0.9.2", "0.9.1", "0.9.1.pre1", "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.1", "0.8.0", "0.7.3.pre2", "0.7.3.pre", "0.7.2", "0.7.1", "0.7.0", "0.6.0", "0.5.0", "0.4.1", "0.4.0", "0.3.1", "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.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8, 2.3.9, 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.20, 2.3.21, 2.3.22, 2.3.23, 2.3.24, 2.3.25, 2.3.26, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.2.34, 2.4.7, 2.4.8, 2.4.10, 2.4.9, 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.20, 2.4.21, 2.4.22, 2.3.27, 2.5.1, 2.5.0, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7]
Recommendation: Update to version 2.5.7.

378 Other Versions

Version License Security Released
2.5.7 MIT 2024-03-22 - 13:09 7 days
2.5.6 MIT 2024-02-06 - 10:14 about 2 months
2.5.5 MIT 2024-01-18 - 20:16 2 months
2.5.4 MIT 2024-01-04 - 12:09 3 months
2.5.3 MIT 2023-12-22 - 12:12 3 months
2.5.2 MIT 2023-12-21 - 14:36 3 months
2.5.1 MIT 2023-12-15 - 20:47 3 months
2.5.0 MIT 2023-12-15 - 14:02 3 months
2.4.22 MIT 2023-11-09 - 16:49 5 months
2.4.21 MIT 2023-10-17 - 14:47 5 months
2.4.20 MIT 2023-09-27 - 11:17 6 months
2.4.19 MIT 2023-08-17 - 19:39 7 months
2.4.18 MIT 2023-08-02 - 08:23 8 months
2.4.17 MIT 2023-07-14 - 11:11 9 months
2.4.16 MIT 2023-07-10 - 18:27 9 months
2.4.15 MIT 2023-06-29 - 17:32 9 months
2.4.14 MIT 2023-06-12 - 12:26 10 months
2.4.13 MIT 2023-05-10 - 07:56 11 months
2.4.12 MIT 2023-04-11 - 21:30 12 months
2.4.11 MIT 2023-04-10 - 20:30 12 months
2.4.10 MIT 2023-03-27 - 13:42 about 1 year
2.4.9 MIT 2023-03-20 - 22:29 about 1 year
2.4.8 MIT 2023-03-08 - 15:10 about 1 year
2.4.7 MIT 2023-02-15 - 17:48 about 1 year
2.4.6 MIT 2023-01-31 - 14:21 about 1 year
2.4.5 MIT 2023-01-21 - 21:54 about 1 year
2.4.4 MIT 2023-01-16 - 21:39 about 1 year
2.4.3 MIT 2023-01-06 - 17:24 about 1 year
2.4.2 MIT 2023-01-01 - 20:43 about 1 year
2.4.1 MIT 2022-12-24 - 19:38 over 1 year
2.4.0 MIT 2022-12-24 - 07:53 over 1 year
2.3.27 MIT 2023-11-10 - 05:38 5 months
2.3.26 MIT 2022-11-17 - 07:11 over 1 year
2.3.25 MIT 2022-11-02 - 15:49 over 1 year
2.3.24 MIT 2022-10-17 - 12:48 over 1 year
2.3.23 MIT 2022-10-05 - 16:27 over 1 year
2.3.22 MIT 2022-09-07 - 12:00 over 1 year
2.3.21 MIT 2022-08-24 - 14:44 over 1 year
2.3.20 MIT 2022-08-10 - 12:53 over 1 year
2.3.19 MIT 2022-07-27 - 18:14 over 1 year
2.3.18 MIT 2022-07-14 - 12:07 over 1 year
2.3.17 MIT 2022-06-29 - 15:17 over 1 year
2.3.16 MIT 2022-06-15 - 15:19 almost 2 years
2.3.15 MIT 2022-06-01 - 14:53 almost 2 years
2.3.14 MIT 2022-05-18 - 17:12 almost 2 years
2.3.13 MIT 2022-05-04 - 06:21 almost 2 years
2.3.12 MIT 2022-04-20 - 15:50 almost 2 years
2.3.11 MIT 2022-04-07 - 02:57 almost 2 years
2.3.10 MIT 2022-03-23 - 20:57 about 2 years
2.3.9 MIT 2022-03-09 - 15:43 about 2 years
2.3.8 MIT 2022-02-23 - 22:33 about 2 years
2.3.7 MIT 2022-02-09 - 16:13 about 2 years
2.3.6 MIT 2022-01-26 - 10:16 about 2 years
2.3.5 MIT 2022-01-12 - 21:42 about 2 years
2.3.4 MIT 2021-12-29 - 14:51 about 2 years
2.3.3 MIT 2021-12-24 - 13:02 over 2 years
2.3.2 MIT 2021-12-24 - 00:16 over 2 years
2.3.1 MIT 2021-12-22 - 21:09 over 2 years
2.3.0 MIT 2021-12-21 - 05:33 over 2 years
2.2.34 MIT 2023-02-06 - 09:04 about 1 year
2.2.33 MIT 2021-12-07 - 16:57 over 2 years
2.2.32 MIT 2 2021-11-23 - 14:37 over 2 years
2.2.31 MIT 2 2021-11-08 - 16:54 over 2 years
2.2.30 MIT 2 2021-10-26 - 14:37 over 2 years
2.2.29 MIT 2 2021-10-08 - 13:29 over 2 years
2.2.28 MIT 2 2021-09-23 - 20:51 over 2 years
2.2.27 MIT 2 2021-09-03 - 08:28 over 2 years
2.2.26 MIT 2 2021-08-17 - 14:03 over 2 years
2.2.25 MIT 2 2021-07-30 - 20:33 over 2 years
2.2.24 MIT 2 2021-07-15 - 15:01 over 2 years
2.2.23 MIT 2 2021-07-09 - 15:42 over 2 years
2.2.22 MIT 2 2021-07-06 - 17:30 over 2 years
2.2.21 MIT 2 2021-06-23 - 13:26 almost 3 years
2.2.20 MIT 2 2021-06-11 - 12:57 almost 3 years
2.2.19 MIT 2 2021-05-31 - 14:54 almost 3 years
2.2.18 MIT 2 2021-05-25 - 18:59 almost 3 years
2.2.17 MIT 4 2021-05-05 - 12:46 almost 3 years
2.2.16 MIT 4 2021-04-09 - 10:28 almost 3 years
2.2.15 MIT 4 2021-03-19 - 10:40 about 3 years
2.2.14 MIT 4 2021-03-08 - 19:48 about 3 years
2.2.13 MIT 4 2021-03-03 - 13:22 about 3 years
2.2.12 MIT 4 2021-03-01 - 14:27 about 3 years
2.2.11 MIT 4 2021-02-17 - 08:20 about 3 years
2.2.10 MIT 2 2021-02-15 - 14:08 about 3 years
2.2.9 MIT 4 2021-02-08 - 21:20 about 3 years
2.2.8 MIT 4 2021-02-02 - 21:07 about 3 years
2.2.7 MIT 4 2021-01-27 - 00:03 about 3 years
2.2.6 MIT 4 2021-01-19 - 13:32 about 3 years
2.2.5 MIT 4 2021-01-11 - 21:09 about 3 years
2.2.4 MIT 4 2020-12-31 - 15:13 about 3 years
2.2.3 MIT 4 2020-12-22 - 19:42 over 3 years
2.2.2 MIT 4 2020-12-17 - 16:41 over 3 years
2.2.1 MIT 4 2020-12-14 - 16:12 over 3 years
2.2.0 MIT 4 2020-12-10 - 10:27 over 3 years
2.2.0.rc.1 MIT 4 2020-07-02 - 12:07 over 3 years
2.2.0.rc.2 MIT 4 2020-10-07 - 19:53 over 3 years
2.1.4 MIT 4 2020-01-05 - 18:19 about 4 years
2.1.3 MIT 4 2020-01-02 - 12:29 about 4 years
2.1.2 MIT 4 2019-12-20 - 00:43 over 4 years
2.1.1 MIT 4 2019-12-18 - 00:13 over 4 years