{"id":"CVE-2026-71479","aliases":["CVE-2026-71479","GHSA-8r8v-xf7q-rcpr","GO-2026-6242"],"related":[],"kind":"vulnerability","state":"published","title":"New API: Integer overflow in quota billing yields negative charges (self-crediting)","summary":"New API is a large language mode (LLM) gateway and artificial intelligence (AI) asset management system. Prior to 1.0.0-rc.18, user-controlled image n, video seconds and duration, max_tokens, max_completion_tokens, maxOutputTokens, audio duration, and billing-expression quantities can overflow conversions in common/quota_math.go and related settlement paths, allowing a low-privileged account with positive balance or an active subscription to turn a negative charge into account credit and potentially drain upstream funds. This issue is fixed in version 1.0.0-rc.18.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"New API is a large language mode (LLM) gateway and artificial intelligence (AI) asset management system. Prior to 1.0.0-rc.18, user-controlled image n, video seconds and duration, max_tokens, max_completion_tokens, maxOutputTokens, audio duration, and billing-expression quantities can overflow conversions in common/quota_math.go and related settlement paths, allowing a low-privileged account with positive balance or an active subscription to turn a negative charge into account credit and potentially drain upstream funds. This issue is fixed in version 1.0.0-rc.18.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nMultiple billing paths multiplied **user-controlled quantity parameters** into the quota calculation without an upper bound or overflow-safe integer conversion. A crafted extreme value (e.g. image `n = 18446744073686646784`, a wrapped-negative accepted by a `*uint` field) makes conversions like `int(float64(quota) * n)` wrap past the int64/int32 range into a large **negative** quota. The negative quota takes effect at **settlement** (not at pre-consume), where it is equivalent to crediting the user's balance — turning a small positive balance into an enormous one.\n\n## Timeline（UTC+8）\n\nThis vulnerability was confirmed **exploited in the wild**. Response timeline (UTC+8):\n\n- **2026-07-06 23:00** — Community user @lihui12388 reported that their deployment had been exploited via this vulnerability (large negative consumption entries in logs and abnormally inflated balances). We confirmed in-the-wild exploitation and started an emergency response immediately.\n- **2026-07-07 01:17** — Emergency fix released as [`v1.0.0-rc.18`](https://github.com/QuantumNous/new-api/releases/tag/v1.0.0-rc.18), roughly 2 hours after the report.\n- **2026-07-07 (next day)** — Given the confirmed active exploitation, we publicly disclosed the vulnerability and the fixed version to the community the following day so that all operators could upgrade and audit promptly.\n- **2026-07-07 13:19** — [`v1.0.0-rc.19`](https://github.com/QuantumNous/new-api/releases/tag/v1.0.0-rc.19) released with additional observability (quota-saturation warning logs) to help operators audit and monitor abuse.\n\n## Preconditions\n\nThis is **not** a zero-balance freebie. The attacker must hold an account whose wallet balance is `> 0` and at least covers the request's normal (un-inflated) pre-consume amount — the pre-consume gate rejects `userQuota <= 0` and insufficient balance with HTTP 403. Quantity multipliers (`n`, duration, ...) are not applied at pre-consume; the overflow only manifests at settlement, flipping the charge negative and crediting the balance.\n\n**Severity escalates** when the deployment enables any feature that grants free starting balance, because the required positive balance is then obtained at zero cost and at scale: check-in rewards (`CheckinSetting.Enabled`), invite rebates (`QuotaForInviter` / `QuotaForInvitee`), or new-user quota gifts (`QuotaForNewUser`). With self-registration on by default and any of these enabled, an attacker can register (or mass-register) to obtain seed balance for free, then inflate it via a single crafted request — effectively unauthenticated exploitation.\n\n## Impact\n\nA low-privilege user with a positive balance can massively inflate their own balance with a single crafted request (negative settlement = credit), violating billing integrity. Sustained abuse can drain the operator's prepaid upstream funds and render billing/service unavailable. **Exploitation in the wild has been confirmed** (see Timeline above).\n\n## Root cause\n\nSingle root cause: user-controlled multipliers lacked upper-bound validation before entering quota math, and the float/decimal-to-int conversions lacked saturation. Because `*uint` accepts huge positive values (a wrapped negative), a `>= 0` check is insufficient — an explicit upper bound is required.\n\n## Fix\n\nFixed via defense-in-depth: (1) upper-bound validation at request ingress (400 on violation), (2) local clamping of the same quantities on validation-bypass paths (passthrough/metadata/multipart), and (3) centralized saturating conversions in `common/quota_math.go` that clamp to int32 and never wrap. Saturation events are additionally audited on the related consume/task log under `admin_info.quota_saturation` (admin-only) and via request-correlated backend warnings.","format":"markdown","source":"ghsa"},{"lang":"en","text":"New API: Integer overflow in quota billing yields negative charges (self-crediting) in github.com/QuantumNous/new-api","format":"markdown","source":"go"},{"lang":"es","text":"La nueva API es una pasarela de modo de lenguaje grande (LLM) y un sistema de gestión de activos de inteligencia artificial (IA). Antes de 1.0.0-rc.18, las cantidades controladas por el usuario de n de imagen, segundos y duración de video, max_tokens, max_completion_tokens, maxOutputTokens, duración de audio y expresión de facturación pueden desbordar las conversiones en common/quota_math.go y las rutas de liquidación relacionadas, permitiendo que una cuenta de bajo privilegio con saldo positivo o una suscripción activa convierta un cargo negativo en crédito de cuenta y potencialmente agote fondos ascendentes. Este problema está solucionado en la versión 1.0.0-rc.18.","source":"nvd"}],"published":"2026-08-17T16:11:28.485Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H","score":9.1,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H","score":9.1,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H","score":9.1,"rating":"CRITICAL"}],"cwes":["CWE-190","CWE-682"],"affected":[{"ranges":[{"version":"< 1.0.0-rc.18","status":"affected"}],"vendor":"QuantumNous","product":"new-api","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.0.0-rc.18"}],"ecosystem":"Go","package":"github.com/QuantumNous/new-api","purl":"pkg:golang/github.com/QuantumNous/new-api","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.0.0-rc.18"}],"ecosystem":"Go","package":"github.com/QuantumNous/new-api","purl":"pkg:golang/github.com/QuantumNous/new-api","source":"go"}],"references":[{"url":"https://github.com/QuantumNous/new-api/security/advisories/GHSA-8r8v-xf7q-rcpr","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/QuantumNous/new-api/commit/c9943d37ad93477dd937fc4901cc3c4e0fd8aaab","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/QuantumNous/new-api/commit/d0bd8aac742d1e160a5ca61743fe35f4fff880e8","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/QuantumNous/new-api/releases/tag/v1.0.0-rc.18","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/QuantumNous/new-api","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-08-17T18:59:17.674Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-71479","url":"https://www.cve.org/CVERecord?id=CVE-2026-71479","licence":"CVE Terms of Use","modified":"2026-08-17T18:59:30.302Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8r8v-xf7q-rcpr","url":"https://github.com/advisories/GHSA-8r8v-xf7q-rcpr","licence":"CC-BY-4.0","modified":"2026-08-18T15:10:55.320Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6242","url":"https://pkg.go.dev/vuln/GO-2026-6242","licence":"CC-BY-4.0","modified":"2026-08-18T15:00:25.674Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-71479","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-71479","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:33.354Z","epss":{"score":0.00519,"percentile":0.45617,"date":"2026-12-01T12:00:22.000Z"}}