|
Data Flow Analysis - Dynamic/Static Taint Analysis
I am currently building a tool �ZeroTracer� that performs data flow analysis for user supplied inputs/tainted inputs. ZeroTracer propagates tainted bytes: memory-to-registers, registers-to-registers, registers-to-memory and memory-to-memory, using a combination of dynamic/static analysis. Dynamic analysis using Pin �a dynamic binary instrumentation tool� to collect a trace log for all memory read/write and registers changes. And static analysis that takes place on the logged trace to perform taint propagation analysis. The name ZeroTracer came from the lessons learned in building older versions of the tool �0xtracer�: Whenever performing taint propagation someone should focus on the smallest unit of data being processed, which I wish would be a BIT but unfortunately it is so complicated to propagate BITs rather than BYTEs. However, its better to use the byte unit cause in most register/memory propagation cases the smallest unit is one byte, for example: MOV to �al, ah, cl�. But thats not the case when it comes to setting the flags in the eflags register, or when rotating or shifting a register. Also its easier to address tainted memory bytes rather than bits. Imagine a tainted byte at address [0x11122388], if we wanna taint it based on bits we have to address it something like [0x11122388(.0)(.1)(.2)(.3)(.4)(.5)(.6)(.7)]. Before getting into details about ZeroTracer�s design, implementation, and features which am planning to do in future posts, lets take an overview about its older version �0xtracer� which is a PaiMei module that relies on pydbg. In 0xtracer I�ve been using memory breakpoints heap/stack to spot any code blocks touching the tainted memory bytes, then perform static taint propagation analysis using pydasm to analyze the basic block that is touching the tainted memory. 0xtracer been using different techniques to tune the propagation analysis. Here is a list of all the techniques I�ve been using in 0xtracer: 1- Memory Break Points �Page Guard/NoAccess�. 2- PyEmu �to emulate registers read/write�. 3- Harware Break Walking �A technique that I invented to taint/propagate a single byte in a single dynamic execution trace�. 4- Code Block(s) Signature �The tool learns from the outputs of the above methods and fingerprints propagation patterns for future use�. 0xtracer first consults its knowledge database to see if the basic code touching the tainted memory is defined in its knowledge, if not, it performs static taint propagation analysis using pyDasm, then emulated dynamic analysis useing pyEmu. Once it recognizes a new pattern it adds it to its knowledge, etc. Comments
| ||||||||||||||||||||||||||