Ruby/bundler/1.4.0.rc.1
Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably
https://rubygems.org/gems/bundler
MIT
6 Security Vulnerabilities
Bundler may install gems from a different source than expected
- https://nvd.nist.gov/vuln/detail/CVE-2013-0334
- https://security.gentoo.org/glsa/201609-02
- http://bundler.io/blog/2014/08/14/bundler-may-install-gems-from-a-different-source-than-expected-cve-2013-0334.html
- http://lists.fedoraproject.org/pipermail/package-announce/2014-October/140609.html
- http://lists.fedoraproject.org/pipermail/package-announce/2014-October/140654.html
- http://lists.fedoraproject.org/pipermail/package-announce/2014-October/140655.html
- http://lists.opensuse.org/opensuse-updates/2015-03/msg00092.html
- http://www.oracle.com/technetwork/topics/security/linuxbulletinoct2015-2719645.html
- http://www.securityfocus.com/bid/70099
- https://github.com/advisories/GHSA-49jx-9cmc-xjxm
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bundler/CVE-2013-0334.yml
- https://web.archive.org/web/20210122060358/https://www.securityfocus.com/bid/70099/
Bundler before 1.7, when multiple top-level source lines are used, allows remote attackers to install arbitrary gems by creating a gem with the same name as another gem in a different source.
Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile.
- https://github.com/rubygems/rubygems/security/advisories/GHSA-fj7f-vq84-fh43
- https://github.com/rubygems/rubygems/pull/5142
- https://github.com/rubygems/rubygems/commit/0fad1ccfe9dd7a3c5b82c1496df3c2b4842870d3
- https://github.com/rubygems/rubygems/commit/a4f2f8ac17e6ce81c689527a8b6f14381060d95f
- https://github.com/advisories/GHSA-fj7f-vq84-fh43
- https://nvd.nist.gov/vuln/detail/CVE-2021-43809
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bundler/CVE-2021-43809.yml
- https://www.sonarsource.com/blog/securing-developer-tools-package-managers/
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
Bundler allows attacker to inject arbitrary code via secondary Gem source
- https://nvd.nist.gov/vuln/detail/CVE-2016-7954
- https://github.com/bundler/bundler/issues/5051
- https://github.com/bundler/bundler/issues/5062
- https://bugzilla.redhat.com/show_bug.cgi?id=1381951
- http://collectiveidea.com/blog/archives/2016/10/06/bundlers-multiple-source-security-vulnerability/
- http://www.openwall.com/lists/oss-security/2016/10/04/5
- http://www.openwall.com/lists/oss-security/2016/10/04/7
- http://www.openwall.com/lists/oss-security/2016/10/05/3
- https://collectiveidea.com/blog/archives/2016/10/06/bundlers-multiple-source-security-vulnerability
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bundler/CVE-2016-7954.yml
- https://web.archive.org/web/20170214030311/http://www.securityfocus.com/bid/93423
- https://github.com/advisories/GHSA-jvgm-pfqv-887x
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.
CVE-2013-0334 rubygem-bundler: 'bundle install' may install a gem from a source other than expected
Bundler before 1.7, when multiple top-level source lines are used, allows remote attackers to install arbitrary gems by creating a gem with the same name as another gem in a different source. A flaw was found in the way Bundler handled gems available from multiple sources. An attacker with access to one of the sources could create a malicious gem with the same name, which they could then use to trick a user into installing, potentially resulting in execution of code from the attacker-supplied malicious gem.
Allows an attacker to inject arbitrary code into your application via any secondary Gem source declared in your Gemfile
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.
Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile
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.
391 Other Versions
Version | License | Security | Released | |
---|---|---|---|---|
2.5.20 | MIT | 2024-09-24 - 18:18 | 4 days | |
2.5.19 | MIT | 2024-09-18 - 11:28 | 10 days | |
2.5.18 | MIT | 2024-08-26 - 14:50 | about 1 month | |
2.5.17 | MIT | 2024-08-01 - 15:25 | about 2 months | |
2.5.16 | MIT | 2024-07-18 - 21:29 | 2 months | |
2.5.15 | MIT | 2024-07-09 - 14:39 | 3 months | |
2.5.14 | MIT | 2024-06-21 - 09:22 | 3 months | |
2.5.13 | MIT | 2024-06-14 - 17:21 | 4 months | |
2.5.12 | MIT | 2024-06-13 - 16:33 | 4 months | |
2.5.11 | MIT | 2024-05-28 - 17:53 | 4 months | |
2.5.10 | MIT | 2024-05-03 - 12:42 | 5 months | |
2.5.9 | MIT | 2024-04-12 - 12:45 | 6 months | |
2.5.8 | MIT | 2024-04-11 - 15:27 | 6 months | |
2.5.7 | MIT | 2024-03-22 - 13:09 | 6 months | |
2.5.6 | MIT | 2024-02-06 - 10:14 | 8 months | |
2.5.5 | MIT | 2024-01-18 - 20:16 | 8 months | |
2.5.4 | MIT | 2024-01-04 - 12:09 | 9 months | |
2.5.3 | MIT | 2023-12-22 - 12:12 | 9 months | |
2.5.2 | MIT | 2023-12-21 - 14:36 | 9 months | |
2.5.1 | MIT | 2023-12-15 - 20:47 | 10 months | |
2.5.0 | MIT | 2023-12-15 - 14:02 | 10 months | |
2.4.22 | MIT | 2023-11-09 - 16:49 | 11 months | |
2.4.21 | MIT | 2023-10-17 - 14:47 | 12 months | |
2.4.20 | MIT | 2023-09-27 - 11:17 | about 1 year | |
2.4.19 | MIT | 2023-08-17 - 19:39 | about 1 year | |
2.4.18 | MIT | 2023-08-02 - 08:23 | about 1 year | |
2.4.17 | MIT | 2023-07-14 - 11:11 | about 1 year | |
2.4.16 | MIT | 2023-07-10 - 18:27 | about 1 year | |
2.4.15 | MIT | 2023-06-29 - 17:32 | about 1 year | |
2.4.14 | MIT | 2023-06-12 - 12:26 | over 1 year | |
2.4.13 | MIT | 2023-05-10 - 07:56 | over 1 year | |
2.4.12 | MIT | 2023-04-11 - 21:30 | over 1 year | |
2.4.11 | MIT | 2023-04-10 - 20:30 | over 1 year | |
2.4.10 | MIT | 2023-03-27 - 13:42 | over 1 year | |
2.4.9 | MIT | 2023-03-20 - 22:29 | over 1 year | |
2.4.8 | MIT | 2023-03-08 - 15:10 | over 1 year | |
2.4.7 | MIT | 2023-02-15 - 17:48 | over 1 year | |
2.4.6 | MIT | 2023-01-31 - 14:21 | over 1 year | |
2.4.5 | MIT | 2023-01-21 - 21:54 | over 1 year | |
2.4.4 | MIT | 2023-01-16 - 21:39 | over 1 year | |
2.4.3 | MIT | 2023-01-06 - 17:24 | over 1 year | |
2.4.2 | MIT | 2023-01-01 - 20:43 | over 1 year | |
2.4.1 | MIT | 2022-12-24 - 19:38 | almost 2 years | |
2.4.0 | MIT | 2022-12-24 - 07:53 | almost 2 years | |
2.3.27 | MIT | 2023-11-10 - 05:38 | 11 months | |
2.3.26 | MIT | 2022-11-17 - 07:11 | almost 2 years | |
2.3.25 | MIT | 2022-11-02 - 15:49 | almost 2 years | |
2.3.24 | MIT | 2022-10-17 - 12:48 | almost 2 years | |
2.3.23 | MIT | 2022-10-05 - 16:27 | almost 2 years | |
2.3.22 | MIT | 2022-09-07 - 12:00 | about 2 years | |
2.3.21 | MIT | 2022-08-24 - 14:44 | about 2 years | |
2.3.20 | MIT | 2022-08-10 - 12:53 | about 2 years | |
2.3.19 | MIT | 2022-07-27 - 18:14 | about 2 years | |
2.3.18 | MIT | 2022-07-14 - 12:07 | about 2 years | |
2.3.17 | MIT | 2022-06-29 - 15:17 | about 2 years | |
2.3.16 | MIT | 2022-06-15 - 15:19 | over 2 years | |
2.3.15 | MIT | 2022-06-01 - 14:53 | over 2 years | |
2.3.14 | MIT | 2022-05-18 - 17:12 | over 2 years | |
2.3.13 | MIT | 2022-05-04 - 06:21 | over 2 years | |
2.3.12 | MIT | 2022-04-20 - 15:50 | over 2 years | |
2.3.11 | MIT | 2022-04-07 - 02:57 | over 2 years | |
2.3.10 | MIT | 2022-03-23 - 20:57 | over 2 years | |
2.3.9 | MIT | 2022-03-09 - 15:43 | over 2 years | |
2.3.8 | MIT | 2022-02-23 - 22:33 | over 2 years | |
2.3.7 | MIT | 2022-02-09 - 16:13 | over 2 years | |
2.3.6 | MIT | 2022-01-26 - 10:16 | over 2 years | |
2.3.5 | MIT | 2022-01-12 - 21:42 | over 2 years | |
2.3.4 | MIT | 2021-12-29 - 14:51 | over 2 years | |
2.3.3 | MIT | 2021-12-24 - 13:02 | almost 3 years | |
2.3.2 | MIT | 2021-12-24 - 00:16 | almost 3 years | |
2.3.1 | MIT | 2021-12-22 - 21:09 | almost 3 years | |
2.3.0 | MIT | 2021-12-21 - 05:33 | almost 3 years | |
2.2.34 | MIT | 2023-02-06 - 09:04 | over 1 year | |
2.2.33 | MIT | 2021-12-07 - 16:57 | almost 3 years | |
2.2.32 | MIT | 2 | 2021-11-23 - 14:37 | almost 3 years |
2.2.31 | MIT | 2 | 2021-11-08 - 16:54 | almost 3 years |
2.2.30 | MIT | 2 | 2021-10-26 - 14:37 | almost 3 years |
2.2.29 | MIT | 2 | 2021-10-08 - 13:29 | almost 3 years |
2.2.28 | MIT | 2 | 2021-09-23 - 20:51 | about 3 years |
2.2.27 | MIT | 2 | 2021-09-03 - 08:28 | about 3 years |
2.2.26 | MIT | 2 | 2021-08-17 - 14:03 | about 3 years |
2.2.25 | MIT | 2 | 2021-07-30 - 20:33 | about 3 years |
2.2.24 | MIT | 2 | 2021-07-15 - 15:01 | about 3 years |
2.2.23 | MIT | 2 | 2021-07-09 - 15:42 | about 3 years |
2.2.22 | MIT | 2 | 2021-07-06 - 17:30 | about 3 years |
2.2.21 | MIT | 2 | 2021-06-23 - 13:26 | over 3 years |
2.2.20 | MIT | 2 | 2021-06-11 - 12:57 | over 3 years |
2.2.19 | MIT | 2 | 2021-05-31 - 14:54 | over 3 years |
2.2.18 | MIT | 2 | 2021-05-25 - 18:59 | over 3 years |
2.2.17 | MIT | 4 | 2021-05-05 - 12:46 | over 3 years |
2.2.16 | MIT | 4 | 2021-04-09 - 10:28 | over 3 years |
2.2.15 | MIT | 4 | 2021-03-19 - 10:40 | over 3 years |
2.2.14 | MIT | 4 | 2021-03-08 - 19:48 | over 3 years |
2.2.13 | MIT | 4 | 2021-03-03 - 13:22 | over 3 years |
2.2.12 | MIT | 4 | 2021-03-01 - 14:27 | over 3 years |
2.2.11 | MIT | 4 | 2021-02-17 - 08:20 | over 3 years |
2.2.10 | MIT | 2 | 2021-02-15 - 14:08 | over 3 years |
2.2.9 | MIT | 4 | 2021-02-08 - 21:20 | over 3 years |
2.2.8 | MIT | 4 | 2021-02-02 - 21:07 | over 3 years |
2.2.7 | MIT | 4 | 2021-01-27 - 00:03 | over 3 years |