Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is it not supported for 32-bit programs to call 64-bit target processes. #5

Open
edsky opened this issue Jun 22, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@edsky
Copy link

edsky commented Jun 22, 2022

Is there any difficulty here?

@OpenByteDev
Copy link
Owner

OpenByteDev commented Jun 22, 2022

It should be possible to do it, as there are also some other injectors that support it, but i have not looked into how they do it.

To extend the current implementation as is, there are some problems:

  • EnumProcessModulesEx does not support iterating x64 modules from an x32 (wow64) process. (Currently used to get addresses of win32 API functions in target process and to confirm that the injection succeeded)
  • CreateRemoteThread will truncate arguments and return value when doing x32->x64.
  • maybe others

@OpenByteDev OpenByteDev added the question Further information is requested label Jun 22, 2022
@edsky
Copy link
Author

edsky commented Jun 23, 2022

You can refer to the implementation of yapi, which supports injection of 32-bit processes into 64-bit processes under C++.

Confirm whether the injection is successful can be determined by remote LoadLibrary,

  • EnumProcessModulesEx the yapi method can call this function under 32 bits.
  • CreateRemoteThread the parameter problem can be done in assembly form.
    The assembly parameters under 64-bit are very fixed, and you only need to write the registers as they are.

@OpenByteDev
Copy link
Owner

EnumProcessModulesEx can be called but will not return x64 modules (see the remarks section).
I dont follow with what you are suggesting for CreateRemoteThread.

@edsky
Copy link
Author

edsky commented Jun 24, 2022

This problem of EnumProcessModulesEx can be easily solved.

One way is to call NtQueryInformationProcess through wow64, and the other way is to directly call NtWow64QueryInformationProcess64.

For related codes, please refer to https://www.52pojie.cn/forum.php?mod=viewthread&tid=872501 and https://stackoverflow.com/questions/3801517/how-to-enum-modules-in-a-64bit -process-from-a-32bit-wow-process?answertab=trending#tab-top

@OpenByteDev
Copy link
Owner

I just want to mention that while I may implement this, I will not work on it in the near future.

@OpenByteDev OpenByteDev added enhancement New feature or request and removed question Further information is requested labels Jan 25, 2023
@OpenByteDev
Copy link
Owner

I rewrote listing processes and modules using ntdll in OpenByteDev/processes@31435c7 but without using the WoW64 methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants