Thanks for your comment. It really helped but I'm still unable to
spawn a target with a different image
than the broker. I have now changed the target image to be notepad+
+.exe which I know is 32 bit. And I'm using a 32 bit broker. I also
defined SANDBOX_EXPORTS at the project level. Here's the stack trace:
--------------------------- Begin --------------------------
> sandbox_poc.exe!base::debug::BreakDebugger() Line 107 C++
sandbox_poc.exe!logging::LogMessage::~LogMessage() Line 614 C++
sandbox_poc.exe!sandbox::ServiceResolverThunk::ResolveTarget(const
void * module=0x028c0000, const char * function_name=0x024bfb30, void
* * address=0x0018f7a0) Line 36 C++
sandbox_poc.exe!
sandbox::ServiceResolverThunk::ResolveInterceptor(const void *
interceptor_module=0x028c0000, const char *
interceptor_name=0x024bfb30, const void * * address=0x0018f7a0) Line
20 C++
sandbox_poc.exe!
sandbox::InterceptionManager::PatchClientFunctions(sandbox::DllInterceptionData
* thunks=0x001c0000, unsigned int thunk_bytes=848,
sandbox::DllInterceptionData * dll_data=0x0018f834) Line 465 + 0x28
bytes C++
sandbox_poc.exe!sandbox::InterceptionManager::PatchNtdll(bool
hot_patch_needed=false) Line 382 + 0x14 bytes C++
sandbox_poc.exe!
sandbox::InterceptionManager::InitializeInterceptions() Line 111 +
0xd bytes C++
sandbox_poc.exe!
sandbox::PolicyBase::SetupAllInterceptions(sandbox::TargetProcess *
target=0x024bf708) Line 444 + 0x8 bytes C++
sandbox_poc.exe!
sandbox::PolicyBase::AddTarget(sandbox::TargetProcess *
target=0x024bf708) Line 227 + 0xc bytes C++
sandbox_poc.exe!sandbox::BrokerServicesBase::SpawnTarget(const
wchar_t * exe_path=0x02089e08, const wchar_t *
command_line=0x02089ea8, sandbox::TargetPolicy * policy=0x024b1ac8,
_PROCESS_INFORMATION * target_info=0x0018fe3c) Line 282 + 0xc bytes C+
+
sandbox_poc.exe!wWinMain(HINSTANCE__ * instance=0x00400000,
HINSTANCE__ * __formal=0x00000000, wchar_t * command_line=0x00293a4e,
int show_command=1) Line 78 + 0x30 bytes C++
sandbox_poc.exe!__tmainCRTStartup() Line 263 + 0x2c bytes C
sandbox_poc.exe!wWinMainCRTStartup() Line 182 C
--------------------------- End Stack trace--------------------------
These are my findings while trying to debug.
1. In the function InterceptionManager::PatchClientFunctions the code
is looking for _TargetNtCreate@48 in the target module. This
obviously does not exist in the target module. Hence the assert fails.
2. The function ServiceResolverThunk::ResolveInterceptor tries to find
the interceptor function in the target module. That makes sense if
both the images are the same. I guess I would have to alter this
function with a SANDBOX_EXPORTS section which looks for the
interceptor function in a module which would have to be defined by
me.
3. The local interceptor on the target module would have to be a dll
which I would have to map to the target process after I call
createprocess? How can I do that? Can I remotely inject a dll in the
target process which carries the interceptor functions before I try to
patch the functions like NtCreateFile etc? Perhaps you can suggest a
better approach.
4. I don't need to call Targetservices::LowerToken() if I don't care
about lockdown? I just want to patch the functions and have them
routed to the broker for the time being. I can alter this behavior
later. But the first priority is to get the patching and IPC working.
Please point out the errors that I have made above.
Thanks again for your comments :-)
> > Chromium Developers mailing list:
chromium-...@chromium.org