GHSA-F8XP-WVCX-P6F4

Vulnerability from github – Published: 2026-03-31 22:31 – Updated: 2026-04-06 23:09
VLAI?
Summary
Cloudreve is vulnerable to Account Takeover via Weak Cryptographic Token Generation (Insecure PRNG Seeding)
Details

Impact

This vulnerability affects Cloudreve instances that were first deployed/initialized with versions prior to V4.10.0.

The application uses the weak pseudo-random number generator math/rand seeded with time.Now().UnixNano() to generate critical security secrets, including the secret_key, and hash_id_salt. These secrets are generated upon first startup and persisted in the database.

An attacker can exploit this by obtaining the administrator's account creation time (via public API endpoints) to narrow the search window for the PRNG seed, and use known hashid to validate the seed. By brute-forcing the seed (demonstrated to take <3 hours on general consumer PC), an attacker can predict the secret_key. This allows them to forge valid JSON Web Tokens (JWTs) for any user, including administrators, leading to full account takeover and privilege escalation.

Note: Servers running V4.10.0+ are still vulnerable if they were originally installed using an older version, as the weak secrets persist in the configuration.

Patches

The issue has been addressed in version 4.13.0. This patch introduces a migration mechanism that automatically:

  1. Invalidate the existing secret_key.
  2. Regenerate a new, cryptographically secure secret_key using crypto/rand.

Users should upgrade to 4.13.0 immediately.

Workarounds

If an immediate upgrade is not possible, administrators must manually rotate the critical secrets in the configuration file to invalidate potential exploits:

  1. Stop the Cloudreve service.
  2. In Cloudreve database, locate secret_key setting.
  3. Replace the value with a long, random string (e.g., generated via openssl rand -base64 64).
  4. Restart the Cloudreve service.

Note: This will log out all currently active users.

Resources

  • Vulnerable Code (Seeding): https://github.com/cloudreve/cloudreve/blob/87d48ac4a7acbc68064c2b9cb23793ac97f4392d/pkg/util/common.go#L21C1-L23C2
  • Vulnerable Code (Usage): https://github.com/cloudreve/cloudreve/blob/87d48ac4a7acbc68064c2b9cb23793ac97f4392d/inventory/setting.go#L591
  • Go Documentation (math/rand)
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/cloudreve/Cloudreve/v4"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "4.0.0-20260205113604-ec9fdd33bc54"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-25726"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-338"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-31T22:31:54Z",
    "nvd_published_at": "2026-04-03T20:16:02Z",
    "severity": "HIGH"
  },
  "details": "### Impact\nThis vulnerability affects **Cloudreve** instances that were **first deployed/initialized** with versions prior to V4.10.0.\n\nThe application uses the weak pseudo-random number generator `math/rand` seeded with `time.Now().UnixNano()` to generate critical security secrets, including the `secret_key`, and `hash_id_salt`. These secrets are generated upon first startup and persisted in the database.\n\nAn attacker can exploit this by obtaining the administrator\u0027s account creation time (via public API endpoints) to narrow the search window for the PRNG seed, and use known hashid to validate the seed. By brute-forcing the seed (demonstrated to take \u003c3 hours on general consumer PC), an attacker can predict the `secret_key`. This allows them to forge valid JSON Web Tokens (JWTs) for any user, including administrators, leading to full account takeover and privilege escalation.\n\n**Note**: Servers running V4.10.0+ are still vulnerable if they were originally installed using an older version, as the weak secrets persist in the configuration.\n\n### Patches\nThe issue has been addressed in version 4.13.0.\nThis patch introduces a migration mechanism that automatically:\n\n1. Invalidate the existing `secret_key`.\n2. Regenerate a new, cryptographically secure `secret_key` using crypto/rand.\n\nUsers should upgrade to 4.13.0 immediately.\n\n### Workarounds\nIf an immediate upgrade is not possible, administrators must manually rotate the critical secrets in the configuration file to invalidate potential exploits:\n\n1. Stop the Cloudreve service.\n2. In Cloudreve database, locate `secret_key` setting.\n3. Replace the value with a long, random string (e.g., generated via `openssl rand -base64 64`).\n4. Restart the Cloudreve service.\n\n_Note: This will log out all currently active users._\n\n### Resources\n* Vulnerable Code (Seeding): https://github.com/cloudreve/cloudreve/blob/87d48ac4a7acbc68064c2b9cb23793ac97f4392d/pkg/util/common.go#L21C1-L23C2\n* Vulnerable Code (Usage): https://github.com/cloudreve/cloudreve/blob/87d48ac4a7acbc68064c2b9cb23793ac97f4392d/inventory/setting.go#L591\n* [Go Documentation (math/rand)](https://pkg.go.dev/math/rand)",
  "id": "GHSA-f8xp-wvcx-p6f4",
  "modified": "2026-04-06T23:09:44Z",
  "published": "2026-03-31T22:31:54Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/cloudreve/cloudreve/security/advisories/GHSA-f8xp-wvcx-p6f4"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-25726"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/cloudreve/cloudreve"
    },
    {
      "type": "WEB",
      "url": "https://github.com/cloudreve/cloudreve/releases/tag/4.13.0"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Cloudreve is vulnerable to Account Takeover via Weak Cryptographic Token Generation (Insecure PRNG Seeding)"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…