embedded-jwk-trust-bypass-node-jose
Embedded JWK Trust Bypass (node-jose)
CVE-2018-0114 affects Cisco’s node-jose library (< 0.11) and allows attackers to forge valid JWTs by embedding their own public key (JWK) inside the JWT header.
The core issue is simple but severe:
The application blindly trusts the JWK provided inside the JWT header and uses it to verify the token signature.
This completely breaks authentication, since an attacker can:
- Generate their own RSA key pair
- Embed the public key in the JWT header (
jwk) - Sign the token with the matching private key
- The server verifies the token using the attacker-controlled key and accepts it as valid
Exploitation Strategy
High-level steps
- Generate your own RSA key pair
- Extract
nandefrom the public key - Embed them in the JWT header as
jwk - Sign the JWT with the matching private key
- Set payload to
admin=true(or equivalent) - Send forged JWT to the application
Detailed Steps
Step 1: We first Generate New RSA Key with format being JWK from burpsuite:
Step 2: Change payload to admin user, then we can use Attack > Embedded JWK feature.
Step 3: We are now logged in as admin user.