{"answers":{"affected":"2 open source packages ship an affected version, including bundler. It affects 1 product.","exploited":"There is no known exploitation of CVE-2021-43809 in the wild and no public exploit code.","fix":"Upgrade bundler to 2.2.33 or later.","what":"CVE-2021-43809 is a medium-severity command injection vulnerability in rubygems, published on 8 Dec 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2021-43809 and fix it if it is affected.\n\nWhat it is: CVE-2021-43809 is a medium-severity command injection vulnerability in rubygems, published on 8 Dec 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2021-43809 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- bundler (RubyGems): affected all versions; fixed in 2.2.33\n- bundler (RubyGems): affected all versions; fixed in 2.2.33\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2021-43809/ (Markdown: https://insights.sbomify.com/CVE-2021-43809/index.md)","id":"CVE-2021-43809","markdown":"https://insights.sbomify.com/CVE-2021-43809/index.md","name":"CVE-2021-43809","record":{"aliases":["ALPINE-CVE-2021-43809","DEBIAN-CVE-2021-43809","GHSA-fj7f-vq84-fh43","MGASA-2022-0102","OESA-2021-1480","OESA-2022-1934","SUSE-SU-2024:3873-1","UBUNTU-CVE-2021-43809"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"Ruby dependency manager","requires_auth":"low_privilege","summary":"Attackers can execute arbitrary code by crafting a Gemfile with a malicious Git URL, exploiting argument injection in Bundler.","user_interaction":"required","vuln_class":"command_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"bundler","vendor":"bundler"}],"cvss":{"score":6.7,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-88","name":"Improper Neutralization of Argument Delimiters in a Command"}],"description":"`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.\n\nTo 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.\n\nThis 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.","ecosystems":["RubyGems","SUSE:Linux Enterprise Module for Basesystem 15 SP5","SUSE:Linux Enterprise Module for Basesystem 15 SP6","SUSE:Linux Enterprise Server 15 SP2-LTSS","SUSE:Linux Enterprise Server 15 SP3-LTSS","SUSE:Linux Enterprise Server 15 SP4-LTSS","SUSE:Linux Enterprise Server for SAP Applications 15 SP2","SUSE:Linux Enterprise Server for SAP Applications 15 SP3","SUSE:Manager Server 4.3","openSUSE:Leap 15.5"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile","id":"CVE-2021-43809","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"RubyGems","product":null,"products":[],"type":"command_injection","year":"2021"},"n_packages":11,"n_references":5,"next":{"headline":"Cross-site Scripting (XSS) when redirect an url","id":"CVE-2021-43810"},"packages":[{"ecosystem":"RubyGems","fixed":["2.2.33"],"introduced":["0"],"last_affected":[],"package":"bundler","purl":null,"source":"GHSA-fj7f-vq84-fh43"},{"ecosystem":"RubyGems","fixed":["2.2.33"],"introduced":["0"],"last_affected":[],"package":"bundler","purl":"pkg:gem/bundler","source":"GHSA-fj7f-vq84-fh43"},{"ecosystem":"SUSE:Linux Enterprise Module for Basesystem 15 SP5","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP5","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Module for Basesystem 15 SP6","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Module%20for%20Basesystem%2015%20SP6","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Server 15 SP2-LTSS","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP2-LTSS","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Server 15 SP3-LTSS","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP3-LTSS","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Server 15 SP4-LTSS","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP4-LTSS","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 15 SP2","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP2","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 15 SP3","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP3","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"SUSE:Manager Server 4.3","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/suse/rubygem-bundler\u0026distro=SUSE%20Manager%20Server%204.3","source":"SUSE-SU-2024:3873-1"},{"ecosystem":"openSUSE:Leap 15.5","fixed":["1.16.1-150000.3.6.1"],"introduced":["0"],"last_affected":[],"package":"rubygem-bundler","purl":"pkg:rpm/opensuse/rubygem-bundler\u0026distro=openSUSE%20Leap%2015.5","source":"SUSE-SU-2024:3873-1"}],"prev":{"headline":"Blade `@parent` Exploitation Leading To Possible XSS in Laravel","id":"CVE-2021-43808"},"products":["rubygems"],"published":"2021-12-08","related":[{"cvss_score":9.8,"headline":"Bundler allows attacker to inject arbitrary code via secondary Gem source","id":"CVE-2016-7954","kev_date_added":null,"published":"2016-12-22"},{"cvss_score":8.8,"headline":"Dependency Confusion in Bundler","id":"CVE-2020-36327","kev_date_added":null,"published":"2021-04-29"},{"cvss_score":7.8,"headline":"Insecure path handling in Bundler","id":"CVE-2019-3881","kev_date_added":null,"published":"2020-09-04"},{"cvss_score":5,"headline":"Bundler may install gems from a different source than expected","id":"CVE-2013-0334","kev_date_added":null,"published":"2014-10-31"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"SUSE"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":"PUBLISHED","updated":"2025-11-03","vendors":["rubygems"]},"summary":"Attackers can execute arbitrary code by crafting a Gemfile with a malicious Git URL, exploiting argument injection in Bundler.","url":"https://insights.sbomify.com/CVE-2021-43809/"}