Back to list
gmh5225

llvm-obfuscation

by gmh5225

awesome llvm security [Welcome to PR]

775🍴 95📅 Jan 22, 2026

SKILL.md


name: llvm-obfuscation description: Expertise in LLVM-based code obfuscation techniques including OLLVM, control flow flattening, string encryption, virtualization, and anti-analysis methods. Use this skill when working on code protection, anti-reverse engineering, or implementing custom obfuscation passes.

LLVM Code Obfuscation Skill

This skill provides comprehensive knowledge of LLVM-based code obfuscation frameworks and techniques for software protection and anti-reverse engineering.

Core Obfuscation Techniques

Control Flow Obfuscation

  • Control Flow Flattening (CFF): Transform structured control flow into a single dispatcher loop with state machine
  • Bogus Control Flow (BCF): Insert opaque predicates and dead code paths
  • CFG Randomization: Randomize basic block ordering and add fake edges

Data Obfuscation

  • String Encryption: Encrypt string literals at compile-time, decrypt at runtime
  • Constant Substitution: Replace constants with complex expressions
  • Variable Splitting: Split variables into multiple components

Code Transformation

  • Instruction Substitution: Replace standard instructions with equivalent complex sequences
  • MBA (Mixed Boolean-Arithmetic): Use mixed boolean-arithmetic expressions for obfuscation
  • Virtualization (VMP): Convert code into custom bytecode executed by embedded VM

Major OLLVM Frameworks

Classic OLLVM

Modern Variants

  • Hikari: Advanced features including function wrapper, anti-class-dump
  • Pluto-Obfuscator: Well-maintained with MBA, indirect branch, global encryption
  • Arkari: Modern implementation with enhanced features
  • o-mvll: Mobile-focused obfuscator for iOS/Android

Specialized Tools

  • IR VMP: GANGE666/xVMP, NiTianErXing666/SmallVmp for virtualization
  • Warbird: Microsoft's commercial obfuscation technology

Implementation Guidelines

Creating Custom LLVM Obfuscation Pass

#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"

class MyObfuscationPass : public llvm::FunctionPass {
public:
    static char ID;
    MyObfuscationPass() : FunctionPass(ID) {}
    
    bool runOnFunction(llvm::Function &F) override {
        // Implement obfuscation logic
        for (auto &BB : F) {
            for (auto &I : BB) {
                // Transform instructions
            }
        }
        return true;
    }
};

Best Practices

  1. Preserve Semantics: Ensure transformations don't break program correctness
  2. Randomization: Use seeded random number generators for reproducible builds
  3. Layered Approach: Combine multiple obfuscation techniques
  4. Performance Balance: Consider runtime overhead vs protection level
  5. Testing: Extensive testing across different inputs and platforms

Toolchain Integration

NDK Integration

  • OLLVM with Android NDK (r17-r23+)
  • Examples: android-ndk-aarch64-host-LLVM6.0-Ollvm-Armariris

Compiler Toolchains

  • ollvm-mingw: Windows cross-compilation
  • ollvm-rust: Rust toolchain integration
  • Swift integration: swift-Ollvm11

Anti-Deobfuscation Considerations

When implementing obfuscation:

  • Consider resistance to symbolic execution (SymCC, KLEE)
  • Add protection against pattern matching deobfuscators
  • Implement anti-debugging checks
  • Use dynamic dispatch to hinder static analysis

Resources

Refer to the main README.md for a comprehensive list of OLLVM implementations and related tools.

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 500以上

+10
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon