GHSA-j6gc-4893-qwmp

Suggest an improvement
Source
https://github.com/advisories/GHSA-j6gc-4893-qwmp
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-j6gc-4893-qwmp/GHSA-j6gc-4893-qwmp.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-j6gc-4893-qwmp
Aliases
Published
2026-08-17T16:36:19Z
Modified
2026-08-18T15:11:00Z
Severity
  • 6.0 (Medium) CVSS_V4 - 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 CVSS Calculator
Summary
New API: Redis user quota cache overwrite via PUT /api/user/self allows quota bypass
Details

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:.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.

Database specific
{
    "cwe_ids":  [
        "CWE-362"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-08-17T16:36:19Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

Go / github.com/QuantumNous/new-api

Package

Name
github.com/QuantumNous/new-api
View open source insights on deps.dev
Purl
pkg:golang/github.com/QuantumNous/new-api

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.0.0-rc.16

Database specific

last_known_affected_version_range
"<= 1.0.0-rc.15"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/08/GHSA-j6gc-4893-qwmp/GHSA-j6gc-4893-qwmp.json"