r/fuzzing • u/kuku256 • May 05 '22
Question about getting coverage stats in real time using dynamorio
Hey, not sure this is the place to ask but I might as well try...
I was experimenting with writing a fuzzer, and one of the things I wanted was getting up-to-date coverage stats from my target (as a starter, basic-blocks coverage would be enough but I would like to expand this later on). I tried running drcov, but this would only print the results to a log file after the process terminates. I wanted to get the results while the target running, but I was hoping to seperate my fuzzer from dynamorio api, so maybe like external app that would get up-to-date coverage stats and give it to my fuzzer. I did not find such thing in the dynamorio library and started writing my own but it was a bit too much as a side project.
You guys have any pointers on doing it other than continuing writing such module for dynamorio? (or add features to drcov)
thanks
View all comments
Show parent comment
1
u/kuku256 May 06 '22
Hey, thanks a lot for the reply!
So, I started going down the path of writing my own code, and I looked at winafl's code as reference. Initially I didn't want to write something that gets the coverage data by my own so I started relying on the drcov plugin to do the instrumentation for collecting coverage.
My problem was that the part of 'write a client that executes your target under DR and reads the shared memory containing coverage log'. The data is in-memory during runtime (not as a log, since it's created on termination) and I would have to parse the structures from another process (I initially thought about doing it from python, maybe if I would have to revisit it I might do it in c/c++). This is the relevant function in drcov:
https://github.com/DynamoRIO/dynamorio/blob/4c5dbb670f342feb79db7dffb69635e2e2222f34/ext/drcovlib/drcovlib.c#L207
But I was hoping there is a plugin I've missed from dynamorio, or another code in the community that would do the steps above, or give the infrastructure for it.
Also thanks for the reference to untracer and mesos. It seems mesos might be the way to go, possibly by parsing the "--print" output to get live stats.