# CVE-2021-26291: block repositories using http by default

> Maven follows HTTP repositories defined in dependencies by default, allowing attackers to inject malicious code via compromised or spoofed repositories.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 23 Apr 2021
- **Updated:** 3 Aug 2024
- **Also known as:** BIT-maven-2021-26291, CLSA-2026-1786433114, DEBIAN-CVE-2021-26291, GHSA-2f88-5hg8-9x2x, MGASA-2023-0230, OESA-2021-1276, UBUNTU-CVE-2021-26291, USN-5245-1, openSUSE-SU-2024:11042-1

## What is CVE-2021-26291?

CVE-2021-26291 is a critical vulnerability in Oracle Financial Services Analytical Applications Infrastructure, published on 23 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Apache Maven will follow repositories that are defined in a dependency’s Project Object Model (pom) which may be surprising to some users, resulting in potential risk if a malicious actor takes over that repository or is able to insert themselves into a position to pretend to be that repository. Maven is changing the default behavior in 3.8.1+ to no longer follow http (non-SSL) repository references by default. More details available in the referenced urls. If you are currently using a repository manager to govern the repositories used by your builds, you are unaffected by the risks present in the legacy behavior, and are unaffected by this vulnerability and change to default behavior. See this link for more information about repository management: https://maven.apache.org/repository-management.html

Weakness: CWE-346 (Origin Validation Error)

## Which versions are affected by CVE-2021-26291?

5 open source packages ship an affected version, including org.apache.maven:maven-compat, maven and org.apache.maven:maven-core. It affects 4 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.maven:maven-compat` | Maven | All versions | 3.8.1 |
| `org.apache.maven:maven-compat` | Maven | All versions | 3.8.1 |
| `maven` | Bitnami | All versions | 3.8.1 |
| `org.apache.maven:maven-core` | Maven | All versions | 3.8.1 |
| `org.apache.maven:maven-core` | Maven | All versions | 3.8.1 |

Products: Apache Maven, Oracle Financial Services Analytical Applications Infrastructure, Oracle Goldengate Big Data and Application Adapters, Quarkus Quarkus.

## How do I fix CVE-2021-26291?

Upgrade org.apache.maven:maven-compat to 3.8.1 or later.

## Is CVE-2021-26291 being exploited?

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

Public exploit code:

- Context of CVE-2021-26291 minimal replicator (github_poc): https://github.com/jpmartins/MinimalReproducer

## Other vulnerabilities in Oracle Financial Services Analytical Applications Infrastructure

- [CVE-2013-0253](https://insights.sbomify.com/CVE-2013-0253/): Security feature bypass in n/a (medium 5.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-26291 and fix it if it is affected.

What it is: CVE-2021-26291 is a critical vulnerability in Oracle Financial Services Analytical Applications Infrastructure, published on 23 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-26291 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.maven:maven-compat (Maven): affected all versions; fixed in 3.8.1
- org.apache.maven:maven-compat (Maven): affected all versions; fixed in 3.8.1
- maven (Bitnami): affected all versions; fixed in 3.8.1
- org.apache.maven:maven-core (Maven): affected all versions; fixed in 3.8.1
- org.apache.maven:maven-core (Maven): affected all versions; fixed in 3.8.1

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-2021-26291/ (Markdown: https://insights.sbomify.com/CVE-2021-26291/index.md)
```

## Sources

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

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