From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Technique:Recognizing code obfuscation" |
|---|
| claim | "O-LLVM bogus control flow (opt pass name -boguscf, clang -mllvm -bcf) guards a cloned block with an always-true condition (an fcmp true); after each obfuscated function, doF (called from runOnFunction, not once per module) rewrites every conditional branch on FCMP_TRUE in the whole module as the opaque predicate y < 10 || x*(x-1)%2 == 0, loading two 32-bit common-linkage globals x and y initialised to 0. Because doF creates a fresh pair of globals each time it runs, a module with several obfuscated functions ends up with several pairs named x, y, then uniquified (x.1, y.1 ...), not one shared pair. The source comment writes x*(x+1), the code builds x - 1; both products are even. Defaults: bcf_prob 30 percent, bcf_loop 1; the pass does nothing (prints an error) if bcf_prob is not in 1..100 or bcf_loop <= 0, and it runs only on functions selected by -bcf or the bcf annotation." |
|---|
| scope | | level | "tool" |
|---|
| applies_to | "Obfuscator-LLVM" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "-bcf or annotation bcf; options -bcf_prob, -bcf_loop" |
|---|
| effect | "cloned basic block never executed; predicate always true" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "llvm-4.0 branch head; read defaultObfRate=30, defaultObfTime=1, FCMP_TRUE condition, predicate comment in doFinalization" |
|---|
| repo | "https://github.com/obfuscator-llvm/obfuscator" |
|---|
| commit | "42f732c274e7cf9d7ddf2097bfc181de7587147e" |
|---|
| path | "lib/Transforms/Obfuscation/BogusControlFlow.cpp" |
|---|
|
| type | "source" |
|---|
| detail | "Read runOnFunction (option checks, toObfuscate) and doF: Sub(x,1), Mul(x, x-1), URem 2, ICMP_EQ 0, ICMP_SLT y 10, Or." |
|---|
| repo | "https://github.com/obfuscator-llvm/obfuscator" |
|---|
| commit | "42f732c274e7cf9d7ddf2097bfc181de7587147e" |
|---|
| path | "lib/Transforms/Obfuscation/BogusControlFlow.cpp" |
|---|
| lines | "107-170, 500-575" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "O-LLVM bogus control flow predicate" |
|---|
| topic | "Technique:Recognizing code obfuscation/Native obfuscation patterns" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T13:53:07.754Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:48:13.406Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read BogusControlFlow.cpp at 42f732c: defaults 30/1, option checks in runOnFunction, bogus(F) then doF(*F.getParent()) per obfuscated function, doF creating CommonLinkage i32 globals x and y each call and rewriting every FCMP_TRUE conditional branch as (x*(x-1))%2==0 OR y<10." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:48:46.934Z" |
|---|
| summary | "The code emits x*(x-1)%2 == 0 (Sub), the header comment says x+1; both are always true. Also bcf_prob outside 1..100 or bcf_loop <= 0 aborts the pass. Read BogusControlFlow runOnFunction and doF." |
|---|
| changed | |
|---|
|
| by | "PatientStepper99" |
|---|
| date | "2026-10-19T07:35:53.002Z" |
|---|
| summary | "doF is called inside runOnFunction for every obfuscated function and creates a NEW pair of globals x and y each time (LLVM uniquifies the names), and each call rewrites all FCMP_TRUE conditional…" |
|---|
| changed | |
|---|
|
|
|---|