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-2023-48223 — Proof-of-concept demonstrating JWT algorithm confusion in fast-jwt library. Includes vulnerable server, token forging script, and verification fix for security education. | Kitploit
Tools/GitHubGitHub/lucastran05/cve-2023-48223
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & EducationLabs & Practice
GitHublucastran05/cve-2023-48223

CVE-2023-48223

Proof-of-concept demonstrating JWT algorithm confusion in fast-jwt library. Includes vulnerable server, token forging script, and verification fix for security education.

View Repository
485 months agoNot yet reviewed

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-2023-48223 PoC (fast-jwt Algorithm Confusion)

This repository demonstrates JWT algorithm confusion in fast-jwt when token verification does not lock allowed algorithms.

Environment Setup

Requirements

  • Node.js 18 or newer
  • npm
  • OpenSSL (must be available in your terminal PATH)

1) Install dependencies

From the project root, run:

root@kitploit:~
npm install

2) Generate RSA keys

The app expects these files:

  • keys/private.pem
  • keys/public.pem

Run one of the following command sets.

PowerShell (Windows):

root@kitploit:~
New-Item -ItemType Directory -Path keys -Force | Out-Null
openssl genrsa -out keys/private.pem 2048
openssl rsa -in keys/private.pem -RSAPublicKey_out -out keys/public.pem

Linux/macOS/Git Bash:

root@kitploit:~
mkdir -p keys
openssl genrsa -out keys/private.pem 2048
openssl rsa -in keys/private.pem -RSAPublicKey_out -out keys/public.pem

3) Start the server

root@kitploit:~
node server.js

Expected output:

root@kitploit:~
Server running at http://localhost:3000

Quick Run (PoC Flow)

1) Get a normal token

root@kitploit:~
curl http://localhost:3000/generateToken

2) Forge an admin token

root@kitploit:~
node sign.js

Copy the printed token.

3) Call the admin endpoint with the forged token

root@kitploit:~
node checkAdmin.js <JWT_TOKEN>

If the attack succeeds, the response contains Welcome Admin!.

Why This Is Vulnerable

In server.js, the verifier does not restrict algorithms:

root@kitploit:~
const verifySync = createVerifier({
  key: publicKey,
});

Without an algorithm allowlist, the server may accept a malicious HS256 token signed using the public key as HMAC secret.

Giai Thich Cach Mo Phong Thu Vien Bi Loi (de dua vao bao cao)

Trong cac demo CVE cua nhom, doi tuong bi loi la thu vien (khong the tu chay doc lap). Vi vay can dung mot ung dung gia lap de mo phong cach he thong thuc te goi API cua thu vien do. O repo nay, file server.js la lop ung dung mo phong.

  • Endpoint /generateToken: route nay goi createSigner cua fast-jwt voi RS256 de tao token hop le cho user thuong (admin=false). Muc dich la tao baseline token “binh thuong” de so sanh voi token gia mao.
  • Endpoint /admin: route nay nhan Bearer token, sau do goi createVerifier tu fast-jwt de verify token va quyet dinh quyen admin theo payload.admin. Diem co y dung ban vulnerable nam o cho verifier khong khoa algorithms, dan den algorithm confusion.

Code flow PoC bo tro:

  • sign.js: mo phong attacker goi createSigner voi HS256 va dung public key lam secret de ky token gia (admin=true).
  • checkAdmin.js: gui request toi /admin voi forged token de chung minh server chap nhan token gia trong cau hinh vulnerable.

Tom lai, nhom khong viet lai ham cua thu vien. Nhom chi dung API goc cua thu vien bi loi (createSigner, createVerifier) ben trong app gia lap de tai hien dung boi canh khai thac.

Fix

Restrict verification to RS256:

root@kitploit:~
const verifySync = createVerifier({
  key: publicKey,
  algorithms: ["RS256"],
});

Safety Note

This project is for security learning in a controlled lab environment only.

Download Tool