Open 4B5F5F4B opened 3 years ago
I think the way I'd want to go about lifting code operating on CR3 and other privileged registers would be to not treat it as a registr, but instead of embed the register name into the ISEL name, then use hyper calls for all reading/writing.
Are you willing to do any of this work?
I think the way I'd want to go about lifting code operating on CR3 and other privileged registers would be to not treat it as a registr, but instead of embed the register name into the ISEL name, then use hyper calls for all reading/writing.
Are you willing to do any of this work?
I want to, but I'm afraid that I'm not familiar with the codebase and how remill works internally:(
What's your use case for privileged instructions? If you'd rather not discuss here, then ping my user name "pag" on the Empire Hacking slack.
What's your use case for privileged instructions? If you'd rather not discuss here, then ping my user name "pag" on the Empire Hacking slack.
I tried to use mcsema to lift some Windows kernel drivers which contains some priviledged instructions
+1 Bump Can you give me a clue about where in the code should I look for a quick patch?
@arbel03 the simplest / quickest patch would be injecting in either a global variable into here:
https://github.com/lifting-bits/remill/blob/master/lib/Arch/X86/Runtime/BasicBlock.cpp#L45 (funny because this is CR8
), or:
1) Move this structure to the end of the file, after the various struct CRnReg
defintions that follow: https://github.com/lifting-bits/remill/blob/master/include/remill/Arch/X86/Runtime/State.h#L766
2) Add some register fields into the just-moved State
structure, e.g. CR8Reg cr8;
. You might need to fixup or remove some static asserts on the size of State
.
3) Add CR8 here, kind of like what is done for other regs: https://github.com/lifting-bits/remill/blob/master/lib/Arch/X86/Arch.cpp#L1704-L1730
Oh you're right, CR3 does exist in the state. I pulled an image from here which seems to be outdated: https://hub.docker.com/r/trailofbits/mcsema/tags Now building locally so it should work :) Thank you!
Newer remill's won't work with mcsema. McSema isn't actively maintained.
While lifting instructions like reading CR8 register, remill fails locating variable or register CR8.
It seems that remill doest add CR8 register in X86/Arch.cpp
My remill commit 37741957d6d43bcaafac8e316a875a1b7ce4838f