Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

binary packer with cellular automaton obfuscation

Notifications You must be signed in to change notification settings

umpolungfish/orgaNULL

Repository files navigation

orgaNULL

CELLULAR AUTOMATON BINARY OBFUSCATOR

OrgaNULL logo

Overview β€’ Features β€’ Usage β€’ Architecture β€’ Obfuscation β€’ Testing β€’ Contributing



🎯 OVERVIEW

OrgaNULL is an advanced binary packer that leverages cellular automaton-based obfuscation combined with modern cryptographic techniques to create heavily protected executables.

πŸ“„ THE PIPELINE



OrgaNULL:

  1. LOADS the target binary and extracts its payload
  2. ENCRYPTS using ChaCha20 stream cipher with 256-bit keys
  3. OBFUSCATES with Cellular Automaton (Rule 30) masking
  4. EMBEDS pure x86-64 assembly unpacking stub
  5. OUTPUTS a heavily obfuscated, ready-to-execute binary

The core of OrgaNULL is a dual-layer protection system combining cryptographic strength with algorithmic complexity, making analysis exceptionally difficult.


πŸš€ INSTALLATION AND USAGE

PREREQUISITES

  • Python 3.7 or higher
  • GCC toolchain for assembly compilation
  • Linux system with memfd_create and fexecve support
  • LIEF library for binary manipulation
  • Cryptography library for ChaCha20

πŸ”¨ INSTALLATION

Install Python dependencies:

pip install -r requirements.txt

πŸ“ BASIC USAGE

1. PACK A BINARY

python3 organull/organull.py <input_binary> <output_packed_binary>

2. EXECUTE THE PACKED BINARY

./<output_packed_binary>

The unpacking stub automatically decrypts and executes the original binary in memory.

πŸ”§ ADVANCED OPTIONS

CUSTOM CA EVOLUTION STEPS:

python3 organull/organull.py <input_binary> <output_packed_binary> --ca-steps 200

ENABLE DEBUG STUB:

python3 organull/organull.py <input_binary> <output_packed_binary> --debug-stub

PARAMETERS:

  • --ca-steps N - Number of cellular automaton evolution steps (default: 100)
  • --debug-stub - Compile unpacking stub with debug messages

EXAMPLE:

python3 organull/organull.py ./my_binary ./my_binary_packed --ca-steps 200 --debug-stub

🐍 PYTHON API

OrgaNULL can be used as a library:

from organull import pack_binary
# Pack a binary with default settings
pack_binary("input_binary", "packed_binary")
# Pack with custom settings
pack_binary("input_binary", "packed_binary", debug_stub=True)

⚑ FEATURES

CORE CAPABILITIES

  • βœ… Dual-layer obfuscation combining crypto + CA
  • πŸ” ChaCha20 encryption with 256-bit keys
  • 🧬 Cellular Automaton masking using Rule 30
  • πŸ’Ύ In-memory execution via memfd_create/fexecve
  • πŸ›‘οΈ Anti-debugging protection with ptrace checks
  • 🎯 Position Independent Code for ASLR compatibility
  • βš™οΈ Pure assembly unpacking for maximum efficiency

PROTECTION FEATURES

  • Multi-format support: ELF and PE binaries
  • Dynamic obfuscation: Unique CA masks per block
  • Anti-analysis: Assembly-based unpacking complexity
  • No disk artifacts: Direct memory execution
  • ASLR compatible: Dynamic base address calculation
  • Configurable intensity: Adjustable CA evolution steps

πŸ—‚οΈ MODULAR ARCHITECTURE

OrgaNULL features a clean separation between high-level logic and low-level operations:

πŸ“¦ CORE COMPONENTS

Component File Purpose
Main Packer organull/organull.py CLI interface & orchestration
CA Engine organull/ca_engine.py Rule 30 cellular automaton implementation
Crypto Engine organull/crypto_engine.py ChaCha20 encryption/decryption
Unpacking Stub organull/complete_unpacking_stub.s Pure x86-64 assembly unpacker
Stub Compiler organull/compile_complete_unpacking_stub.py Assembly compilation script
API Interface organull/__init__.py Package exports and public API

🎨 ARCHITECTURE BENEFITS

πŸ”§ Maintainability Clear separation between Python and assembly
πŸ“ˆ Extensibility Easy to add new obfuscation layers
βœ… Testability Comprehensive test suite included
πŸš€ Performance Assembly stub for critical path
πŸ›‘οΈ Security Multiple protection layers

🎯 OBFUSCATION LAYERS

OrgaNULL employs a sophisticated multi-layer protection system:

LAYER 1: CHACHA20 ENCRYPTION

Click to expand encryption details
  • 256-bit encryption keys for maximum security
  • 96-bit nonces for unique encryption per block
  • Stream cipher design for efficient encryption
  • Zero-padding for proper block alignment
  • Modern cryptographic standard with proven security

LAYER 2: CELLULAR AUTOMATON MASKING

Click to expand CA details
  • Rule 30 implementation - Chaotic, pseudo-random evolution
  • Unique masks per block - Block index XORed with key material
  • Configurable evolution steps - Adjustable complexity (default: 100)
  • 32-byte block processing - Optimal for performance
  • Deterministic yet complex - Reproducible but hard to analyze

LAYER 3: ASSEMBLY UNPACKING

Click to expand assembly features
  • Pure x86-64 assembly - No high-level language overhead
  • CA evolution in assembly - Direct algorithm implementation
  • ChaCha20 decryption in assembly - Native crypto operations
  • Dynamic base address calculation - ASLR compatibility
  • Anti-debugging checks - Ptrace-based detection
  • In-memory execution - memfd_create + fexecve syscalls

ADVANCED PROTECTION TECHNIQUES

Click to expand advanced techniques

πŸ›‘οΈ ANTI-ANALYSIS

  • Ptrace-based anti-debugging - Prevents debugger attachment
  • In-memory execution - No disk artifacts for forensics
  • Assembly complexity - Difficult to analyze and reverse

πŸ”„ POSITION INDEPENDENCE

  • ASLR compatibility - Works with randomized addresses
  • Dynamic base calculation - Runtime address resolution
  • Relative addressing - Position-independent code

🎭 OBFUSCATION DEPTH

  • Dual-layer encryption - Crypto + CA masking
  • Configurable complexity - Adjustable CA evolution steps
  • Unique per-block masks - No pattern repetition

βœ… TESTING

COMPREHENSIVE TEST SUITE

Run all tests:

# Main integration test
python3 tests/run_packer_test.py
# Unit tests
python3 tests/test_ca_engine.py
python3 tests/test_crypto_engine.py
# All tests
python -m unittest discover tests/

TEST COVERAGE

  • βœ“ CA engine correctness
  • βœ“ Crypto engine functionality
  • βœ“ Assembly stub compilation
  • βœ“ End-to-end packing/unpacking
  • βœ“ Binary format compatibility

πŸ”¬ TECHNICAL IMPLEMENTATION

The obfuscation process is sophisticated yet systematic:

1️⃣ BINARY ANALYSIS

The input binary is loaded and analyzed using LIEF. The payload is extracted while preserving necessary metadata.

2️⃣ ENCRYPTION LAYER

ChaCha20 stream cipher encrypts the entire payload using a randomly generated 256-bit key and 96-bit nonce.

3️⃣ CA MASKING LAYER

Each 32-byte block of encrypted data is masked with a unique pattern generated by evolving a Rule 30 cellular automaton.

4️⃣ STUB COMPILATION

The assembly unpacking stub is compiled with embedded configuration parameters (key, nonce, CA steps, payload size).

5️⃣ BINARY INTEGRATION

The encrypted and masked payload is embedded into a new binary along with the compiled stub. The entry point is adjusted to execute the stub first.

6️⃣ RUNTIME UNPACKING

When executed, the stub:

  • Performs anti-debugging checks (ACTIVE - ptrace detection)
  • Regenerates CA masks and removes them
  • Decrypts the payload with ChaCha20
  • Creates an in-memory file descriptor
  • Executes the original binary from memory

⚠️ ANTI-DEBUGGING ACTIVE: The unpacking stub now performs ptrace-based debugger detection. If a debugger is detected, the binary exits silently with code 4, preventing runtime analysis.


⚠️ LIMITATIONS AND SECURITY CONSIDERATIONS

OrgaNULL is a powerful research tool with important considerations:

STRENGTHS

  • βœ… Strong cryptographic foundation (ChaCha20)
  • βœ… Additional CA-based obfuscation layer
  • βœ… Assembly unpacking increases analysis difficulty
  • βœ… In-memory execution avoids disk artifacts
  • βœ… Anti-debugging protections

LIMITATIONS

  • ⚠️ x86-64 Linux systems only
  • ⚠️ Not suitable for production security applications
  • ⚠️ Assembly complexity may cause compatibility issues
  • ⚠️ Significant increase in packed binary size
  • ⚠️ Requires memfd_create and fexecve support

FUTURE ROADMAP

  • πŸ”„ Multi-architecture support (ARM, x86)
  • πŸ“š Additional obfuscation techniques
  • 🎯 Enhanced anti-analysis features
  • ⚑ Optimized stub size and performance
  • πŸ§ͺ Extended compatibility testing

πŸ“‹ RECENT UPDATES

Version 1.0.1 (2026εΉ΄01月10ζ—₯)

Bug Fixes & Improvements:

  • βœ… Anti-debugging protection now ACTIVE - Enabled ptrace-based debugger detection in unpacking stub
  • βœ… Fixed duplicate code blocks in main packer module
  • βœ… Added missing cryptography dependency to requirements.txt
  • βœ… Corrected test suite key material lengths (all tests now pass)
  • βœ… Fixed import statements in integration test suite
  • βœ… Enhanced test runner with automatic executable permissions
  • βœ… Created comprehensive CLAUDE.md for AI-assisted development

Security Enhancements:

  • πŸ›‘οΈ Packed binaries now resist debugger attachment via ptrace checks
  • πŸ›‘οΈ Silent exit on debugger detection (exit code 4)
  • πŸ›‘οΈ No error messages or hints provided to reverse engineers

Testing:

  • βœ“ All unit tests passing (CA engine: 5/5, Crypto engine: functional)
  • βœ“ Integration tests verified on x86-64 Linux
  • βœ“ Assembly stub compilation tested in both debug and release modes

CONTRIBUTING

Contributions are welcome!


πŸ“„ LICENSE

OrgaNULL / OrgaNULL is available in the public domain. See UNLICENSE.md for details.



boredom, compounds, a restless mind

orgaNULL - f*ck the Hayflick Limit

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /