nacos权限认证绕过问题
原始问题
安全问题排查的时候发现的漏洞:
如下图,通过访问nacos特定的地址再加上sql注入,可以查看到nacos的账号密码,然后进入nacos可以访问到数据库以及服务信息。
问题解决
1. 设置权限认证
nacos权限认证绕过问题,查了一下,通过nacos配置文件可以设置访问时的权限认证;
配置文件目录 nacos\conf\application.properties
修改内容:nacos.core.auth.enabled=false ——> true
重启nacos,重启服务。
出现新问题(服务注册不上nacos)
2024-06-19 17:05:35.364 ERROR 15920 --- [ main] c.a.c.n.discovery.NacosDiscoveryClient : get service name from nacos server fail,
com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/service/list after all servers([192.168.0.120:8849]) tried: ErrCode:403, ErrMsg:<html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Wed Jun 19 17:05:35 CST 2024</div><div>There was an unexpected error (type=Forbidden, status=403).</div><div>unknown user!</div></body></html>
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:556) ~[nacos-client-1.4