Résumé
JWT algorithm confusion is an authentication-bypass class affecting servers that trust the attacker-controlled 'alg' field in a token's header to choose how the signature is verified, mapping to OWASP API2:2023 Broken Authentication. When a library exposes a single algorithm-agnostic verify call, setting alg to 'none' makes it accept a token with an empty signature and skip verification entirely, as Tim McLean documented across multiple libraries in a 2015 Auth0-coordinated disclosure. In the RS256-to-HS256 variant, a server expecting asymmetric RS256 passes its RSA public key to verify, but an attacker flips the header to HS256 so the library reuses that same public key as the HMAC secret; because the public key is not secret, the attacker can forge and HMAC-sign an arbitrary admin payload that validates. CVE-2015-9235 (CVSS 9.8) captured exactly this in node jsonwebtoken before 4.2.2, where a token signed with an HS-family algorithm was accepted in place of one expected to use an RS/ES asymmetric key. PortSwigger's Web Security Academy documents both the 'none' and RS256/HS256 confusion techniques as practical authentication-bypass labs.
Comment l’éviter dans votre code
- Pin the expected signing algorithm server-side and explicitly reject 'none' and any mismatched alg.
- Verify with the correct key type only; never let an RSA public key be used as an HMAC secret.
- Pass an allowlist of algorithms to the verify call rather than trusting the token's alg header.
- Validate iss/aud/exp and bind the token to a server-side session.
- Upgrade to patched libraries (jsonwebtoken >= 4.2.2) and prefer asymmetric-only verification paths.
Références
Vulnérabilités liées
Tout AppSec →- CRITICALAPPSEC-NOAUTH-2023
nOAuth, disclosed by Descope's security team on June 20, 2023 (reported to Microsoft on April 11, 2023), is a cross-tenant account-takeover class in multi-tenant Microsoft Entra ID (Azure AD) OAuth applications, mapping to OWASP API2:2023 Broken Authentication. The flaw existed because Entra ID emitted an 'email' claim in the OIDC token that was both mutable and unverified, while applications used that email rather than the immutable 'sub'/'oid' claim to identify and link the signed-in user. An attacker who controlled their own Entra tenant could set the email attribute of an attacker account to a victim's email address, then use 'Log in with Microsoft' against any vulnerable app; the app merged accounts by the spoofed email and granted full control of the victim's account, requiring no interaction from the victim. Descope confirmed real exposure in major SaaS apps including a design platform with millions of monthly users. Microsoft mitigated by no longer emitting unverified email claims by default for app registrations created after June 2023 and added the xms_edov claim and a RemoveUnverifiedEmailClaim flag.
- MEDIUMAPPSEC-SOURCEMAP-DISCLOSURE
A source map (.map) is a build artifact that maps minified bundle code back to the original source, and bundlers embed the full original code in its sourcesContent field. Left reachable in production or shipped inside a package, it hands anyone the unminified codebase, internal comments, hidden API endpoints, auth logic, and any secrets that were compiled in. Discovery is trivial: open DevTools and read the Sources tab, request the bundle's .map URL directly, or Google-dork for ext:map intext:webpack, then reconstruct the whole project with a tool like unwebpack-sourcemap. Passive scanners such as Acunetix and Burp already flag it as a standalone finding. It is usually rated medium on its own but escalates fast when the recovered source contains live credentials or undocumented endpoints; exposed Webpack source maps have leaked hardcoded Stripe secret keys that enabled unauthorized payments. High-profile cases include Apple's App Store web front-end in November 2025, shipped with source maps still enabled, and Anthropic's Claude Code, whose entire TypeScript source leaked via a source map left in a published npm package in March 2026.
- HIGHAPPSEC-GRAPHQL-ABUSE
GraphQL servers expose three abuse primitives stemming from the query language's flexibility. Leaving introspection enabled lets any client send a __schema query and recover the entire type system, including internal admin mutations and deprecated fields, providing a map of the attack surface (OWASP API8/API2). Because per-request rate limiters count one HTTP request regardless of operations inside it, an attacker can use field aliasing (e.g. attempt0:login(...), attempt1:login(...)) or array batching to pack dozens of login or verifyOtp mutations into a single request, brute-forcing credentials or short OTP/2FA codes while the rate limiter sees only one request; this aliasing-bypass technique is reproduced in the PortSwigger Web Security Academy 'Bypassing GraphQL brute force protections' lab and Wallarm's GraphQL batching research. Deeply nested or recursive queries cause an exponential explosion of resolver and database calls, exhausting CPU, memory and connection pools for denial of service, the core of OWASP API4:2023 Unrestricted Resource Consumption. HackerOne has disclosed a real GraphQL authentication-bypass finding, and Apollo Server v4 disabled array batching by default in response to these attacks.
- HIGHAPPSEC-RACE-TOCTOU
A business-logic race condition exploits the brief window between a check on shared state and the act that mutates it (time-of-check to time-of-use), letting concurrent requests each pass the same check before any of them commits, so a limited resource is consumed more times than allowed (OWASP API6:2023, Unrestricted Access to Sensitive Business Flows). The vulnerable code is any check-then-act sequence on shared state without atomic database-level locking: validate a single-use coupon or gift card then redeem it, check a balance then withdraw or transfer, or verify a one-per-user limit then grant. Firing many near-simultaneous requests collapses the state machine and redeems one coupon multiple times, withdraws the same balance twice, or bypasses a per-user cap. James Kettle's 'Smashing the state machine: the true potential of web race conditions' (PortSwigger, published 9 August 2023, presented at Black Hat USA and DEF CON 31) introduced the single-packet attack, which withholds the final HTTP/2 frames of 20-30 requests and releases them in one TCP packet, neutralizing network jitter and squeezing arrivals into a sub-millisecond window so the race becomes reliably exploitable.
- HIGHAPPSEC-TMOBILE-API-2023
On January 19, 2023 T-Mobile disclosed in an SEC 8-K filing that an attacker had abused a single API to obtain data on roughly 37 million current postpaid and prepaid customer accounts, with access beginning on or around November 25, 2022 and continuing about six weeks until detection on January 5, 2023 and cutoff a day later. The exposed fields included names, billing addresses, emails, phone numbers, dates of birth, account numbers, and plan features; T-Mobile stated no passwords, payment card data, Social Security numbers, or government IDs were taken. T-Mobile only stated that a bad actor obtained data through a single API without authorization, without publishing the low-level mechanism; the security-community consensus reconstruction is Broken Object Level Authorization (BOLA/IDOR), where the API returned per-customer records without verifying the caller was authorized for that specific object, letting the attacker walk through customer identifiers at scale. The mechanism maps to BOLA via a user-controlled key, or, if the endpoint lacked authorization entirely, to missing authorization.
- CRITICALAPPSEC-AUTO-API-2023
On January 3, 2023 Sam Curry and a team of researchers published Web Hackers vs. The Auto Industry, documenting critical API authorization flaws across about 16 automakers including Kia, Hyundai, Honda, Nissan, Acura, Infiniti, BMW, Ferrari, Porsche, Rolls Royce and Mercedes-Benz, plus telematics providers such as SiriusXM Connected Vehicle Services and Spireon. The connected-car APIs treated the VIN, which is visible through the windshield and effectively public, as an object identifier without verifying the caller actually owned the vehicle, a Broken Object Level Authorization flaw. Using only a target VIN, researchers could enroll a vehicle to an attacker account or bypass ownership checks and then remotely unlock, start, locate, honk, and track vehicles, achieving full account takeover. Several manufacturers also had Broken Function Level Authorization and misconfigured SSO/OTP endpoints exposing internal dealer portals. The work maps to OWASP API1:2023 (BOLA) and API5:2023 (BFLA).