CVE-2026-77633

CVE-2026-77633 is a high-severity race condition vulnerability in github.com/cloudreve/Cloudreve/v4 (go), affecting versions < 4.0.0-20260715025621-7329602751c0. It is fixed in 4.0.0-20260715025621-7329602751c0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Cloudreve: Storage-quota TOCTOU race allows quota bypass and storage-based denial of service

Cloudreve v4 splits the storage-quota check (reading the user's used bytes and comparing them to MaxStorage) and the charge (incrementing users.storage) into two non-atomic steps in the PrepareUpload code path. This creates a Time-of-Check to Time-of-Use (TOCTOU) race condition. Any authenticated user, including an unprivileged account in the default User group, can concurrently issue several upload-session requests that all read the same stale used snapshot, each pass the check, and then each contribute their declared size to users.storage. The end result is that the total approved capacity exceeds the group's MaxStorage many times over.

The same primitive is trivially amplifiable into a storage-based denial of service. During PrepareUpload, Cloudreve reserves the declared size against users.storage before any bytes are written, so an attacker can push the reserved amount far beyond the host's physical disk (tested: a 1 GiB-quota account reserved 17 GiB in a single 20-way burst), and can then materialise the reservation by completing chunked uploads to actually write the excess bytes to disk. Amplification to the host's free space fills the disk and denies uploads for every user of the instance.

Exploitation requires only a valid session with Files.Write permission. No administrator configuration, no non-default storage policy, and no elevated privileges are needed. The default deployment (local storage policy, default User group) is affected.

Technical details

PrepareUpload in pkg/filemanager/fs/dbfs/upload.go splits quota enforcement across two stages:

Stage A, the check (snapshot compare, no lock), pkg/filemanager/fs/dbfs/validator.go:

func (f *DBFS) validateUserCapacity(ctx context.Context, size int64, u *ent.User) error {
    capacity, err := f.Capacity(ctx, u)              // reads "used"
    if err != nil { return ... }
    return f.validateUserCapacityRaw(ctx, size, capacity)
}

func (f *DBFS) validateUserCapacityRaw(ctx context.Context, size int64, capacity *fs.Capacity) error {
    if capacity.Used + size > capacity.Total {       // snapshot compare only; no lock, no reservation
        return fs.ErrInsufficientCapacity
    }
    return nil
}

capacity.Used comes from the in-memory *ent.User that was hydrated once at the beginning of the request, pkg/filemanager/fs/dbfs/dbfs.go:

func (f *DBFS) Capacity(ctx context.Context, u *ent.User) (*fs.Capacity, error) {
    ...
    res.Used  = f.user.Storage            // captured at request start
    res.Total = requesterGroup.MaxStorage
    return res, nil
}

No SELECT is issued at check time, no row lock is taken on the user row, and pending upload sessions are not counted.

Stage B, the charge (single unconditional UPDATE, outside the tx), pkg/filemanager/fs/dbfs/upload.go → inventory/tx.go → inventory/user.go:

// PrepareUpload: check (A) ...  then, many statements later ...
if err := f.validateUserCapacity(ctx, req.Props.Size, ancestor.Owner()); err != nil {
    return nil, err
}
...
if err := inventory.CommitWithStorageDiff(ctx, dbTx, f.l, f.userClient); err != nil { ... }  // charge (B)

// inventory/user.go
c.client.User.Update().Where(user.ID(uid)).AddStorage(diff).Exec(ctx)  // SQL: storage = storage + diff

Between A and B the code performs storage-policy load-balancing, save-path generation, encryption-metadata generation, transaction start, placeholder-file/entity creation, and metadata upsert. This leaves a wide race window. N concurrent PrepareUpload requests each read the same stale Used snapshot at A, each pass their independent quota check, and then each add their own size to users.storage at B. The committed total is up to N × size above MaxStorage.

Three defensive controls that would each independently close the race are missing:

  1. The check and the charge are not enclosed in the same transaction with a SELECT ... FOR UPDATE on the user row.
  2. The charge is a plain storage = storage + :size UPDATE, not an atomic conditional update of the form UPDATE users SET storage = storage + :size WHERE id = :uid AND storage + :size <= :max_storage.
  3. Used is computed only from committed entities. Concurrent pending upload sessions (which have already been reserved by the accounting model) are not counted, so races among sessions that haven't yet completed are invisible to each other.

Impact

Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing. Typical impact: TOCTOU exploits, data corruption, or privilege escalation.

CVE-2026-77633 has a CVSS score of 7.1 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.0.0-20260715025621-7329602751c0); upgrading removes the vulnerable code path.

Affected versions

github.com/cloudreve/Cloudreve/v4 (< 4.0.0-20260715025621-7329602751c0)

Security releases

github.com/cloudreve/Cloudreve/v4 → 4.0.0-20260715025621-7329602751c0 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade github.com/cloudreve/Cloudreve/v4 to 4.0.0-20260715025621-7329602751c0 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-77633? CVE-2026-77633 is a high-severity race condition vulnerability in github.com/cloudreve/Cloudreve/v4 (go), affecting versions < 4.0.0-20260715025621-7329602751c0. It is fixed in 4.0.0-20260715025621-7329602751c0. Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing.
  2. How severe is CVE-2026-77633? CVE-2026-77633 has a CVSS score of 7.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of github.com/cloudreve/Cloudreve/v4 are affected by CVE-2026-77633? github.com/cloudreve/Cloudreve/v4 (go) versions < 4.0.0-20260715025621-7329602751c0 is affected.
  4. Is there a fix for CVE-2026-77633? Yes. CVE-2026-77633 is fixed in 4.0.0-20260715025621-7329602751c0. Upgrade to this version or later.
  5. Is CVE-2026-77633 exploitable, and should I be worried? Whether CVE-2026-77633 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-77633 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-77633? Upgrade github.com/cloudreve/Cloudreve/v4 to 4.0.0-20260715025621-7329602751c0 or later.

Other vulnerabilities in github.com/cloudreve/Cloudreve/v4

Stop the waste.
Protect your environment with Kodem.