Skip to content

Ekrembrck/Computer_Arch_Project_Shadow_Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shadow Stack Security Mechanism (CFI)

This project implements a software-based Shadow Stack mechanism to ensure Control Flow Integrity (CFI) on x86-64 architectures. It protects function return addresses from buffer overflow attacks.

Project Structure

  • main.c: Binary Search implementation with attack simulation.
  • main_matrix.c: Matrix summation with nested function call tests.
  • security_layer.h/c: Core Shadow Stack logic and macros.
  • Makefile: Automated build and test script.

How to Build

To compile all versions (secured and non-secured), run:

  • ./binary_with_security : This version demonstrates how the shadow stack detects a compromised return address
  • perf stat ./binary_with_security / perf stat ./binary_no_security : To measure execution time and instruction overhead using perf
  • ./matrix_with_security : To verify shadow stack stability during nested function calls

Implementation Details

The security layer uses SHADOW_PROLOGUE() and SHADOW_EPILOGUE() macros.

Prologue: Captures the return address using __builtin_return_address(0) and stores it in an isolated shadow stack.

Epilogue: Compares the hardware stack's return address with the shadow stack copy. If a mismatch is detected (Attack), the program terminates immediately.

##Performance Summary Execution Overhead: ~30.4%

Instruction Overhead: ~2.4 instructions per function call.

Detection Rate: 100% against simulated return address manipulation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors