Fix bug: DLL address still use ImageBase address in spite of changing lib_base.#801
Fix bug: DLL address still use ImageBase address in spite of changing lib_base.#801nacayoshi00 wants to merge 17 commits into
Conversation
|
There are some test with fixed based DLL address. Will you be able to update the test ? |
|
I understood. I will add the test to test_pe.py. Please be patient. |
|
I updated test_pe.py to check the fix of lib address relocation.
I added a sample PE file for the test. So Should I send a pull request to https://github.com/qilingframework/rootfs/tree/master? |
Yes. If there is a new exe, you need to update rootfs |
|
OK, I sent the pull request of rootfs. And fix some code to pass the test |
| if exist %WINDIR%\SysWOW64\downlevel\api-ms-win-core-fibers-l1-1-1.dll xcopy /f /y %WINDIR%\SysWOW64\downlevel\api-ms-win-core-fibers-l1-1-1.dll "examples\rootfs\x86_windows\Windows\System32\" | ||
| if exist %WINDIR%\SysWOW64\downlevel\api-ms-win-core-localization-l1-2-1.dll xcopy /f /y %WINDIR%\SysWOW64\downlevel\api-ms-win-core-localization-l1-2-1.dll "examples\rootfs\x86_windows\Windows\System32\" | ||
| if exist %WINDIR%\SysWOW64\downlevel\api-ms-win-core-sysinfo-l1-2-1.dll xcopy /f /y %WINDIR%\SysWOW64\downlevel\api-ms-win-core-sysinfo-l1-2-1.dll "examples\rootfs\x86_windows\Windows\System32\" | ||
| xcopy /f /y %WINDIR%\SysWOW64\downlevel\api-*.dll "examples\rootfs\x86_windows\Windows\System32\" |
There was a problem hiding this comment.
I think we need to limit and copy only needed DLL. It seems the test took 4 hours due to additional dlls
|
OK, I updated examples/scripts/dllscollector.bat to copy only needed DLL. |
|
Redoing the test and see how long will it take to do the test. |
|
|
||
| if self.ql.archtype == QL_ARCH.X86: | ||
| address = self.ql.pack32(addr) | ||
| # load all DLL files linked from the target PE file recursively and make IAT of all dlls. |
There was a problem hiding this comment.
Here onwards
The test before this take around 15-20 min. With the new implementation. It takes around 4 hours to complete the test.
We need to find a better way, This is way too slow.
One method is to cache like how we cache the dll address. maybe we can do the same
| self.ql.log.warning(f' - {warning}') | ||
|
|
||
| # [Room for Improvement] too much time when kernelbase.dll is loaded. | ||
| self.ql.log.debug('relocate {}, {:x}'.format(dll_name, self.dll_last_address)) |
There was a problem hiding this comment.
We need to standardize all the quote. Double quote. " and not '
|
I see, but the result was unexpected for me because the test took only 1638s on my laptop PC.
Since I think these fixes are needed because emulation fails when DLL's address is not resolved, I have another solution to solve the problem.
If u r OK, I'll try to update. |
|
1638s is one test or all test ? The test is being done from github CI, so i guess we need to make that as benchmark. I guess your idea is fine. We need to fix CI result. Else gonna be bad if we need to spend 4 hours for each test. Since currently only 10min for all test. |
|
It took 1638s to finish all the tests. |
|
Sure. Will be waiting :) |
|
I'm sorry for late the response. I update these files to load dll dynamically.
I checked the time dramatically reduced in my PC when libcache is enabled.
|
|
I resolved the conflict and re-uploaded |
|
Could you mind if I ask you to run the workflow? Or should I do something to proceed with the workflow? |
|
There is still a conlifct with wscok32 |
|
Sorry too late. I removed the conflict. So could you please run the workflow? |
|
Hi @nacayoshi00, |
|
Since author did not repnse since Aug 2021. PR will be close for now. |
… lib_base
Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing