CVE-2026-64865: New API Redis User Quota Cache Overwrite Vulnerability

MODERATE
Advisory Identifier: GHSA-j6gc-4893-qwmp
CWE-362
Published
Advisory Summary

CVE-2026-64865 is a MODERATE redis user quota cache overwrite vulnerability (CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')) affecting New API libraries in the Go ecosystem. The issue involves redis user quota cache overwrite via put /api/user/self allows quota bypass. Remediation is available by upgrading affected packages to version 1.0.0-rc.16.

CVE-2026-64865 at a Glance

CVE Identifier CVE-2026-64865
GHSA Identifier GHSA-j6gc-4893-qwmp
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Affected Product New API
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-64865

To remediate this vulnerability, upgrade all affected New API 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/QuantumNous/new-api fixed: 1.0.0-rc.16
Upgrade github.com/QuantumNous/new-api to 1.0.0-rc.16
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/QuantumNous/new-api

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-64865, inspect your project dependencies for New API:

inspect dependencies for github.com/QuantumNous/new-api

Analyze the terminal output to locate any version of New API in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0-rc.16), 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 New API, 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 Authenticated users can repeatedly call PUT /api/user/self with language or sidebar_modules while relay requests are consuming quota. The settings path reads a full User snapshot and writes it back through User.Update(), which refreshes Redis with RedisHSetObj and overwrites the Quota field. This can erase concurrent HINCRBY quota deductions and keep cached balance artificially high, allowing calls far beyond the paid quota. ### Impact A low-privileged authenticated user may bypass quota enforcement and cause financial loss to operators. Authentication and pre-consumption use cached quota, while DB/log usage can continue increasing. ### Affected Components - controller/user.go: UpdateSelf language/sidebar_modules branches - model/user.go: User.Update / UpdateWithTx full snapshot update - model/user_cache.go: updateUserCache RedisHSetObj full hash write - model/user.go: GetUserQuota reads Redis cache first ### Root Cause Normal billing uses Redis HINCRBY on user:<id>.Quota, while settings updates use a stale full user snapshot to HSET the entire cache hash, including Quota. These two writers race on the same Redis field. ### Patches This issue is fixed in v1.0.0-rc.16. The fix makes user setting updates field-scoped, prevents stale user snapshots from overwriting accounting fields, and keeps generic user cache refreshes from modifying Quota. Quota cache updates are reserved for atomic quota delta paths or explicit quota synchronization paths. ### Workarounds If upgrading immediately is not possible, operators should temporarily restrict or rate-limit PUT /api/user/self and avoid allowing frequent user setting updates while Redis-backed quota cache is enabled. This is only a mitigation; upgrading is recommended. ### Remediation Upgrade to v1.0.0-rc.16 or later. Deployments with Redis enabled should restart application instances after upgrading so stale in-process code paths are removed.

CVE-2026-64865 Affected New API Versions

1 component(s)
Fixed Versions:
1.0.0-rc.16
Product / Package Ecosystem Affected Versions Fixed Version
github.com/QuantumNous/new-api
Go
< 1.0.0-rc.16
1.0.0-rc.16

References

Frequently Asked Questions

What is CVE-2026-64865?
CVE-2026-64865 is a security vulnerability in New API involving Redis user quota cache overwrite via PUT /api/user/self allows quota bypass under CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition').
Which New API versions are affected?
Affected versions include releases prior to 1.0.0-rc.16 across affected packages: github.com/QuantumNous/new-api.
What version fixes CVE-2026-64865?
Upgrading to 1.0.0-rc.16 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/QuantumNous/new-api affected?
Yes, github.com/QuantumNous/new-api is affected in releases prior to 1.0.0-rc.16. Upgrade your dependency to 1.0.0-rc.16 or later.
What CWE is associated with CVE-2026-64865?
CVE-2026-64865 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-64865?
Run the dependency tree command: 'inspect dependencies for github.com/QuantumNous/new-api'. 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-j6gc-4893-qwmp",
  "modified" : "2026-08-17T16:36:19Z",
  "published" : "2026-08-17T16:36:19Z",
  "aliases" : [ "CVE-2026-64865" ],
  "summary" : "New API: Redis user quota cache overwrite via PUT /api/user/self allows quota bypass",
  "details" : "### Summary\nAuthenticated users can repeatedly call PUT /api/user/self with language or sidebar_modules while relay requests are consuming quota. The settings path reads a full User snapshot and writes it back through User.Update(), which refreshes Redis with RedisHSetObj and overwrites the Quota field. This can erase concurrent HINCRBY quota deductions and keep cached balance artificially high, allowing calls far beyond the paid quota.\n\n### Impact\nA low-privileged authenticated user may bypass quota enforcement and cause financial loss to operators. Authentication and pre-consumption use cached quota, while DB/log usage can continue increasing.\n\n### Affected Components\n- controller/user.go: UpdateSelf language/sidebar_modules branches\n- model/user.go: User.Update / UpdateWithTx full snapshot update\n- model/user_cache.go: updateUserCache RedisHSetObj full hash write\n- model/user.go: GetUserQuota reads Redis cache first\n\n### Root Cause\nNormal billing uses Redis HINCRBY on user:<id>.Quota, while settings updates use a stale full user snapshot to HSET the entire cache hash, including Quota. These two writers race on the same Redis field.\n\n### Patches\nThis issue is fixed in v1.0.0-rc.16. The fix makes user setting updates field-scoped, prevents stale user snapshots from overwriting accounting fields, and keeps generic user cache refreshes from modifying Quota. Quota cache updates are reserved for atomic quota delta paths or explicit quota synchronization paths.\n\n### Workarounds\nIf upgrading immediately is not possible, operators should temporarily restrict or rate-limit PUT /api/user/self and avoid allowing frequent user setting updates while Redis-backed quota cache is enabled. This is only a mitigation; upgrading is recommended.\n\n### Remediation\nUpgrade to v1.0.0-rc.16 or later. Deployments with Redis enabled should restart application instances after upgrading so stale in-process code paths are removed.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/QuantumNous/new-api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.0-rc.16"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.0.0-rc.15"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/security/advisories/GHSA-j6gc-4893-qwmp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/commit/dfc0d6324b40c1d6c2972e524409f933541bfb0f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/QuantumNous/new-api"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/QuantumNous/new-api/releases/tag/v1.0.0-rc.16"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-362" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-17T16:36:19Z",
    "nvd_published_at" : null
  }
}