GPCS4/3rdParty/tinydbr
2023-06-26 23:23:32 +08:00
..
arch/x86 reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
windows add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
.clang-format add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
.gitignore update tinydbr 2022-03-16 01:07:23 +08:00
assembler.h add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
common.cpp add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
common.h reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
instruction.h add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
LICENSE add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
memory_callback.cpp implement virtual cpu 2022-03-25 06:37:37 +08:00
memory_callback.h implement virtual cpu 2022-03-25 06:37:37 +08:00
memory_monitor.cpp implement virtual cpu 2022-03-25 06:37:37 +08:00
memory_monitor.h implement virtual cpu 2022-03-25 06:37:37 +08:00
memory_monitor_impl.cpp reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
memory_monitor_impl.h reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
note.txt add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
README.md add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00
structure.h reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
tinydbr.cpp support vs2022 and llvm 16.0.6 2023-06-20 21:24:59 +08:00
tinydbr.h reconstruct tinydbr files, prevent header infection 2022-03-25 05:14:38 +08:00
TinyDBR.vcxproj fix tinydbr release cpp version 2023-06-26 23:23:32 +08:00
TinyDBR.vcxproj.filters implement virtual cpu 2022-03-25 06:37:37 +08:00
unwind.h add tinydbr library and reconstruct 3rdparty libraries 2022-03-11 02:05:59 +08:00

TinyDBR

UE4 Demo

What is TinyDBR?

TinyDBR is meant for tiny dynamic binary rewriter fox x86 instruction set.

This is a port to the TinyInst by Google Project Zero team to fit my own needs.

The original TinyInst works as a debuuger and the target process runs seperately as a debuggee.

While TinyDBR runs inter the target process and translate instructions right there.

How TinyDBR works?

Currently, TinyDBR only support Windows and X64.

Both TinyInst and TinyDBR will protect the target's code to non-executable property, then an attempt to execute the target code will raise an execute exception.

But compared to TinyInst, which catch the exception and translate instructions in debug event loop of the debugger process, TinyDBR registers a VEH handler at the target process, and does all tranlation steps within the VEH handler.

Other parts are almost the same as the original TinyInst.

Memory Monitor

TinyDBR ships with a memory access monitor which can monitor memory read/write with some limitations(see below).

Support all SSE and AVX/AVX512 instructions including gather and scatter.

Users can inherite the MemoryCallback class to get notified when memory access happens.

See here for an example.

Limitations

There are some limitations due to my own usage.

Basically, what I want is just to monitor heap access, code and stack access is not useful for me,

besides, monitor all of that is too expensive.

  1. Code memory is not supported. (e.g. call [mem])

  2. Stack memory is not supported (e.g. mov rax, [rsp - 8])

  3. FS and GS segment access is not supported. (e.g. mov rax, gs:[58])

  4. Conditional read and write are not implemented accurately. (e.g. cmpxchg, vpgatherqd)

    I removed the condition, which means the callback will always be called no matter the memory referenced is really read/written or not. This reduced the complexity of the implementation.

    But even with this limitation, it also ensures that, before the memory read we have chance to feed the memory the target may read and, after the memory write, we always get the correct content of the target memory.

TODO List:

  1. Refactory the public interface for easy usage. Done.
  2. Remove remote memory backup as we now have only one process.
  3. Support rewrite shellcode without modules. Done.
  4. Support rewrite multiple modules.
  5. Support other platform.