BinHardS - Binary Hardening Scanner
A CLI tool to inspect compiled binaries (ELF, PE, Mach-O) for security mitigations and insecure patterns.
Table of Contents
- Project Title
- Overview
- Features
- Getting Started
- Usage
- Documentation
- Contributing
- Roadmap
- Community & Support
- Security
- License
- Acknowledgments
Overview
The Binary Hardening Scanner is a developer-facing security tool designed to inspect compiled binaries for critical security mitigations and insecure coding patterns. It directly addresses the common issue of typos or omissions in compiler flags that can silently disable essential protections.
This tool helps developers and security engineers:
- Verify that security features like NX, PIE, Stack Canaries, and RELRO are enabled in their binaries.
- Identify potentially dangerous function calls (e.g.,
gets,strcpy) that could lead to vulnerabilities. - Catch missing fortified library function calls that could indicate incomplete hardening.
- Integrate security checks into CI/CD pipelines to catch build configuration errors early.
The scanner operates on the final compiled binary, making it language-agnostic and suitable for any development workflow.
Features
- Cross-Platform Support: Analyzes ELF (Linux), PE (Windows), and Mach-O (macOS) binaries
- Security Mitigation Checks:
- NX (No-eXecute) / DEP (Data Execution Prevention)
- PIE (Position Independent Executable) / ASLR (Address Space Layout Randomization)
- Stack Canaries
- RELRO (RELocation Read-Only) - for ELF binaries
- Function Analysis:
- Detects fortified library functions (
__chkvariants) - Flags potentially dangerous functions (
gets,strcpy, etc.)
- Detects fortified library functions (
- CI/CD Integration: JSON output option for easy integration into automated pipelines
- Developer-Friendly Output: Clear, colorized terminal output with detailed notes
- Language Agnostic: Works with binaries compiled from any programming language
Getting Started
Prerequisites
- Rust (toolchain for building)
- For testing with compiled binaries: GCC/Clang (Linux), Visual Studio (Windows), Xcode (macOS)
Installation
From Source
The binary will be available at target/release/binhards.
Using Cargo
Running
After building:
# Analyze a binary
# Get JSON output for CI/CD
# Verbose output
Usage
Basic Analysis
# Analyze a Linux ELF binary
# Analyze a Windows PE binary (on Windows or with Wine)
# Analyze a macOS Mach-O binary (on macOS)
CI/CD Integration
# In a CI script, fail if critical mitigations are missing
if ! | ; then
fi
Example Output
BinHardS Scanner Report
File: /bin/ls
Format: ELF
Security Mitigations:
NX (No-eXecute): ENABLED
Note: Stack is marked as non-executable
PIE (Position Independent Executable): ENABLED
Note: Binary is position independent (PIE enabled)
Stack Canary: ENABLED
Note: Stack canaries detected: __stack_chk_fail
RELRO (RELocation Read-Only): FULL
Note: Full RELRO: GOT is read-only after relocation
Fortified Functions:
Fortified functions detected: 5
Unprotected functions detected: 0
Documentation
Detailed documentation is available in the project repository:
For information on how security mitigations work, see:
Contributing
We welcome contributions from the community!
Development Setup
- Install Rust toolchain
- Clone the repository
- Run tests:
cargo test - Build:
cargo build - Run:
cargo run -- /path/to/binary
Please open an issue first to discuss significant changes.
Roadmap
Planned enhancements:
- Enhanced PE analysis for additional Windows security features (Control Flow Guard, etc.)
- Improved Mach-O fat binary handling for multi-architecture analysis
- Plugin system for custom checks
- Performance optimizations for large binary analysis
- Integration with popular CI/CD platforms (GitHub Actions, GitLab CI, etc.)
See GitHub Issues for current development tasks and enhancements.
Community & Support
- Discussions: GitHub Discussions
- Issues: GitHub Issues
- For general questions, please use GitHub Discussions
Security
We take security seriously. If you discover a security vulnerability within this project, please follow our Security Policy to report it responsibly.
- Please report security issues to:
hello@ibrahimstudio.com - SECURITY.md
License
This project is licensed under the MIT License.