Organization: National Technical Research Organisation (NTRO)
A comprehensive application software that obfuscates object files generated from C and C++ code using LLVM compiler infrastructure. The tool generates highly obfuscated binaries for Windows and Linux platforms that are resistant to reverse engineering.
- Control Flow Flattening - Transforms control flow into a flat structure using switch statements
- Bogus Control Flow - Inserts fake conditional branches that are never taken
- Instruction Substitution - Replaces standard instructions with semantically equivalent complex sequences
- String Encryption - Encrypts string literals with XOR-based encryption
- Opaque Predicates - Inserts predicates that always evaluate to true/false but are hard to analyze
- Function Splitting - Splits functions into multiple basic blocks
- Obfuscation level (1-5)
- Number of obfuscation cycles
- String encryption intensity
- Bogus code insertion rate
- Control flow complexity
The tool generates detailed JSON and HTML reports containing:
- All input parameters
- Output file attributes (size, hash, timestamps)
- Obfuscation methods applied
- Amount of bogus code generated
- Number of obfuscation cycles completed
- String obfuscation statistics
- Number of fake loops inserted
- Performance metrics
- LLVM 14+ (tested with LLVM 14-17)
- CMake 3.15+
- C++17 compatible compiler (GCC 9+, Clang 10+, MSVC 2019+)
- Python 3.8+ (for reporting)
# Ubuntu/Debian
sudo apt-get install llvm-14 llvm-14-dev clang-14 cmake build-essential
# Fedora/RHEL
sudo dnf install llvm llvm-devel clang cmake gcc-c++- Install LLVM from https://releases.llvm.org/
- Install Visual Studio 2019+ with C++ tools
- Install CMake from https://cmake.org/
mkdir build
cd build
cmake ..
cmake --build . --config Release./llvm-obfuscator -i input.c -o output./llvm-obfuscator \
-i input.cpp \
-o obfuscated_output \
--level 5 \
--cycles 3 \
--string-encryption high \
--bogus-flow 0.4 \
--flatten-control-flow \
--instruction-substitution \
--report report.json| Option | Description | Default |
|---|---|---|
-i, --input |
Input source file (C/C++) | Required |
-o, --output |
Output binary name | obfuscated |
--level |
Obfuscation level (1-5) | 3 |
--cycles |
Number of obfuscation cycles | 1 |
--string-encryption |
String encryption (none/low/medium/high) | medium |
--bogus-flow |
Bogus control flow rate (0.0-1.0) | 0.3 |
--flatten-control-flow |
Enable control flow flattening | false |
--instruction-substitution |
Enable instruction substitution | false |
--fake-loops |
Number of fake loops to insert | 5 |
--report |
Report output file (JSON) | report.json |
--html-report |
Generate HTML report | false |
--target |
Target platform (linux/windows) | auto-detect |
-v, --verbose |
Verbose output | false |
./llvm-obfuscator -i hello.c -o hello_obf./llvm-obfuscator \
-i sensitive.cpp \
-o sensitive_obf \
--level 5 \
--cycles 5 \
--string-encryption high \
--bogus-flow 0.8 \
--flatten-control-flow \
--instruction-substitution \
--fake-loops 20 \
--html-report# For Windows target on Linux
./llvm-obfuscator -i app.c -o app.exe --target windows
# For Linux target
./llvm-obfuscator -i app.c -o app --target linux{
"input_parameters": {
"source_file": "input.c",
"obfuscation_level": 5,
"cycles": 3,
"string_encryption": "high"
},
"output_attributes": {
"file_name": "output",
"file_size": 45678,
"sha256": "abc123...",
"target_platform": "linux"
},
"obfuscation_statistics": {
"bogus_code_lines": 1234,
"obfuscation_cycles": 3,
"strings_encrypted": 45,
"fake_loops_inserted": 20,
"functions_obfuscated": 12
}
}llvm-obfuscator/
├── src/
│ ├── passes/ # LLVM transformation passes
│ │ ├── ControlFlowFlattening.cpp
│ │ ├── BogusControlFlow.cpp
│ │ ├── InstructionSubstitution.cpp
│ │ └── StringEncryption.cpp
│ ├── obfuscator.cpp # Main obfuscation engine
│ ├── reporter.cpp # Report generation
│ └── main.cpp # CLI interface
├── include/
│ └── obfuscator/
├── tests/
│ └── test_samples/
└── CMakeLists.txt
- The obfuscated code is designed to resist static analysis and reverse engineering
- String encryption uses runtime decryption to protect sensitive strings
- Control flow obfuscation makes decompilation significantly harder
- Multiple obfuscation cycles compound the complexity
Obfuscation level vs. performance overhead:
- Level 1-2: 5-15% overhead
- Level 3: 15-30% overhead
- Level 4-5: 30-60% overhead
- Obfuscation increases binary size (typically 2-5x)
- Runtime performance may be impacted
- Debugging obfuscated code is extremely difficult
- Some optimizations may be disabled
cd build
ctest --output-on-failureThis is a research project for NTRO. For contributions or issues, please contact the development team.
Proprietary - National Technical Research Organisation (NTRO)
Developed for NTRO Problem Statement ID 25236
- LLVM Documentation: https://llvm.org/docs/
- Code Obfuscation Techniques: https://en.wikipedia.org/wiki/Obfuscation_(software)
- LLVM Pass Writing: https://llvm.org/docs/WritingAnLLVMPass.html