CVE-2025-67124

6.8 MEDIUM

📋 TL;DR

This vulnerability in miniserve allows attackers to overwrite arbitrary files outside the intended upload directory through a TOCTOU (Time-of-Check Time-of-Use) and symlink race condition. It affects deployments where uploads are enabled and attackers can create or replace filesystem entries in the upload destination directory. This is particularly dangerous in shared writable directory or volume scenarios.

💻 Affected Systems

Products:
  • svenstaro/miniserve
Versions: 0.32.0 and earlier (when uploads enabled)
Operating Systems: Linux, Unix-like systems with symlink support
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when upload functionality is enabled (-u or --upload flag). Default configuration without uploads is not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise through overwriting critical system files, configuration files, or authorized_keys files, potentially leading to remote code execution or privilege escalation.

🟠

Likely Case

Data corruption, service disruption, or unauthorized file modification in the web server's context, potentially affecting other applications sharing the same filesystem.

🟢

If Mitigated

Limited impact if proper file permissions, isolation, and access controls prevent attackers from creating symlinks in the upload directory.

🌐 Internet-Facing: MEDIUM - Requires upload functionality enabled and attacker ability to create symlinks in upload directory, which may be restricted in properly configured deployments.
🏢 Internal Only: MEDIUM - Same technical risk but potentially higher likelihood in internal environments with less restrictive permissions.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploit requires precise timing (race condition) and ability to create symlinks in the upload directory. Public proof-of-concept exists in the GitHub gist reference.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.33.0 or later

Vendor Advisory: https://github.com/svenstaro/miniserve

Restart Required: Yes

Instructions:

1. Update miniserve to version 0.33.0 or later using cargo update miniserve. 2. Restart the miniserve service. 3. Verify the version with miniserve --version.

🔧 Temporary Workarounds

Disable upload functionality

all

Remove upload capability entirely if not required

Do not use -u or --upload flags when starting miniserve

Restrict upload directory permissions

linux

Prevent symlink creation in upload directory

chmod 755 /path/to/upload/dir
chown root:root /path/to/upload/dir

🧯 If You Can't Patch

  • Disable upload functionality completely if not required
  • Run miniserve in a container with read-only filesystem for upload directory or use bind mounts with proper permissions

🔍 How to Verify

Check if Vulnerable:

Check if running miniserve version 0.32.0 or earlier with uploads enabled

Check Version:

miniserve --version

Verify Fix Applied:

Verify miniserve version is 0.33.0 or later and upload functionality still works as expected

📡 Detection & Monitoring

Log Indicators:

  • Multiple rapid file upload attempts with similar timestamps
  • Failed file operations outside expected upload directory

Network Indicators:

  • Unusual upload patterns with rapid successive requests

SIEM Query:

source="miniserve" AND (event="upload" OR event="file_write") AND (path NOT CONTAINS "/expected/upload/dir/")

🔗 References

📤 Share & Export