目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1000

100.0%

CVE-2024-51442 PoC — Minidlna 命令注入漏洞

来源
关联漏洞
标题:Minidlna 命令注入漏洞 (CVE-2024-51442)
Description:Minidlna是一套媒体服务器软件。 Minidlna v1.3.3及之前版本存在安全漏洞,该漏洞源于存在命令注入,允许攻击者通过特制的minidlna.conf配置文件执行任意操作系统命令。
Description
CVE-2024-51442 write up and example config file
介绍
## Description

CVE-2024-51442 is a command injection vulnerability in minidlna/Readyshare version <= 1.3.3. This vulnerability can be exploited by running minidlnad with a specially crafter db_dir parameter used in minidlna.conf.

## Vulnerability

The vulnerability exists both in  in the `rescan` functionality of the `check_db` function

minidlna.c
```c
rescan:

		CLEARFLAG(RESCAN_MASK);

		if (ret < 0)

			DPRINTF(E_WARN, L_GENERAL, "Creating new database at %s/files.db\n", db_path);

		else if (ret == 1)

			DPRINTF(E_WARN, L_GENERAL, "New media_dir detected; rebuilding...\n");

		else if (ret == 2)

			DPRINTF(E_WARN, L_GENERAL, "Removed media_dir detected; rebuilding...\n");

		else

			DPRINTF(E_WARN, L_GENERAL, "Database version mismatch (%d => %d); need to recreate...\n",

				ret, DB_VERSION);

		sqlite3_close(db);

		snprintf(cmd, sizeof(cmd), "rm -rf %s/files.db %s/art_cache", db_path, db_path);

		if (system(cmd) != 0)

			DPRINTF(E_FATAL, L_GENERAL, "Failed to clean old file cache!  Exiting...\n");
```


and when `-R` is passed as an optional command line parameter:

minidlna.c
```c
case 'R':

			snprintf(buf, sizeof(buf), "rm -rf %s/files.db %s/art_cache", db_path, db_path);

			if (system(buf) != 0)

				DPRINTF(E_FATAL, L_GENERAL, "Failed to clean old file cache %s. EXITING\n", db_path);

			break;
```

The above code will run `"rm -rf %s/files.db %s/art_cache` with `db_path` as a parameter to the format string. `db_path` is picked up from the configuration file when processed by the code in `options.c` .

## Exploitation

This vulnerability can be exploited by using the example `minidlna.conf` in this repository as the configuration file. This will open a file system window using `xdg-open` as a proof of concept.

```bash
minidlnad -d -f minidlna.conf
```
文件快照

[4.0K] /data/pocs/6680b96abd017840eaa006da89a956c429240b6c ├── [3.8K] minidlna.conf └── [1.8K] README.md 0 directories, 2 files
神龙机器人已为您缓存
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →