Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-4444-JWT-Algorithm-Confusion-via-kid-Injection — POC for CVE-2026-4444 demonstrating JWT algorithm confusion via untrusted kid injection, including vulnerable Node.js server and Python exploit for token forgery and privilege escalation. | Kitploit
Tools/GitHubGitHub/george0papasotiriou/cve-2026-4444-jwt-algorithm-confusion-via-kid-injection
Authentication & AuthorizationExploitationWeb Application ExploitationCryptographyLearning & EducationAPI SecurityLabs & Practice
GitHubgeorge0papasotiriou/cve-2026-4444-jwt-algorithm-confusion-via-kid-injection

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-4444-JWT-Algorithm-Confusion-via-kid-Injection

POC for CVE-2026-4444 demonstrating JWT algorithm confusion via untrusted kid injection, including vulnerable Node.js server and Python exploit for token forgery and privilege escalation.

View Repository
41 month agoNot yet reviewed

CVE-2026-4444 – JWT Algorithm Confusion via kid Injection

Program Code (Node.js server + Python exploit)

root@kitploit:~
// jwt_server.js - Vulnerable JWT verification server
const express = require('express');
const jwt = require('jsonwebtoken');
const jwksClient = require('jwks-rsa');
const axios = require('axios');

const app = express();
app.use(express.json());

// Normally fetches public key from a JWKS endpoint, but vulnerable kid handling
async function getPublicKey(kid) {
    // Attacker can inject a kid that points to their own URL
    if (kid.startsWith('http://') || kid.startsWith('https://')) {
        // Fetch the key from attacker-controlled URL (INSECURE!)
        const response = await axios.get(kid);
        return response.data.publicKey; // expects PEM
    }
    // Otherwise use local JWKS (simulated)
    return `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCYZM5rPY4
...
-----END PUBLIC KEY-----`;
}

app.post('/api/verify', async (req, res) => {
    const token = req.body.token;
    const decoded = jwt.decode(token, { complete: true });
    const kid = decoded.header.kid;
    try {
        const publicKey = await getPublicKey(kid);
        const payload = jwt.verify(token, publicKey, { algorithms: ['RS256','HS256'] });
        res.json({ status: 'authenticated', user: payload.sub });
    } catch (e) {
        res.status(401).json({ error: e.message });
    }
});

app.listen(3000, () => console.log('JWT server on :3000'));

CVE-2026-4444 – JWT Algorithm Confusion via kid Injection

Severity: Critical

Overview

A JWT verification service blindly trusts the kid header to locate the public key, allowing an attacker to supply a URL pointing to their own key. This leads to full token forgery and privilege escalation.

Vulnerability Details

  • Type: JWT Algorithm Confusion / SSRF
  • Impact: Unauthorized access, administrator impersonation.
  • Root Cause: The server fetches a public key from a user‑controlled kid URI without validating that it belongs to a trusted origin.

Exploit Demonstration

  1. Start the vulnerable server:
    root@kitploit:~
    node jwt_server.js
    
  2. Run the exploit (which also launches a fake key server):
    root@kitploit:~
    python exploit_jwt_kid.py
    
Download Tool