Oct 9, 2026·6 min read·18 visits
A type-confusion vulnerability in fast-jwt prior to 6.3.0 allows validly signed tokens structured as JSON arrays to completely bypass claim validations such as expiration (exp) and issuer (iss) verification.
A high-severity type-confusion vulnerability exists in NearForm fast-jwt prior to version 6.3.0. The vulnerability allows attackers to bypass crucial claim validation steps (such as expiration, issuer, audience, and subject validations) by presenting a validly signed JSON Web Token structured as a JSON array instead of a JSON object. This occurs because the library's decoder fails to reject JSON arrays during type evaluation.
The fast-jwt library is an optimized, high-performance JSON Web Token (JWT) implementation developed by NearForm for the Node.js ecosystem. In production environments, systems leverage this library to handle high-throughput authentication and authorization processes. Because token validation is the primary barrier protecting restricted backend services, any flaw in the verification logic exposes the entire application context to unauthorized access.
The vulnerability, designated as CVE-2026-107723, represents a severe flaw categorized under CWE-1287 (Improper Validation of Specified Type of Input). Specifically, the library's decoder fails to enforce that a JWT payload must be a JSON object, accepting JSON arrays instead. This structural discrepancy introduces type confusion downstream during the security verification phase.
When an attacker provides a validly signed JWT with an array payload, the token successfully passes signature verification. However, the system silently bypasses all subsequent safety checks, including expiration, issuer, and audience validations. Consequently, the application processes the unvalidated payload as authenticated, leading to complete security control bypasses.
The underlying flaw stems from a fundamental quirk in JavaScript's type evaluation model combined with a structural standard mismatch. RFC 7519 explicitly mandates that the JWT Claims Set must be a JSON object. However, JavaScript’s typeof operator evaluates arrays as objects, meaning that typeof [] evaluates to 'object'. Because the initial parser did not explicitly reject array-shaped payloads, they successfully satisfied the type check and advanced into the verification lifecycle.
Once the array payload enters the verifier module, the claim validation loop begins evaluating standard configuration limits. The verifier checks whether specific claims exist in the payload using the JavaScript in operator. While this operator checks for keys inside standard objects, its behavior on arrays is fundamentally different.
When executed against an array, the in operator checks if the specified string matches either a numeric index or a built-in array property. Because security claims such as 'exp', 'nbf', 'iss', or 'aud' are strings and do not map to numeric indexes, expressions like 'exp' in payload consistently evaluate to false. The validation loop interprets this false result as the absence of the claim, causing the library to silently skip the security check and successfully approve the token.
To understand the vulnerability, it is necessary to examine the original implementation of the validation logic within the parser module. In vulnerable versions of fast-jwt, the validation statement was designed to reject non-object payloads. However, due to the type evaluation quirk, the validation successfully executed without raising an error when a JSON array was submitted.
// Vulnerable code in src/decoder.js
if (!payload || typeof payload !== 'object') {
throw new TokenError(TokenError.codes.invalidPayload, 'The payload must be an object', { payload })
}The official security patch introduced in commit 86e83efd8b5244f50859532d99244f0a9a9a4368 resolves this logic gap by appending an explicit check for arrays. By combining the typeof check with Array.isArray(), the library safely blocks arrays from entering the verifier stage.
// Patched code in src/decoder.js
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
throw new TokenError(TokenError.codes.invalidPayload, 'The payload must be an object', { payload })
}This explicit check ensures that array-shaped structures are safely rejected during the decoding stage before any signature or claim verification takes place. This modification restricts the allowed payloads strictly to valid JSON objects, aligning the library with the specifications of RFC 7519.
Exploiting this vulnerability requires that an attacker present a validly signed token containing a JSON array payload. In typical environments, an attacker might obtain this by exploiting an endpoint that signs user-controlled JSON or by leveraging key-compromise or algorithm-confusion scenarios. For instance, if symmetric validation is incorrectly enabled alongside asymmetric public keys, an attacker can sign the token locally using the server's public key.
The attacker structures the JWT Claims Set as a serialized JSON array instead of a JSON object. This array is then encoded using standard Base64url and appended with a signature generated via the appropriate cryptographic algorithm. When the target server receives this token, the fast-jwt library successfully verifies the signature but silently ignores all security-critical checks like expiration dates.
A functional proof-of-concept script illustrates how a forged array-payload token successfully bypasses verification configured with strict issuer and audience controls:
const { createHmac } = require('node:crypto');
const { createVerifier } = require('fast-jwt');
function forgeArrayPayloadToken(key, payload = ['attacker', 'role:admin']) {
const header = Buffer.from(JSON.stringify({ alg: 'HS256', typ: 'JWT' })).toString('base64url');
const encodedPayload = Buffer.from(JSON.stringify(payload)).toString('base64url');
const signingInput = `${header}.${encodedPayload}`;
const signature = createHmac('sha256', key).update(signingInput).digest('base64url');
return `${signingInput}.${signature}`;
}
const key = 'shared-secret';
const forgedToken = forgeArrayPayloadToken(key);
const verifier = createVerifier({
key,
allowedIss: ['legit-issuer'],
allowedAud: ['legit-audience']
});
try {
const decoded = verifier(forgedToken);
console.log('Bypass Success:', decoded);
} catch (err) {
console.log('Rejected:', err.message);
}The primary remediation step is to upgrade the fast-jwt dependency to version 6.3.0 or higher, which completely resolves the type-confusion flaw. If upgrading immediately is not possible due to dependency constraints or system freeze policies, a viable workaround is available within the library's existing API configuration.
Developers can mitigate this bypass by specifying the requiredClaims option within the createVerifier parameters. Specifying parameters such as requiredClaims: ['exp', 'iss'] forces the validation engine to explicitly assert the existence and structural validity of these keys. When an array-shaped payload is passed, the verification logic will fail the assertion and throw an error, preventing the silent bypass.
Additionally, organizations can implement a layer of defense-in-depth by employing a Web Application Firewall (WAF) rule to intercept and block array-payload JWTs. A standard JWT payload begins with a JSON object, which serializes in Base64url as ey. Conversely, a JSON array payload serializes with the starting characters Wy. A regular expression can detect and drop these invalid structures at the network perimeter.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
fast-jwt NearForm | < 6.3.0 | 6.3.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1287: Improper Validation of Specified Type of Input |
| Attack Vector | Network (AV:N) |
| CVSS Base Score | 8.1 |
| Exploit Status | Proof of Concept available |
| CISA KEV Status | Not listed |
| Remediation Status | Patched in v6.3.0 |
The software receives input that is expected to be of a specific type, but it does not validate or incorrectly validates that the input is of that type.
CVE-2026-28385 (GHSA-3gq2-x4qg-p4g6) is a Server-Side Request Forgery (SSRF) vulnerability in Canonical LXD versions 4.12 through 6.9. An authenticated user possessing the can_create_images entitlement can force the LXD daemon to execute arbitrary outbound HTTP and HTTPS requests via the /1.0/images API endpoint. Due to the absence of egress destination validation, an attacker can probe host loopback services, RFC 1918 private network segments, and cloud Instance Metadata Services (IMDS) from the network position of the privileged LXD daemon.
Canonical LXD and LXC Incus contain an arbitrary file write vulnerability (CWE-73 / CWE-59) in the `/1.0/instances/<name>/exec` REST API endpoint. When an instance is unpacked from an image archive, top-level symbolic links are extracted directly onto the host filesystem within the instance storage directory. If a crafted image includes a symbolic link named `exec-output` pointing to an arbitrary host path, invoking the execution endpoint with `record-output: true` causes the privileged host daemon to follow the symlink and write command output files directly to the target host directory. An authenticated attacker with permissions to import images and execute commands can exploit this flaw to write controlled content to sensitive host directories such as `/etc/cron.d`, resulting in arbitrary code execution on the host as `root`.
CVE-2026-48749 (tracked as GHSA-vghh-5rfx-xhq8 for LXD and GHSA-2q3f-q5pq-g8wv for Incus) is a critical container escape vulnerability in the Canonical LXD and Linux Containers Incus system container managers. By importing a specially crafted container image archive containing duplicate tar member headers, an authenticated attacker can replace the instance rootfs directory with a symbolic link pointing to the underlying host root filesystem. When performing file operations on a stopped container, the privileged forkfile helper binary resolves the symbolic link without confinement and chroots directly into the host filesystem, granting arbitrary root-level file read and write access.
GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.
A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.
CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.