CVE-2021-43809
Fixed in a distro release EPSS 3%CVSS 6.7
`Bundler` is a package for managing application dependencies in Ruby. 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. 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. This vulnerability can lead to Arbitrary Code Execution, which could potentially lead to the takeover of the system. However, the exploitability is very low, because it requires a lot of user interaction. 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. 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.
Products: rubygems
Fixed upstream
| Ecosystem | Package | Fixed in |
|---|---|---|
| RubyGems | bundler | 2.2.33 |
Distro releases
| Release | Package | Fixed in |
|---|---|---|
| AlmaLinux 8 | ruby | 2.5.9-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | ruby-devel | 2.5.9-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | ruby-doc | 2.5.9-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | ruby-irb | 2.5.9-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | ruby-libs | 2.5.9-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-abrt | 0.3.0-4.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-abrt-doc | 0.3.0-4.module_el8.10.0+3871+342e2c2f |
| AlmaLinux 8 | rubygem-bigdecimal | 1.3.4-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-bson | 4.3.0-2.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-bson | 4.3.0-2.module_el8.6.0+3170+4b08f9d4 |
| AlmaLinux 8 | rubygem-bson | 4.3.0-2.module_el8.5.0+259+8cec6917 |
| AlmaLinux 8 | rubygem-bson-doc | 4.3.0-2.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-bundler | 1.16.1-5.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-bundler-doc | 1.16.1-5.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-did_you_mean | 1.2.0-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-io-console | 0.4.6-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-json | 2.1.0-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-minitest | 5.10.3-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-mongo | 2.5.1-2.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-mongo-doc | 2.5.1-2.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-mysql2 | 0.4.10-4.module_el8.5.0+259+8cec6917 |
| AlmaLinux 8 | rubygem-mysql2 | 0.4.10-4.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-mysql2 | 0.4.10-4.module_el8.6.0+3170+4b08f9d4 |
| AlmaLinux 8 | rubygem-mysql2-doc | 0.4.10-4.module_el8.5.0+2625+ec418553 |
| AlmaLinux 8 | rubygem-net-telnet | 0.1.1-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-openssl | 2.1.2-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-pg | 1.0.0-3.module_el8.9.0+3635+c6f99506 |
| AlmaLinux 8 | rubygem-pg-doc | 1.0.0-3.module_el8.9.0+3635+c6f99506 |
| AlmaLinux 8 | rubygem-power_assert | 1.1.1-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-psych | 3.0.2-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-rake | 12.3.3-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-rdoc | 6.0.1.1-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-test-unit | 3.2.7-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygem-xmlrpc | 0.3.0-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygems | 2.7.6.3-114.module_el8.10.0+3991+5e651d4e |
| AlmaLinux 8 | rubygems-devel | 2.7.6.3-114.module_el8.10.0+3991+5e651d4e |
| Alpine 3.15 | ruby-bundler | 2.2.33-r0 |
| Arch Linux | ruby-bundler | no fix |
| Debian 11 | rubygems | 3.2.5-2+deb11u1 |
| Debian 12 | rubygems | 3.3.5-1 |
| Debian 13 | rubygems | 3.3.5-1 |
| Debian 14 | rubygems | 3.3.5-1 |
| Red Hat Enterprise Linux 8 | ruby | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-debuginfo | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-debugsource | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-devel | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-doc | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-irb | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-libs | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | ruby-libs-debuginfo | 0:2.5.9-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-abrt | 0:0.3.0-4.module+el8.10.0+22021+135c76a8 |
| Red Hat Enterprise Linux 8 | rubygem-abrt-doc | 0:0.3.0-4.module+el8.10.0+22021+135c76a8 |
| Red Hat Enterprise Linux 8 | rubygem-bigdecimal | 0:1.3.4-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-bigdecimal-debuginfo | 0:1.3.4-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-bson | 0:4.3.0-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-bson-debuginfo | 0:4.3.0-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-bson-debugsource | 0:4.3.0-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-bson-doc | 0:4.3.0-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-bundler | 0:1.16.1-5.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-bundler-doc | 0:1.16.1-5.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-did_you_mean | 0:1.2.0-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-io-console | 0:0.4.6-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-io-console-debuginfo | 0:0.4.6-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-json | 0:2.1.0-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-json-debuginfo | 0:2.1.0-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-minitest | 0:5.10.3-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-mongo | 0:2.5.1-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-mongo-doc | 0:2.5.1-2.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-mysql2 | 0:0.4.10-4.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-mysql2-debuginfo | 0:0.4.10-4.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-mysql2-debugsource | 0:0.4.10-4.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-mysql2-doc | 0:0.4.10-4.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-net-telnet | 0:0.1.1-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-openssl | 0:2.1.2-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-openssl-debuginfo | 0:2.1.2-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-pg | 0:1.0.0-3.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-pg-debuginfo | 0:1.0.0-3.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-pg-debugsource | 0:1.0.0-3.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-pg-doc | 0:1.0.0-3.module+el8.9.0+19193+435404ae |
| Red Hat Enterprise Linux 8 | rubygem-power_assert | 0:1.1.1-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-psych | 0:3.0.2-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-psych-debuginfo | 0:3.0.2-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-rake | 0:12.3.3-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-rdoc | 0:6.0.1.1-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-test-unit | 0:3.2.7-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygem-xmlrpc | 0:0.3.0-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygems | 0:2.7.6.3-114.module+el8.10.0+23088+750dc6ca |
| Red Hat Enterprise Linux 8 | rubygems-devel | 0:2.7.6.3-114.module+el8.10.0+23088+750dc6ca |
| Rocky Linux 8 | ruby | 0:2.5.9-114.module+el8.10.0+1979+815637df |
| Rocky Linux 8 | rubygem-abrt | 0:0.3.0-4.module+el8.9.0+1536+5f79634e |
| Rocky Linux 8 | rubygem-abrt | 0:0.3.0-4.module+el8.5.0+738+032c9c02 |
| Rocky Linux 8 | rubygem-bson | 0:4.3.0-2.module+el8.9.0+1536+5f79634e |
| Rocky Linux 8 | rubygem-bundler | 0:1.16.1-5.module+el8.10.0+1979+815637df |
| Rocky Linux 8 | rubygem-mongo | 0:2.5.1-2.module+el8.9.0+1536+5f79634e |
| Rocky Linux 8 | rubygem-mysql2 | 0:0.4.10-4.module+el8.9.0+1536+5f79634e |
| Rocky Linux 8 | rubygem-pg | 0:1.0.0-3.module+el8.9.0+1536+5f79634e |
| SUSE Linux Enterprise Module for Basesystem 15 SP5 | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Module for Basesystem 15 SP6 | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Module for Basesystem 15 SP7 | rubygem-bundler | 2.2.34-150700.21.3.1 |
| SUSE Linux Enterprise Server 15 SP2-LTSS | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Server 15 SP3-LTSS | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Server 15 SP4-LTSS | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Server for SAP Applications 15 SP2 | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Linux Enterprise Server for SAP Applications 15 SP3 | rubygem-bundler | 1.16.1-150000.3.6.1 |
| SUSE Manager Server 4.3 | rubygem-bundler | 1.16.1-150000.3.6.1 |
| Ubuntu 16.04 LTS | bundler | no fix |
| Ubuntu 20.04 LTS | bundler | no fix |
| Ubuntu Pro 18.04 LTS | bundler | no fix |
| openSUSE Leap 15.5 | rubygem-bundler | 1.16.1-150000.3.6.1 |