/*****************************************************************************
To be the apostrophe which changed "Impossible" into "I'm possible"!
POC code of chapter 10.6 in book "Vulnerability Exploit and Analysis Technique"
file name : target_server.cpp
author : failwest
date : 2007.4.4
description : TCP server which got a stack overflow bug for exploit practice
Noticed : Complied with VC 6.0 and build into release version are recommend
version : 1.0
E-mail : failwest@gmail.com
Only for educational purposes enjoy the fun from exploiting :)
******************************************************************************/
#include<iostream.h>
#include<winsock2.h>
#pragma comment(lib, "ws2_32.lib")
void msg_display(char * buf)
{
char msg[200];
strcpy(msg,buf);// overflow here, copy 0x200 to 200
cout<<"********************"<<endl;
cout<<"received:"<<endl;
cout<<msg<<endl;
}
void main()
{
int sock,msgsock,lenth,receive_len;
struct sockaddr_in sock_server,sock_client;
char buf[0x200]; //noticed it is 0x200
HeapSpray在《0day安全》中有比较详细的介绍。2007的black hat 阿姆斯特丹上,一个叫亚历山大的逆向工程师提出了一种叫“heap 风水”的技术,在heapspray的基础上又做了很多深入研究。由于feedback和火,他在几个月后的LV black hat上再次被邀请演讲,当时我和两个趋势的研究员慕名去听,窃窃的发现这个老外和好莱坞一个明星暴像,而且竟然赫然的用中文汉字标注着“风水”两个字,不过是繁体:)。听完之后觉得风水这个词来形容这种技术真的很贴切。