CVEfocus › CVE database › CVE-2021-43809

CVE-2021-43809Local Code Execution through Argument Injection via dash leading git url parameter in…

CVSS 6.7 MediumEPSS 3.1% (higher than 88% of CVEs)Published 2021-12-08Updated 2026-11-02Assigner: GitHub_M

`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.

CWE-88

What to do

Fixed builds are available from AlmaLinux, Alpine, Debian, Red Hat, Rocky Linux, RubyGems: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

76Fixed
4Fix pending
2Will not fix
8Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 20.04bundlerFix pendingUBUNTU-CVE-2021-43809
Ubuntu 18.04bundlerFix pendingUBUNTU-CVE-2021-43809
Ubuntu 16.04bundlerFix pendingUBUNTU-CVE-2021-43809
Ubuntu 14.04bundlerFix pending
Debian 14rubygemsFixed3.3.5-1DEBIAN-CVE-2021-43809
Debian 13rubygemsFixed3.3.5-1DEBIAN-CVE-2021-43809
Debian 12rubygemsFixed3.3.5-1DEBIAN-CVE-2021-43809
Red Hat Enterprise Linux 8rubyFixed0:2.5.9-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8ruby-bundled-gemsNot affected
Red Hat Enterprise Linux 8ruby-default-gemsNot affected
Red Hat Enterprise Linux 8ruby-develFixed0:2.5.9-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8ruby-docFixed0:2.5.9-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8ruby-irbFixed0:2.5.9-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8ruby-libsFixed0:2.5.9-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-abrtFixed0:0.3.0-4.module+el8.10.0+22021+135c76a8RHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-abrt-docFixed0:0.3.0-4.module+el8.10.0+22021+135c76a8RHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-bigdecimalFixed0:1.3.4-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-bsonFixed0:4.3.0-2.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-bson-docFixed0:4.3.0-2.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-bundlerFixed0:1.16.1-5.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-bundler-docFixed0:1.16.1-5.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-did_you_meanFixed0:1.2.0-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-io-consoleFixed0:0.4.6-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-irbNot affected
Red Hat Enterprise Linux 8rubygem-jsonFixed0:2.1.0-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-minitestFixed0:5.10.3-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-mongoFixed0:2.5.1-2.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-mongo-docFixed0:2.5.1-2.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-mysql2Fixed0:0.4.10-4.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-mysql2-docFixed0:0.4.10-4.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-net-telnetFixed0:0.1.1-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-opensslFixed0:2.1.2-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-pgFixed0:1.0.0-3.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-pg-docFixed0:1.0.0-3.module+el8.9.0+19193+435404aeRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-power_assertFixed0:1.1.1-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-psychFixed0:3.0.2-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-raccNot affected
Red Hat Enterprise Linux 8rubygem-rakeFixed0:12.3.3-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-rbsNot affected
Red Hat Enterprise Linux 8rubygem-rdocFixed0:6.0.1.1-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-rexmlNot affected
Red Hat Enterprise Linux 8rubygem-rssNot affected
Red Hat Enterprise Linux 8rubygem-test-unitFixed0:3.2.7-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygem-typeprofNot affected
Red Hat Enterprise Linux 8rubygem-xmlrpcFixed0:0.3.0-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygemsFixed0:2.7.6.3-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 8rubygems-develFixed0:2.7.6.3-114.module+el8.10.0+23088+750dc6caRHSA-2025:7539
Red Hat Enterprise Linux 7rubygem-bundlerWill not fix
Out of support scope
Red Hat Enterprise Linux 7rubygem-bundler-docWill not fix
Out of support scope
AlmaLinux 8rubyFixed2.5.9-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8ruby-develFixed2.5.9-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8ruby-docFixed2.5.9-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8ruby-irbFixed2.5.9-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8ruby-libsFixed2.5.9-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-abrtFixed0.3.0-4.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-abrt-docFixed0.3.0-4.module_el8.10.0+3871+342e2c2fALSA-2025:7539
AlmaLinux 8rubygem-bigdecimalFixed1.3.4-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-bsonFixed4.3.0-2.module_el8.6.0+3170+4b08f9d4ALSA-2025:7539
AlmaLinux 8rubygem-bson-docFixed4.3.0-2.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-bundlerFixed1.16.1-5.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-bundler-docFixed1.16.1-5.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-did_you_meanFixed1.2.0-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-io-consoleFixed0.4.6-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-jsonFixed2.1.0-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-minitestFixed5.10.3-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-mongoFixed2.5.1-2.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-mongo-docFixed2.5.1-2.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-mysql2Fixed0.4.10-4.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-mysql2-docFixed0.4.10-4.module_el8.5.0+2625+ec418553ALSA-2025:7539
AlmaLinux 8rubygem-net-telnetFixed0.1.1-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-opensslFixed2.1.2-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-pgFixed1.0.0-3.module_el8.9.0+3635+c6f99506ALSA-2025:7539
AlmaLinux 8rubygem-pg-docFixed1.0.0-3.module_el8.9.0+3635+c6f99506ALSA-2025:7539
AlmaLinux 8rubygem-power_assertFixed1.1.1-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-psychFixed3.0.2-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-rakeFixed12.3.3-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-rdocFixed6.0.1.1-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-test-unitFixed3.2.7-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygem-xmlrpcFixed0.3.0-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygemsFixed2.7.6.3-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
AlmaLinux 8rubygems-develFixed2.7.6.3-114.module_el8.10.0+3991+5e651d4eALSA-2025:7539
Rocky Linux 8rubyFixed0:2.5.9-114.module+el8.10.0+1979+815637dfRLSA-2025:7539
Rocky Linux 8rubygem-abrtFixed0:0.3.0-4.module+el8.9.0+1536+5f79634eRLSA-2025:7539
Rocky Linux 8rubygem-bsonFixed0:4.3.0-2.module+el8.9.0+1536+5f79634eRLSA-2025:7539
Rocky Linux 8rubygem-bundlerFixed0:1.16.1-5.module+el8.10.0+1979+815637dfRLSA-2025:7539
Rocky Linux 8rubygem-mongoFixed0:2.5.1-2.module+el8.9.0+1536+5f79634eRLSA-2025:7539
Rocky Linux 8rubygem-mysql2Fixed0:0.4.10-4.module+el8.9.0+1536+5f79634eRLSA-2025:7539
Rocky Linux 8rubygem-pgFixed0:1.0.0-3.module+el8.9.0+1536+5f79634eRLSA-2025:7539
Alpine Linux 3.15ruby-bundlerFixed2.2.33-r0ALPINE-CVE-2021-43809
RubyGems librarybundlerFixed2.2.33GHSA-fj7f-vq84-fh43

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.