其他分享
首页 > 其他分享> > 栈溢出绕过验证

栈溢出绕过验证

作者:互联网

栈溢出绕过验证

自己动手通过反汇编分析的一个栈溢出的案例。

1.程序代码

/*****************************************************************************
      To be the apostrophe which changed "Impossible" into "I'm possible"!
		
POC code of chapter 2.2 in book "Vulnerability Exploit and Analysis Technique"
 
file name	: stack_overflow_var.c
author		: failwest  
date		: 2006.9.20
description	: demo show nearby var overrun in stack
			  input 8 letters to bypass authentication  
Noticed		: complied with VC6.0 and build into begug version
version		: 1.0
E-mail		: failwest@gmail.com
		
	Only for educational purposes    enjoy the fun from exploiting :)
******************************************************************************/
#include <stdio.h>

#define PASSWORD "1234567"

int verify_password (char *password)
{
	int authenticated;
	char buffer[8];// add local buff
	authenticated=strcmp(password,PASSWORD);
	strcpy(buffer,password);//over flowed here!	
	return authenticated;
}


main()
{
	int valid_flag=0;
	char password[1024];
	while(1)
	{
		printf("please input password:       ");
		
		scanf("%s",password);
		
		valid_flag = verify_password(password);
		
		if(valid_flag)
		{
			printf("incorrect password!\n\n");
		}
		else
		{
			printf("Congratulation! You have passed the verification!\n");
			break;
		}
	}
}

2.分析过程

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
over!

标签:函数,验证,verify,入口,valid,绕过,password,strcmp,溢出
来源: https://blog.csdn.net/weixin_50972562/article/details/121866613