CVE-2021-29441: Nacos common Authentication Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-36hp-jr8h-556f
CWE-290
Published
Advisory Summary

CVE-2021-29441 is a HIGH authentication bypass vulnerability (CWE-290: Authentication Bypass by Spoofing) affecting Nacos common libraries in the Maven ecosystem. The issue involves authentication bypass. Remediation is available by upgrading affected packages to version 1.4.1.

CVE-2021-29441 at a Glance

CVE Identifier CVE-2021-29441
GHSA Identifier GHSA-36hp-jr8h-556f
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-290: Authentication Bypass by Spoofing
Affected Product Nacos common
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2021-29441

To remediate this vulnerability, upgrade all affected Nacos common dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

com.alibaba.nacos:nacos-common fixed: 1.4.1
<dependency>
    <groupId>com.alibaba.nacos</groupId>
    <artifactId>nacos-common</artifactId>
    <version>1.4.1</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=com.alibaba.nacos

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-29441, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=com.alibaba.nacos

Analyze the terminal output to locate any version of Nacos common in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.1), your application is affected.

Note: The mvn dependency:tree -Dincludes=com.alibaba.nacos command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-290: Authentication Bypass by Spoofing, where this attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks. In Nacos common, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

When configured to use authentication (`-Dnacos.core.auth.enabled=true`) Nacos uses the `AuthFilter` servlet filter to enforce authentication. This filter has a [backdoor](https://github.com/alibaba/nacos/blob/5fa05aef52f7432aeab19fe53035431b9d8c91d9/core/src/main/java/com/alibaba/nacos/core/auth/AuthFilter.java#L78-L81) that enables Nacos servers to bypass this filter and therefore skip authentication checks. This mechanism relies on the `user-agent` HTTP header so it can be easily spoofed. The following request to the `configuration` endpoint gets rejected as we are not providing any credentials: ``` ❯ curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataIdfoo&group=foo&content=helloWorld" {"timestamp":"2020-12-02T14:33:57.154+0000","status":403,"error":"Forbidden","message":"unknown user!","path":"/nacos/v1/cs/configs"} ``` However the following one gets accepted by using the `Nacos-Server` user-agent header: ``` ❯ curl -X POST -A Nacos-Server "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataIdfoo&group=foo&content=helloWorld" true ``` #### Impact This issue may allow any user to carry out any administrative tasks on the Nacos server.

CVE-2021-29441 Affected Nacos common Versions

1 component(s)
Fixed Versions:
1.4.1
Product / Package Ecosystem Affected Versions Fixed Version
com.alibaba.nacos:nacos-common
Maven
< 1.4.1
1.4.1

References

Frequently Asked Questions

What is CVE-2021-29441?
CVE-2021-29441 is a security vulnerability in Nacos common involving Authentication Bypass under CWE-290: Authentication Bypass by Spoofing.
Which Nacos common versions are affected?
Affected versions include releases prior to 1.4.1 across affected packages: com.alibaba.nacos:nacos-common.
What version fixes CVE-2021-29441?
Upgrading to 1.4.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nacos-common affected?
Yes, com.alibaba.nacos:nacos-common is affected in releases prior to 1.4.1. Upgrade your dependency to 1.4.1 or later.
What CWE is associated with CVE-2021-29441?
CVE-2021-29441 is classified under CWE-290: Authentication Bypass by Spoofing (This attack-focused weakness is caused by incorrectly implemented authentication schemes that are subject to spoofing attacks.).
How can I check Maven dependencies for CVE-2021-29441?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.alibaba.nacos'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-36hp-jr8h-556f",
  "modified" : "2021-05-10T14:56:08Z",
  "published" : "2021-04-27T20:09:17Z",
  "aliases" : [ "CVE-2021-29441" ],
  "summary" : "Authentication Bypass",
  "details" : "When configured to use authentication (`-Dnacos.core.auth.enabled=true`) Nacos uses the `AuthFilter` servlet filter to enforce authentication. This filter has a [backdoor](https://github.com/alibaba/nacos/blob/5fa05aef52f7432aeab19fe53035431b9d8c91d9/core/src/main/java/com/alibaba/nacos/core/auth/AuthFilter.java#L78-L81) that enables Nacos servers to bypass this filter and therefore skip authentication checks. This mechanism relies on the `user-agent` HTTP header so it can be easily spoofed.\n\nThe following request to the `configuration` endpoint gets rejected as we are not providing any credentials:\n```\n❯ curl -X POST \"http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataIdfoo&group=foo&content=helloWorld\"\n{\"timestamp\":\"2020-12-02T14:33:57.154+0000\",\"status\":403,\"error\":\"Forbidden\",\"message\":\"unknown user!\",\"path\":\"/nacos/v1/cs/configs\"}                                                                                                       \n```\n\nHowever the following one gets accepted by using the `Nacos-Server` user-agent header:\n```\n❯ curl -X POST -A Nacos-Server \"http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataIdfoo&group=foo&content=helloWorld\"\ntrue \n```\n\n#### Impact\n\nThis issue may allow any user to carry out any administrative tasks on the Nacos server.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.alibaba.nacos:nacos-common"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29441"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/nacos/issues/4701"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/alibaba/nacos/pull/4703"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-36hp-jr8h-556f"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-290" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-27T20:08:38Z",
    "nvd_published_at" : "2021-04-27T21:15:00Z"
  }
}