Vulnerabilities in pkg:golang/github.com/gofiber/utils

PACKAGE
Advisory Identifier: GHSA-m98w-cqp3-qcqr
Advisory Summary

CVE-2025-66565 is a CRITICAL fiber utils uuidv4 and uuid vulnerability (CWE-331: Insufficient Entropy) affecting Github.com/gofiber/utils/v2 libraries in the Go ecosystem. The issue involves fiber utils uuidv4 and uuid silent fallback to predictable values. Remediation is available by upgrading affected packages to version 2.0.0-rc.4, 1.2.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gofiber/utils

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gofiber/utils. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-m98w-cqp3-qcqr CVE-2025-66565 CRITICAL Fiber Utils UUIDv4 and UUID Silent Fallback to Predictable Values

CVE-2025-66565 at a Glance

CVE Identifier CVE-2025-66565
GHSA Identifier GHSA-m98w-cqp3-qcqr
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-331: Insufficient Entropy
Affected Product Github.com/gofiber/utils/v2
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2025-66565

To remediate this vulnerability, upgrade all affected Github.com/gofiber/utils/v2 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/gofiber/utils/v2 fixed: 2.0.0-rc.4
Upgrade github.com/gofiber/utils/v2 to 2.0.0-rc.4
github.com/gofiber/utils fixed: 1.2.0
Upgrade github.com/gofiber/utils to 1.2.0
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/gofiber/utils/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2025-66565, inspect your project dependencies for Github.com/gofiber/utils/v2:

inspect dependencies for github.com/gofiber/utils/v2

Analyze the terminal output to locate any version of Github.com/gofiber/utils/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0-rc.4), 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-331: Insufficient Entropy, where the product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others. In Github.com/gofiber/utils/v2, 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 Critical security vulnerabilities exist in both the `UUIDv4()` and `UUID()` functions of the `github.com/gofiber/utils` package. When the system's cryptographic random number generator (`crypto/rand`) fails, both functions silently fall back to returning predictable UUID values, the zero UUID `"00000000-0000-0000-0000-000000000000"`. This compromises the security of all Fiber applications using these functions for security-critical operations on **Go versions prior to 1.24**. **Both functions are vulnerable to the same root cause (`crypto/rand` failure):** * `UUIDv4()`: Indirect vulnerability through `uuid.NewRandom()` → `crypto/rand.Read()` → fallback to `UUID()` * `UUID()`: Direct vulnerability through `crypto/rand.Read(uuidSeed[:])` → silent zero UUID return > **Note:** Go 1.24 and later panics on `crypto/rand` `Read()` failures, mitigating this vulnerability. Applications running on Go 1.24+ are not affected by the silent fallback behavior. --- ## Vulnerability Details ### Affected Functions * **Package**: `github.com/gofiber/utils` * **Functions**: `UUIDv4()` and `UUID()` * **Return Type**: `string` (both functions) * **Locations**: `common.go:93-99` (UUIDv4), `common.go:60-89` (UUID) ### Technical Description The vulnerability occurs through two related but distinct failure paths, both ultimately caused by `crypto/rand.Read()` failures on Go < 1.24: #### Primary Path: UUIDv4() Vulnerability 1. `UUIDv4()` calls `google/uuid.NewRandom()` which internally uses `crypto/rand.Read()` 2. If `uuid.NewRandom()` fails, `UUIDv4()` falls back to the internal `UUID()` function 3. **No error is returned to the application** - silent security failure occurs #### Secondary Path: UUID() Vulnerability 1. `UUID()` directly calls `crypto/rand.Read(uuidSeed[:])` to seed its internal state 2. If seeding fails, `UUID()` **silently fails** and returns the zero UUID `"00000000-0000-0000-0000-000000000000"` 3. Applications receive predictable UUIDs with no indication of the security failure --- ### Code Analysis #### UUIDv4() Vulnerability Path ```go func UUIDv4() string { token, err := uuid.NewRandom() // Uses crypto/rand.Read() internally if err != nil { return UUID() // Dangerous fallback - no error returned to application } return token.String() } ``` #### UUID() Vulnerability Path ```go func UUID() string { uuidSetup.Do(func() { if _, err := rand.Read(uuidSeed[:]); err != nil { // Direct crypto/rand.Read() call return // Silent failure - no seeding, uuidCounter remains 0 } uuidCounter = binary.LittleEndian.Uint64(uuidSeed[:8]) }) if atomic.LoadUint64(&uuidCounter) <= 0 { return "00000000-0000-0000-0000-000000000000" // Zero UUID returned silently } // ... generate UUID from counter } ``` **Root Cause:** Both vulnerabilities stem from `crypto/rand.Read()` failures, occurring through different code paths with the same dangerous silent fallback behavior. --- ## Security Impact ### Severity: CRITICAL This issue is especially severe because many Fiber middleware packages (session, CSRF, auth, rate-limit, request-ID, etc.) default to `utils.UUIDv4()` for generating security-sensitive identifiers. A failure in `crypto/rand` would cause **every generated identifier across the entire application** to collapse to a single predictable value (the zero UUID), resulting in: * **Session fixation / universal session hijack** * **CSRF token predictability and bypass** * **Authentication token replay** * **Global identifier collisions leading to severe application breakage** * **Potential application-wide DoS** due to every request using the same “unique” key, causing cache overwrites, session stomping, corrupted internal maps, and loss of isolation across all users --- ### Attack Scenario While **entropy exhaustion is extremely rare on modern Linux systems**, *RNG access failures* (e.g., restricted `/dev/random` or `/dev/urandom` access, broken container environments, sandbox restrictions, misconfigured VMs, or FIPS-mode RNG failures) are realistic. In these scenarios on **Go < 1.24**, `crypto/rand` may return errors immediately — triggering the vulnerable fallback paths. On **Go 1.24+**, `crypto/rand` `Read()` panics on failure, mitigating the silent-zero fallback issue. --- ### Proof of Concept 1. `uuid.NewRandom()` fails (indirect `crypto/rand.Read()` failure) 2. `UUIDv4()` calls `UUID()` as fallback with no error returned 3. `UUID()` seeding fails directly via `crypto/rand.Read(uuidSeed[:])` 4. Zero UUID `"00000000-0000-0000-0000-000000000000"` is returned silently 5. No error is propagated to the application from either function --- ## Affected Versions * All versions of `github.com/gofiber/utils` containing the `UUIDv4()` or `UUID()` functions * Applications using Fiber middleware that depend on `UUIDv4()` or `UUID` for security * **Only applicable to Go < 1.24**; Go 1.24+ panics/block on `crypto/rand` `Read()` failures and is not affected --- ## Mitigation ### Immediate Workaround Replace usage of `utils.UUIDv4()` with `uuid.New()` or wait for fix: ```go sessionID := uuid.New() ``` ### Recommended Fix Modify `utils.UUIDv4()` and `utils.UUID()` to fail explicitly when cryptographic randomness is unavailable: ```go func UUIDv4() string { token, err := uuid.NewRandom() if err != nil { panic(fmt.Sprintf("utils: failed to generate secure UUID: %v", err)) } return token.String() } func UUID() string { uuidSetup.Do(func() { if _, err := rand.Read(uuidSeed[:]); err != nil { panic(fmt.Sprintf("utils: failed to seed UUID generator: %v", err)) } uuidCounter = binary.LittleEndian.Uint64(uuidSeed[:8]) }) if atomic.LoadUint64(&uuidCounter) <= 0 { panic("utils: UUID generator not properly seeded") } // ... generate UUID from counter } ``` --- ## Detection Applications can detect if they're affected by: 1. Checking if they use `github.com/gofiber/utils` 2. Searching for `UUIDv4()` and `UUID()` usage in security-critical code paths 3. Reviewing Fiber middleware configurations that rely on defaults of `UUIDv4()` for security identifiers --- ## References * **Package Repository**: [https://github.com/gofiber/utils](https://github.com/gofiber/utils) * **Fiber Framework**: [https://github.com/gofiber/fiber](https://github.com/gofiber/fiber) * **Google UUID Library**: [https://github.com/google/uuid](https://github.com/google/uuid) * Golang `crypto/rand` behavior changes: [golang/go#66821](https://github.com/golang/go/issues/66821), [Go 1.25.5 source](https://cs.opensource.google/go/go/+/refs/tags/go1.25.5:src/crypto/rand/rand.go;l=80) --- ## Contact Reported by: [@sixcolors](https://github.com/sixcolors) --- ## Classification * **OWASP**: A02:2021 - Cryptographic Failures * **Impact**: Complete compromise of application security model on Go < 1.24 * **Exploitability**: Medium (requires entropy failure) * **Scope**: All Fiber applications using affected middleware on Go < 1.24

CVE-2025-66565 Affected Github.com/gofiber/utils/v2 Versions

2 component(s)
Fixed Versions:
2.0.0-rc.41.2.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gofiber/utils/v2
Go
< 2.0.0-rc.4
2.0.0-rc.4
github.com/gofiber/utils
Go
< 1.2.0
1.2.0

References

Frequently Asked Questions

What is CVE-2025-66565?
CVE-2025-66565 is a security vulnerability in Github.com/gofiber/utils/v2 involving Fiber Utils UUIDv4 and UUID Silent Fallback to Predictable Values under CWE-331: Insufficient Entropy.
Which Github.com/gofiber/utils/v2 versions are affected?
Affected versions include releases prior to 2.0.0-rc.4, 1.2.0 across affected packages: github.com/gofiber/utils/v2, github.com/gofiber/utils.
What version fixes CVE-2025-66565?
Upgrading to 2.0.0-rc.4, 1.2.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gofiber/utils/v2 affected?
Yes, github.com/gofiber/utils/v2 is affected in releases prior to 2.0.0-rc.4. Upgrade your dependency to 2.0.0-rc.4 or later.
Is github.com/gofiber/utils affected?
Yes, github.com/gofiber/utils is affected in releases prior to 1.2.0. Upgrade your dependency to 1.2.0 or later.
What CWE is associated with CVE-2025-66565?
CVE-2025-66565 is classified under CWE-331: Insufficient Entropy (The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.).
How can I check Go dependencies for CVE-2025-66565?
Run the dependency tree command: 'inspect dependencies for github.com/gofiber/utils/v2'. 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-m98w-cqp3-qcqr",
  "modified" : "2025-12-12T16:30:26Z",
  "published" : "2025-12-08T17:57:26Z",
  "aliases" : [ "CVE-2025-66565" ],
  "summary" : "Fiber Utils UUIDv4 and UUID Silent Fallback to Predictable Values",
  "details" : "## Summary\n\nCritical security vulnerabilities exist in both the `UUIDv4()` and `UUID()` functions of the `github.com/gofiber/utils` package. When the system's cryptographic random number generator (`crypto/rand`) fails, both functions silently fall back to returning predictable UUID values, the zero UUID `\"00000000-0000-0000-0000-000000000000\"`. This compromises the security of all Fiber applications using these functions for security-critical operations on **Go versions prior to 1.24**.\n\n**Both functions are vulnerable to the same root cause (`crypto/rand` failure):**\n\n* `UUIDv4()`: Indirect vulnerability through `uuid.NewRandom()` → `crypto/rand.Read()` → fallback to `UUID()`\n* `UUID()`: Direct vulnerability through `crypto/rand.Read(uuidSeed[:])` → silent zero UUID return\n\n> **Note:** Go 1.24 and later panics on `crypto/rand` `Read()` failures, mitigating this vulnerability. Applications running on Go 1.24+ are not affected by the silent fallback behavior.\n\n---\n\n## Vulnerability Details\n\n### Affected Functions\n\n* **Package**: `github.com/gofiber/utils`\n* **Functions**: `UUIDv4()` and `UUID()`\n* **Return Type**: `string` (both functions)\n* **Locations**: `common.go:93-99` (UUIDv4), `common.go:60-89` (UUID)\n\n### Technical Description\n\nThe vulnerability occurs through two related but distinct failure paths, both ultimately caused by `crypto/rand.Read()` failures on Go < 1.24:\n\n#### Primary Path: UUIDv4() Vulnerability\n\n1. `UUIDv4()` calls `google/uuid.NewRandom()` which internally uses `crypto/rand.Read()`\n2. If `uuid.NewRandom()` fails, `UUIDv4()` falls back to the internal `UUID()` function\n3. **No error is returned to the application** - silent security failure occurs\n\n#### Secondary Path: UUID() Vulnerability\n\n1. `UUID()` directly calls `crypto/rand.Read(uuidSeed[:])` to seed its internal state\n2. If seeding fails, `UUID()` **silently fails** and returns the zero UUID `\"00000000-0000-0000-0000-000000000000\"`\n3. Applications receive predictable UUIDs with no indication of the security failure\n\n---\n\n### Code Analysis\n\n#### UUIDv4() Vulnerability Path\n\n```go\nfunc UUIDv4() string {\n\ttoken, err := uuid.NewRandom()  // Uses crypto/rand.Read() internally\n\tif err != nil {\n\t\treturn UUID()  // Dangerous fallback - no error returned to application\n\t}\n\treturn token.String()\n}\n```\n\n#### UUID() Vulnerability Path\n\n```go\nfunc UUID() string {\n\tuuidSetup.Do(func() {\n\t\tif _, err := rand.Read(uuidSeed[:]); err != nil {  // Direct crypto/rand.Read() call\n\t\t\treturn  // Silent failure - no seeding, uuidCounter remains 0\n\t\t}\n\t\tuuidCounter = binary.LittleEndian.Uint64(uuidSeed[:8])\n\t})\n\tif atomic.LoadUint64(&uuidCounter) <= 0 {\n\t\treturn \"00000000-0000-0000-0000-000000000000\"  // Zero UUID returned silently\n\t}\n\t// ... generate UUID from counter\n}\n```\n\n**Root Cause:** Both vulnerabilities stem from `crypto/rand.Read()` failures, occurring through different code paths with the same dangerous silent fallback behavior.\n\n---\n\n## Security Impact\n\n### Severity: CRITICAL\n\nThis issue is especially severe because many Fiber middleware packages (session, CSRF, auth, rate-limit, request-ID, etc.) default to `utils.UUIDv4()` for generating security-sensitive identifiers. A failure in `crypto/rand` would cause **every generated identifier across the entire application** to collapse to a single predictable value (the zero UUID), resulting in:\n\n* **Session fixation / universal session hijack**\n* **CSRF token predictability and bypass**\n* **Authentication token replay**\n* **Global identifier collisions leading to severe application breakage**\n* **Potential application-wide DoS** due to every request using the same “unique” key, causing cache overwrites, session stomping, corrupted internal maps, and loss of isolation across all users\n\n---\n\n### Attack Scenario\n\nWhile **entropy exhaustion is extremely rare on modern Linux systems**, *RNG access failures* (e.g., restricted `/dev/random` or `/dev/urandom` access, broken container environments, sandbox restrictions, misconfigured VMs, or FIPS-mode RNG failures) are realistic. In these scenarios on **Go < 1.24**, `crypto/rand` may return errors immediately — triggering the vulnerable fallback paths.\n\nOn **Go 1.24+**, `crypto/rand` `Read()` panics on failure, mitigating the silent-zero fallback issue.\n\n---\n\n### Proof of Concept\n\n1. `uuid.NewRandom()` fails (indirect `crypto/rand.Read()` failure)\n2. `UUIDv4()` calls `UUID()` as fallback with no error returned\n3. `UUID()` seeding fails directly via `crypto/rand.Read(uuidSeed[:])`\n4. Zero UUID `\"00000000-0000-0000-0000-000000000000\"` is returned silently\n5. No error is propagated to the application from either function\n\n---\n\n## Affected Versions\n\n* All versions of `github.com/gofiber/utils` containing the `UUIDv4()` or `UUID()` functions\n* Applications using Fiber middleware that depend on `UUIDv4()` or `UUID` for security\n* **Only applicable to Go < 1.24**; Go 1.24+ panics/block on `crypto/rand` `Read()` failures and is not affected\n\n---\n\n## Mitigation\n\n### Immediate Workaround\n\nReplace usage of `utils.UUIDv4()` with `uuid.New()` or wait for fix:\n\n```go\nsessionID := uuid.New()\n```\n\n### Recommended Fix\n\nModify `utils.UUIDv4()` and `utils.UUID()` to fail explicitly when cryptographic randomness is unavailable:\n\n```go\nfunc UUIDv4() string {\n\ttoken, err := uuid.NewRandom()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"utils: failed to generate secure UUID: %v\", err))\n\t}\n\treturn token.String()\n}\n\nfunc UUID() string {\n    uuidSetup.Do(func() {\n        if _, err := rand.Read(uuidSeed[:]); err != nil {\n            panic(fmt.Sprintf(\"utils: failed to seed UUID generator: %v\", err))\n        }\n        uuidCounter = binary.LittleEndian.Uint64(uuidSeed[:8])\n    })\n    if atomic.LoadUint64(&uuidCounter) <= 0 {\n        panic(\"utils: UUID generator not properly seeded\")\n    }\n    // ... generate UUID from counter\n}\n```\n\n---\n\n## Detection\n\nApplications can detect if they're affected by:\n\n1. Checking if they use `github.com/gofiber/utils`\n2. Searching for `UUIDv4()` and `UUID()` usage in security-critical code paths\n3. Reviewing Fiber middleware configurations that rely on defaults of `UUIDv4()` for security identifiers\n\n---\n\n## References\n\n* **Package Repository**: [https://github.com/gofiber/utils](https://github.com/gofiber/utils)\n* **Fiber Framework**: [https://github.com/gofiber/fiber](https://github.com/gofiber/fiber)\n* **Google UUID Library**: [https://github.com/google/uuid](https://github.com/google/uuid)\n* Golang `crypto/rand` behavior changes: [golang/go#66821](https://github.com/golang/go/issues/66821), [Go 1.25.5 source](https://cs.opensource.google/go/go/+/refs/tags/go1.25.5:src/crypto/rand/rand.go;l=80)\n\n---\n\n## Contact\n\nReported by: [@sixcolors](https://github.com/sixcolors)\n\n---\n\n## Classification\n\n* **OWASP**: A02:2021 - Cryptographic Failures\n* **Impact**: Complete compromise of application security model on Go < 1.24\n* **Exploitability**: Medium (requires entropy failure)\n* **Scope**: All Fiber applications using affected middleware on Go < 1.24",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gofiber/utils/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0-rc.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 2.0.0-rc.3.0.20251205210924-6c6cf047032b"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gofiber/utils"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.1.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/utils/security/advisories/GHSA-m98w-cqp3-qcqr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66565"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gofiber/utils/commit/6c6cf047032b9c8dff43d29f990b4b10e9b02d47"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gofiber/utils"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-252", "CWE-331", "CWE-338" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-08T17:57:26Z",
    "nvd_published_at" : "2025-12-09T16:18:21Z"
  }
}