{"id":31536428,"url":"https://github.com/lowlevel01/llvm-obfuscation-passes","last_synced_at":"2026-05-17T17:02:56.528Z","repository":{"id":315287614,"uuid":"1058830447","full_name":"lowlevel01/llvm-obfuscation-passes","owner":"lowlevel01","description":"Educational collection of LLVM obfuscation passes. (Feel free to use it for your course)","archived":false,"fork":false,"pushed_at":"2025-09-17T19:36:49.000Z","size":143,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-17T19:53:46.655Z","etag":null,"topics":["llvm","llvm-pass","obfuscation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lowlevel01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-17T15:53:27.000Z","updated_at":"2025-09-17T19:45:35.000Z","dependencies_parsed_at":"2025-09-17T19:54:14.634Z","dependency_job_id":"ac0958b3-5dea-4ffc-ab70-45e550e073df","html_url":"https://github.com/lowlevel01/llvm-obfuscation-passes","commit_stats":null,"previous_names":["lowlevel01/llvm-obfuscation-passes"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lowlevel01/llvm-obfuscation-passes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowlevel01%2Fllvm-obfuscation-passes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowlevel01%2Fllvm-obfuscation-passes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowlevel01%2Fllvm-obfuscation-passes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowlevel01%2Fllvm-obfuscation-passes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lowlevel01","download_url":"https://codeload.github.com/lowlevel01/llvm-obfuscation-passes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lowlevel01%2Fllvm-obfuscation-passes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278279327,"owners_count":25960679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["llvm","llvm-pass","obfuscation"],"created_at":"2025-10-04T07:16:25.119Z","updated_at":"2026-05-17T17:02:56.522Z","avatar_url":"https://github.com/lowlevel01.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# llvm-obfuscation-passes\nEducational collection of LLVM 17+ obfuscation passes. (Feel free to use it for your course)\n\nNOTE: I used the skeleton and modified build system from https://github.com/sampsyo/llvm-pass-skeleton/\n\n## Implemented Obfuscation Passes\n\n### Mixed Boolean-Arithmetic (MBA) Transformations\n\n| Pass | Description | Mathematical Identity |\n|------|-------------|----------------------|\n| **MBA_Add_Sub** | Obfuscates addition and subtraction using XOR/AND operations | `x + y → (x ⊕ y) + (x ∧ y) \u003c\u003c 1` \u003cbr\u003e `x - y → x + (-y)` |\n\n### String Obfuscation\n| Pass | Description | Technique |\n|------|-------------|-----------|\n| **String_Xor** | Obfuscates string literals using XOR encryption | Encrypts strings at compile-time, decrypts at runtime using external function |\n\n### Control Flow Flattening\n| Pass | Description | Technique |\n|------|-------------|-----------|\n| **CFF** | Flattens control flow using switch-based dispatcher | Converts all branches to a centralized switch statement that dispatches to basic blocks based on a state variable |\n## Build Instructions\n```bash\n# Clone the repository\ngit clone https://github.com/your-username/llvm-obfuscation-passes.git\ncd llvm-obfuscation-passes\n\n# Build the passes\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j$(nproc)\n```\n\n## Usage Examples\n\n### MBA Obfuscation\n```bash\n# Navigate back to project root\ncd ..\n\n# Apply MBA obfuscation to your C code\nclang -fpass-plugin=build/passes/mba_add_sub/MBA_Add_Sub_Pass.so \\\n      examples/mba_Add_Sub/mba_add_sub.c -o examples/mba_Add_Sub/mba_add_sub_obfuscated\n\n# View the obfuscated IR\nclang -fpass-plugin=build/passes/mba_add_sub/MBA_Add_Sub_Pass.so \\\n      -S -emit-llvm examples/mba_Add_Sub/mba_add_sub.c -o examples/mba_Add_Sub/mba_add_sub_obfuscated.ll\n\n# Compare original vs obfuscated\nclang -S -emit-llvm examples/mba_Add_Sub/mba_add_sub.c -o examples/mba_Add_Sub/mba_add_sub_original.ll\ndiff examples/mba_Add_Sub/mba_add_sub_original.ll examples/mba_Add_Sub/mba_add_sub_obfuscated.ll\n````\n### String XOR Obfuscation\n\n```bash\n# Compile the external decrypt function to object file\nclang -c external/decrypt_string_xor.c -o external/decrypt_string_xor.o\n\n# Apply string XOR obfuscation and compile to object file\nclang -fpass-plugin=build/passes/string_xor/String_Xor_Pass.so \\\n      -c examples/StringXor/string_xor.c -o examples/StringXor/string_xor_obfuscated.o\n\n# Link both object files to create the final executable\nclang examples/StringXor/string_xor_obfuscated.o external/decrypt_string_xor.o \\\n      -o examples/StringXor/string_xor_obfuscated\n\n# View the obfuscated IR\nclang -fpass-plugin=build/passes/string_xor/String_Xor_Pass.so \\\n      -S -emit-llvm examples/StringXor/string_xor.c -o examples/StringXor/string_xor_obfuscated.ll\n\n# Compare original vs obfuscated\nclang -S -emit-llvm examples/StringXor/string_xor.c -o examples/StringXor/string_xor_original.ll\ndiff examples/StringXor/string_xor_original.ll examples/StringXor/string_xor_obfuscated.ll\n```\n### Control Flow Flattening\n```bash\n# Navigate back to project root\ncd ..\n\n# Apply Control Flow flattening to your C code\nclang -fpass-plugin=build/passes/cff/CFF_Pass.so \\\n      examples/CFF/cff.c -o examples/CFF/cffed\n\n# View the obfuscated IR\nclang -fpass-plugin=build/passes/cff/CFF_Pass.so \\\n      -S -emit-llvm examples/CFF/cff.c -o examples/CFF/cffed.ll\n\n# Compare original vs obfuscated\nclang -S -emit-llvm examples/CFF/cff.c -o examples/CFF/normal.ll\ndiff examples/CFF/normal.ll examples/CFF/cffed.ll\n````\n![CFF](images/cff_example.png)\n\n## Development\n\n### Adding New Passes\n\n1. Create a new directory under `passes/your_pass_name/`.  \n2. Add your pass implementation in `passes/your_pass_name/YourPass.cpp`.  \n3. Create `passes/your_pass_name/CMakeLists.txt` following the existing pattern (in the other passes).  \n4. Add the subdirectory to `passes/CMakeLists.txt`.  \n5. Create test cases in `examples/`.  \n6. Update this `README.md` to document the new pass.\n\n## Contributing\n\nContributions are welcome! Please feel free to:\n\n- Add new obfuscation passes\n- Improve existing implementations  \n- Add test cases and examples\n- Fix bugs or improve documentation\n- Suggest new features\n\n## Disclaimer\n\nThis software is intended for educational and research purposes only. Users are responsible for ensuring compliance with applicable laws and regulations when using obfuscation techniques.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowlevel01%2Fllvm-obfuscation-passes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flowlevel01%2Fllvm-obfuscation-passes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flowlevel01%2Fllvm-obfuscation-passes/lists"}