# CVE-2021-29442: Authentication bypass

> Unauthenticated users can access unprotected Derby database endpoints in Nacos when using embedded storage, allowing database queries or deletion.

- **Severity:** High 8.6 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/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:** 27 Apr 2021
- **Updated:** 3 Aug 2024

## What is CVE-2021-29442?

CVE-2021-29442 is a high-severity missing authorization vulnerability in alibaba nacos, published on 27 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Nacos is a platform designed for dynamic service discovery and configuration and service management. In Nacos before version 1.4.1, the ConfigOpsController lets the user perform management operations like querying the database or even wiping it out. While the /data/remove endpoint is properly protected with the @Secured annotation, the /derby endpoint is not protected and can be openly accessed by unauthenticated users. These endpoints are only valid when using embedded storage (derby DB) so this issue should not affect those installations using external storage (e.g. mysql)

Weakness: CWE-306 (Missing Authentication for Critical Functionality)

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

It affects 1 product.


Products: Alibaba Nacos.

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

Upgrade to a fixed version.

## Is CVE-2021-29442 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-29442 exists.

Public exploit code:

- QVD-2024-26473 && CVE-2021-29442 (github_poc): https://github.com/VictorShem/QVD-2024-26473
- Nacos Derby命令执行漏洞利用脚本 (github_poc): https://github.com/nanaao/cve-2021-29442-Nacos-Derby-rce-exp
- Nacos <1.4.1 - Authentication Bypass (nuclei): http/cves/2021/CVE-2021-29442.yaml

## Other vulnerabilities in alibaba nacos

- [CVE-2021-43116](https://insights.sbomify.com/CVE-2021-43116/): Use of Hard-coded Credentials in Nacos (high 8.8)
- [CVE-2021-29441](https://insights.sbomify.com/CVE-2021-29441/): Authentication bypass (high 8.6)
- [CVE-2021-44667](https://insights.sbomify.com/CVE-2021-44667/): Cross-site Scripting in Nacos (medium 6.1)
- [CVE-2020-19676](https://insights.sbomify.com/CVE-2020-19676/): Incorrect Access Control in Nacos (medium 5.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2021-29442 is a high-severity missing authorization vulnerability in alibaba nacos, published on 27 Apr 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-29442 exists.

Affected product: alibaba nacos. No package-level version data is available, so check the vendor advisory linked from the reference page.

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

## Sources

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

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