Skip to content

An educational Secure Boot and Kernel Integrity Verification system demonstrating chain of trust, kernel signing, and protection against boot-level attacks using SHA-256 and RSA-2048.

Notifications You must be signed in to change notification settings

Ayushkumar418/SecBootKIVS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Boot and Kernel Integrity Verification System

A comprehensive implementation of secure boot concepts for educational purposes, demonstrating protection against boot-level and kernel-level attacks.

License: MIT Platform Language

Overview

This project implements a Chain of Trust that verifies kernel integrity before allowing boot. It uses industry-standard cryptographic techniques (SHA-256 + RSA-2048) aligned with real-world secure boot implementations.


Problem Statement

Traditional boot processes often load the operating system kernel without strong integrity checks. If an attacker installs a rootkit/bootkit or modifies the kernel image, the system may boot a compromised OS without any warning.

This project solves the problem of unauthorized or tampered kernels being loaded during boot, by enforcing a cryptographic verification step before boot is allowed.


Objectives

  • Design an educational Secure Boot model using SHA-256 and RSA-2048
  • Verify kernel integrity before boot authorization
  • Detect and block tampered or malicious kernel images
  • Provide clear attack simulations and logs for teaching and demos
  • Offer a Kali Linux–friendly implementation for security students

Key Features

  • SHA-256 Kernel Hashing - Creates unique fingerprint of kernel image
  • RSA-2048 Digital Signatures - Authenticates kernel origin
  • Tamper Detection - Blocks modified/compromised kernels
  • Security Logging - Auditable record of all verification attempts
  • Attack Simulation - Demonstrates rootkit/bootkit detection
  • Key Revocation - Block compromised signing keys
  • Timestamp Verification - Anti-replay protection
  • Performance Benchmarks - Measure cryptographic speeds
  • Recovery Mode - Safe boot options when verification fails
  • HTML Reports - Professional test result documentation

Installation

Prerequisites

  • Operating System: Linux (tested on Kali Linux)
  • Compiler: GCC
  • Libraries: OpenSSL development libraries
  • Tools: Make, Bash

Clone from GitHub

# Clone the repository
git clone https://github.com/Ayushkumar418/SecBootKIVS.git

# Navigate to project directory
cd SecBootKIVS

Install Dependencies

Kali Linux / Debian / Ubuntu

sudo apt update
sudo apt install build-essential libssl-dev

Fedora / RHEL

sudo dnf install gcc make openssl-devel

Arch Linux

sudo pacman -S base-devel openssl

Quick Start

# 1. Build the project
make all

# 2. Generate RSA key pair
make genkeys

# 3. Run interactive demonstration
make demo

# 4. Run automated tests
make test

Project Structure

SecBootKIVS/
├── src/
│   ├── crypto/          # SHA-256 and RSA implementation
│   ├── signing/         # Kernel signing tool
│   ├── bootloader/      # Boot verification module
│   ├── logger/          # Security event logging
│   ├── security/        # Key revocation, timestamps
│   └── benchmark/       # Performance measurement
├── scripts/             # Automation scripts
├── tests/               # Test suite and attack simulations
├── grub/                # GRUB integration configuration
├── keys/                # Generated cryptographic keys
├── reports/             # Generated HTML reports
├── docs/                # Additional documentation
└── Makefile

Available Commands

Command Description
make all Build all components
make clean Remove build artifacts
make genkeys Generate RSA key pair
make demo Run interactive demonstration
make test Run automated test suite (12 tests)
make attack Run attack simulation (6 attacks)
make benchmark Run performance benchmarks
make report Generate HTML test report
make recovery Start recovery mode
make help Show all available commands

Usage Examples

Sign a Kernel

./bin/kernel_signer sign /path/to/vmlinuz keys/private_key.pem vmlinuz.sig

Verify a Kernel

./bin/boot_verifier /path/to/vmlinuz vmlinuz.sig keys/public_key.pem

Generate HTML Report

make report
# Opens reports/test_report.html

Security Model

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Private Key   │───>│  Sign Kernel    │───>│   Signature     │
│  (Keep Secret!) │    │  (SHA-256+RSA)  │    │   (.sig file)   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                                       │
        ┌──────────────────────────────────────────────┘
        v
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Public Key    │───>│ Verify Kernel   │───>│  Boot Decision  │
│   (In Loader)   │    │  (At Boot)      │    │  Allow/Deny     │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Documentation


Limitations

  • This is a simulation, not a full UEFI Secure Boot implementation
  • The boot verification runs in user space, not in firmware
  • It does not use a hardware root of trust (TPM, HSM, Secure Element)
  • Private key storage is file-based, not hardware-protected
  • Kernel is simulated as a file, not the actual /boot/vmlinuz of the host OS

This project is meant for learning and demonstration, not for production use.


Real-World Mapping

This project models the same core ideas used in real-world Secure Boot:

  • UEFI Secure Boot

    • Firmware holds trusted public keys
    • Only signed bootloaders/kernels are executed
  • Our Project

    • keys/public_key.pem represents firmware-trusted public key
    • bin/boot_verifier represents the verification logic in firmware/bootloader
    • Signed kernel + .sig file represent trusted boot artifacts

By understanding this project, students can better understand how Secure Boot, kernel integrity, and chain of trust work on real systems.


Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is for educational purposes only. Not for production deployment.


Author

Ayush Kumar

OS Security Project - Academic Demonstration


Acknowledgments

  • OpenSSL Project for cryptographic libraries
  • UEFI Forum for Secure Boot specification reference
  • Kali Linux for testing environment

About

An educational Secure Boot and Kernel Integrity Verification system demonstrating chain of trust, kernel signing, and protection against boot-level attacks using SHA-256 and RSA-2048.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published