# CVE-2020-36327: Dependency Confusion in Bundler

> Bundler may install rogue public gems instead of intended private dependencies, allowing attackers to execute arbitrary code via dependency confusion.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 29 Apr 2021
- **Updated:** 8 Oct 2026
- **Also known as:** ALSA-2022:0545, DEBIAN-CVE-2020-36327, GHSA-fp4w-jxhp-m23p, OESA-2021-1258, RHSA-2022:0545, RHSA-2022:0546, RHSA-2022:0547, RHSA-2022:0548, RLSA-2022:0545, ROOT-APP-RUBY-CVE-2020-36327, SUSE-SU-2025:1294-1, UBUNTU-CVE-2020-36327

## What is CVE-2020-36327?

CVE-2020-36327 is a high-severity vulnerability in Fedoraproject Fedora, published on 29 Apr 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Bundler 1.16.0 through 2.2.9 and 2.2.11 through 2.2.16 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. NOTE: it is not correct to use CVE-2021-24105 for every "Dependency Confusion" issue in every product.

## Which versions are affected by CVE-2020-36327?

4 open source packages ship an affected version, including bundler. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `bundler` | RubyGems | From 1.16.0 | 2.2.10 |
| `bundler` | RubyGems | From 1.16.0 | 2.2.10 |
| `bundler` | RubyGems | From 2.2.11 | 2.2.18 |
| `bundler` | RubyGems | From 2.2.11 | 2.2.18 |
| `ruby` | AlmaLinux:8 | All versions | 2.5.9-107.module_el8.5.0+2625+ec418553 |
| `ruby-devel` | AlmaLinux:8 | All versions | 2.5.9-107.module_el8.5.0+2625+ec418553 |
| `ruby-doc` | AlmaLinux:8 | All versions | 2.5.9-107.module_el8.5.0+2625+ec418553 |
| `ruby-irb` | AlmaLinux:8 | All versions | 2.5.9-107.module_el8.5.0+2625+ec418553 |
| `ruby-libs` | AlmaLinux:8 | All versions | 2.5.9-107.module_el8.5.0+2625+ec418553 |
| `rubygem-abrt` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+259+8cec6917 |
| `rubygem-abrt` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+2623+08a8ba32 |
| `rubygem-abrt` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+2625+ec418553 |
| `rubygem-abrt-doc` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+259+8cec6917 |
| `rubygem-abrt-doc` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+2623+08a8ba32 |
| `rubygem-abrt-doc` | AlmaLinux:8 | All versions | 0.3.0-4.module_el8.5.0+2625+ec418553 |
| `rubygem-bigdecimal` | AlmaLinux:8 | All versions | 1.3.4-107.module_el8.5.0+2625+ec418553 |
| `rubygem-bson` | AlmaLinux:8 | All versions | 4.3.0-2.module_el8.5.0+259+8cec6917 |
| `rubygem-bson` | AlmaLinux:8 | All versions | 4.3.0-2.module_el8.5.0+2625+ec418553 |
| `rubygem-bson-doc` | AlmaLinux:8 | All versions | 4.3.0-2.module_el8.5.0+259+8cec6917 |
| `rubygem-bson-doc` | AlmaLinux:8 | All versions | 4.3.0-2.module_el8.5.0+2625+ec418553 |
| `rubygem-bundler` | AlmaLinux:8 | All versions | 1.16.1-4.module_el8.5.0+259+8cec6917 |
| `rubygem-bundler` | AlmaLinux:8 | All versions | 1.16.1-4.module_el8.5.0+2625+ec418553 |
| `rubygem-bundler-doc` | AlmaLinux:8 | All versions | 1.16.1-4.module_el8.5.0+259+8cec6917 |
| `rubygem-bundler-doc` | AlmaLinux:8 | All versions | 1.16.1-4.module_el8.5.0+2625+ec418553 |
| `rubygem-did_you_mean` | AlmaLinux:8 | All versions | 1.2.0-107.module_el8.5.0+2625+ec418553 |
| `rubygem-io-console` | AlmaLinux:8 | All versions | 0.4.6-107.module_el8.5.0+2625+ec418553 |
| `rubygem-json` | AlmaLinux:8 | All versions | 2.1.0-107.module_el8.5.0+2625+ec418553 |
| `rubygem-minitest` | AlmaLinux:8 | All versions | 5.10.3-107.module_el8.5.0+2625+ec418553 |
| `rubygem-mongo` | AlmaLinux:8 | All versions | 2.5.1-2.module_el8.5.0+259+8cec6917 |
| `rubygem-mongo` | AlmaLinux:8 | All versions | 2.5.1-2.module_el8.5.0+2625+ec418553 |
| `rubygem-mongo-doc` | AlmaLinux:8 | All versions | 2.5.1-2.module_el8.5.0+259+8cec6917 |
| `rubygem-mongo-doc` | AlmaLinux:8 | All versions | 2.5.1-2.module_el8.5.0+2625+ec418553 |
| `rubygem-mysql2` | AlmaLinux:8 | All versions | 0.4.10-4.module_el8.5.0+259+8cec6917 |
| `rubygem-mysql2` | AlmaLinux:8 | All versions | 0.4.10-4.module_el8.5.0+2625+ec418553 |
| `rubygem-mysql2-doc` | AlmaLinux:8 | All versions | 0.4.10-4.module_el8.5.0+259+8cec6917 |
| `rubygem-mysql2-doc` | AlmaLinux:8 | All versions | 0.4.10-4.module_el8.5.0+2625+ec418553 |
| `rubygem-net-telnet` | AlmaLinux:8 | All versions | 0.1.1-107.module_el8.5.0+2625+ec418553 |
| `rubygem-openssl` | AlmaLinux:8 | All versions | 2.1.2-107.module_el8.5.0+2625+ec418553 |
| `rubygem-pg` | AlmaLinux:8 | All versions | 1.0.0-2.module_el8.5.0+259+8cec6917 |
| `rubygem-pg` | AlmaLinux:8 | All versions | 1.0.0-2.module_el8.5.0+2625+ec418553 |

Products: Bundler Bundler, Fedoraproject Fedora, Microsoft Package Manager Configurations.

## How do I fix CVE-2020-36327?

Upgrade bundler to a fixed version for your release line: 2.2.10 or 2.2.18.

## Is CVE-2020-36327 being exploited?

There is no known exploitation of CVE-2020-36327 in the wild and no public exploit code.

## Other vulnerabilities in Fedoraproject Fedora

- [CVE-2016-7954](https://insights.sbomify.com/CVE-2016-7954/): Bundler allows attacker to inject arbitrary code via secondary Gem source (critical 9.8)
- [CVE-2019-3881](https://insights.sbomify.com/CVE-2019-3881/): Insecure path handling in Bundler (high 7.8)
- [CVE-2021-43809](https://insights.sbomify.com/CVE-2021-43809/): Local Code Execution through Argument Injection via dash leading git url parameter in Gemfile (medium 6.7)
- [CVE-2013-0334](https://insights.sbomify.com/CVE-2013-0334/): Bundler may install gems from a different source than expected (medium 5.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2020-36327 and fix it if it is affected.

What it is: CVE-2020-36327 is a high-severity vulnerability in Fedoraproject Fedora, published on 29 Apr 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2020-36327 in the wild and no public exploit code.

Affected packages and fixed versions:
- bundler (RubyGems): affected from 1.16.0; fixed in 2.2.10
- bundler (RubyGems): affected from 1.16.0; fixed in 2.2.10
- bundler (RubyGems): affected from 2.2.11; fixed in 2.2.18
- bundler (RubyGems): affected from 2.2.11; fixed in 2.2.18

Task:
1. 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.
2. 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.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2020-36327/ (Markdown: https://insights.sbomify.com/CVE-2020-36327/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2020-36327
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2020-36327
- OSV: https://osv.dev/vulnerability/CVE-2020-36327

---
From sbomify Insights: https://insights.sbomify.com/CVE-2020-36327/
Summaries are generated and may contain mistakes; the official description above is the record.
