Skip to content

Repository files navigation

İstinye Üniversitesi

🛡️ CipherNone: JWT "alg: none" Vulnerability & Hardening Lab

Security CI Semgrep npm audit

🇹🇷 Türkçe | 🇬🇧 English

👤 Proje Bilgileri

Öğrenci Efe Sidal
Danışman Hoca Keyvan Arasteh
Üniversite İstinye Üniversitesi
Bölüm Bilişim Güvenliği Teknolojisi
Ders Güvenli Web Yazılımı Geliştirme

🇹🇷 Türkçe

CipherNone, modern web mimarilerinde (REST API'ler) sıkça karşılaşılan kritik bir kimlik doğrulama zafiyetini (JWT Signature Bypass) uygulamalı olarak gösteren bir AppSec (Uygulama Güvenliği) laboratuvarıdır.

Bu projede saldırgan, JWT'nin header kısmındaki algoritmayı alg: none olarak değiştirip imza kısmını boş bırakarak yetki atlatma (Authentication Bypass) yapar. Proje, hem bu zafiyetin sömürülmesini (Exploitation) hem de mimari düzeyde nasıl yamalanacağını (Hardening) kanıtlarıyla sunar.

🚀 Proje İçeriği

  • vulnerable_api.js (Kurban): Kasıtlı olarak "alg: none" kontrolünü yapmayan, imzasız token'ları kabul eden delik deşik bir Node.js API (Port: 3000).
  • exploit.js (Silah): Herhangi bir kütüphane kullanmadan, tamamen sıfırdan sahte bir Base64Url JWT üreten ve kurban API'ye "Admin" yetkisiyle sızan saldırı scripti.
  • secure_api.js (Zırh): Zero-Trust prensibiyle yazılmış, sadece HS256 algoritmasını kabul eden ve sahte token'ları anında reddeden yamalı (Hardened) API (Port: 3001).

🛡️ Gelişmiş Güvenlik Özellikleri (Advanced Security Features)

  • Unit Tests: Jest ve Supertest ile otomatik güvenlik doğrulama testleri entegre edildi.
  • Rate Limiting: express-rate-limit ile Brute-Force saldırılarına karşı koruma katmanı eklendi.
  • HTTPS/TLS: Tüm trafik Self-Signed SSL sertifikası ile uçtan uca şifrelendi.

🎬 Demo

Projenin çalışma anını, exploit sürecini ve güvenli API'nin saldırıyı engellediğini aşağıdaki videodan izleyebilirsiniz:

Demo Video

📊 Test Kapsamı

Projede JWT güvenlik mekanizmalarını doğrulamak için Jest + Supertest ile 4 adet otomatik test yazıldı.

  • ✅ Geçerli HS256 admin token ile /admin erişimi
  • ✅ alg: none saldırısının tespiti ve engellenmesi
  • ✅ Algorithm Confusion (RS256 alg + HS256 imza) saldırısının engellenmesi
  • ✅ User rolü ile admin erişiminin reddedilmesi

Security Test 1 Security Test 2 Security Test 3 Security Test 4 - Jest Summary

🎬 Demo (İnteraktif Galeri)

CipherNone laboratuvarının tüm özelliklerini, zafiyetli API üzerindeki alg:none saldırısını ve RS256 hardening savunmasını adım adım inceleyebileceğiniz interaktif galeriye aşağıdan ulaşabilirsiniz.

CipherNone Dashboard Preview


🚀 Başlangıç (Getting Started)

📦 Kurulum (Installation)

git clone https://github.com/EfeSidal/GuvenliWebYazilimiGelistirme-CipherNone-.git
cd GuvenliWebYazilimiGelistirme-CipherNone-
npm install

🛠 Kullanım (PoC)

1. Zafiyetli Sunucuyu Başlatın:

node src/vulnerable_api.js

2. Silahı Ateşleyin (Saldırı Aşaması):

node src/exploit.js

3. Güvenli Sunucuyu Test Edin (Savunma Aşaması):

node src/secure_api.js

İstinye Üniversitesi

👤 Project Info

Student Efe Sidal
Instructor Keyvan Arasteh
University Istinye University
Department Information Security Technology
Course Secure Web Software Development

🇬🇧 English

CipherNone is an AppSec (Application Security) laboratory that practically demonstrates a critical authentication vulnerability commonly found in modern web architectures (REST APIs): the JWT Signature Bypass.

🚀 Project Contents

  • vulnerable_api.js (The Victim): An intentionally flawed Node.js API that fails to check for "alg: none" and accepts unsigned tokens.
  • exploit.js (The Weapon): An attack script that generates a forged Base64Url JWT entirely from scratch, bypassing the victim API.
  • secure_api.js (The Armor): A hardened API built on Zero-Trust principles that strictly enforces the RS256 algorithm.

🎬 Demo

Watch the video below to see how the project worked, the exploit process, and how the secure API prevented the attack:

Demo Video

📊 Test Coverage

  • ✅ Accessing /admin with a valid HS256 admin token
  • ✅ Detection and prevention of the alg: none attack
  • ✅ Prevention of the Algorithm Confusion attack
  • ✅ Rejection of admin access with the User role

Security Test Coverage

🎬 Demo (Interactive Gallery)

Explore all CipherNone features, including the alg:none exploit on the vulnerable API and RS256 hardening defense, through our frame-by-frame interactive gallery.

CipherNone Dashboard Preview


🚀 Getting Started

📦 Installation

npm install

🛠 Usage (PoC)

1. Start the Vulnerable Server: node src/vulnerable_api.js 2. Fire the Weapon: node src/exploit.js 3. Test the Secure Server: node src/secure_api.js


📜 Governance & Links

(Change the port in exploit.js to 3001 and attack again. Result: 403 Forbidden - Attack Blocked!)

About

A practical AppSec laboratory demonstrating the JWT 'alg: none' signature bypass vulnerability, complete with exploitation and hardening scripts in Node.js.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages