All vulnerabilities

Servers and applications

GHSA-rj2f-m3wv-558h

Balance Check-Then-Spend TOCTOU Race Allows Spending Beyond Token Credit Limit

Severity
Medium
Published
17 Nov 2026
Last changed
17 Nov 2026
Added to UpHeron
17 Nov 2026
Fixed in
0.8.8
Sources
Project advisories (GitHub)

Description

CONFIRMED

  • Vulnerability: Time-of-Check to Time-of-Use (TOCTOU) Race Condition
  • CWE: CWE-367 (Time-of-check Time-of-use Race Condition)
  • Severity: Medium-High
  • CVSS (estimate): 6.5 — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L (modeled as resource-abuse/quota-bypass rather than confidentiality/integrity loss)
  • File: packages/api/src/middleware/checkBalance.ts (checkBalanceRecord, lines 48-~90) — the pre-flight read
  • File: api/app/clients/BaseClient.js:684-713 — calls checkBalance() before sendCompletion(), the actual (potentially tens-of-seconds) LLM call
  • Final debit (confirmed safe): packages/data-schemas/src/methods/transaction.ts:211-298 (updateBalance, CAS-loop, floors at 0)
  • Affected endpoints: every code path through BaseClient.sendMessage(), including api/server/controllers/assistants/chatV1.js:289 and chatV2.js:162
From LibreChat-AI/LibreChat's security advisory. Shortened; the full text is there.

Affected software

SoftwareAffected versions
LibreChatServers and applications · github:librechat-ai/librechat
  • Every version before 0.8.8

About LibreChat

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

From its GitHub repository.
Docker Hub pulls
669,094Docker Hub, 15 Nov 2026
GitHub stars
47,138GitHub, 15 Nov 2026
Forks
9,706GitHub, 15 Nov 2026
License
MITGitHub
First published on GitHub
12 Feb 2023GitHub

References