IDA修改汇编指令

版权声明:© By www.mrchen.love https://blog.csdn.net/weixin_43206704/article/details/86582543

写一段小程序

#include <stdio.h>
#include <string.h>

int main()
{
	char password[1024];
	while (true)
	{
		printf("please input password:\t");
		scanf("%s", password);

		if (strcmp(password, "1234567"))
		{
			printf("Incorrect!\n");
		}
		else
		{
			printf("Congratulation!\n");
			break;
		}

	}
	return 0;
}

程序逻辑为直到输入了正确的密码“1234567”才退出程序。

IDA修改程序

程序用IDA打开如下:
IDA
发现strcmp是内联在main函数里的,此时修改if里的判断,将.text:004010E5处的 test eax,eax指令改为xor eax,eax指令的话,则输入什么密码都会判断正确。

点击Edit > Patch program > Assemble
在这里插入图片描述
修改指令
在这里插入图片描述

最后点击Edit > Patch program > Apply pathes to input file > OK

再次运行程序:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43206704/article/details/86582543