
Most breaches of modern applications do not involve exotic zero-days. They exploit an API that returns another customer's record when an identifier is changed, a bearer token copied from a compromised laptop, a dependency that was quietly backdoored, or a server tricked into fetching cloud credentials from an internal address. Each of these has a precise technical cause and a precise technical remedy.
This article examines the attack classes we encounter most often in web and mobile backends and the engineering controls we use against them, from authorisation models to post-quantum key exchange.
Security work is only effective when it is aimed. Threat modelling makes the target explicit: draw the data-flow diagram, mark every trust boundary (browser to API, API to database, service to third party), and ask systematically what can go wrong at each crossing. The STRIDE taxonomy — Spoofing, Tampering, Repudiation, Information disclosure, Denial of service and Elevation of privilege — gives that question structure, mapping respectively onto authentication, integrity, non-repudiation, confidentiality, availability and authorisation.
The output is a ranked list of threats with owners and mitigations, which turns "be secure" into concrete, testable engineering tasks. It should be revisited whenever a new trust boundary appears: a new integration, a mobile client, or a language model with access to tools.
The OWASP API Security Top 10 (2023 edition) ranks Broken Object Level Authorization first, and for good reason. The pattern is trivial: a request for /invoices/1043 is authenticated, but the server never checks that invoice 1043 belongs to the caller. Changing the number reveals another customer's data.
Authentication tells you who the caller is; authorisation must be evaluated for every object on every request. Robust designs:
Most APIs authenticate with bearer tokens, frequently JWTs. A bearer token behaves like cash: whoever holds it can spend it. That has three consequences.
First, validate JWTs strictly. Pin the expected signing algorithm on the server instead of trusting the token's own alg header. This closes both the historic "alg: none" bypass and algorithm-confusion attacks, in which an attacker signs a token with HMAC using the server's RSA public key as the shared secret and a careless verifier accepts it. Always check the issuer, audience, expiry and not-before claims, and resolve signing keys only from a trusted key set.
Second, minimise the value of a stolen token. Access tokens should live for minutes, not days. Refresh tokens should be rotated on every use, with reuse detection: if a refresh token that has already been exchanged is presented again, one of the two parties is an attacker, and the entire token family is revoked.
Third, bind tokens to their legitimate holder. With mutual TLS (RFC 8705) a token is bound to a client certificate. With DPoP (RFC 9449) the client generates a key pair, the token is bound to the thumbprint of the public key, and every request carries a freshly signed proof covering the HTTP method, the URL and a timestamp. A token exfiltrated from logs or a compromised proxy is useless without the private key, which can be kept non-extractable in the browser's WebCrypto store or the device's secure enclave.
For browser applications, the Backend-for-Frontend pattern goes one step further: tokens never reach JavaScript at all. A server-side component holds them, and the browser receives only an HttpOnly, Secure, SameSite session cookie, which removes token theft through cross-site scripting from the threat model entirely.
When passwords must be stored, use a memory-hard key-derivation function. OWASP currently recommends Argon2id with a minimum of 19 MiB of memory, two iterations and a parallelism of one. Memory hardness matters because it makes large-scale GPU and ASIC cracking proportionally more expensive: an attacker cannot simply trade memory for more parallel cores.
Application secrets and sensitive fields are best protected by envelope encryption. Each record or object is encrypted with its own data encryption key (DEK); the DEK is in turn encrypted by a key encryption key (KEK) that never leaves a hardware security module or cloud KMS. Rotating the KEK requires only re-wrapping the DEKs, not re-encrypting the data, and every decryption becomes an auditable event.
The cipher mode matters too. AES-GCM, the most widely used authenticated cipher, fails catastrophically if a nonce is ever reused under the same key: an attacker can recover the XOR of the two plaintexts and the internal authentication key, which allows forged messages. With random 96-bit nonces, NIST SP 800-38D limits a single key to about 2³² encryptions. High-volume systems should rotate keys well before that point or use a nonce-misuse-resistant mode such as AES-GCM-SIV.
Any feature that fetches a URL on a user's behalf — webhooks, link previews, image import, PDF rendering — can be abused to make the server request internal addresses. The most damaging target is the cloud instance metadata service at 169.254.169.254, which can hand out temporary credentials for the server's cloud role. This technique was at the core of the 2019 Capital One breach.
Mitigations are layered. Resolve the hostname, validate the resulting IP address against an allow-list that excludes private, loopback and link-local ranges, and connect to exactly that address to avoid DNS-rebinding races. Disable redirects or re-validate every hop. Run fetchers in an isolated network segment with no route to internal services. On AWS, enforce IMDSv2, whose session-token handshake defeats most simple SSRF payloads.
A modern application ships with hundreds or thousands of transitive dependencies, each an implicit trust relationship. The xz-utils backdoor discovered in March 2024 (CVE-2024-3094) showed how far a patient attacker will go: a maintainer identity was cultivated over roughly two years, and the malicious payload was hidden in binary test files and activated by a build script that appeared only in the release tarballs, not in the visible source repository. Its target was SSH authentication on several Linux distributions.
Defending against this requires verifiable provenance at every stage:
Cross-site scripting persists because every rendering path is a potential injection point. A strict Content Security Policy built on per-response nonces and 'strict-dynamic' — rather than on domain allow-lists, which are frequently bypassable — blocks injected scripts even when an escaping bug slips through. Trusted Types go further by making dangerous DOM sinks such as innerHTML reject plain strings, turning a whole class of DOM-based XSS into a type error caught during development.
A sufficiently large quantum computer running Shor's algorithm would break RSA and elliptic-curve cryptography, the foundation of today's key exchange and digital signatures. Such machines do not exist yet, but "harvest now, decrypt later" is already a rational strategy: record encrypted traffic today and decrypt it once the capability arrives. Data that must remain confidential for a decade or longer is therefore at risk now.
In August 2024 NIST published the first post-quantum standards: FIPS 203 (ML-KEM, derived from CRYSTALS-Kyber) for key encapsulation, and FIPS 204 (ML-DSA, from CRYSTALS-Dilithium) and FIPS 205 (SLH-DSA, from SPHINCS+) for digital signatures. Major browsers and CDNs now negotiate the hybrid key exchange X25519MLKEM768 by default. It combines classical X25519 with ML-KEM-768, so a connection remains secure as long as either algorithm holds.
The practical engineering task is cryptographic agility: an inventory of where each algorithm is used, configuration rather than code deciding which algorithm is selected, and protocols that negotiate versions. Systems built this way adopt new primitives through a configuration change; systems with algorithms hard-coded into storage formats and wire protocols face multi-year migrations.
Prevention eventually fails, so design for detection. Emit structured security events — authentication failures, authorisation denials, refresh-token reuse, privilege changes — with correlation identifiers that follow a request across services. Alert on behaviour rather than single events: a burst of 403 responses from one client is often the signature of an object-level authorisation probe in progress. Plant canary tokens — fake credentials that should never be used — in configuration files and databases; any use is an unambiguous signal of compromise.
Application security is an engineering discipline with specific failure modes and specific, well-understood controls. Per-object authorisation enforced in the data layer, short-lived sender-constrained tokens, memory-hard password hashing and envelope encryption, verifiable software provenance, strict browser policies and cryptographic agility are not aspirational best practices — they are the concrete mechanisms that stop the attacks that actually happen. Combined with a living threat model and good telemetry, they turn security from a recurring audit finding into a property of the system.

Why most retrieval-augmented LLM systems fail after the demo, and the retrieval, ranking, evaluation and security techniques that make them dependable in the enterprise.

What really happens between a satellite signal and the dot on a phone screen, and how sensor fusion, probabilistic map matching and uncertainty-aware geofencing turn noisy fixes into reliable automated decisions.