0

I am looking to do some Data Flow Analysis via code. I have already the code that parses a binary and disassembles it (x86/x64) and creates Basic Blocks.

Now what I would like to do is, for any Basic Block, analyze the effect of each instruction and compose all these effects to derive information at basic block boundaries.

Also I would like to perform Variable Tracking and Live Variable Analysis. Last, CFG (Control Flow Graph) to see all these effects across basic blocks.

Is there any available C/C+ Lib or subset of any Open Source Project that can help me achieve this?

Thanks!

  • 1
    you Can maybe reuse some piece of code from the LLVM project. – niosega Dec 2 '18 at 8:21
  • To use LLVM, first I'll need to lift my code x86 to LLVM bitcode? How do you envision the best approach to use LLVM in this case? I see the LLVM has interesting classes and functions for basic blocks – fred26 Dec 2 '18 at 21:01
2

You could look at the radare project:

https://github.com/radare/radare2

Their ESIL representation of mnemonics can help you track down the access to variables, registers and even flags.

https://radare.gitbooks.io/radare2book/content/disassembling/esil.html

For example, inc edi will result in edi,++=,$o,of,=,$s,sf,=,$z,zf,=,$p,pf,=

1

A nice framework to look at is Triton which does a good job in Dynamic Symbolic Execution. I ended up looking at the code and implementing my own solution with their same approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.