### Example SLLVM Configuration Source: https://github.com/lich4/sllvm/blob/main/README.md A typical SLLVM configuration file demonstrating global settings, policy map definitions, and policy application for module and function levels. ```json { "log_level": "info", "policy_map": { "mod_pol": { "dump": ["ir"], }, "func_pol": { "enable_ce": true, "ce_size_min": 5, "ce_size_max": 128, "ce_algo": 0 } }, "policies": [ { "desc": "Module-level policy", "module": ".*", "policy": "mod_pol" }, { "desc": "Function-level policy", "module": ".*", "func": ".*", "policy": "func_pol" } ] } ``` -------------------------------- ### Full Layered Policy Example Source: https://context7.com/lich4/sllvm/llms.txt This comprehensive JSON demonstrates layered policy inheritance and combination for multiple obfuscation passes. It includes module-level and function-level policies with IR dumping. ```json { "log_level": "debug", "src_root": "./src", "policy_map": { "base_mod": { "dump": ["ir"], "enable_std": false }, "base_func": { "enable_ibr": true, "ibr_prob": 100, "ibr_use_igv": true, "enable_icall": true, "enable_igv": true, "igv_use_dyn": true }, "heavy": { "base": "base_func", "enable_ce": true, "ce_algo": 100, "ce_mode_stack": true, "ce_size_min": 3, "ce_size_max": 512, "enable_fla": true, "fla_prob": 100, "fla_force_reg": true, "fla_use_igv": true, "fla_use_dyn": true, "enable_bcf": true, "bcf_prob": 80, "bcf_use_var": true, "enable_ecf": true, "ecf_prob": 80, "enable_split": true, "split_maxsize": 6, "enable_sec": true, "sec_ad_prob": 70 }, "medium": { "base": "base_func", "enable_fla": true, "fla_prob": 60, "enable_bcf": true, "bcf_prob": 50, "enable_sec": true, "sec_ad_prob": 30 } }, "policies": [ { "desc": "Module defaults", "module": ".*", "policy": "base_mod" }, { "desc": "Heavy obfuscation for crypto/auth/payment code", "module": ".*(crypto|auth|payment|license).*", ``` ```json "func": ".*", "policy": "heavy" }, { "desc": "Medium obfuscation for business logic", "module": ".*(model|service|controller).*", ``` ```json "func": ".*", "policy": "medium" } ] } ``` -------------------------------- ### BCF Source Example Source: https://context7.com/lich4/sllvm/llms.txt Shows a C function before Bogus Control Flow obfuscation. The result involves always-false branches that insert fake basic blocks referencing junk code. ```c // Source int main(int argc, char** argv) { if (argc == 1) { printf("no args\n"); } else { printf("%d args\n", argc - 1); } return 0; } // Result: always-false branches insert fake basic blocks referencing junk code. // BCF constant mode: uses invariant global values for the predicate. // BCF variable mode (bcf_use_var=true): uses mutable variable expressions — // cannot be defeated by marking data segments read-only in IDA Pro. ``` -------------------------------- ### C Code Example for Instruction Splitting Source: https://context7.com/lich4/sllvm/llms.txt This C code demonstrates two cooperating functions. After applying instruction splitting, their instructions will be fragmented, making disassembly difficult. ```c // Source — two cooperating functions void test(int argc) { if (argc <= 0) printf("not possible\n"); else if (argc == 1) printf("no arg\n"); else printf("%d args\n", argc - 1); } int main(int argc, const char** argv) { if (argc <= 0) printf("not possible\n"); else if (argc == 1) printf("no arg\n"); else if (argc == 2) printf("1 arg\n"); else printf("%d args\n", argc - 1); return 0; } // Result: instructions from `test` and `main` are split into chunks // of up to `split_maxsize` instructions and relocated to random addresses. // Disassemblers cannot identify contiguous function bodies. ``` -------------------------------- ### C Calling Convention Obfuscation Showcase Source: https://github.com/lich4/sllvm/blob/main/README.md Demonstrates a C function and its main entry point for testing calling convention obfuscation. This example is used to illustrate the effects of randomized register usage for parameters and return values. ```c static int test(int a0, int a1, int a2, int a3, int a4) { printf("a0=%d\n", a0); printf("a1=%d\n", a1); printf("a2=%d\n", a2); printf("a3=%d\n", a3); printf("a4=%d\n", a4); return a0 + a1 + a2 + a3 + a4; } int main(int argc, char** argv) { test(argv[0][0], argv[0][1], argv[0][2], argv[0][3], argv[0][4]); return 0; } ``` -------------------------------- ### FLA Flattened Function Example Source: https://context7.com/lich4/sllvm/llms.txt Illustrates a C function before and after Control Flow Flattening. The result shows basic blocks dispatched through a central switch-case loop, obscuring the original control flow. ```c // Source — branching function flattened by FLA int main(int argc, char** argv) { if (argc <= 0) { printf("not possible\n"); } else if (argc == 1) { printf("no args\n"); } else { printf("%d args\n", argc - 1); } return 0; } // Result: all basic blocks are dispatched through a central switch-case loop. // State variable is obfuscated; decompiler cannot recover the original if/else chain. ``` -------------------------------- ### C System Call Obfuscation Showcase Source: https://github.com/lich4/sllvm/blob/main/README.md Illustrates system call obfuscation by converting standard system calls into direct SVC instructions. This example shows the usage of the `access` system call and prints its return value. ```c int main(int argc, char** argv) { int r = access("/tmp/1.txt", 0); printf("r=%d\n", r); return 0; } ``` -------------------------------- ### Example C code with encrypted string Source: https://context7.com/lich4/sllvm/llms.txt This C code demonstrates a string literal that will be encrypted at compile time by SLLVM's Constant Encryption (CE) feature. No source code modifications are required. ```c // Source code — no modifications required int main(int argc, char** argv) { printf("hello sllvm\n"); // This string is encrypted at compile time return 0; } // After CE (static area mode): string bytes in binary are ciphertext; // decryption stub inserted at function prologue, plaintext written to static area. // After CE (ce_mode_stack=true): decrypted bytes placed on the stack, // static area never contains plaintext. ``` -------------------------------- ### C Instruction Splitting Showcase Source: https://github.com/lich4/sllvm/blob/main/README.md Demonstrates instruction splitting by scattering a function's instructions across random addresses. This example includes two functions, `test` and `main`, to showcase the obfuscation on different code segments. ```c void test(int argc) { if (argc <= 0) { printf("not possible\n"); } else if (argc == 1) { printf("no arg\n"); } else { printf("%d args\n", argc - 1); } } int main(int argc, const char** argv) { if (argc <= 0) { printf("not possible\n"); } else if (argc == 1) { printf("no arg\n"); } else if (argc == 2) { printf("1 arg\n"); } else { printf("%d args\n", argc - 1); } return 0; } ``` -------------------------------- ### Example C Code for FCC Obfuscation Source: https://context7.com/lich4/sllvm/llms.txt This C code demonstrates a function with five integer parameters. When compiled with FCC obfuscation, the arguments will be passed via arbitrary registers instead of the standard ABI registers. ```c // Source — five integer parameters via standard ABI (X0–X4) static int test(int a0, int a1, int a2, int a3, int a4) { return a0 + a1 + a2 + a3 + a4; } int main(int argc, char** argv) { test(argv[0][0], argv[0][1], argv[0][2], argv[0][3], argv[0][4]); return 0; } // Result: arguments passed via arbitrary registers, e.g., X8, X1, X6, D26, D2, X15. // fcc_type=0 → only X0–X8 // fcc_type=1 → only integer registers // fcc_type=2 → only floating-point registers // fcc_type=10 → any available register ``` -------------------------------- ### Example C Code for SVC System Call Obfuscation Source: https://context7.com/lich4/sllvm/llms.txt This C code shows a standard libc call to `access`. When compiled with SVC obfuscation, this call is replaced with an inline SVC instruction, bypassing standard system call mechanisms. ```c // Source — standard libc call int main(int argc, char** argv) { int r = access("/tmp/1.txt", 0); printf("r=%d\n", r); return 0; } // Result: `access()` call is replaced with an inline SVC instruction // with the correct ARM64 syscall number, bypassing PLT stubs and // dynamic linker-level API monitoring. ``` -------------------------------- ### Basic C Program for String Encryption Showcase Source: https://github.com/lich4/sllvm/blob/main/README.md This C code snippet demonstrates a simple program structure used to showcase string encryption capabilities. It includes standard library functions for output. ```c int main(int argc, char** argv) { printf("hello sllvm\n"); return 0; } ``` -------------------------------- ### Configure Instruction Splitting Policy Source: https://context7.com/lich4/sllvm/llms.txt This JSON defines a policy for instruction splitting, specifying maximum chunk size. It's used to configure the obfuscation behavior. ```json { "policy_map": { "split_pol": { "enable_split": true, "split_maxsize": 8 } }, "policies": [ { "desc": "Split instructions in critical functions", "module": ".*critical.*", "func": ".*", "policy": "split_pol" } ] } ``` -------------------------------- ### Configure Security Protection (Anti-Debugging) Policy Source: https://context7.com/lich4/sllvm/llms.txt This JSON policy enables anti-debugging logic injection into targeted functions. It controls the probability of insertion and allows custom LLVM IR for tailored detection. ```json { "policy_map": { "sec_pol": { "enable_sec": true, "sec_ad_prob": 60, "sec_usr_ir": true } }, "policies": [ { "desc": "Inject anti-debugging into all functions", "module": ".*", "func": ".*", "policy": "sec_pol" } ] } ``` -------------------------------- ### Configure SVC System Call Obfuscation (JSON) Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables SVC (Supervisor Call) system call obfuscation, including the injection of custom LLVM IR for hardening. This policy targets file I/O related modules. ```json { "policy_map": { "svc_pol": { "enable_svc": true, "svc_usr_ir": true } }, "policies": [ { "desc": "Replace syscalls in file I/O functions", "module": ".*io.*", "func": ".*", "policy": "svc_pol" } ] } ``` -------------------------------- ### Configure ECF Policy Source: https://context7.com/lich4/sllvm/llms.txt Enables Novel Control Flow with specific parameters. This strategy introduces non-standard control transfers to defeat symbolic execution engines. ```json { "policy_map": { "ecf_pol": { "enable_ecf": true, "ecf_prob": 100 } }, "policies": [ { "desc": "Apply novel control flow to high-value targets", "module": ".*(license|validate).*", ``` -------------------------------- ### Configure BCF Policy Source: https://context7.com/lich4/sllvm/llms.txt Enables Bogus Control Flow with specific parameters. Use this to insert opaque predicates and dead code paths into the control flow graph. ```json { "policy_map": { "bcf_pol": { "enable_bcf": true, "bcf_prob": 80, "bcf_complex": 3, "bcf_use_var": true } }, "policies": [ { "desc": "Add bogus control flow to all functions", "module": ".*", "func": ".*", "policy": "bcf_pol" } ] } ``` -------------------------------- ### C Program for Control Flow Flattening Showcase Source: https://github.com/lich4/sllvm/blob/main/README.md This C code demonstrates conditional logic, which is useful for illustrating control flow flattening. It handles different argument counts. ```c int main(int argc, char** argv) { if (argc <= 0) { printf("not possible\n"); } else if (argc == 1) { printf("no args\n"); } else { printf("%d args\n", argc - 1); } return 0; } ``` -------------------------------- ### Configure FW Policy Source: https://context7.com/lich4/sllvm/llms.txt Enables Function Wrapping with specific parameters. This technique wraps direct sub-function calls with additional nesting layers to defeat inlining-based recovery. ```json { "policy_map": { "fw_pol": { "enable_fw": true, "fw_loop_min": 2, "fw_loop_max": 5, "fw_exclude": ["malloc", "free", "printf"] } }, "policies": [ { "desc": "Wrap calls in the payment module", "module": ".*payment.*", "func": ".*", "policy": "fw_pol" } ] } ``` -------------------------------- ### SLLVM Configuration: sllvm.json Source: https://context7.com/lich4/sllvm/llms.txt The central configuration file for SLLVM. It uses a policy_map to define named obfuscation profiles and a policies array to bind those profiles to matching modules and functions via regular expressions. ```json { "log_level": "info", "src_root": "/path/to/project/src", "policy_map": { "default_mod": { "dump": ["ir", "asm"], "enable_std": false }, "sensitive_func": { "base": "default_mod", "enable_ce": true, "ce_size_min": 4, "ce_size_max": 256, "ce_algo": 100, "ce_mode_stack": true, "enable_fla": true, "fla_prob": 80, "fla_force_reg": true, "fla_use_igv": true, "fla_use_dyn": true, "enable_bcf": true, "bcf_prob": 70, "bcf_use_var": true, "enable_ibr": true, "ibr_prob": 100, "ibr_use_igv": true, "ibr_use_dyn": true, "enable_icall": true, "icall_use_igv": true, "enable_sec": true, "sec_ad_prob": 50 }, "light_func": { "enable_fla": true, "fla_prob": 50, "enable_bcf": true, "bcf_prob": 40 } }, "policies": [ { "desc": "Apply module defaults to all files", "module": ".*", "policy": "default_mod" }, { "desc": "Heavy obfuscation for crypto and auth functions", "module": ".*(crypto|auth|login).*", "func": ".*", "policy": "sensitive_func" }, { "desc": "Light obfuscation for utility functions", "module": ".*(utils|helpers).*", "func": ".*", "policy": "light_func" } ] } ``` -------------------------------- ### Configure FLA Policy Source: https://context7.com/lich4/sllvm/llms.txt Enables Control Flow Flattening with specific parameters. Use this to transform a function's basic-block graph into a switch-case dispatcher loop. ```json { "policy_map": { "fla_pol": { "enable_fla": true, "fla_prob": 100, "fla_force_reg": true, "fla_use_igv": true, "fla_use_dyn": true, "fla_use_rcf": true, "fla_blk_size": 3, "fla_invoke_op": 1 } }, "policies": [ { "desc": "Flatten all functions in the core module", "module": ".*core.*", "func": ".*", "policy": "fla_pol" } ] } ``` -------------------------------- ### Configure IBR Indirect Branch Obfuscation (JSON) Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables IBR (Indirect Branch) obfuscation, setting the probability to 100%% and enabling both encrypted jump targets (igv) and dynamic target derivation. This policy is applied to security-sensitive modules. ```json { "policy_map": { "ibr_pol": { "enable_ibr": true, "ibr_prob": 100, "ibr_use_igv": true, "ibr_use_dyn": true } }, "policies": [ { "desc": "Indirect all branches in security-sensitive code", "module": ".*(security|protect).*", "func": ".*", "policy": "ibr_pol" } ] } ``` -------------------------------- ### Configure ICALL Indirect Call Obfuscation (JSON) Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables ICALL (Indirect Call) obfuscation, using indirect global variables and dynamic target derivation. This policy is intended for application layer modules. ```json { "policy_map": { "icall_pol": { "enable_icall": true, "icall_use_igv": true, "icall_use_dyn": true } }, "policies": [ { "desc": "Indirect all calls in the application layer", "module": ".*app.*", "func": ".*", "policy": "icall_pol" } ] } ``` -------------------------------- ### Configure IGV Indirect Global Variable Access (JSON) Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables IGV (Indirect Global Variable) obfuscation, with dynamic computation of the indirection pointer. This policy is applied globally to all modules and functions. ```json { "policy_map": { "igv_pol": { "enable_igv": true, "igv_use_dyn": true } }, "policies": [ { "desc": "Indirect all global references", "module": ".*", "func": ".*", "policy": "igv_pol" } ] } ``` -------------------------------- ### Configure Function Inlining Policy Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables function inlining for all direct callees of a target function. This is used to flatten the call graph. ```json { "policy_map": { "inline_pol": { "enable_inline": true } }, "policies": [ { "desc": "Inline all callees in the validation logic", "module": ".*validate.*", "func": ".*", "policy": "inline_pol" } ] } ``` -------------------------------- ### Configure FCC Calling Convention Obfuscation (JSON) Source: https://context7.com/lich4/sllvm/llms.txt This JSON configuration enables FCC (Function Calling Convention) obfuscation, specifying the number of custom conventions and registers to use. Apply this policy to randomize calling conventions across the entire module. ```json { "policy_map": { "fcc_mod_pol": { "enable_fcc": true, "fcc_num": 8, "fcc_type": 10, "fcc_narg_reg": 6 } }, "policies": [ { "desc": "Randomize calling conventions for the whole module", "module": ".*", "policy": "fcc_mod_pol" } ] } ``` -------------------------------- ### CE — String Encryption Configuration Source: https://context7.com/lich4/sllvm/llms.txt Configuration for Constant Encryption (CE) which encrypts string literals at compile time. Supports various algorithms and modes for enhanced security. ```json { "policy_map": { "string_pol": { "enable_ce": true, "ce_size_min": 5, "ce_size_max": 128, "ce_algo": 0, "ce_mode_stack": true } }, "policies": [ { "desc": "Encrypt all strings in the network module", "module": ".*network.*", "func": ".*", "policy": "string_pol" } ] } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.