Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-29442 PoC — Authentication bypass

Source
Associated Vulnerability
Title:Authentication bypass (CVE-2021-29442)
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)
Description
Nacos Derby命令执行漏洞利用脚本
Readme
## 简介

Nacos Derby命令执行漏洞利用脚本,默认使用User-Agent绕过漏洞进行利用

Nacos 是一款用于服务注册、发现和配置管理的开源平台。在其早期版本(≤2.4.0-BETA)中,Nacos 默认集成了 Apache Derby 作为嵌入式数据库。由于 Derby 数据库默认未设置访问控制,攻击者可以未经授权地访问特定接口,执行任意 SQL 语句,最终导致远程命令执行漏洞。

**漏洞原理:**

1. **未授权访问:** 在默认配置下,Nacos 的 Derby 数据库接口未设置访问控制,允许任何人访问。

2. **SQL 注入:** 攻击者通过特定的 HTTP 请求,向 Nacos 的 Derby 接口发送恶意 SQL 查询。例如,访问以下 URL:

   ```
   http://<Nacos服务器地址>:8848/nacos/v1/cs/ops/derby?sql=select * from users
   ```

   这将返回用户表中的所有数据。

3. **远程命令执行:** 更为严重的是,攻击者可以利用 Derby 的特定功能,通过 SQL 语句执行任意代码。例如,使用 `CALL` 语句加载远程的恶意 JAR 包,并执行其中的代码,从而在受害者服务器上执行任意命令。

**修复措施:**

- **升级 Nacos:** 官方已在最新版本中修复了此漏洞,建议将 Nacos 升级至最新版本。

- **禁用 Derby 接口:** 如果不使用嵌入式数据库,建议禁用 Derby 接口,防止未经授权的访问。

- **启用身份验证:** 配置 Nacos 的身份验证机制,确保只有授权用户才能访问相关接口。

此漏洞的利用可能导致数据泄露、服务中断,甚至服务器被完全控制,危害极大。因此,强烈建议受影响的用户尽快采取上述措施进行防护。 


## POC/EXP - 使用方法
```
nacos_derby_rce.py [-h] -u URL [-a TOKEN]
```
File Snapshot

[4.0K] /data/pocs/37a76c9d028b40a88cd9b1b718d30416bbb1b766 ├── [ 11K] LICENSE ├── [ 42K] nacos_derby_rce.py └── [1.8K] README.md 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →