HabrSeptember 11, 2026🇷🇺Translated from Russian

API Token Lifecycle: From Issuance to Revocation and Secure Management

The security of API tokens extends far beyond cryptographic signatures. Even a properly signed token using a strong algorithm can be stolen and abused because the signature only prevents modification, not theft. Once an attacker obtains a valid access token, the server typically cannot distinguish the legitimate user from the attacker presenting the stolen credentials.

Stage 1: Token Issuance

Security begins at creation. Public clients such as single-page applications and mobile apps must use the Authorization Code Flow with PKCE rather than legacy implicit flows. PKCE binds the authorization request to a client-generated code_verifier, preventing an attacker who intercepts only the authorization code from completing the exchange. Confidential backend services should use the client_credentials grant with short-lived tokens and regularly rotated secrets stored in dedicated secret-management systems.

Access tokens for browser applications should expire within 5 to 15 minutes. Refresh tokens may live longer, supporting sliding sessions with an absolute maximum lifetime to force re-authentication. Endpoints such as /login, /token, and /oauth/authorize require strict rate limiting that considers account identifiers, device signals, and IP ranges, not just single addresses. Confidential clients can further strengthen authentication by presenting short-lived signed JWT assertions instead of static client secrets.

Stage 2: Client-Side Storage

Storing tokens in localStorage or sessionStorage exposes them to any JavaScript running on the page, including code injected through XSS, compromised npm packages, or supply-chain attacks. HttpOnly cookies marked Secure and SameSite=Lax significantly reduce direct token extraction. The Backend-for-Frontend (BFF) pattern offers even stronger protection by keeping OAuth tokens on the server; the browser receives only an opaque session identifier stored in an HttpOnly cookie. Session data can be maintained in Redis or another secure backend store, enabling centralized rotation, revocation, and monitoring.

Stage 3: Transmission and Usage

Bearer tokens are commonly sent in the Authorization header and require TLS. Cookie-based authentication simplifies client code but necessitates additional CSRF defenses such as synchronizer tokens or strict Origin/Referer validation. Sensitive operations should combine multiple layers rather than relying on any single browser flag.

By following short-lived tokens, atomic refresh-token rotation, HttpOnly cookies or BFF architecture, and comprehensive revocation capabilities, applications can substantially limit the impact of token compromise.

Related articles

HabrVulnerabilities & Exploits

Fuzzy Logic in Cybersecurity: Reducing Vulnerability Queue by 7.5 Times with CVSS, EPSS and FSTEC Comparison

An information security specialist has developed a fuzzy logic system that prioritizes vulnerabilities far more effectively than traditional scoring methods. The approach uses linguistic variables and membership functions to handle the inherent uncertainty in exploitability and impact assessments. By integrating EPSS probability data with CVSS impact scores and vulnerability age, the model reduces the actionable backlog by a factor of 7.5. The implementation relies on the Mamdani inference algorithm and trapezoidal membership functions to produce smooth, human-interpretable urgency ratings. Detailed coverage checks and rule-base validation ensure no gaps exist in the decision space. Real-world testing on CVE-2025-49113 in Roundcube Webmail demonstrated practical advantages over rigid threshold logic. The method is positioned as a practical enhancement rather than a replacement for existing standards.

AntiMalwareVulnerabilities & Exploits

VLC Media Player Hit by Two Memory Corruption Flaws Exploitable via Malicious PNG and Rogue RealRTSP Server

Two vulnerabilities have been discovered in the VLC media player that allow out-of-bounds memory access. The issues affect versions from 3.0.0 through 3.0.23. CVE-2026-56711, rated 8.6 on CVSS 4.0, stems from an integer overflow when calculating image buffer sizes in PNG files, enabling attackers to trigger writes beyond allocated memory simply by opening a crafted image or loading it from a playlist. CVE-2026-73324, scored 6.9, resides in the RealRTSP module and permits a malicious server to send an oversized response string that causes reads past the end of a buffer due to a missing null terminator. Both flaws are present in official VideoLAN builds, although some distributions may exclude the RealRTSP component. No special configuration or plugins are required to trigger the issues. Until patched releases appear, users are advised to avoid opening images or playlists from untrusted sources and to refrain from connecting to unknown RealRTSP streams.

AntiMalwareVulnerabilities & Exploits

September Windows 11 Security Update KB5124008 Breaks Always On VPN Certificate Authentication

The September security update KB5124008 for Windows 11 has introduced a regression that disables Always On VPN connections using certificate-based authentication. The issue affects devices running Windows 11 versions 24H2 and 25H2 that connect to Remote Routing and Access Service (RRAS) and Network Policy Server (NPS) instances on Windows Server 2019. VPN profiles deployed via Microsoft Intune are impacted, with the failure occurring during the certificate negotiation phase of the IPsec connection. Users confirm the problem is reproducible: the VPN works before the patch, stops after installation, and resumes after patch removal and reboot. Microsoft has not yet acknowledged the regression or released a fix, leaving administrators to pause deployment through WSUS or Intune and open support cases with client and NPS logs. A potential workaround involves switching profiles to EAP-TLS, though its reliability remains unconfirmed.

SecuritylabVulnerabilities & Exploits

PKCE Becomes Mandatory for OAuth Public Clients as RFC 9700 and OAuth 2.1 Close Authorization Code Interception Risks

PKCE, or Proof Key for Code Exchange, was introduced in RFC 7636 to prevent code interception attacks in OAuth 2.0 flows used by mobile and single-page applications. The mechanism generates a code_verifier and derives a code_challenge using S256 hashing to bind the authorization code to the original client session. Without PKCE, malicious apps on the same device can hijack custom URI schemes like myapp://callback and exchange stolen codes for access tokens. RFC 9700, published in January 2025, now mandates PKCE for public clients and recommends it for confidential ones while requiring S256 over the weaker plain method. The upcoming OAuth 2.1 draft further embeds PKCE into the core authorization code flow and removes implicit and resource owner password credentials grants. Major providers including Auth0, Okta, and Microsoft Entra ID show varying default support, highlighting the need for explicit S256 implementation. The standard also protects against code injection attacks even when client secrets are present.