bliutech / mbased

MIT IEEE URTC 2024. GSET 2024. Repository for the "MBASED: Practical Simplifications of Mixed Boolean-Arithmetic Obfuscation". A Binary Ninja decompiler plugin taking ideas from compiler construction to simplify obfuscated boolean expressions.
https://github.com/bliutech/mbased/blob/main/.github/paper.pdf
MIT License
6 stars 0 forks source link

Solver: Implement z3 Simplifier #21

Closed bliutech closed 2 months ago

bliutech commented 3 months ago

We will be benchmarking two potential ways to simplify boolean statements for our solver. This first technique leverages the SMT solver, z3. The goal of this issue is to write an optimization pass for our solver to leverage which uses the z3 backend, an SMT solver.

Action Items

Here is the general flow of our pass.

# Z3MappingVisitor produces a mapping of the string representation of `Var`s to the `z3.Bool` instances
# TranslateToZ3 produces the z3 representation of the boolean expression
# `simplify` is called on the boolean expression to produced the simplified output.
# pass the string representation of the simplified output back into the `Parser` so we can return the simplified AST.

Resources

Specifically, check out the "Boolean Logic" section of this tutorial. It shows all of the relevant z3 functions and classes we will be using.