New API integer overflow: one request turned a $0.10 balance into $16.9T A critical integer overflow vulnerability, CVE-2026-71479, in the self-hosted OpenAI-compatible LLM gateway New API (QuantumNous/new-api) allowed a single image request to turn a $0.10 balance into $16,893,488,147,419.20, as reproduced by security researchers. The flaw, affecting versions up to v1.0.0-rc.17, was exploited in the wild on July 6, 2026, and fixed in v1.0.0-rc.18, which clamps quantities and uses saturating arithmetic. The vulnerability has a CVSS score of 9.1 and can corrupt billing ledgers, granting unlimited free model usage. Unlimited AI Credits from One Integer: New API's Quota Overflow CVE-2026-71479 and How to Check Your Gateway New API QuantumNous/new-api is a self-hosted, OpenAI-compatible LLM gateway — a billing and access-control layer that sits in front of upstream model providers and meters what each user spends. On July 6, 2026 an operator noticed accounts on their instance showing wildly inflated balances and negative consumption entries. The cause is CVE-2026-71479 https://github.com/QuantumNous/new-api/security/advisories/GHSA-8r8v-xf7q-rcpr : user-controlled quantity fields — the image count n, video duration, token limits — enter the quota math with no upper bound, and a large enough value overflows New API's 64-bit integer arithmetic into a negative charge. A negative charge is a credit. We reproduced it against the real product: a single image request turned a $0.10 balance into $16,893,488,147,419.20 , and confirmed the fix in v1.0.0-rc.18 rejects the same request. The Vulnerability CVE-2026-71479 https://github.com/QuantumNous/new-api/security/advisories/GHSA-8r8v-xf7q-rcpr is CWE-190 Integer Overflow or Wraparound https://cwe.mitre.org/data/definitions/190.html , compounded by CWE-682 Incorrect Calculation https://cwe.mitre.org/data/definitions/682.html . New API tracks each user's balance as an integer "quota" 500,000 units = $1 by default . When a request is priced, the per-unit quota is multiplied by a client-supplied quantity. In versions up to and including v1.0.0-rc.17, the image-generation handler reads the count straight from the request body with no ceiling: // relay/image handler.go New API <= v1.0.0-rc.17 imageN := uint 1 if request.N = nil { imageN = request.N // no upper bound; uint from JSON } ... info.PriceData.AddOtherRatio "n", float64 imageN // folded into billing At settlement the total charge is computed as roughly perImageQuota × n and stored in a signed 64-bit integer. Go's int is 64-bit; its ceiling is 2^63 − 1 ≈ 9.22 × 10^18. Push the product past that line and the value is reinterpreted as a negative number. The settlement code applies that number to the balance without checking its sign, and subtracting a negative quota adds credit. The critical detail is that the charge only overflows at settlement , after a small pre-charge check has already passed — so the attack looks like an ordinary, funded request right up until the balance inverts. - CVSS: 9.1 Critical CVSS v3.1, AV:N/AC:L/PR:N/UI:N/S:U/ C:N/I:H/A:H — GitHub CNA via the project advisory. Note the vector: this is an integrity and availability flaw billing corruption , not code execution and not data disclosure. - CWE: CWE-190 Integer Overflow or Wraparound , CWE-682 Incorrect Calculation - AFFECTED: New API <= v1.0.0-rc.17 image count, video/async duration, and output-token quantity paths all lack bounds - FIXED: New API v1.0.0-rc.18 — clamps quantities MaxImageN = 128, MaxTaskDurationSeconds = 3600 and routes quota math through saturating conversions in common/quota math.go. v1.0.0-rc.19 added saturation logging. - PRECONDITION: an account whose balance covers one normally-priced request to pass the pre-charge gate . Self-registration is enabled by default; where a deployment grants free starting balance, check-in bonuses, or referral credit, that account is free to create. - IMPACT: a single request mints an effectively unlimited balance — free model usage, and a corrupted billing ledger - EXPLOITED: Yes — reported in the wild on 2026-07-06; the maintainer shipped the emergency patch rc.18 roughly two hours later. Not yet in CISA KEV. - ADVISORY: GHSA-8r8v-xf7q-rcpr https://github.com/QuantumNous/new-api/security/advisories/GHSA-8r8v-xf7q-rcpr AM I EXPOSED? - AFFECTEDAny self-hosted New API instance on <= v1.0.0-rc.17 where an attacker can obtain an account with even a tiny positive balance — trivial wherever self-registration plus free starting/check-in/referral credit is enabled, which is a common configuration for public gateways. - NOT YOUInstances on v1.0.0-rc.18 or later, or where no untrusted user can ever hold a positive balance closed registration, no free grants, and every funded account fully trusted . The gateway not being internet-reachable also removes remote attackers. - CHECKQuery the unauthenticated status endpoint for the exact version: curl -s http://TARGET:3000/api/status | grep -o '"version":" ^" "' — anything at or below v1.0.0-rc.17 is vulnerable. Every response also carries an X-New-Api-Version header curl -sI http://TARGET:3000/ | grep -i x-new-api-version . - FIXUpgrade to New API v1.0.0-rc.18 or later pin the image tag; do not run :latest unpinned . Until then, disable self-registration and any free-balance grants so no untrusted account can pass the pre-charge gate, and audit balances and consumption logs for negative-charge entries. Reproducing It Against the Real Product A billing-overflow claim is easy to assert and worth proving end to end. We ran New API's own image — calciumion/new-api:v1.0.0-rc.17, unmodified — in an isolated throwaway container on port 3000, with a stock dall-e-3 price entry the image ships priced at $0.04 per image . To avoid needing a real provider key, we pointed a channel at a local mock that simply returns a valid 200 image response; New API bills from the client-supplied n, not from what the upstream actually returns, so the mock is sufficient. The advisory is the proof the bug is real; this reproduction makes the arithmetic concrete and confirms the fix. The attacker is an ordinary user with a small balance — we funded the account with $0.10, enough to clear the pre-charge on one normal image. Then a single request, with an image count chosen to push the settlement product past the signed-64-bit ceiling: one authenticated image request, absurd n curl -X POST http://TARGET:3000/v1/images/generations \ -H "Authorization: Bearer sk-