3 ms·
I'd love to know more about disassembly. I've recently had more and more reason to go deeper into applications I'm running as dependencies. A few issues I've fo
by aidos 9y ago
I'd love to know more about disassembly. I've recently had more and more reason to go deeper into applications I'm running as dependencies. A few issues I've found and fixed just by using strace to get an idea of the system calls.
There was one thing in particular where I knew there was a jump somewhere (if some_length < some_width) that caused bad outputs. I was playing around looking at registers etc in gdb while following along with a disassembled version of the code, but it was impossible to get any idea where to start.
I wanted something that could give me a few seconds worth of samples of where the instruction register was spending its time as a starting point, but couldn't find any such tool (linux).
Within my control:
- giving input files to explicitly set unique numbers to watch out for
- giving inputs that would generate bad output numbers only in the bad code path
- giving inputs to force a load of jumps down the bad or good code paths
Does anyone have any advice on how you might approach such a situation?
- bitexploder 9y agoAFL automates this to a large degree. It doesn't do it with the type of machine control and monitoring you are asking for, but if you can instrument it with AFL, this is a perfect use case for it. It will do the hard work for you. If you want to control the computer, you have options. Qemu can give you fine grained CPU level logging you want: http://moyix.blogspot.jp/2014/07/breaking-spotify-drm-with-panda.html http://moyix.blogspot.jp/2014/07/breaking-spotify-drm-with-p... -- this is an article that walks through logging them instructions. (https://github.com/panda-re/panda https://github.com/panda-re/panda) Finally there are RE frameworks where you can instrument (hook) function calls (Frida being a good cross platform option). I would try AFL first. But playing with Panda can be really fun too. (edit: and a colleague just pointed out -- https://github.com/angr https://github.com/angr, which will also let you work right at the level you want to, I think).
- eccfcco15 9y agoIt's not free, but IDA Pro has tracing functionality similar to what you want. There are bootleg copies if you look hard enough, an old version (5.0) free for windows only, and feature limited demos.
- tptacek 9y agoWhat you want is a hit tracer. A hit tracer sets a breakpoint at the beginning of every basic block, and records and clears every breakpoint hit (so the performance hit is relatively low). You'd use a hit tracer to record a "baseline" of your target program when it's not doing the thing you care about. Then you'd run the program again and trigger the behavior. Then you'd diff the traces. AFL is doing something related when it explores states in targets. There are a lot of free hit tracers, but they're also kind of a build-your-own-light-saber deal. If you have a Python debugger library and a disassembly, a hit tracer is close to "hello world".
- TACIXAT 9y ago>I wanted something that could give me a few seconds worth of samples of where the instruction register was spending its time You could write this with Pin [1], but I'd be surprised if there wasn't a profiling tool with instruction level analysis available. If there truly isn't, then there are Pin examples that can be pretty quickly modified to achieve this. 1. https://software.intel.com/en-us/articles/pin-a-dynamic-binary-instrumentation-tool https://software.intel.com/en-us/articles/pin-a-dynamic-bina...