Executive Summary
A critical authentication bypass vulnerability (CVE-2026-18248, CVSS 9.1) has been disclosed in @fastify/aws-lambda version 6.4.0 — the official adapter for running Fastify web applications on AWS Lambda. The vulnerability allows remote attackers to spoof AWS API Gateway authorizer claims, bypassing authorization decisions in any Fastify application that relies on request.awsLambda.event for access control.
Any serverless application on AWS Lambda using this adapter for authorization decisions is potentially vulnerable to unauthenticated access and privilege escalation.
Vulnerability Overview
| Attribute | Value |
|---|---|
| CVE ID | CVE-2026-18248 |
| CVSS Score | 9.1 (Critical) |
| Type | Authentication Bypass / Authorization Spoofing |
| Attack Vector | Network (no prior authentication required) |
| Privileges Required | None |
| User Interaction | None |
| Affected Package | @fastify/aws-lambda 6.4.0 |
Affected Versions
| Package | Affected Version | Fixed Version |
|---|---|---|
| @fastify/aws-lambda | 6.4.0 | Check upstream for patch |
Technical Analysis
@fastify/aws-lambda decorates each incoming Fastify request with two objects:
request.awsLambda.event— the raw API Gateway event objectrequest.awsLambda.context— the Lambda execution context
The official documentation encourages developers to use request.awsLambda.event for authorization decisions — particularly for reading API Gateway authorizer claims (e.g., claims set by a Lambda Authorizer or Cognito JWT).
In version 6.4.0, the getter that populates these values can be overridden or spoofed via crafted HTTP headers. In the default configuration, an attacker can send a specially crafted request that makes the application's authorization logic read attacker-controlled values as if they were legitimate API Gateway authorizer claims.
Vulnerable Authorization Pattern (commonly documented):
const claims = request.awsLambda.event.requestContext.authorizer.claims;
if (claims.role === 'admin') {
// Allow access to admin resource
}
Attack:
1. Attacker crafts HTTP request with headers that override event properties
2. Application reads crafted headers as trusted authorizer claims
3. Authorization check passes with attacker-supplied role/group values
4. Attacker gains unauthorized access to protected resourcesImpact Assessment
| Impact | Description |
|---|---|
| Authentication Bypass | Bypass Lambda Authorizer and Cognito checks |
| Privilege Escalation | Claim admin or elevated roles without valid credentials |
| Data Exfiltration | Access protected API resources and underlying data |
| Account Takeover | Impersonate any user by spoofing identity claims |
| Compliance Violation | Unauthorized access to regulated data (PII, PHI, PCI) |
Affected Patterns
Applications are vulnerable if they:
- Use
@fastify/aws-lambda6.4.0 as their Lambda adapter - Read authorization data from
request.awsLambda.event(e.g.,requestContext.authorizer.claims) - Make access control decisions based on these values
// VULNERABLE: Reading claims from event without validation
app.get('/admin', async (req, reply) => {
const claims = req.awsLambda.event.requestContext.authorizer.claims;
if (!claims || claims['cognito:groups'] !== 'Admins') {
return reply.status(403).send({ error: 'Forbidden' });
}
// ... admin logic
});Remediation
Step 1: Update @fastify/aws-lambda
# Check current version
npm list @fastify/aws-lambda
# Update to patched version (check npm for latest)
npm update @fastify/aws-lambda
# Or install specific patched version
npm install @fastify/aws-lambda@latestStep 2: Verify Your Authorization Logic
Audit all Fastify routes that read from request.awsLambda.event for authorization:
# Find vulnerable patterns in your codebase
grep -r "awsLambda.event" src/ --include="*.ts" --include="*.js"
grep -r "requestContext.authorizer" src/ --include="*.ts" --include="*.js"Step 3: Implement Defense-in-Depth Authorization
Until patched, add explicit header validation or use Cognito JWT verification directly:
import { createVerifier } from 'fast-jwt';
// Verify the JWT token directly instead of trusting event claims
app.addHook('preHandler', async (request, reply) => {
const token = request.headers.authorization?.replace('Bearer ', '');
if (!token) {
return reply.status(401).send({ error: 'Unauthorized' });
}
try {
const verify = createVerifier({ key: process.env.JWT_PUBLIC_KEY });
request.user = await verify(token);
} catch {
return reply.status(401).send({ error: 'Invalid token' });
}
});Step 4: Review API Gateway Configuration
Ensure your API Gateway configuration enforces authentication at the gateway level and does not allow requests to bypass authorizers:
- In API Gateway, verify Lambda Authorizer or Cognito Authorizer is applied to all routes
- Set Authorization to deny by default
- Enable API Gateway access logging to detect anomalous requests
Detection Indicators
| Indicator | Description |
|---|---|
Requests with unusual requestContext headers | Potential spoofing attempts |
| Access to admin/privileged endpoints without valid JWTs | Authorization bypass exploitation |
| CloudWatch Lambda logs showing unexpected claim values | Anomalous event context data |
| API Gateway access logs with 200 responses to unauthorized paths | Successful exploitation |
AWS-Specific Mitigations
// API Gateway Resource Policy — restrict to known sources
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:*:*:*",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": ["10.0.0.0/8"]
}
}
}
]
}Enable AWS WAF on your API Gateway to detect and block exploitation attempts while patches are applied.
References
- NIST NVD — CVE-2026-18248
- @fastify/aws-lambda on npm
- AWS API Gateway Lambda Authorizer Documentation