简体   繁体   English

如何在Windows7 x64中使用ollydbg注入Windows API调用

[英]How to inject a Windows API call use ollydbg in Windows7 x64

I am using Windows7 x64, and OllyDbg 2.01(alpha 2) 我正在使用Windows7 x64和OllyDbg 2.01(alpha 2)

I have an exe, and I want to popup a MessageBox to show some information during execution, and there is a great tutorial shows you how to do this: How to inject code into a exe file , basically, it is about adding a MessageBoxA API call with the wanted information: 我有一个exe,我想弹出一个MessageBox以便在执行过程中显示一些信息,并且有一个很棒的教程向您展示了如何执行此操作: 如何将代码注入exe文件 ,基本上,这是关于添加MessageBoxA API的致电所需信息:

PUSH 0                 ; BUTTONS = <OK ONLY>
PUSH 1008751           ; CAPTION  = Our adress of the "INJECTED NOTEPAD"
PUSH 1008751           ; MESSAGE  = Same like above.
PUSH 0                 ; ICON        = <NO ICON>
CALL MessageBoxA       ; Run MessageBoxA with the Params above.

It does work when in live debug session: I injected the code, and then debug it - the message box does pops up. 在实时调试会话中它确实起作用:我注入了代码,然后对其进行调试-消息框确实弹出。 But after I save the executable (RMB->Edit->Select all; RMB->Edit->Copy to executable; In the new window, RMB->save file), and then execute, it just crashed. 但是在保存可执行文件(RMB->编辑->全选; RMB->编辑->复制到可执行文件;在新窗口中,RMB->保存文件),然后执行后,它崩溃了。

Here are what I've observed: 这是我观察到的:

Before save, the CALL MessageBoxA is actually CALL 74DAFD1E, which means 74DAFD1E is the address of API MessageBoxA, but after save, the address is changed to some other value. 保存之前,CALL MessageBoxA实际上是CALL 74DAFD1E,这意味着74DAFD1E是API MessageBoxA的地址,但是保存后,该地址将更改为其他值。

Also, do you think ASLR would virtually stop up from injecting windows API call? 另外,您认为ASLR实际上不会停止注入Windows API调用吗?

Any ideas? 有任何想法吗? how could I managed to show the information I wanted from that exe? 如何设法显示该exe所需的信息?
Thanks in advance! 提前致谢!

This is caused by ASLR, to make it work in Windows7, one approach is to disable ASLR (at your own risk). 这是由ASLR引起的,要使其在Windows7中工作,一种方法是禁用ASLR(后果自负)。

You can download the Enhanced Mitigation Experience Toolkit (EMET) tool, install and run EMET_GUI.exe, in the pop up dialog, disable the ASLR and reboot: 您可以下载增强型缓解体验工具包(EMET)工具,安装并运行EMET_GUI.exe,在弹出的对话框中,禁用ASLR并重新启动: EMET GUI

You may want to re-enable ASLR after finishing your work, as it has impact on your OS's security. 您可能需要在完成工作后重新启用ASLR,因为它会影响操作系统的安全性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM