CVE-2026-77633: Cloudreve Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-xj3h-wwxq-gfcj
CVSS 7.1
CWE-362 CWE-367 CWE-770
Published
Advisory Summary

CVE-2026-77633 is a HIGH (CVSS 7.1) denial of service vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting Cloudreve libraries in the Go ecosystem. The issue involves storage-quota toctou race allows quota bypass and storage-based denial of service. Remediation is available by upgrading affected packages to version 4.0.0-20260715025621-7329602751c0.

CVE-2026-77633 at a Glance

CVE Identifier CVE-2026-77633
GHSA Identifier GHSA-xj3h-wwxq-gfcj
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product Cloudreve
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability High (A:H)

How to Fix CVE-2026-77633

To remediate this vulnerability, upgrade all affected Cloudreve dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/cloudreve/Cloudreve/v4 fixed: 4.0.0-20260715025621-7329602751c0
Upgrade github.com/cloudreve/Cloudreve/v4 to 4.0.0-20260715025621-7329602751c0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/cloudreve/Cloudreve/v4

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-77633, inspect your project dependencies for Cloudreve:

inspect dependencies for github.com/cloudreve/Cloudreve/v4

Analyze the terminal output to locate any version of Cloudreve in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.0-20260715025621-7329602751c0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition'), where the product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently. In Cloudreve, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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`: ```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`: ```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`: ```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.

CVE-2026-77633 Affected Cloudreve Versions

1 component(s)
Fixed Versions:
4.0.0-20260715025621-7329602751c0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/cloudreve/Cloudreve/v4
Go
< 4.0.0-20260715025621-7329602751c0
4.0.0-20260715025621-7329602751c0

References

Frequently Asked Questions

What is CVE-2026-77633?
CVE-2026-77633 is a security vulnerability in Cloudreve involving Storage-quota TOCTOU race allows quota bypass and storage-based denial of service under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which Cloudreve versions are affected?
Affected versions include releases prior to 4.0.0-20260715025621-7329602751c0 across affected packages: github.com/cloudreve/Cloudreve/v4.
What version fixes CVE-2026-77633?
Upgrading to 4.0.0-20260715025621-7329602751c0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/cloudreve/Cloudreve/v4 affected?
Yes, github.com/cloudreve/Cloudreve/v4 is affected in releases prior to 4.0.0-20260715025621-7329602751c0. Upgrade your dependency to 4.0.0-20260715025621-7329602751c0 or later.
What is the CVSS score of CVE-2026-77633?
CVE-2026-77633 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H.
What CWE is associated with CVE-2026-77633?
CVE-2026-77633 is classified under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') (The product contains a concurrent code sequence that requires temporary, exclusive access to a shared resource, but a timing window exists in which the shared resource can be modified by another code sequence operating concurrently.).
How can I check Go dependencies for CVE-2026-77633?
Run the dependency tree command: 'inspect dependencies for github.com/cloudreve/Cloudreve/v4'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xj3h-wwxq-gfcj",
  "modified" : "2026-09-22T20:40:33Z",
  "published" : "2026-09-22T20:40:33Z",
  "aliases" : [ "CVE-2026-77633" ],
  "summary" : "Cloudreve: Storage-quota TOCTOU race allows quota bypass and storage-based denial of service",
  "details" : "## Summary\n\nCloudreve 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.\n\nThe 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.\n\nExploitation 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.\n\n## Technical details\n\n`PrepareUpload` in `pkg/filemanager/fs/dbfs/upload.go` splits quota enforcement across two stages:\n\n**Stage A — the check (snapshot compare, no lock)** — `pkg/filemanager/fs/dbfs/validator.go`:\n\n```go\nfunc (f *DBFS) validateUserCapacity(ctx context.Context, size int64, u *ent.User) error {\n    capacity, err := f.Capacity(ctx, u)              // reads \"used\"\n    if err != nil { return ... }\n    return f.validateUserCapacityRaw(ctx, size, capacity)\n}\n\nfunc (f *DBFS) validateUserCapacityRaw(ctx context.Context, size int64, capacity *fs.Capacity) error {\n    if capacity.Used + size > capacity.Total {       // snapshot compare only; no lock, no reservation\n        return fs.ErrInsufficientCapacity\n    }\n    return nil\n}\n```\n\n`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`:\n\n```go\nfunc (f *DBFS) Capacity(ctx context.Context, u *ent.User) (*fs.Capacity, error) {\n    ...\n    res.Used  = f.user.Storage            // captured at request start\n    res.Total = requesterGroup.MaxStorage\n    return res, nil\n}\n```\n\nNo SELECT is issued at check time, no row lock is taken on the user row, and pending upload sessions are not counted.\n\n**Stage B — the charge (single unconditional UPDATE, outside the tx)** — `pkg/filemanager/fs/dbfs/upload.go` → `inventory/tx.go` → `inventory/user.go`:\n\n```go\n// PrepareUpload: check (A) ...  then, many statements later ...\nif err := f.validateUserCapacity(ctx, req.Props.Size, ancestor.Owner()); err != nil {\n    return nil, err\n}\n...\nif err := inventory.CommitWithStorageDiff(ctx, dbTx, f.l, f.userClient); err != nil { ... }  // charge (B)\n\n// inventory/user.go\nc.client.User.Update().Where(user.ID(uid)).AddStorage(diff).Exec(ctx)  // SQL: storage = storage + diff\n```\n\nBetween 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`.\n\nThree defensive controls that would each independently close the race are missing:\n\n1. The check and the charge are not enclosed in the same transaction with a `SELECT ... FOR UPDATE` on the user row.\n2. 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`.\n3. `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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/cloudreve/Cloudreve/v4"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "4.0.0-20260715025621-7329602751c0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/cloudreve/cloudreve/security/advisories/GHSA-xj3h-wwxq-gfcj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-77633"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudreve/cloudreve/commit/7329602751c00bb4136fe9ad8b364d0df70773df"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/cloudreve/cloudreve"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/cloudreve/cloudreve/releases/tag/4.18.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-362", "CWE-367", "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-22T20:40:33Z",
    "nvd_published_at" : "2026-09-22T16:17:55Z"
  }
}