CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2025-67124

Served Cold: Race Conditions and Arbitrary File Overwrite in miniserve

Amit Schendel
Amit Schendel
Senior Security Researcher

Jan 24, 2026·6 min read·35 visits

Executive Summary (TL;DR)

If you're using `miniserve` with file uploads enabled, you might be serving up your own system files on a silver platter. CVE-2025-67124 is a race condition that lets an attacker trick the server into following a symbolic link during the upload finalization process. By winning the race, they can overwrite files outside the upload directory (like `/etc/shadow` or `~/.ssh/authorized_keys`), leading to Denial of Service or potential Remote Code Execution. The fix? Upgrade immediately or turn off uploads.

A classic Time-of-Check to Time-of-Use (TOCTOU) vulnerability in miniserve v0.32.0 allows attackers to overwrite arbitrary files via symbolic link racing during file uploads.

The Hook: When "Mini" Becomes Major

miniserve is one of those tools that developers love. It's a statically compiled, zero-dependency, "just works" HTTP server written in Rust. Need to share a directory? miniserve .. Done. It's the Swiss Army knife of quick-and-dirty file sharing.

But things get complicated when you stop just serving files and start accepting them. The --upload-files flag transforms this simple file server into a writable drop box. And as any seasoned security researcher knows, allowing users to write to the disk is like inviting a vampire into your house—you have to set very specific ground rules, or you're going to have a bad time.

In version 0.32.0, those ground rules were strictly enforced... but they were enforced with a stopwatch that was just a little too slow. We're looking at a classic concurrency bug in a modern language: a Time-of-Check to Time-of-Use (TOCTOU) vulnerability that proves even Rust's borrow checker can't save you from logic errors.

The Flaw: A Gap in the Armor

The vulnerability lies in how miniserve handles the finalization of uploaded files. When you upload a file, the server needs to decide where to put it and ensure it's not overwriting something it shouldn't—or at least, that was the intention.

The logic follows a familiar, fatal pattern:

  1. Check: Does the destination path look safe? Is it free?
  2. Act: Okay, create the file and write the data.

This is the "Time-of-Check" and the "Time-of-Use". In a single-threaded world, this is fine. But filesystems are shared state. Between step 1 and step 2, there is a microsecond-sized window of opportunity. It's like checking if the bridge is down, looking away to tie your shoe, and then driving the car forward assuming the bridge is still there.

An attacker with write access to the upload directory (common in shared hosting or container volumes) can exploit this gap. They wait for the server to validate the filename payload.txt. Right after the check passes, but before the server opens the file descriptor for writing, the attacker swaps payload.txt with a symbolic link pointing to /etc/passwd. The server, blind to the switch, happily opens the link and overwrites the system password file.

The Code: Rust vs. The Filesystem

While Rust provides memory safety, it doesn't automatically enforce atomic filesystem operations. The vulnerable code likely looked something like this (pseudocode representation of the logic flaw):

// The Vulnerable Pattern
let dest_path = upload_dir.join(filename);
 
// 1. The Check
if !dest_path.exists() {
    // <--- ATTACKER SWAPS FILE FOR SYMLINK HERE
    
    // 2. The Use
    let mut file = File::create(dest_path)?;
    file.write_all(&data)?;
}

The issue is that path.exists() and File::create(path) are two separate system calls. The operating system kernel schedules them independently. If the attacker is fast enough (or the server is slow enough), the state of the filesystem changes between those two lines.

The Fix usually involves using low-level file flags to ensure atomicity. In POSIX systems, this means using O_CREAT | O_EXCL. This flag tells the kernel: "Create this file, but fail instantly if it already exists." This combines the Check and the Use into a single atomic instruction, leaving no gap for the attacker to slip in a symlink.

The Exploit: Winning the Race

Exploiting a race condition is usually about brute force and timing. We need to continuously toggle a file between being a "safe" file and a "malicious" symlink, hoping the server catches the symlink at the exact wrong moment.

The Setup:

  1. You need a miniserve instance with --upload-files.
  2. You need write access to the upload directory (e.g., you are a low-privileged user on a shared server, or you have script execution capabilities inside the container).

The Attack Loop:

# The target we want to overwrite
TARGET="/root/.ssh/authorized_keys"
 
# The bait file
BAIT="payload.txt"
 
while true; do
    # State A: Normal file (passes the check)
    touch $BAIT
    
    # State B: Symlink to target (hijacks the write)
    rm $BAIT
    ln -s $TARGET $BAIT
done

While this loop runs, the attacker spams upload requests to miniserve. Most requests will fail (either the file exists, or the write fails permissions). But eventually, the stars align: miniserve checks the path when it's State A (safe), context switches, the loop swaps it to State B (symlink), and then miniserve writes to the target. Bingo. You've just overwritten the root SSH keys with your uploaded content.

The Impact: From File Write to RCE

Why should you panic? Because arbitrary file overwrites are rarely just about defacement. They are the gateway to Remote Code Execution (RCE).

If an attacker can overwrite specific files, they own the system:

  • Authorized Keys: Overwrite ~/.ssh/authorized_keys with their own public key. Result: SSH access as the user running miniserve.
  • Cron Jobs: Overwrite a script in /etc/cron.d/ or /etc/periodic/. Result: The system executes the attacker's script automatically.
  • Config Files: Overwrite miniserve's own config or binary (if permissions allow). Result: Persistent backdoor.

Even in a restricted container, overwriting /etc/shadow or /etc/passwd can cause a Denial of Service or allow privilege escalation if the container is running as root (which, let's be honest, half the containers on the internet are).

The Fix: Closing the Window

The mitigation is straightforward but requires code changes. You cannot "config" your way out of a race condition in the binary logic, other than disabling the affected feature.

For Users:

  • Update: Move to a version later than 0.32.0 immediately.
  • Disable Uploads: If you don't absolutely need --upload-files, turn it off. It's the safest way to operate.
  • Permissions: Ensure the upload directory is not world-writable or writable by untrusted local users.

For Developers:

  • Never check and then open. Always open with flags that enforce your constraints.
  • Use O_TMPFILE (on Linux) to write data to an unnamed temporary file first, then linkat it into place. This is atomic and avoids partial file uploads appearing in the directory.
  • If you must support overwrites, use secure temporary directories and rename operations, which are atomic on POSIX filesystems.

Official Patches

GitHubOfficial repository containing releases

Technical Appendix

CVSS Score
6.8/ 10
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.10%
Top 100% most exploited

Affected Systems

svenstaro/miniserve 0.32.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
miniserve
svenstaro
= 0.32.00.33.0
AttributeDetail
CWE IDCWE-367 (TOCTOU)
Attack VectorLocal / Network (Uploads)
CVSS6.8 (Medium)
ImpactArbitrary File Overwrite
Exploit StatusPoC Available
Architecturex86, ARM, etc. (Rust generic)

MITRE ATT&CK Mapping

T1363Race Condition
Privilege Escalation
T1059Command and Scripting Interpreter
Execution
CWE-367
Time-of-Check Time-of-Use (TOCTOU) Race Condition

The software checks the state of a resource before using it, but the resource's state can change between the check and the use in a way that invalidates the results of the check.

Known Exploits & Detection

GistOriginal vulnerability report and methodology by Ali Firas

Vulnerability Timeline

CVE Published
2026-01-23
GHSA Advisory Published
2026-01-23

References & Sources

  • [1]GHSA Advisory
  • [2]NVD Record

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 minutes ago•CVE-2026-68587
9.2

CVE-2026-68587: Broken Access Control in SiYuan Note Transaction Endpoints

CVE-2026-68587 is a critical authorization bypass vulnerability in SiYuan, an open-source personal knowledge management workspace. When deployed in publish mode, specific transaction endpoints fail to perform administrative role validation. This omission enables unauthenticated remote readers to retrieve the rendered Document Object Model (DOM) of publish-disabled (private) documents by supplying a target heading block identifier. Upgrading to version v3.7.3 or later resolves this issue by applying appropriate routing middleware constraints.

Amit Schendel
Amit Schendel
1 views•6 min read
•about 1 hour ago•CVE-2026-68586
9.2

CVE-2026-68586: Missing Authorization in SiYuan Backlink Content Endpoints Allows Information Disclosure

SiYuan is a privacy-first personal knowledge management system. In versions prior to v3.7.3, the application fails to apply publish-access filters to the getBacklinkDoc and getBackmentionDoc content endpoints (/api/ref/getBacklinkDoc and /api/ref/getBackmentionDoc). While the corresponding backlink list endpoints correctly filter out publish-forbidden documents, the content endpoints, which are only gated by high-level route authorization checks via CheckAuth, do not. Consequently, a user with low-privilege read access, or an anonymous reader when publish Basic Auth is disabled, can directly invoke these endpoints using a known publish-forbidden document's ID to retrieve its rendered DOM content or determine whether it references a specific target block.

Amit Schendel
Amit Schendel
1 views•7 min read
•about 2 hours ago•CVE-2026-68585
5.8

CVE-2026-68585: Metadata Disclosure via Missing Authorization in SiYuan API

A metadata disclosure vulnerability exists in SiYuan prior to version v3.7.3. The /api/block/getBlockInfo endpoint fails to validate authorization boundaries in publish mode, allowing anonymous readers to access private document metadata.

Alon Barad
Alon Barad
3 views•8 min read
•about 3 hours ago•CVE-2026-72812
6.5

CVE-2026-72812: Broken Access Control and SQL Injection in SiYuan

A critical authorization bypass vulnerability exists in SiYuan personal knowledge management system before v3.7.4. The /api/ref/refreshBacklink endpoint lacks administrative role verification, enabling unauthenticated users to initiate database transactions and disk operations. When combined with an unsafe SQL generation pattern in nested backlink queries, an attacker can exploit a secondary SQL injection vulnerability to compromise local databases or cause denial-of-service conditions.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 4 hours ago•CVE-2026-72811
10.0

CVE-2026-72811: Remote SQL Injection in SiYuan Backlink and Mention Search Engine

A critical SQL Injection vulnerability exists in the SiYuan note-taking application (versions <= v3.7.2) due to improper neutralization of single quotes within the backlink and mention search queries. Because the application constructs SQLite Full Text Search (FTS) queries via direct string concatenation and uses a database driver that supports stacked query statements, remote unauthenticated attackers can execute arbitrary SQL commands on the master database, compromising all hosted notebooks. This issue has been fully remediated in version v3.7.4.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 5 hours ago•CVE-2026-72810
8.6

CVE-2026-72810: Publish-Boundary Bypass and Real-Time Data Leakage via WebSocket Session Pollution in SiYuan

CVE-2026-72810 is a critical publish-boundary bypass vulnerability in the SiYuan personal knowledge management system before version 3.7.4. The flaw lies in the backend real-time WebSocket broadcast mechanism. When configured in public publish mode, the system fails to differentiate between unauthenticated public reader sessions and authorized administrative sessions within its global connection pool. This architectural oversight allows unauthenticated remote attackers connecting to the public WebSocket endpoint on port 6808 to passively receive real-time, raw workspace modification events, including keystroke logs, block updates, and content from protected or forbidden documents.

Amit Schendel
Amit Schendel
4 views•7 min read