F-2026-0001·authorization-error
Frontend trusts WebSocket balance_update events as authoritative, enabling UI balance spoofing and state desync
TL;DR
The frontend accepted balance_update WebSocket events as authoritative and updated displayed balance without validating message authenticity, session binding, or server truth. An attacker tampering with WebSocket traffic could modify newBalance and put the UI into an inconsistent state.
Severity
HIGH
Impact
HIGH
Likelihood
MEDIUM
Method
MManual review
CAT.
Complexity
LOW
Exploitability
HIGH
02Section · Description
Description
The frontend accepted balance_update WebSocket events and updated the user's displayed balance without validating that:
- The message was authentic (origin integrity).
- The update corresponded to the current authenticated user session.
- The new balance matched server truth (e.g., via a confirmatory API fetch).
A user, or an attacker with the ability to tamper with WebSocket traffic, could therefore spoof the UI balance and put the client into an inconsistent state with the backend and the on-chain vault.
Vulnerable scenario:
- Authenticate and open the app.
- Intercept a legitimate
balance_updatemessage in the WebSocket stream. - Modify
newBalance(for example, from4.238334to5000000.238334). - The UI updates immediately, showing an incorrect available balance.
03Section · Impact
Impact
- UI integrity loss: the interface can display a fabricated balance.
- State desync: the UI may enable or disable actions based on the false balance, confusing users and support staff and increasing the chance of secondary errors during swap and withdrawal flows.
04Section · Recommendation
Recommendation
Treat WebSocket messages as advisory, not authoritative.
- On
balance_update, trigger a refresh fromGET /api/user/balance(or equivalent) and update the UI using API truth only. - Validate message binding: ensure the
walletAddressmatches the authenticated wallet in the client context. - Consider including a server-side
sessionId/userIdand validating it client-side.
Fair Casino: Fixed. Zealynx: Verified.
Status
Fixed