Vulnerability DatabaseCVE-2026-137656

CVE-2026-137656: 
Chainguard vulnerability analysis and mitigation

Overview

CVE-2026-137656 is a race condition vulnerability in LibreChat's checkBalance middleware that allows authenticated users to obtain multiple auto-refill token credits by sending concurrent requests. Affecting LibreChat versions 0.7.8 through 0.8.8-rc2 (fixed in 0.8.9), the flaw enables K simultaneous chat requests to each pass the same stale lastRefill eligibility check and receive K × refillAmount credits from a single refill window. It was published on November 26, 2026, with a patch released November 17, 2026. The CVSS v3.1 base score is 3.1 (Low), and the CVSS v4.0 base score is 2.3 (Low) (GitHub Advisory, LibreChat Advisory).

Technical details

The root cause is CWE-362 (Race Condition / Concurrent Execution using Shared Resource with Improper Synchronization), with a secondary weakness of CWE-841 (Improper Enforcement of Behavioral Workflow). In the vulnerable code (packages/api/src/middleware/checkBalance.ts, lines 113–140), the auto-refill eligibility check reads lastRefill from the balance record without holding a lock. The updateBalance compare-and-swap (CAS) operation in createAutoRefillTransaction is keyed only on tokenCredits, not on lastRefill, so its retry loop re-reads and re-adds refillAmount for each concurrent request that passed the eligibility gate. An attacker with a depleted balance can fire K simultaneous POST requests to /api/ask/openAI during an open refill window; each request independently reads the same stale lastRefill, passes the eligibility check, and calls createAutoRefillTransaction, resulting in K × refillAmount credits being added instead of one (LibreChat Advisory, Vulnerable Code).

Impact

Successful exploitation allows any authenticated user to inflate their token credit balance far beyond the configured refillAmount per interval, effectively bypassing the platform's token credit limits. In deployments where token credits map directly to monetary cost (e.g., API usage billed to the operator), this constitutes a financial integrity violation. There is no confidentiality or availability impact; the harm is limited to integrity of the credit accounting system (LibreChat Advisory, GitHub Advisory).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at the time of disclosure. The vulnerability requires a valid authenticated session and the target instance must have autoRefillEnabled: true with an elapsed refill interval and a near-zero balance — conditions that limit opportunistic exploitation. The EPSS score is 0.0, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. The advisory includes a detailed PoC script demonstrating the attack, attributed to reporter HarshKumar09 (LibreChat Advisory, GitHub Advisory).

Exploitation steps

  1. Authenticate: Obtain a valid JWT bearer token for a LibreChat account on a target instance running version 0.7.8–0.8.8-rc2.
  2. Confirm preconditions: Verify that autoRefillEnabled is true, the refill interval has elapsed, and the account balance is near zero (e.g., curl -s http://<host>/api/balance -H "Authorization: Bearer $TOKEN" returns a low tokenCredits value).
  3. Fire concurrent requests: Send K simultaneous POST requests to the chat endpoint within the same refill eligibility window, before any single request can update lastRefill:
for i in $(seq 1 10); do
  curl -s -o /dev/null -X POST http://<host>/api/ask/openAI \
    -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
    --data '{"text":"hi","endpoint":"openAI","model":"gpt-4o"}' &
done; wait
  1. Observe multiplied credits: Each concurrent request independently passes the lastRefill eligibility check and calls createAutoRefillTransaction, crediting refillAmount per request. With K=10 and refillAmount=10000, the balance becomes ~100,000 instead of ~10,000.
  2. Verify: Re-query the balance endpoint to confirm the inflated credit total (LibreChat Advisory).

Indicators of compromise

  • Network: Burst of simultaneous POST requests to /api/ask/openAI (or other chat endpoints) from the same authenticated user within a very short time window (milliseconds apart).
  • Logs: Multiple createAutoRefillTransaction log entries for the same user within a single refill interval; repeated [Balance.check] debug log entries showing the same stale lastRefill value across concurrent requests.
  • Application Behavior: User tokenCredits balance significantly exceeding the configured refillAmount after a single refill interval (e.g., balance = N × refillAmount where N > 1); rapid successive credit refill events in transaction logs for a single user.

Mitigation and workarounds

Upgrade LibreChat to version 0.8.9 or later, which replaces the vulnerable createAutoRefillTransaction flow with an atomic reserveBalance / releaseBalanceReservation mechanism that fences on tokenCredits, reservations, and lastRefill in a single compare-and-swap write, ensuring one refill window credits exactly once. The fix is delivered via commits 696bcb6c1e (credit reservation) and 0fea0240d6 (balance reset without rollover). As a temporary workaround, disabling autoRefillEnabled in the LibreChat configuration eliminates the vulnerable code path until an upgrade is possible. Monitoring for anomalous rapid credit refills from individual users can help detect exploitation attempts (LibreChat Release, Fix Commit 1, Fix Commit 2).

Community reactions

The vulnerability was reported by security researcher HarshKumar09 and accepted by the LibreChat maintainer (danny-avila), who assessed it as medium severity and prioritized a fix. The maintainer's audit note confirms the fix atomically fences on lastRefill, balance, reservation, and policy values before applying credits, addressing the stale-window race. No significant broader media coverage or notable community commentary beyond the GitHub advisory has been identified (LibreChat Advisory).

Additional resources


Source: This report was generated using AI

Related Chainguard vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-137490HIGH8.7
  • Chainguard logoChainguard
  • surrealdb
NoYesNov 26, 2026
CVE-2026-137588HIGH7.1
  • Chainguard logoChainguard
  • cpe:2.3:a:librechat:librechat
NoYesNov 26, 2026
CVE-2026-137489MEDIUM5.3
  • Chainguard logoChainguard
  • surrealdb
NoYesNov 26, 2026
CVE-2026-137488MEDIUM5.3
  • Chainguard logoChainguard
  • surrealdb
NoYesNov 26, 2026
CVE-2026-137656LOW2.3
  • Chainguard logoChainguard
  • librechat
NoYesNov 26, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management