When the Client Betrays the Server: Real-World Architecture Mistakes

In previous articles, we explored server-side security, covering SQL injections, authentication bypasses, automated testing, and network/port scanning. Today, we shift our focus to architectural flaws in Client-Side and API implementations.
Developers often rely on a flawed assumption: "If the browser UI does not display a button, the user cannot execute the action."
This is a fundamental mistake. The client side is an untrusted environment. Users can interact directly with APIs, modify request parameters, tamper with payloads, and communicate with backend services outside the intended user interface.
Today, we analyze two practical case studies where missing API authorization controls and improper data validation created operational and business risks.
Case 1: Coffee Chain, Unprotected WebSockets, and Order Display Manipulation
Consider a standard customer workflow at a coffee shop. You receive a receipt featuring a QR code, scan it to track your order status on a digital queue display, and open the associated web page.
In the analyzed instance, the QR code redirected to an external IP address with a non-standard port rather than a secured HTTPS domain:
http://10.0.x.x:90xx/
What was the architectural flaw?
Inspecting network traffic via DevTools → Network revealed active WebSocket connections handling real-time updates for the order board.
Further analysis identified a C#/.NET backend utilizing SignalR, a framework designed for real-time bi-directional communication.
Adjacent infrastructure services were also discovered. Some properly required authentication, establishing an appropriate security boundary.
Vulnerability Analysis (PoC)
To verify the finding safely, a test handshake request was executed to initiate a WebSocket connection:
curl -X POST "http://10.0.x.x:90xx/api/hubs/arrivalsScreen/negotiate?negotiateVersion=1"
Once connected, structured data was successfully injected into the active order array without requiring authentication.
Business Impact & Risks:
- Disruption of digital queue displays during peak hours.
- Injection of arbitrary order statuses, disrupting kitchen workflows.
- Customer confusion and operational delays.
- Potential further reconnaissance of internal network segments if network controls are misconfigured.
Case 2: Quick-Service Restaurant Chain, QR Codes, and Server-Side Validation
The second case involves a major international quick-service restaurant (QSR) chain. Receipts included a QR code designed to grant customers access to specific in-store amenities.
What was the architectural flaw?
Scanning the QR code using a standard reader revealed an unencrypted plaintext string formatted as follows:
PaymentProvider;02701587;2026.09.04 14:33:30;-16900.00;257831
The structure was straightforward to decode:
- PaymentProvider — Integration or payment gateway identifier.
- 02701587 — Terminal or POS ID.
- 2026.09.04 14:33:30 — Timestamp.
- -16900.00 — Transaction amount.
- 257831 — Receipt or transaction sequence number.
Where was the vulnerability?
The validation mechanism trusted the client-provided QR code content without verifying its authenticity against server records.
When verification relies solely on string formatting checks, arbitrary QR codes can be generated with modified parameters (e.g., altered timestamps or transaction IDs).
If similar client-trust patterns are applied to discount vouchers, loyalty programs, or order fulfillment systems, the risk escalates to direct financial losses.
Product Protection: API Security and DevSecOps Guidelines
Both cases highlight a common security anti-pattern: implicit trust in client-side data and missing server-side validation boundaries.
1. Securing APIs and WebSocket Infrastructure
Authentication and Authorization
WebSocket and HTTP endpoints must enforce strict access controls. Implement robust authentication mechanisms (JWT, OAuth2, or API Keys).
WebSocket handshake requests should be authorized only after validating active session tokens and verifying user roles (RBAC).
Network Isolation and Reverse Proxies
Direct exposure of internal IP addresses and technical ports to the public Internet must be avoided. Deploy Reverse Proxies (e.g., Nginx, Envoy) configured with TLS encryption (HTTPS/WSS).
Network Segmentation
POS terminals, public displays, camera systems, and backend services must reside in isolated network segments or VLANs.
2. Securing QR Codes and Offline Validation
Cryptographic Signatures (HMAC)
If business data must be embedded directly into a QR code, append a server-generated cryptographic signature:
Data + Secret_Key → HMAC-SHA256
Without access to the server-side secret key, unauthorized modification of the payload invalidates the signature.
Dynamic Single-Use Tokens (Server-Side Validation)
The most secure architecture avoids embedding business logic inside QR codes altogether. Instead, issue a cryptographically strong, time-bound, single-use token.
Upon scanning, the client queries the server to validate the token, mark it as consumed, and authorize the requested action.
Conclusion
Following Responsible Disclosure principles, detailed reports were submitted to the respective system administrators to facilitate timely remediation.
Embedding security controls into the initial software architecture protects organizations from operational, financial, and reputational risks.